Forums - Issue with constant indexing in fragment shader

2 posts / 0 new
Last post
Issue with constant indexing in fragment shader
carrado.grant@g...
Join Date: 20 Sep 12
Posts: 38
Posted: Mon, 2014-12-15 16:27

Here is a snippet demonstrating the issue


    for( int i = 0; i < MAX_DIRECTIONAL_LIGHTS; i++ )
    {
      lv.lightVec     = fragIn.directionLightsDir[i].xyz;
      lv.lightColor   = directionalLights[i].attrib1.rgb;
      
      lv.attenuation  = 1.0;
    
      ApplyBRDF( lv, diffuseAccum, specularAccum );
      
      diffuseContrib+=diffuseAccum;
      specularContrib+=specularAccum;
    }

MAX_DIRECTIONAL_LIGHTS is defined in the global scope as const int MAX_DIRECTIONAL_LIGHTS = 2;

The accumulated value returns garbage with the loop, however if I remove the loop ( just repeat the loop body twice ), the result is correct. Again tested on a Mali GPU and with desktop GL and the loop works fine.  Any clue ?

  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Thu, 2015-01-08 08:04

This seems to be a problem that we've seen on several 8974-based devices, but not on more recent devices (8084 and 8994) .  We'll need to investigate further...

  • Up0
  • Down0
or Register

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.