mesa: fix blending when using luminance/intensity emulation

neither of these have a real alpha channel, so reuse the xrgb blend
clamping here to ensure the "right" alpha value is used

cc: mesa-stable

fixes:
spec@arb_texture_float@fbo-blending-formats

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17687>
This commit is contained in:
Mike Blumenkrantz 2022-08-09 16:56:08 -04:00 committed by Marge Bot
parent 3eec931e9b
commit 4f28e2827c
7 changed files with 9 additions and 34 deletions

View file

@ -144,9 +144,7 @@ spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgrad,Fail
spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail
spec@arb_texture_float@fbo-blending-formats,Fail spec@arb_texture_float@fbo-blending-formats,Fail
spec@arb_texture_float@fbo-blending-formats@GL_ALPHA32F_ARB,Fail spec@arb_texture_float@fbo-blending-formats@GL_ALPHA32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_INTENSITY16F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_INTENSITY32F_ARB,Fail spec@arb_texture_float@fbo-blending-formats@GL_INTENSITY32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE16F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE32F_ARB,Fail spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE_ALPHA32F_ARB,Fail spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE_ALPHA32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_RGB16F,Fail spec@arb_texture_float@fbo-blending-formats@GL_RGB16F,Fail

View file

@ -129,8 +129,6 @@ spec@arb_texture_cube_map@copyteximage cube,Fail
# 16-bit so that texture filtering worked, since GL 2.1 let you do that. # 16-bit so that texture filtering worked, since GL 2.1 let you do that.
# Crocus instead decided to follow r300 and other GL2 hardware in using the # Crocus instead decided to follow r300 and other GL2 hardware in using the
# requested size for storage even if the HW can't filter textures with it. # requested size for storage even if the HW can't filter textures with it.
spec@arb_texture_float@fbo-blending-formats,Fail
spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE32F_ARB,Fail
spec@arb_texture_rg@fbo-blending-formats-float,Fail spec@arb_texture_rg@fbo-blending-formats-float,Fail
spec@arb_texture_rg@fbo-blending-formats-float@GL_RG32F,Fail spec@arb_texture_rg@fbo-blending-formats-float@GL_RG32F,Fail
spec@arb_texture_float@texwrap formats bordercolor,Fail spec@arb_texture_float@texwrap formats bordercolor,Fail

View file

@ -579,8 +579,6 @@ spec@arb_texture_cube_map_array@fbo-generatemipmap-cubemap array s3tc_dxt1,Fail
spec@arb_texture_float@fbo-blending-formats,Fail spec@arb_texture_float@fbo-blending-formats,Fail
spec@arb_texture_float@fbo-blending-formats@GL_ALPHA16F_ARB,Fail spec@arb_texture_float@fbo-blending-formats@GL_ALPHA16F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_ALPHA32F_ARB,Fail spec@arb_texture_float@fbo-blending-formats@GL_ALPHA32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_INTENSITY16F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_INTENSITY32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_RGB32F,Fail spec@arb_texture_float@fbo-blending-formats@GL_RGB32F,Fail
spec@arb_texture_float@fbo-clear-formats,Fail spec@arb_texture_float@fbo-clear-formats,Fail
spec@arb_texture_float@fbo-clear-formats@GL_ALPHA16F_ARB,Fail spec@arb_texture_float@fbo-clear-formats@GL_ALPHA16F_ARB,Fail
@ -778,10 +776,6 @@ spec@ext_texture_shared_exponent@texwrap formats bordercolor,Fail
spec@ext_texture_shared_exponent@texwrap formats bordercolor-swizzled,Fail spec@ext_texture_shared_exponent@texwrap formats bordercolor-swizzled,Fail
spec@ext_texture_shared_exponent@texwrap formats bordercolor-swizzled@GL_RGB9_E5- swizzled- border color only,Fail spec@ext_texture_shared_exponent@texwrap formats bordercolor-swizzled@GL_RGB9_E5- swizzled- border color only,Fail
spec@ext_texture_shared_exponent@texwrap formats bordercolor@GL_RGB9_E5- border color only,Fail spec@ext_texture_shared_exponent@texwrap formats bordercolor@GL_RGB9_E5- border color only,Fail
spec@ext_texture_snorm@fbo-blending-formats,Fail
spec@ext_texture_snorm@fbo-blending-formats@GL_INTENSITY16_SNORM,Fail
spec@ext_texture_snorm@fbo-blending-formats@GL_INTENSITY8_SNORM,Fail
spec@ext_texture_snorm@fbo-blending-formats@GL_INTENSITY_SNORM,Fail
spec@ext_texture_snorm@texwrap formats bordercolor,Fail spec@ext_texture_snorm@texwrap formats bordercolor,Fail
spec@ext_texture_snorm@texwrap formats bordercolor-swizzled,Fail spec@ext_texture_snorm@texwrap formats bordercolor-swizzled,Fail
spec@ext_texture_snorm@texwrap formats bordercolor-swizzled@GL_ALPHA16_SNORM- swizzled- border color only,Fail spec@ext_texture_snorm@texwrap formats bordercolor-swizzled@GL_ALPHA16_SNORM- swizzled- border color only,Fail

