panfrost: adjust format in blend shaders

Blend shaders operate on 4 components, and this makes
a difference for some operations (particularly blends
with constant values). Usually the hardware handles the
conversion smoothly, but there are a few special cases where
there is an alpha channel in the "wrong" place; we need
to handle those specially.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39705>
This commit is contained in:
Eric R. Smith 2026-01-27 18:50:02 -04:00 committed by Marge Bot
parent 77bba3cf87
commit 40db69604f
5 changed files with 20 additions and 73 deletions

View file

@ -22,7 +22,6 @@ spec@arb_shader_texture_lod@execution@tex-miplevel-selection *projgradarb 2drect
spec@arb_shader_texture_lod@execution@tex-miplevel-selection *projgradarb 2drectshadow,Crash
spec@arb_texture_buffer_object@texture-buffer-size-clamp,Crash
spec@arb_texture_float@fbo-alphatest-formats,Crash
spec@arb_texture_float@fbo-blending-formats,Crash
spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16I,Fail
spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16_SNORM,Fail
spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R32I,Fail
@ -59,10 +58,6 @@ spec@arb_texture_rectangle@tex-miplevel-selection gl2:texture() 2drectshadow,Cra
spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drect,Crash
spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drect_projvec4,Crash
spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drectshadow,Crash
spec@arb_texture_rg@fbo-blending-formats,Fail
spec@arb_texture_rg@fbo-blending-formats@GL_R8,Fail
spec@arb_texture_rg@fbo-blending-formats@GL_RG8,Fail
spec@arb_texture_rg@fbo-blending-formats@GL_RG,Fail
spec@arb_transform_feedback_instanced@draw-auto instanced,Fail
spec@egl 1.4@eglterminate then unbind context,Fail
spec@egl_khr_gl_image@egl_khr_gl_renderbuffer_image-clear-shared-image gl_depth_component24,Fail
@ -70,20 +65,6 @@ spec@egl_khr_surfaceless_context@viewport,Fail
spec@egl_mesa_configless_context@basic,Fail
spec@ext_base_instance@arb_base_instance-drawarrays_gles3,Fail
spec@ext_framebuffer_blit@fbo-blit-check-limits,Fail
spec@ext_framebuffer_object@fbo-blending-format-quirks,Fail
spec@ext_framebuffer_object@fbo-blending-formats,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA4,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA,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_INTENSITY,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE4_ALPHA4,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE4,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE8_ALPHA8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE_ALPHA,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE,Fail
spec@ext_transform_feedback2@draw-auto,Fail
spec@ext_transform_feedback@builtin-varyings gl_clipdistance,Fail
spec@ext_transform_feedback@change-size base-shrink,Fail
@ -252,7 +233,6 @@ afbcp-spec@arb_shader_texture_lod@execution@tex-miplevel-selection *projgradarb
afbcp-spec@arb_shader_texture_lod@execution@tex-miplevel-selection *projgradarb 2drectshadow,Fail
afbcp-spec@arb_texture_buffer_object@texture-buffer-size-clamp,Crash
afbcp-spec@arb_texture_float@fbo-alphatest-formats,Crash
afbcp-spec@arb_texture_float@fbo-blending-formats,Crash
afbcp-spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16I,Fail
afbcp-spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16_SNORM,Fail
afbcp-spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R32I,Fail
@ -289,10 +269,6 @@ afbcp-spec@arb_texture_rectangle@tex-miplevel-selection gl2:texture() 2drectshad
afbcp-spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drect,Crash
afbcp-spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drect_projvec4,Crash
afbcp-spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drectshadow,Crash
afbcp-spec@arb_texture_rg@fbo-blending-formats,Fail
afbcp-spec@arb_texture_rg@fbo-blending-formats@GL_R8,Fail
afbcp-spec@arb_texture_rg@fbo-blending-formats@GL_RG8,Fail
afbcp-spec@arb_texture_rg@fbo-blending-formats@GL_RG,Fail
afbcp-spec@glsl-1.30@execution@tex-miplevel-selection texture() 2drect,Fail
afbcp-spec@glsl-1.30@execution@tex-miplevel-selection texture() 2drectshadow,Fail
afbcp-spec@khr_texture_compression_astc@miptree-gles srgb-fp,Fail

