Forums - GLSL compiler weird behavior Adreno 420

1 post / 0 new
GLSL compiler weird behavior Adreno 420
sasmaster
Join Date: 2 Mar 17
Posts: 1
Posted: Fri, 2017-03-03 03:27

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:

 


bool InRange(float val)
{
    return val >= 0.0 && val <= 1.0;
}
 

float HardShadow (sampler2D shadowMap, vec4 lightClipPosition, float bias)

{
    vec3 shadowMapCoords = lightClipPosition.xyz / lightClipPosition.w;
    shadowMapCoords = (shadowMapCoords + 1.0) / 2.0;
 
    if (!InRange (shadowMapCoords.z)
        || !InRange (shadowMapCoords.x)
        || !InRange (shadowMapCoords.y))
        return 1.0;
}

 

 

 

 

 

 

 
 

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)) 
     {
         return 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?

 

  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.