OpenGL 2.0 - Shader Compiler

I’m just curious to see if anyone has done anything usefull with the OpenGL 2.0 shader compiler code. I was just looking through the code and while most of it just goes ‘swoosh’ over my head I would like to try to do something cool with it. After I figure out how compilers work and such.

BTW, on a second note, it looks to me from the spec (now I didn’t go through the whole thing with a fine tooth comb but…) that the OGL 2.0 shader language should work just fine with the Radeon 9700 and NV30. Is there anything that I’m missing that is in the shader spec that needs hardware for certain things that are more powerfull than what the Radeon 9700 and NV30 can do? To me it looked like these cards could handle it all just fine.

Just some thoughts.


Looping in fragment shaders comes to mind…

Ah yes you’re right. For some reason I thought looping could be done in the fragment_program functionality of these newer cards but now I remember it can’t be done. Maybe the NV40 and whatever ATI card that is similar to that will have all of that.


Many loops can be unrolled in software, including some with loop counts not known at compile time. You can execute the maximum number of instructions and throw away the results for invalid loop indices using compare-like instructions. Unrolling can proceed up to the limit on the number of instructions, which is 1024 on NV30 (not sure exactly what it is on R300).

True run-time branching, like we see on CPUs and in the NV30 vertex engine (see the NV_vertex_program2 spec), doesn’t appear to be supported by either fragment program architecture in this generation.