View file

@ -17,7 +17,6 @@ spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail
spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgrad,Fail
spec@arb_texture_buffer_object@texture-buffer-size-clamp,Crash
spec@arb_texture_float@fbo-alphatest-formats,Crash
spec@arb_texture_float@fbo-blending-formats,Crash
spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16I,Fail
spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16_SNORM,Fail
spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R32I,Fail
@ -52,26 +51,12 @@ spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type
spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drect,Crash
spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drect_projvec4,Crash
spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drectshadow,Crash
spec@arb_texture_rg@fbo-blending-formats,Fail
spec@arb_texture_rg@fbo-blending-formats@GL_R8,Fail
spec@arb_texture_rg@fbo-blending-formats@GL_RG8,Fail
spec@arb_texture_rg@fbo-blending-formats@GL_RG,Fail
spec@arb_transform_feedback_instanced@draw-auto instanced,Fail
spec@egl 1.4@eglterminate then unbind context,Fail
spec@egl_khr_gl_image@egl_khr_gl_renderbuffer_image-clear-shared-image gl_depth_component24,Fail
spec@egl_khr_surfaceless_context@viewport,Fail
spec@egl_mesa_configless_context@basic,Fail
spec@ext_framebuffer_blit@fbo-blit-check-limits,Fail
spec@ext_framebuffer_object@fbo-blending-formats,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA4,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA,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_INTENSITY,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE4,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE,Fail
spec@ext_transform_feedback2@draw-auto,Fail
spec@ext_transform_feedback@builtin-varyings gl_clipdistance,Fail
spec@ext_transform_feedback@change-size base-shrink,Fail
@ -271,7 +256,6 @@ afbcp-spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,F
afbcp-spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgrad,Fail
afbcp-spec@arb_texture_buffer_object@texture-buffer-size-clamp,Crash
afbcp-spec@arb_texture_float@fbo-alphatest-formats,Crash
afbcp-spec@arb_texture_float@fbo-blending-formats,Crash
afbcp-spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16I,Fail
afbcp-spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16_SNORM,Fail
afbcp-spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R32I,Fail
@ -306,10 +290,6 @@ afbcp-spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Textur
afbcp-spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drect,Crash
afbcp-spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drect_projvec4,Crash
afbcp-spec@arb_texture_rectangle@tex-miplevel-selection gl2:textureproj 2drectshadow,Crash
afbcp-spec@arb_texture_rg@fbo-blending-formats,Fail
afbcp-spec@arb_texture_rg@fbo-blending-formats@GL_R8,Fail
afbcp-spec@arb_texture_rg@fbo-blending-formats@GL_RG8,Fail
afbcp-spec@arb_texture_rg@fbo-blending-formats@GL_RG,Fail
afbcp-spec@arb_transform_feedback_instanced@draw-auto instanced,Fail
afbcp-spec@egl 1.4@eglterminate then unbind context,Fail
afbcp-spec@egl_khr_gl_image@egl_khr_gl_renderbuffer_image-clear-shared-image gl_depth_component24,Fail
@ -317,16 +297,6 @@ afbcp-spec@egl_khr_gl_image@egl_khr_gl_renderbuffer_image-clear-shared-image gl_
afbcp-spec@egl_khr_surfaceless_context@viewport,Fail
afbcp-spec@egl_mesa_configless_context@basic,Fail
afbcp-spec@ext_framebuffer_blit@fbo-blit-check-limits,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA4,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA8,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats@GL_INTENSITY4,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats@GL_INTENSITY8,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats@GL_INTENSITY,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE4,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE8,Fail
afbcp-spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE,Fail
afbcp-spec@ext_transform_feedback2@draw-auto,Fail
afbcp-spec@ext_transform_feedback@builtin-varyings gl_clipdistance,Fail
afbcp-spec@ext_transform_feedback@change-size base-shrink,Fail

View file

