Mesa (main): freedreno/a6xx: Fix border color swizzling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 29 03:37:28 UTC 2022


Module: Mesa
Branch: main
Commit: 39c64a4b537a7e919d959369c2c0cdd19447a251
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=39c64a4b537a7e919d959369c2c0cdd19447a251

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Fri Jun 17 15:45:18 2022 +0200

freedreno/a6xx: Fix border color swizzling

>From the API's point of view, border color replacement looks like this:

       --------------------
       | API Border Color |
       --------------------
               |
-----------    |    ----------------      ----------
| API fmt |-------->| User Swizzle |----->| Shader |
-----------         ----------------      ----------

>From the HW point of view, it looks like this:

                    -------------------
                    | HW Border Color |
                    -------------------
                             |
----------     -----------   |   ---------------      ----------
| HW fmt |-----| HW swap |------>| Tex Swizzle |----->| Shader |
----------     -----------       ---------------      ----------

When the HW fmt + HW swap isn't enough to represent an API format, we
need to prepend our own swizzle to the the user's swizzle, so the tex
swizzle is a "format swizzle" composed with the user swizzle. However,
we don't want this format swizzle to be applied to border colors, so
there's a workaround in freedreno which is meant to undo the format
swizzle so that the HW border color with the format swizzle applied
equals the API border color, and everything is ok. However, on a6xx at
least it was incorrectly undoing the entire tex swizzle. This broke
border color with a user swizzle, because it was now effectively not
getting applied for the border color. It also made it seem like the user
swizzle is required for the workaround, which would have implications
for VK_EXT_border_color_swizzle with turnip, but it's not.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17177>

---

 src/freedreno/ci/freedreno-a630-fails.txt     | 118 --------------------------
 src/gallium/drivers/freedreno/a6xx/fd6_emit.c |   4 +-
 2 files changed, 2 insertions(+), 120 deletions(-)

diff --git a/src/freedreno/ci/freedreno-a630-fails.txt b/src/freedreno/ci/freedreno-a630-fails.txt
index 71ea0762031..36e603986d3 100644
--- a/src/freedreno/ci/freedreno-a630-fails.txt
+++ b/src/freedreno/ci/freedreno-a630-fails.txt
@@ -74,20 +74,6 @@ spec at arb_depth_buffer_float@fbo-clear-formats stencil at GL_DEPTH32F_STENCIL8,Fail
 spec at arb_depth_buffer_float@fbo-generatemipmap-formats,Fail
 spec at arb_depth_buffer_float@fbo-generatemipmap-formats at GL_DEPTH_COMPONENT32F,Fail
 spec at arb_depth_buffer_float@fbo-generatemipmap-formats at GL_DEPTH_COMPONENT32F NPOT,Fail
-spec at arb_depth_buffer_float@texwrap formats bordercolor,Fail
-spec at arb_depth_buffer_float@texwrap formats bordercolor at GL_DEPTH32F_STENCIL8- border color only,Fail
-spec at arb_depth_buffer_float@texwrap formats bordercolor at GL_DEPTH_COMPONENT32F- border color only,Fail
-spec at arb_depth_buffer_float@texwrap formats bordercolor-swizzled,Fail
-spec at arb_depth_buffer_float@texwrap formats bordercolor-swizzled at GL_DEPTH32F_STENCIL8- swizzled- border color only,Fail
-spec at arb_depth_buffer_float@texwrap formats bordercolor-swizzled at GL_DEPTH_COMPONENT32F- swizzled- border color only,Fail
-spec at arb_depth_texture@texwrap formats bordercolor,Fail
-spec at arb_depth_texture@texwrap formats bordercolor at GL_DEPTH_COMPONENT16- border color only,Fail
-spec at arb_depth_texture@texwrap formats bordercolor at GL_DEPTH_COMPONENT24- border color only,Fail
-spec at arb_depth_texture@texwrap formats bordercolor at GL_DEPTH_COMPONENT32- border color only,Fail
-spec at arb_depth_texture@texwrap formats bordercolor-swizzled,Fail
-spec at arb_depth_texture@texwrap formats bordercolor-swizzled at GL_DEPTH_COMPONENT16- swizzled- border color only,Fail
-spec at arb_depth_texture@texwrap formats bordercolor-swizzled at GL_DEPTH_COMPONENT24- swizzled- border color only,Fail
-spec at arb_depth_texture@texwrap formats bordercolor-swizzled at GL_DEPTH_COMPONENT32- swizzled- border color only,Fail
 
 # "0 primitives generated:
 #  Incorrect number of prims generated.
@@ -97,8 +83,6 @@ spec at arb_direct_state_access@transformfeedback-bufferbase at general test,Fail
 spec at arb_direct_state_access@transformfeedback-bufferrange,Fail
 spec at arb_direct_state_access@transformfeedback-bufferrange at general test,Fail
 
-spec at arb_es2_compatibility@texwrap formats bordercolor-swizzled,Fail
-spec at arb_es2_compatibility@texwrap formats bordercolor-swizzled at GL_RGB565- swizzled- border color only,Fail
 spec at arb_occlusion_query@occlusion_query_order,Fail
 spec at arb_point_sprite@arb_point_sprite-interactions 1.0,Fail
 spec at arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
