Jump to content
  • Advertisement
Sign in to follow this  
golgoth

GLSL Uniform!

This topic is 4744 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

Hi all! for some mysterious reason i cant do this... uniform int Count; void main() { for (int i = 0; i < Count; i++) { ...... } } any work around for this?

Share this post


Link to post
Share on other sites
Advertisement
Hardware support for dynamic looping isnt wide spread, as such that will fail to compile if it cant be done on the hardware.

Away around it, make it a static loop, however with this you have to be carefull not to blow the instruction limit if the hardware requires the loop to be unrolled.

Share this post


Link to post
Share on other sites
the "Count" var is pass as the number of per pixel light in scene... i dont see any way out... thats a big problem... there is no way i can imagine hardcoding light count! if it s what u mean!

Share this post


Link to post
Share on other sites
could we do something like this:

uniform int Count;

void main()
{
for (int i = 0; i < 100; i++)
{
if (i > Count)
{
break;
}

}
}

not sure how to translate the break:

any ideas?

Share this post


Link to post
Share on other sites
What GPU are you using? It really shouldn't matter, because if the GLSL program is too complex to be executed in hardware, it should fall back to software rendering. But unfortunately, most implementations are not so compliant.

Share this post


Link to post
Share on other sites
gforce 6800 on amd pcix architecture!

whenever i try to implement an uniform variable into a for or even a while condition-expression... it does not compile at all!

it doesnt make any sens...

i ve tried:

uniform int Count;

void main()
{
for (int i = 0; i < 100; i++)
{
if (i < Count)
{
....
}
}
}

im having a nigthmare... can anyone snap me out of it?

is that will means a uniform variables cannot be written in shaders?

Phantom can u be more precise on static loop pleaze?

thx

[Edited by - golgoth on September 22, 2005 11:17:37 PM]

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!