GL_MULTISAMPLE performance implications against unsupporting rendering targets.

Does anyone know if there’s a performance penalty leaving GL_MULTISAMPLE enabled when switching (say via FBO) to a standard (non multisampled) rendering target?

I’d rather avoid tons of little state checking and glEnable/glDisable API calls every time I bind and unbind to an offscreen FBO. My hope is that the driver just ignores it in these cases.

I have no actual knowledge of the performance characteristics of the various implementations on this matter.

But I do know the GL spec. And the specification states that GL_MULTISAMPLE is enabled by default. While that would not be the first time that OpenGL’s defaults were a low-performance route, I rather suspect that implementations would take appropriate precautions to ensure that this was not a performance problem in practice. They can always tell if the FBO is multisampled, so they can know whether to turn on the expensive multisample stuff, regardless of the enable/disable state.

very helpful. thanks!

[QUOTE=mlfarrell;1263465]Does anyone know if there’s a performance penalty leaving GL_MULTISAMPLE enabled when switching (say via FBO) to a standard (non multisampled) rendering target?

I’d rather avoid tons of little state checking and glEnable/glDisable API calls every time I bind and unbind to an offscreen FBO. My hope is that the driver just ignores it in these cases.[/QUOTE]

Per-spec, for multisample rasterization to be performed, both GL_MULTISAMPLE must be enabled and the value of SAMPLE_BUFFERS must be set to one (true). Your single-sample render targets should have SAMPLE_BUFFERS == 0. So AFAIK there’s no functional reason to disable GL_MULTISAMPLE when rasterizing to these single-sample render targets.

And while anything is possible, I doubt that any vendor GL drivers are going to exhibit a performance penalty when rasterizing to a single-sample render target with GL_MULTISAMPLE enabled. But test both ways and verify that on the vendor driver’s you care about if you’re unsure.