Hi, I have read in the OpenGL wiki that when a shader generates an output to a color attachment that is currently disabled in the FrameBuffer which is being used, that output is discarted.
I would like to know if it is a guarantee of better performance ( respect if it would be enabled ), or it depends of the driver.
Specifically that I pretend to do is the next:
Currently I have a renderer where I apply a bloom filter, the bloom filter has its own FrameBuffer which is cleared black, and sometimes I render some geometry with color on it, to blur it later and do a additive blending with the final scene. ( I know that I could use the original scene to apply bloom, but I prefer this method ).
The question is that I often have to duplicated ( copy the most of the code ) the shaders to do the bloom version ( default, terrain, billboard ), and it would be nice to have these shaders in one with two outputs, one for the default ouput and another for the bloom ouput.
The steps would be:
- Use my scene FrameBuffer with the default ouput ( color attachment ) enabled and the bloom ouput disabled ( GL_NONE ).
- Render the main scene, writing in the default ouput.
- Use my bloom FrameBuffer with the the default ouput disabled, and the bloom ouput enabled.
- Render the geometry that uses bloom writing in the bloom ouput.
Is it a valid approach in terms of perfomance? ( The color attachments are enabled or disabled in each FrameBuffer only once at the creation of it. )
Maybe the bloom case is not the best example but it could be applicable to other situations.
Thanks in advance,