mesa: Fix inconsistent multisampled CopyTexImage checks

According to the GL_EXT_multisampled_render_to_texture specification,
copy operations should be allowed when the extension is supported.

Previously, glCopyTexImage* would unconditionally fail with
GL_INVALID_OPERATION when copying from any multisampled framebuffer
(samples > 0), even when using render-to-texture attachments.

Fixes: d7b9da2673 ("mesa/main: fix artifacts with GL_EXT_multisampled_render_to_texture")

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Wujian Sun <wujian.sun_1@nxp.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40863>
This commit is contained in:
Wujian Sun 2026-04-09 14:06:54 +08:00 committed by Marge Bot
parent c415134454
commit 2e340d63d2

View file

@ -2380,9 +2380,13 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
"glCopyTexImage%dD(invalid readbuffer)", dimensions);
return GL_TRUE;
}
/**
* From the GL_EXT_multisampled_render_to_texture spec:
* Operations are allowed when the extension is supported.
*/
if (!ctx->st_opts->allow_multisampled_copyteximage &&
ctx->ReadBuffer->Visual.samples > 0) {
ctx->ReadBuffer->Visual.samples > 0 &&
!_mesa_has_rtt_samples(ctx->ReadBuffer)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyTexImage%dD(multisample FBO)", dimensions);
return GL_TRUE;