Jump to content
  • Advertisement
Sign in to follow this  
carterjiaojiao

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

This topic is 419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!