From ecdb0c153c08250bdc95cd6e3a42d030f0240381 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 (cherry picked from commit 2e340d63d2b1fe13a23c607f93f83d04bdad0c9a) Part-of: --- .pick_status.json | 2 +- src/mesa/main/teximage.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 49e4c192f11..f0b80aceb52 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -924,7 +924,7 @@ "description": "mesa: Fix inconsistent multisampled CopyTexImage checks", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "d7b9da2673a8aef49f83dc043aae6ff4fcb212a3", "notes": null 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;