@@ -186,45 +170,7 @@ spec at arb_tessellation_shader@execution at vs-tes-tessinner-tessouter-inputs-quads,F
 spec at arb_tessellation_shader@execution at vs-tes-tessinner-tessouter-inputs-tris,Fail
 spec at arb_tessellation_shader@execution at vs-tes-vertex,Fail
 
-spec at arb_texture_compression_bptc@texwrap formats bordercolor-swizzled,Fail
-spec at arb_texture_compression_bptc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RGBA_BPTC_UNORM- swizzled- border color only,Fail
-spec at arb_texture_compression_bptc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT- swizzled- border color only,Fail
-spec at arb_texture_compression_bptc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT- swizzled- border color only,Fail
-spec at arb_texture_compression_bptc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM- swizzled- border color only,Fail
-spec at arb_texture_compression@texwrap formats bordercolor-swizzled,Fail
-spec at arb_texture_compression@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RGBA- swizzled- border color only,Fail
-spec at arb_texture_compression@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RGB- swizzled- border color only,Fail
-spec at arb_texture_float@texwrap formats bordercolor-swizzled,Fail
-spec at arb_texture_float@texwrap formats bordercolor-swizzled at GL_RGB16F- swizzled- border color only,Fail
-spec at arb_texture_float@texwrap formats bordercolor-swizzled at GL_RGB32F- swizzled- border color only,Fail
-spec at arb_texture_float@texwrap formats bordercolor-swizzled at GL_RGBA16F- swizzled- border color only,Fail
-spec at arb_texture_float@texwrap formats bordercolor-swizzled at GL_RGBA32F- swizzled- border color only,Fail
 spec at arb_texture_rectangle@1-1-linear-texture,Fail
-spec at arb_texture_rgb10_a2ui@texwrap formats bordercolor-swizzled,Fail
-spec at arb_texture_rgb10_a2ui@texwrap formats bordercolor-swizzled at GL_RGB10_A2UI- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats bordercolor-swizzled,Fail
-spec at arb_texture_rg@texwrap formats bordercolor-swizzled at GL_R16- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats bordercolor-swizzled at GL_R8- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats bordercolor-swizzled at GL_RG16- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats bordercolor-swizzled at GL_RG8- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-float bordercolor-swizzled,Fail
-spec at arb_texture_rg@texwrap formats-float bordercolor-swizzled at GL_R16F- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-float bordercolor-swizzled at GL_R32F- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-float bordercolor-swizzled at GL_RG16F- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-float bordercolor-swizzled at GL_RG32F- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_R16I- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_R16UI- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_R32I- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_R32UI- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_R8I- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_R8UI- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_RG16I- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_RG16UI- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_RG32I- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_RG32UI- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_RG8I- swizzled- border color only,Fail
-spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_RG8UI- swizzled- border color only,Fail
 
 spec at arb_timer_query@timestamp-get,Fail
 
@@ -312,39 +258,9 @@ spec at ext_framebuffer_multisample@sample-alpha-to-coverage 4 color,Fail
 spec at ext_framebuffer_multisample@sample-alpha-to-coverage 4 depth,Fail
 spec at ext_framebuffer_object@fbo-alphatest-nocolor,Fail
 spec at ext_framebuffer_object@fbo-alphatest-nocolor-ff,Fail
-spec at ext_packed_depth_stencil@texwrap formats bordercolor,Fail
-spec at ext_packed_depth_stencil@texwrap formats bordercolor at GL_DEPTH24_STENCIL8- border color only,Fail
-spec at ext_packed_depth_stencil@texwrap formats bordercolor-swizzled,Fail
-spec at ext_packed_depth_stencil@texwrap formats bordercolor-swizzled at GL_DEPTH24_STENCIL8- swizzled- border color only,Fail
 spec at ext_packed_float@query-rgba-signed-components,Fail
-spec at ext_packed_float@texwrap formats bordercolor-swizzled,Fail
-spec at ext_packed_float@texwrap formats bordercolor-swizzled at GL_R11F_G11F_B10F- swizzled- border color only,Fail
 
-spec at ext_texture_compression_rgtc@texwrap formats bordercolor-swizzled,Fail
-spec at ext_texture_compression_rgtc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RED_RGTC1- swizzled- border color only,Fail
-spec at ext_texture_compression_rgtc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RG_RGTC2- swizzled- border color only,Fail
-spec at ext_texture_compression_rgtc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_SIGNED_RG_RGTC2- swizzled- border color only,Fail
-spec at ext_texture_compression_s3tc@texwrap formats bordercolor-swizzled,Fail
-spec at ext_texture_compression_s3tc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RGBA_S3TC_DXT1_EXT- swizzled- border color only,Fail
-spec at ext_texture_compression_s3tc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RGBA_S3TC_DXT3_EXT- swizzled- border color only,Fail
-spec at ext_texture_compression_s3tc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RGBA_S3TC_DXT5_EXT- swizzled- border color only,Fail
-spec at ext_texture_compression_s3tc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RGB_S3TC_DXT1_EXT- swizzled- border color only,Fail
 spec at ext_texture_integer@multisample-formats 4 gl_ext_texture_integer,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGB16I- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGB16UI- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGB32I- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGB32UI- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGB8I- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGB8UI- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGBA16I- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGBA16UI- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGBA32I- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGBA32UI- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGBA8I- swizzled- border color only,Fail
