You're adding branching, two loops, calls to 'pow' function and a bunch
of divisions to a function that is often executed many thousand times
per second. It's not obvious to me that this wont have a performance
impact.
I understand that it's a correction fix but removing those GRID defines
and making it obvious that the code is hard-coded to 4x4 and not
allowing it to be changed is just as correct. As your testing proved
that changing it to anything but 4x4 doesn't make much sense, I find
this more appropriate as we don't have to worry about the possible
performance impact those changes might have to bezierPatchEvaluate.
- David