diff --git a/src/freedreno/ci/freedreno-a306-fails.txt b/src/freedreno/ci/freedreno-a306-fails.txt index ac6dfdc6e14..d135254bf39 100644 --- a/src/freedreno/ci/freedreno-a306-fails.txt +++ b/src/freedreno/ci/freedreno-a306-fails.txt @@ -1098,6 +1098,11 @@ spec@nv_copy_image@nv_copy_image-formats@Source: GL_ALPHA16/Destination: GL_ALPH spec@glsl-1.30@execution@fs-uint-to-float-of-extract-int8,Fail spec@glsl-1.30@execution@fs-uint-to-float-of-extract-int16,Fail +# Failing after bugfix https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35014 +# when we stopped skipping the blend code when an inactive integer buffer was attached +dEQP-GLES3.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.9,Fail +dEQP-GLES3.functional.draw_buffers_indexed.random.max_required_draw_buffers.2,Fail + # glcts update dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_src_dst_x,Fail dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_dst_x,Fail diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index d069943917b..ef8a8ed54ce 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -1136,7 +1136,7 @@ _mesa_update_clamp_fragment_color(struct gl_context *ctx, * - there is an integer colorbuffer */ if (!drawFb || !drawFb->_HasSNormOrFloatColorBuffer || - drawFb->_IntegerBuffers) + drawFb->_IntegerDrawBuffers) clamp = GL_FALSE; else clamp = _mesa_get_clamp_fragment_color(ctx, drawFb); diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index c4c67ade324..e395319a094 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -739,6 +739,28 @@ updated_drawbuffers(struct gl_context *ctx, struct gl_framebuffer *fb) } } +static void +update_drawbuffer_mask(struct gl_context *ctx, struct gl_framebuffer *fb, + GLbitfield *buffers, GLbitfield *draw_buffers) +{ + *draw_buffers = 0; + for (unsigned i = 0; i < fb->_NumColorDrawBuffers; i++) { + gl_buffer_index buf = fb->_ColorDrawBufferIndexes[i]; + if (buf < BUFFER_COLOR0) + continue; + + if (*buffers & (1 << (buf - BUFFER_COLOR0))) + *draw_buffers |= (1 << i); + } +} + +void +_mesa_update_drawbuffer_masks(struct gl_context *ctx, + struct gl_framebuffer *fb) +{ + update_drawbuffer_mask(ctx, fb, &ctx->DrawBuffer->_IntegerBuffers, + &ctx->DrawBuffer->_IntegerDrawBuffers); +} /** * Helper function to set the GL_DRAW_BUFFER state for the given context and @@ -817,6 +839,8 @@ _mesa_drawbuffers(struct gl_context *ctx, struct gl_framebuffer *fb, fb->_NumColorDrawBuffers = count; } + _mesa_update_drawbuffer_masks(ctx, fb); + /* set remaining outputs to BUFFER_NONE */ for (buf = fb->_NumColorDrawBuffers; buf < ctx->Const.MaxDrawBuffers; buf++) { if (fb->_ColorDrawBufferIndexes[buf] != BUFFER_NONE) { diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index 004ba17689c..1b54b2cef56 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -52,6 +52,10 @@ _mesa_readbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, extern void _mesa_update_draw_buffers(struct gl_context *ctx); +extern void +_mesa_update_drawbuffer_masks(struct gl_context *ctx, + struct gl_framebuffer *fb); + extern GLenum _mesa_back_to_front_if_single_buffered(const struct gl_framebuffer *fb, GLenum buffer); diff --git a/src/mesa/main/draw_validate.c b/src/mesa/main/draw_validate.c index 2d035e79bbe..0b7e5bdd53c 100644 --- a/src/mesa/main/draw_validate.c +++ b/src/mesa/main/draw_validate.c @@ -155,16 +155,8 @@ _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) { - 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; - } - } + if (ctx->DrawBuffer->_IntegerDrawBuffers) + return; } } diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index ca4373ce322..b026b431ac2 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1732,6 +1732,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, return; } + _mesa_update_drawbuffer_masks(ctx, fb); + /* Provisionally set status = COMPLETE ... */ fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT; diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 72058c3bc02..f98c421d07f 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -1056,6 +1056,6 @@ _mesa_is_multisample_enabled(const struct gl_context *ctx) bool _mesa_is_alpha_test_enabled(const struct gl_context *ctx) { - bool buffer0_is_integer = ctx->DrawBuffer->_IntegerBuffers & 0x1; + bool buffer0_is_integer = ctx->DrawBuffer->_IntegerDrawBuffers & 0x1; return (ctx->Color.AlphaEnabled && !buffer0_is_integer); } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 4ed82e24a0b..1c7a6301bcd 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1266,7 +1266,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu break; /* GL_EXT_textrue_integer */ case GL_RGBA_INTEGER_MODE_EXT: - v->value_int = (ctx->DrawBuffer->_IntegerBuffers != 0); + v->value_int = (ctx->DrawBuffer->_IntegerDrawBuffers != 0); break; /* GL_ATI_meminfo & GL_NVX_gpu_memory_info */ case GL_VBO_FREE_MEMORY_ATI: diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 88932dbbc71..4e367eb0f3f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2691,7 +2691,8 @@ struct gl_framebuffer */ bool _HasAttachments; - GLbitfield _IntegerBuffers; /**< Which color buffers are integer valued */ + GLbitfield _IntegerBuffers; /**< Which color buffer attachments are integer valued */ + GLbitfield _IntegerDrawBuffers; /**< Which color draw buffers are integer valued */ GLbitfield _BlendForceAlphaToOne; /**< Which color buffers need blend factor adjustment */ GLbitfield _IsRGB; /**< Which color buffers have an RGB base format? */ GLbitfield _FP32Buffers; /**< Which color buffers are FP32 */ diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c index d0e19d3a354..9ba4b44d57d 100644 --- a/src/mesa/state_tracker/st_atom_blend.c +++ b/src/mesa/state_tracker/st_atom_blend.c @@ -175,8 +175,8 @@ blend_per_rt(const struct st_context *st, unsigned num_cb) /* this can only happen if GL_ARB_draw_buffers_blend is enabled */ return GL_TRUE; } - if (ctx->DrawBuffer->_IntegerBuffers && - (ctx->DrawBuffer->_IntegerBuffers != cb_mask)) { + if (ctx->DrawBuffer->_IntegerDrawBuffers && + (ctx->DrawBuffer->_IntegerDrawBuffers != cb_mask)) { /* If there is a mix of integer/non-integer buffers then blending * must be handled on a per buffer basis. */ return GL_TRUE; @@ -280,7 +280,7 @@ st_update_blend( struct st_context *st ) /* blending enabled */ for (i = 0, j = 0; i < num_state; i++) { if (!(ctx->Color.BlendEnabled & (1 << i)) || - (ctx->DrawBuffer->_IntegerBuffers & (1 << i)) || + (ctx->DrawBuffer->_IntegerDrawBuffers & (1 << i)) || !blend->rt[i].colormask) continue; @@ -340,7 +340,7 @@ st_update_blend( struct st_context *st ) blend->dither = ctx->Color.DitherFlag; if (_mesa_is_multisample_enabled(ctx) && - !(ctx->DrawBuffer->_IntegerBuffers & 0x1)) { + !(ctx->DrawBuffer->_IntegerDrawBuffers & 0x1)) { /* Unlike in gallium/d3d10 these operations are only performed * if both msaa is enabled and we have a multisample buffer. */ diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index eb3295bdf75..e3301f89d51 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -129,7 +129,7 @@ st_update_depth_stencil_alpha(struct st_context *st) } if (ctx->Color.AlphaEnabled && !st->lower_alpha_test && - !(ctx->DrawBuffer->_IntegerBuffers & 0x1)) { + !(ctx->DrawBuffer->_IntegerDrawBuffers & 0x1)) { dsa->alpha_enabled = 1; dsa->alpha_func = func_to_gallium(ctx->Color.AlphaFunc); dsa->alpha_ref_value = ctx->Color.AlphaRefUnclamped;