From ab1edf76eda36084ecea7fb35f56445c560f6528 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Tue, 13 May 2025 21:58:09 +1000 Subject: [PATCH] mesa: relax EXT_texture_integer validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates mesa to avoid throwing an error if an attached fbo wont actually be drawn into. Fixes: 705978e2831e ("mesa: do integer FB / shader validation check in _mesa_valid_to_render()") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13144 Reviewed-by: Marek Olšák Part-of: (cherry picked from commit 1d4ebe79b5be5d32b9900ed8dd726104c1fc8888) --- .pick_status.json | 2 +- src/mesa/main/draw_validate.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index d641107eb46..0fb973f8421 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -134,7 +134,7 @@ "description": "mesa: relax EXT_texture_integer validation", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "705978e2831eb8b8bb23bd11ee08ce51d9b2915c", "notes": null diff --git a/src/mesa/main/draw_validate.c b/src/mesa/main/draw_validate.c index 9e77284c3f9..b2957297cce 100644 --- a/src/mesa/main/draw_validate.c +++ b/src/mesa/main/draw_validate.c @@ -155,8 +155,16 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx) /* If drawing to integer-valued color buffers, there must be an * active fragment shader (GL_EXT_texture_integer). */ - if (ctx->DrawBuffer->_IntegerBuffers) - return; + if (ctx->DrawBuffer->_IntegerBuffers) { + for (int i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { + gl_buffer_index buf = ctx->DrawBuffer->_ColorDrawBufferIndexes[i]; + if (buf < BUFFER_COLOR0) + continue; + + if (ctx->DrawBuffer->_IntegerBuffers & (1 << (buf - BUFFER_COLOR0))) + return; + } + } } }