We are experiencing very strange visual bugs when runing our shader programs on Samsung Galaxy Note 4 device.Adreno(TM)420 Renderer.We have quite complext shader programs to render PBR,lighting,shadow mapping etc.
The above mentioned device didn't present the shadows at all.Also lights rendering is wrong.
The same programs work fine on the following hardware:
PC,OSX,iOS(6-7),Samsung Galaxy A7,Meizu M5,Xiomi 4A,Motorolla Nexus 6
In case of the shadows we had this chunk of code:
float HardShadow (sampler2D shadowMap, vec4 lightClipPosition, float bias)
Where the if() with 3 calls to InRange method was causing the shadows not to show up at all.
Changing to
if ((shadowMapCoords.x < 0.0 || shadowMapCoords.x > 1.0 || shadowMapCoords.y < 0.0 || shadowMapCoords.y > 1.0 || shadowMapCoords.z < 0.0 || shadowMapCoords.z > 1.0))
Fixed it.
Important to note,there are no errors during shader complilations or during runtime.
Now I wonder,is it a kind of rule dictated by the GLSL compiler,or the driver?Any limitation to amount of function exectuions in a shader body?
Do we have to inline all the methods found in the shader into shader's 'main' function to get all our stuf to work correctly on this device?