I have two 2D textures. The first, an MSAA texture, uses a target of GL_TEXTURE_2D_MULTISAMPLE. The second, non MSAA texture, uses a target of GL_TEXTURE_2D.
According to OpenGL's spec on ARB_texture_multisample, only GL_NEAREST is a valid filtering option when the MSAA texture is being drawn to.
In this case, both of these textures are attached to GL_COLOR_ATTACHMENT0 via their individual Framebuffer objects. Their resolutions are also the same size (to my knowledge this is necessary when blitting an MSAA to non-MSAA).
So, given the current constraints, if I blit the MSAA holding FBO to the non-MSAA holding FBO, do I still need to use GL_NEAREST as the filtering option, or is GL_LINEAR valid, since both textures have already been rendered to?
The filtering options only come into play when you sample from the textures. They play no role while you render to the texture.
When sampling from multisample textures,
GL_NEARESTis indeed the only supported filter option. You also need to use a special sampler type (sampler2DMS) in the GLSL code, with corresponding sampling instructions.I actually can't find anything in the spec saying that setting the filter to
GL_LINEARfor multisample textures is an error. But the filter is not used at all. From the OpenGL 4.5 spec (emphasis added):For blitting between multisample and non-multisample textures with
glBlitFramebuffer(), the filter argument can be eitherGL_LINEARorGL_NEAREST, but it is ignored in this case. From the 4.5 spec:This makes sense because there is a restriction in this case that the source and destination rectangle need to be the same size:
Since the filter is only applied when the image is stretched, it does not matter in this case.