Advertisement

Intel G41 Card can not index uniform array variables with a variablefragment shaders?

Started by May 16, 2017 03:14 AM
4 comments, last by carterjiaojiao 7 years, 8 months ago

Look this:


....
struct Light
{
  ...
}
uniform Light u_lights[4];
 for(int i = 0 ; i<4 ;i++)
{
   ...
   //Then use i index u_lights array.
   totalSpecularColor += u_lights[i].specular *specular_bsdf;//Then GLSL can not get u_lights[i].specular vaule
When I write like this: u_lights[0].specular ,then I can get the value. why? Help me,please.
   ...
}

The G41 is a very old OpenGL 2.0 era GPU, and there were many limitations in that era.
One common limitation is the inability to dynamically index arrays from within fragment shaders.

So array where i changes its value will not work...
but array[1] where 1 obviously always has the same value, will work.

There is no fix for this. On these old GPU's you will have to use a different kind of algorithm.

Advertisement

The G41 is a very old OpenGL 2.0 era GPU, and there were many limitations in that era.
One common limitation is the inability to dynamically index arrays from within fragment shaders.

So array where i changes its value will not work...
but array[1] where 1 obviously always has the same value, will work.

There is no fix for this. On these old GPU's you will have to use a different kind of algorithm.

Thank you very much.So ,I have to make many shaders for multilight.My fucking boss wanted the app compatiale with this old hardwarw ...

If the amount of light is fixed, then the static indexing for arrays shouldn't be that much of an issue.

the problem is with intel gcards at all, i think nvidia should take control over the market :P

If the amount of light is fixed, then the static indexing for arrays shouldn't be that much of an issue.

But G41 not :(

This topic is closed to new replies.

Advertisement