• Advertisement
Sign in to follow this  

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

Recommended Posts

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.
   ...
}

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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 ... 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Advertisement