I have several shaders which writes to multiple outputs, for example :
Code :layout(location = 0) vec4 SceneColor layout(location = 1) vec4 SceneInfos
In some situations, I want to only write to the first output. As I use a FBO, I simply disable some write buffers.
But for GLSL part what is the best way ?
- write 2 shaders, a version with 2 outputs, a version with a single output and switch between the 2 ? (sure that's works, but not really developper-friendly)
- a single shader, declare the 2 outputs, and use a bool uniform to know if I should write to both outputs ?
- a single shader, and simply disable some write buffers of the FBO ?
The third solution seems the best, but I know don't if there is any issue or performance hit when a shader write to an output which is disabled.