mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 13:40:16 +01:00
st/mesa: fix _IntegerBuffers bitfield use
Previously we were assuming that all color attachments were active.
Fixes: 8fb966688b ("st/mesa: Disable blending for integer formats.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13168
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35014>
This commit is contained in:
parent
fd8d8264e0
commit
d04d9da98c
11 changed files with 47 additions and 19 deletions
|
|
@ -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-int8,Fail
|
||||||
spec@glsl-1.30@execution@fs-uint-to-float-of-extract-int16,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
|
# 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_min_reverse_src_dst_x,Fail
|
||||||
dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_dst_x,Fail
|
dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_dst_x,Fail
|
||||||
|
|
|
||||||
|
|
@ -1136,7 +1136,7 @@ _mesa_update_clamp_fragment_color(struct gl_context *ctx,
|
||||||
* - there is an integer colorbuffer
|
* - there is an integer colorbuffer
|
||||||
*/
|
*/
|
||||||
if (!drawFb || !drawFb->_HasSNormOrFloatColorBuffer ||
|
if (!drawFb || !drawFb->_HasSNormOrFloatColorBuffer ||
|
||||||
drawFb->_IntegerBuffers)
|
drawFb->_IntegerDrawBuffers)
|
||||||
clamp = GL_FALSE;
|
clamp = GL_FALSE;
|
||||||
else
|
else
|
||||||
clamp = _mesa_get_clamp_fragment_color(ctx, drawFb);
|
clamp = _mesa_get_clamp_fragment_color(ctx, drawFb);
|
||||||
|
|
|
||||||
|
|
@ -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
|
* 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;
|
fb->_NumColorDrawBuffers = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_mesa_update_drawbuffer_masks(ctx, fb);
|
||||||
|
|
||||||
/* set remaining outputs to BUFFER_NONE */
|
/* set remaining outputs to BUFFER_NONE */
|
||||||
for (buf = fb->_NumColorDrawBuffers; buf < ctx->Const.MaxDrawBuffers; buf++) {
|
for (buf = fb->_NumColorDrawBuffers; buf < ctx->Const.MaxDrawBuffers; buf++) {
|
||||||
if (fb->_ColorDrawBufferIndexes[buf] != BUFFER_NONE) {
|
if (fb->_ColorDrawBufferIndexes[buf] != BUFFER_NONE) {
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@ _mesa_readbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||||
extern void
|
extern void
|
||||||
_mesa_update_draw_buffers(struct gl_context *ctx);
|
_mesa_update_draw_buffers(struct gl_context *ctx);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
_mesa_update_drawbuffer_masks(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *fb);
|
||||||
|
|
||||||
extern GLenum
|
extern GLenum
|
||||||
_mesa_back_to_front_if_single_buffered(const struct gl_framebuffer *fb,
|
_mesa_back_to_front_if_single_buffered(const struct gl_framebuffer *fb,
|
||||||
GLenum buffer);
|
GLenum buffer);
|
||||||
|
|
|
||||||
|
|
@ -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
|
/* If drawing to integer-valued color buffers, there must be an
|
||||||
* active fragment shader (GL_EXT_texture_integer).
|
* active fragment shader (GL_EXT_texture_integer).
|
||||||
*/
|
*/
|
||||||
if (ctx->DrawBuffer->_IntegerBuffers) {
|
if (ctx->DrawBuffer->_IntegerDrawBuffers)
|
||||||
for (int i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
|
return;
|
||||||
gl_buffer_index buf = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
|
|
||||||
if (buf < BUFFER_COLOR0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ctx->DrawBuffer->_IntegerBuffers & (1 << (buf - BUFFER_COLOR0)))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1732,6 +1732,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_mesa_update_drawbuffer_masks(ctx, fb);
|
||||||
|
|
||||||
/* Provisionally set status = COMPLETE ... */
|
/* Provisionally set status = COMPLETE ... */
|
||||||
fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT;
|
fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1056,6 +1056,6 @@ _mesa_is_multisample_enabled(const struct gl_context *ctx)
|
||||||
bool
|
bool
|
||||||
_mesa_is_alpha_test_enabled(const struct gl_context *ctx)
|
_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);
|
return (ctx->Color.AlphaEnabled && !buffer0_is_integer);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1266,7 +1266,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
|
||||||
break;
|
break;
|
||||||
/* GL_EXT_textrue_integer */
|
/* GL_EXT_textrue_integer */
|
||||||
case GL_RGBA_INTEGER_MODE_EXT:
|
case GL_RGBA_INTEGER_MODE_EXT:
|
||||||
v->value_int = (ctx->DrawBuffer->_IntegerBuffers != 0);
|
v->value_int = (ctx->DrawBuffer->_IntegerDrawBuffers != 0);
|
||||||
break;
|
break;
|
||||||
/* GL_ATI_meminfo & GL_NVX_gpu_memory_info */
|
/* GL_ATI_meminfo & GL_NVX_gpu_memory_info */
|
||||||
case GL_VBO_FREE_MEMORY_ATI:
|
case GL_VBO_FREE_MEMORY_ATI:
|
||||||
|
|
|
||||||
|
|
@ -2691,7 +2691,8 @@ struct gl_framebuffer
|
||||||
*/
|
*/
|
||||||
bool _HasAttachments;
|
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 _BlendForceAlphaToOne; /**< Which color buffers need blend factor adjustment */
|
||||||
GLbitfield _IsRGB; /**< Which color buffers have an RGB base format? */
|
GLbitfield _IsRGB; /**< Which color buffers have an RGB base format? */
|
||||||
GLbitfield _FP32Buffers; /**< Which color buffers are FP32 */
|
GLbitfield _FP32Buffers; /**< Which color buffers are FP32 */
|
||||||
|
|
|
||||||
|
|
@ -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 */
|
/* this can only happen if GL_ARB_draw_buffers_blend is enabled */
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
if (ctx->DrawBuffer->_IntegerBuffers &&
|
if (ctx->DrawBuffer->_IntegerDrawBuffers &&
|
||||||
(ctx->DrawBuffer->_IntegerBuffers != cb_mask)) {
|
(ctx->DrawBuffer->_IntegerDrawBuffers != cb_mask)) {
|
||||||
/* If there is a mix of integer/non-integer buffers then blending
|
/* If there is a mix of integer/non-integer buffers then blending
|
||||||
* must be handled on a per buffer basis. */
|
* must be handled on a per buffer basis. */
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
|
@ -280,7 +280,7 @@ st_update_blend( struct st_context *st )
|
||||||
/* blending enabled */
|
/* blending enabled */
|
||||||
for (i = 0, j = 0; i < num_state; i++) {
|
for (i = 0, j = 0; i < num_state; i++) {
|
||||||
if (!(ctx->Color.BlendEnabled & (1 << i)) ||
|
if (!(ctx->Color.BlendEnabled & (1 << i)) ||
|
||||||
(ctx->DrawBuffer->_IntegerBuffers & (1 << i)) ||
|
(ctx->DrawBuffer->_IntegerDrawBuffers & (1 << i)) ||
|
||||||
!blend->rt[i].colormask)
|
!blend->rt[i].colormask)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -340,7 +340,7 @@ st_update_blend( struct st_context *st )
|
||||||
blend->dither = ctx->Color.DitherFlag;
|
blend->dither = ctx->Color.DitherFlag;
|
||||||
|
|
||||||
if (_mesa_is_multisample_enabled(ctx) &&
|
if (_mesa_is_multisample_enabled(ctx) &&
|
||||||
!(ctx->DrawBuffer->_IntegerBuffers & 0x1)) {
|
!(ctx->DrawBuffer->_IntegerDrawBuffers & 0x1)) {
|
||||||
/* Unlike in gallium/d3d10 these operations are only performed
|
/* Unlike in gallium/d3d10 these operations are only performed
|
||||||
* if both msaa is enabled and we have a multisample buffer.
|
* if both msaa is enabled and we have a multisample buffer.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ st_update_depth_stencil_alpha(struct st_context *st)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->Color.AlphaEnabled && !st->lower_alpha_test &&
|
if (ctx->Color.AlphaEnabled && !st->lower_alpha_test &&
|
||||||
!(ctx->DrawBuffer->_IntegerBuffers & 0x1)) {
|
!(ctx->DrawBuffer->_IntegerDrawBuffers & 0x1)) {
|
||||||
dsa->alpha_enabled = 1;
|
dsa->alpha_enabled = 1;
|
||||||
dsa->alpha_func = func_to_gallium(ctx->Color.AlphaFunc);
|
dsa->alpha_func = func_to_gallium(ctx->Color.AlphaFunc);
|
||||||
dsa->alpha_ref_value = ctx->Color.AlphaRefUnclamped;
|
dsa->alpha_ref_value = ctx->Color.AlphaRefUnclamped;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue