I’m trying to compute the lighting in a vertex shader.
//More or less the code I have
void ComputeLighting(int lightNumber)
{
....
//Using gl_LightSource[lightNumber]
//
}
void main()
{
int i;
for(i=0; i<3; i++)
{
ComputeLighting(i);
}
}
The problem is, it runs in software. Ah fudge!
The second problem is, the software implementation has undefined behavior. Sometimes it works, sometimes nothing renders, sometimes it’s all black.
The third problem is, I need loops else it will exceed the instruction limit.
I don’t want to expand the loop manually.
I would guess that it runs in software because it exceeds the instruction limit. I don’t know if our compiler support real loops in the vertex shader yet. It seems that it just expands the constant loop and thus causes it to overflow the instruction count.
Loops in Catalyst 4.7 doesnt seem to work for me either. I am using the latest version of Shader Designer (v. 1.5.5, just released and downloaded today). Does anybody have any answers to this problem?
In case u were wondering i am doing my own version of a real time 2/3/4d perlin shader (just to get used to GLSL). all of the algorithms r complete but it cant run on hardware.
Loops are supported and works fine for me. But it depends on how you’re using it. Static loops are supported and work well as long as it doesn’t exceed the instruction count limit.
Well, any loop that can map to the static branching hardware should run. We can’t support loops that depends on dynamic data though, but this seems not to be the case here.
In any case, if you guys have any sample code with loops that doesn’t work that you think should work on our hardware, feel free to send it to me at epersson (at) ati.com and I’ll take a look at it.
… and we argued about needing some kind of speciallized chip that does hardwired raytracing.
What I have currently only does spheres and planes. I can try something more complex later. It’s possible to use NURBS surfaces to represent “organic” shapes so it should be possible to raytrace say… a teapot.