View file

@ -137,10 +137,6 @@ spec@arb_sample_shading@samplemask 4 all@noms partition,Fail
spec@arb_sample_shading@samplemask 4 all@sample mask_in_one,Fail spec@arb_sample_shading@samplemask 4 all@sample mask_in_one,Fail
spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgrad,Fail spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgrad,Fail
spec@arb_texture_float@fbo-blending-formats,Fail spec@arb_texture_float@fbo-blending-formats,Fail
spec@arb_texture_float@fbo-blending-formats@GL_INTENSITY16F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_INTENSITY32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE16F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_LUMINANCE32F_ARB,Fail
spec@arb_texture_float@fbo-blending-formats@GL_RGB32F,Fail spec@arb_texture_float@fbo-blending-formats@GL_RGB32F,Fail
spec@egl 1.4@eglterminate then unbind context,Fail spec@egl 1.4@eglterminate then unbind context,Fail
@ -165,11 +161,6 @@ spec@ext_framebuffer_multisample@interpolation 4 centroid-edges,Fail
spec@ext_framebuffer_multisample@interpolation 4 non-centroid-deriv-disabled,Fail spec@ext_framebuffer_multisample@interpolation 4 non-centroid-deriv-disabled,Fail
spec@ext_framebuffer_multisample@interpolation 4 non-centroid-disabled,Fail spec@ext_framebuffer_multisample@interpolation 4 non-centroid-disabled,Fail
spec@ext_framebuffer_object@fbo-blending-formats,Fail spec@ext_framebuffer_object@fbo-blending-formats,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_INTENSITY,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_INTENSITY12,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_INTENSITY16,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_INTENSITY4,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_INTENSITY8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE12,Fail spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE12,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE16,Fail spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE16,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_RGB10,Fail spec@ext_framebuffer_object@fbo-blending-formats@GL_RGB10,Fail
@ -201,13 +192,6 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvu420,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-transcode-nv12-as-r8-gr88,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-transcode-nv12-as-r8-gr88,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-unsupported_format,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-unsupported_format,Fail
spec@ext_packed_float@query-rgba-signed-components,Fail spec@ext_packed_float@query-rgba-signed-components,Fail
spec@ext_texture_snorm@fbo-blending-formats,Fail
spec@ext_texture_snorm@fbo-blending-formats@GL_INTENSITY16_SNORM,Fail
spec@ext_texture_snorm@fbo-blending-formats@GL_INTENSITY8_SNORM,Fail
spec@ext_texture_snorm@fbo-blending-formats@GL_INTENSITY_SNORM,Fail
spec@ext_texture_snorm@fbo-blending-formats@GL_LUMINANCE16_SNORM,Fail
spec@ext_texture_snorm@fbo-blending-formats@GL_LUMINANCE8_SNORM,Fail
spec@ext_texture_snorm@fbo-blending-formats@GL_LUMINANCE_SNORM,Fail
spec@ext_texture_swizzle@depth_texture_mode_and_swizzle,Fail spec@ext_texture_swizzle@depth_texture_mode_and_swizzle,Fail
spec@intel_performance_query@intel_performance_query-issue_2235,Fail spec@intel_performance_query@intel_performance_query-issue_2235,Fail
spec@khr_texture_compression_astc@array-gl,Fail spec@khr_texture_compression_astc@array-gl,Fail

View file

