Imagination PowerVR SDK Blog

GLSL ES: Gradient calculation inside a conditional block compiler warning

faq

#1

When compiling a GLSL ES shader what does the warning “Calls to any function that may require a gradient calculation inside a conditional block may return undefined results” mean?


#2

This message is given when functions are used inside a conditional block which require gradient information.



Gradient information is based on a 2x2 pixel block processing: if any of the pixels in a 2x2 block are not taking the same branch as the other pixels then the resulting data, which is used for gradient calculation, might be undefined and thus the resulting gradient invalid.