@ -30,10 +30,6 @@ afbcp-spec@arb_texture_query_levels@execution@vs-baselevel,Crash
afbcp-spec@arb_texture_query_levels@execution@vs-maxlevel,Crash
afbcp-spec@arb_texture_query_levels@execution@vs-miptree,Crash
afbcp-spec@arb_texture_query_levels@execution@vs-nomips,Crash
afbcp-spec@arb_texture_rg@fbo-blending-formats,Fail
afbcp-spec@arb_texture_rg@fbo-blending-formats@GL_R8,Fail
afbcp-spec@arb_texture_rg@fbo-blending-formats@GL_RG8,Fail
afbcp-spec@arb_texture_rg@fbo-blending-formats@GL_RG,Fail
afbcp-spec@ext_image_dma_buf_import@ext_image_dma_buf_import-refcount-multithread,Crash
afbcp-spec@glsl-1.30@execution@tex-miplevel-selection texturegrad 1darray,Fail
afbcp-spec@glsl-1.30@execution@tex-miplevel-selection texturegrad 1darrayshadow,Fail
@ -112,10 +108,6 @@ spec@arb_texture_query_levels@execution@vs-baselevel,Crash
spec@arb_texture_query_levels@execution@vs-maxlevel,Crash
spec@arb_texture_query_levels@execution@vs-miptree,Crash
spec@arb_texture_query_levels@execution@vs-nomips,Crash
spec@arb_texture_rg@fbo-blending-formats,Fail
spec@arb_texture_rg@fbo-blending-formats@GL_R8,Fail
spec@arb_texture_rg@fbo-blending-formats@GL_RG8,Fail
spec@arb_texture_rg@fbo-blending-formats@GL_RG,Fail
spec@arb_transform_feedback_instanced@draw-auto instanced,Fail
spec@egl 1.4@egl-ext_egl_image_storage,Fail
spec@egl 1.4@eglterminate then unbind context,Fail
@ -143,16 +135,6 @@ spec@ext_framebuffer_multisample@draw-buffers-alpha-to-coverage 8,Fail
spec@ext_framebuffer_multisample@sample-alpha-to-coverage 16 color,Fail
spec@ext_framebuffer_multisample@sample-alpha-to-coverage 6 color,Fail
spec@ext_framebuffer_multisample@sample-alpha-to-coverage 8 color,Fail
spec@ext_framebuffer_object@fbo-blending-formats,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA4,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_ALPHA,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_INTENSITY,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE4,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE8,Fail
spec@ext_framebuffer_object@fbo-blending-formats@GL_LUMINANCE,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-refcount-multithread,Crash
spec@ext_shader_framebuffer_fetch@execution@gles3@discard-ms8,Fail
spec@ext_shader_framebuffer_fetch_non_coherent@execution@gles3@discard-ms8,Fail

View file

@ -773,6 +773,23 @@ get_equation_str(const struct pan_blend_rt_state *rt_state, char *str,
}
}
enum pipe_format
GENX(pan_blend_shader_fmt)(enum pipe_format format)
{
switch (format) {
#if PAN_ARCH < 6
case PIPE_FORMAT_R10G10B10A2_UNORM:
case PIPE_FORMAT_R10G10B10X2_UNORM:
return PIPE_FORMAT_R8G8B8A8_UNORM;
#endif
case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_L8A8_UNORM:
return PIPE_FORMAT_R8G8B8A8_UNORM;
default:
return format;
}
}
nir_shader *
GENX(pan_blend_create_shader)(const struct pan_blend_state *state,
nir_alu_type src0_type, nir_alu_type src1_type,
@ -791,7 +808,7 @@ GENX(pan_blend_create_shader)(const struct pan_blend_state *state,
state->logicop_enable ? logicop_str(state->logicop_func) : equation_str);
nir_builder *b = &builder;
const enum pipe_format format = rt_state->format;
const enum pipe_format format = GENX(pan_blend_shader_fmt)(rt_state->format);
const struct util_format_description *format_desc =
util_format_description(format);

View file

@ -115,6 +115,8 @@ uint32_t pan_pack_blend(const struct pan_blend_equation equation);
#ifdef PAN_ARCH
enum pipe_format GENX(pan_blend_shader_fmt)(enum pipe_format format);
nir_shader *GENX(pan_blend_create_shader)(const struct pan_blend_state *state,
nir_alu_type src0_type,
nir_alu_type src1_type, unsigned rt);