@ -1290,7 +1290,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
fb->_HasSNormOrFloatColorBuffer = GL_FALSE; fb->_HasSNormOrFloatColorBuffer = GL_FALSE;
fb->_HasAttachments = true; fb->_HasAttachments = true;
fb->_IntegerBuffers = 0; fb->_IntegerBuffers = 0;
fb->_RGBBuffers = 0; fb->_BlendForceAlphaToOne = 0;
fb->_FP32Buffers = 0; fb->_FP32Buffers = 0;
/* Start at -2 to more easily loop over all attachment points. /* Start at -2 to more easily loop over all attachment points.
@ -1451,8 +1451,10 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
if (_mesa_is_format_integer_color(attFormat)) if (_mesa_is_format_integer_color(attFormat))
fb->_IntegerBuffers |= (1 << i); fb->_IntegerBuffers |= (1 << i);
if (baseFormat == GL_RGB) if ((baseFormat == GL_RGB && ctx->st->needs_rgb_dst_alpha_override) ||
fb->_RGBBuffers |= (1 << i); (baseFormat == GL_LUMINANCE && !util_format_is_luminance(attFormat)) ||
(baseFormat == GL_INTENSITY && !util_format_is_intensity(attFormat)))
fb->_BlendForceAlphaToOne |= (1 << i);
if (type == GL_FLOAT && _mesa_get_format_max_bits(attFormat) > 16) if (type == GL_FLOAT && _mesa_get_format_max_bits(attFormat) > 16)
fb->_FP32Buffers |= (1 << i); fb->_FP32Buffers |= (1 << i);

View file

@ -2722,7 +2722,7 @@ struct gl_framebuffer
bool _HasAttachments; bool _HasAttachments;
GLbitfield _IntegerBuffers; /**< Which color buffers are integer valued */ GLbitfield _IntegerBuffers; /**< Which color buffers are integer valued */
GLbitfield _RGBBuffers; /**< Which color buffers have baseformat == RGB */ GLbitfield _BlendForceAlphaToOne; /**< Which color buffers need blend factor adjustment */
GLbitfield _FP32Buffers; /**< Which color buffers are FP32 */ GLbitfield _FP32Buffers; /**< Which color buffers are FP32 */
/* ARB_color_buffer_float */ /* ARB_color_buffer_float */

View file

@ -148,14 +148,14 @@ blend_per_rt(const struct st_context *st, unsigned num_cb)
return GL_TRUE; return GL_TRUE;
} }
if (st->needs_rgb_dst_alpha_override && ctx->DrawBuffer->_RGBBuffers) { if (ctx->DrawBuffer->_BlendForceAlphaToOne) {
/* Overriding requires independent blend functions (not just enables), /* Overriding requires independent blend functions (not just enables),
* require drivers exposing PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND to * require drivers exposing PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND to
* also expose PIPE_CAP_INDEP_BLEND_FUNC. * also expose PIPE_CAP_INDEP_BLEND_FUNC.
*/ */
assert(st->has_indep_blend_func); assert(st->has_indep_blend_func);
/* If some of the buffers are RGB, we may need to override blend /* If some of the buffers are RGB or emulated L/I, we may need to override blend
* factors that reference destination-alpha to constants. We may * factors that reference destination-alpha to constants. We may
* need different blend factor overrides per buffer (say one uses * need different blend factor overrides per buffer (say one uses
* a DST_ALPHA factor and another uses INV_DST_ALPHA), so we flip * a DST_ALPHA factor and another uses INV_DST_ALPHA), so we flip
@ -269,8 +269,7 @@ st_update_blend( struct st_context *st )
const struct gl_renderbuffer *rb = const struct gl_renderbuffer *rb =
ctx->DrawBuffer->_ColorDrawBuffers[i]; ctx->DrawBuffer->_ColorDrawBuffers[i];
if (st->needs_rgb_dst_alpha_override && rb && if (rb && (ctx->DrawBuffer->_BlendForceAlphaToOne & (1 << i))) {
(ctx->DrawBuffer->_RGBBuffers & (1 << i))) {
struct pipe_rt_blend_state *rt = &blend->rt[i]; struct pipe_rt_blend_state *rt = &blend->rt[i];
rt->rgb_src_factor = fix_xrgb_alpha(rt->rgb_src_factor); rt->rgb_src_factor = fix_xrgb_alpha(rt->rgb_src_factor);
rt->rgb_dst_factor = fix_xrgb_alpha(rt->rgb_dst_factor); rt->rgb_dst_factor = fix_xrgb_alpha(rt->rgb_dst_factor);