-spec at ext_texture_integer@texwrap formats bordercolor-swizzled at GL_RGBA8UI- swizzled- border color only,Fail
-spec at ext_texture_shared_exponent@texwrap formats bordercolor-swizzled,Fail
-spec at ext_texture_shared_exponent@texwrap formats bordercolor-swizzled at GL_RGB9_E5- swizzled- border color only,Fail
 
 # These failures go away with FD_MESA_DEBUG=noblit, but don't seem to be related
 # to the actual mipmap generation blits (which we do fall back on)
@@ -364,25 +280,6 @@ spec at ext_texture_snorm@fbo-generatemipmap-formats at GL_LUMINANCE16_SNORM NPOT,Fail
 
 spec at ext_texture_snorm@multisample-formats 2 gl_ext_texture_snorm,Fail
 spec at ext_texture_snorm@multisample-formats 4 gl_ext_texture_snorm,Fail
-spec at ext_texture_snorm@texwrap formats bordercolor-swizzled,Fail
-spec at ext_texture_snorm@texwrap formats bordercolor-swizzled at GL_R16_SNORM- swizzled- border color only,Fail
-spec at ext_texture_snorm@texwrap formats bordercolor-swizzled at GL_R8_SNORM- swizzled- border color only,Fail
-spec at ext_texture_snorm@texwrap formats bordercolor-swizzled at GL_RG16_SNORM- swizzled- border color only,Fail
-spec at ext_texture_snorm@texwrap formats bordercolor-swizzled at GL_RG8_SNORM- swizzled- border color only,Fail
-spec at ext_texture_snorm@texwrap formats bordercolor-swizzled at GL_RGB16_SNORM- swizzled- border color only,Fail
-spec at ext_texture_snorm@texwrap formats bordercolor-swizzled at GL_RGB8_SNORM- swizzled- border color only,Fail
-spec at ext_texture_snorm@texwrap formats bordercolor-swizzled at GL_RGBA16_SNORM- swizzled- border color only,Fail
-spec at ext_texture_snorm@texwrap formats bordercolor-swizzled at GL_RGBA8_SNORM- swizzled- border color only,Fail
-spec at ext_texture_srgb@texwrap formats bordercolor-swizzled,Fail
-spec at ext_texture_srgb@texwrap formats bordercolor-swizzled at GL_SRGB8_ALPHA8- swizzled- border color only,Fail
-spec at ext_texture_srgb@texwrap formats bordercolor-swizzled at GL_SRGB8- swizzled- border color only,Fail
-spec at ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled,Fail
-spec at ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled at GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT- swizzled- border color only,Fail
-spec at ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled at GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT- swizzled- border color only,Fail
-spec at ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled at GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT- swizzled- border color only,Fail
-spec at ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled at GL_COMPRESSED_SRGB_ALPHA- swizzled- border color only,Fail
-spec at ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled at GL_COMPRESSED_SRGB_S3TC_DXT1_EXT- swizzled- border color only,Fail
-spec at ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled at GL_COMPRESSED_SRGB- swizzled- border color only,Fail
 spec at ext_transform_feedback@geometry-shaders-basic,Fail
 spec at ext_transform_feedback@intervening-read prims_generated,Fail
 spec at ext_transform_feedback@intervening-read prims_generated use_gs,Fail
@@ -555,21 +452,6 @@ spec@!opengl 1.1 at polygon-mode-offset@config 6: Expected blue pixel in center,Fai
 spec@!opengl 1.1 at polygon-mode-offset@config 6: Expected white pixel on right edge,Fail
 spec@!opengl 1.1 at polygon-mode-offset@config 6: Expected white pixel on top edge,Fail
 spec@!opengl 1.1 at polygon-mode-offset,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_R3_G3_B2- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGB10_A2- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGB10- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGB12- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGB16- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGB4- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGB5_A1- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGB5- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGB8- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGBA12- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGBA16- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGBA2- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGBA4- swizzled- border color only,Fail
-spec@!opengl 1.1 at texwrap formats bordercolor-swizzled at GL_RGBA8- swizzled- border color only,Fail
 spec@!opengl 1.4 at gl-1.4-polygon-offset,Fail
 
 # "MESA: error: unknown vertex shader output name: VARYING_SLOT_EDGE
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
index a0f9d255958..e578b2f7cb5 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
@@ -120,8 +120,8 @@ setup_border_colors(struct fd_texture_stateobj *tex,
 
       unsigned char swiz[4];
 
-      fd6_tex_swiz(format, swiz, view->swizzle_r, view->swizzle_g,
-                   view->swizzle_b, view->swizzle_a);
+      fd6_tex_swiz(format, swiz, PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y,
+                   PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W);
 
       for (j = 0; j < 4; j++) {
          int c = swiz[j];



More information about the mesa-commit mailing list