mesa/st: fix _IsRGBDraw bitfield use

Previously we were assuming that all color attachments were active.

Fixes: 5b51d754d0 ("st/mesa: Optionally override RGB/RGBX dst alpha blend factors")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35014>
(cherry picked from commit b7d8c195a2)
This commit is contained in:
Timothy Arceri 2025-05-16 15:43:19 +10:00 committed by Eric Engestrom
parent 50b5881450
commit 66fc7554b3
4 changed files with 7 additions and 5 deletions

View file

@ -574,7 +574,7 @@
"description": "mesa/st: fix _IsRGBDraw bitfield use",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "5b51d754d00dfd7d8f4069aca4619f3b056c4eac",
"notes": null

View file

@ -762,7 +762,8 @@ _mesa_update_drawbuffer_masks(struct gl_context *ctx,
&ctx->DrawBuffer->_IntegerDrawBuffers);
update_drawbuffer_mask(ctx, fb, &ctx->DrawBuffer->_BlendForceAlphaToOne,
&ctx->DrawBuffer->_BlendForceAlphaToOneDraw);
update_drawbuffer_mask(ctx, fb, &ctx->DrawBuffer->_IsRGB,
&ctx->DrawBuffer->_IsRGBDraw);
}
/**

View file

@ -2695,7 +2695,8 @@ struct gl_framebuffer
GLbitfield _IntegerDrawBuffers; /**< Which color draw buffers are integer valued */
GLbitfield _BlendForceAlphaToOne; /**< Which color attachments need blend factor adjustment */
GLbitfield _BlendForceAlphaToOneDraw; /**< Which color buffers need blend factor adjustment */
GLbitfield _IsRGB; /**< Which color buffers have an RGB base format? */
GLbitfield _IsRGB; /**< Which color attachments have an RGB base format? */
GLbitfield _IsRGBDraw; /**< Which color buffers have an RGB base format? */
GLbitfield _FP32Buffers; /**< Which color buffers are FP32 */
/* ARB_color_buffer_float */

View file

@ -143,7 +143,7 @@ allow_rgb_colormask_promotion(const struct st_context *st,
* without needing independent blending. (If none should be promoted,
* we can just skip this optimization as it doesn't do anything.)
*/
bool same = ctx->DrawBuffer->_IsRGB == u_bit_consecutive(0, num_cb) &&
bool same = ctx->DrawBuffer->_IsRGBDraw == u_bit_consecutive(0, num_cb) &&
(ctx->Color.ColorMask & full_mask) == rgb_mask;
/* We can support different per-RT promotion decisions if we driver
@ -256,7 +256,7 @@ st_update_blend( struct st_context *st )
* partial writes may require preserving/combining new and old data.
*/
if (promote_rgb_colormasks &&
colormask == 0x7 && (ctx->DrawBuffer->_IsRGB & (1 << i)))
colormask == 0x7 && (ctx->DrawBuffer->_IsRGBDraw & (1 << i)))
colormask = 0xf;
blend->rt[i].colormask = colormask;