I currently have a master shader that I customize as I compile it by tagging the appropriate last line on, which defines the main I need. It handles 20 or so different pixel formats, and makes a shader to order to convert to RGBA 16F.
I used this approach to keep conditionals out, based on anecdotal evidence that it’s a ‘bad thing’. Now I’m planning on trying to use OpenSceneGraph as a back-end, and I don’t want to create the shaders on the fly, as it will be on the same thread. My eventual approach will be to compile the ‘pieces’ of my shader, and link it differently depending on what I need though.
For now though, I just want to get rolling, so I’m considering a switch inside a single shader that switches on the source pixel format. Does it still have to be if/else if, or did a switch statement get added yet?
But the real question is, since this shader is running on HD sized video frames, will the conditional every pixel completely kill me, or is workable on modern hardware and drivers? I’m targeting Mac OS 10.5 and later and high end Linux cards with current drivers.