From 2e340d63d2b1fe13a23c607f93f83d04bdad0c9a Mon Sep 17 00:00:00 2001 From: Wujian Sun Date: Thu, 9 Apr 2026 14:06:54 +0800 Subject: [PATCH] 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: d7b9da2673a ("mesa/main: fix artifacts with GL_EXT_multisampled_render_to_texture") Reviewed-by: Erik Faye-Lund Signed-off-by: Wujian Sun Part-of: --- src/mesa/main/teximage.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index e8714f679f7..c49d5185de2 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -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;