radv: fix border color swizzle for stencil-only format on GFX9+
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 23 Feb 2023 08:50:17 +0000 (09:50 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 7 Mar 2023 15:10:33 +0000 (15:10 +0000)
Swizzle of 8-bit stencil format is defined as _x__ but the hw expects
BC_SWIZZLE_XYZW.

Fixes dEQP-VK.pipeline.monolithic.sampler.border_swizzle.*s8_uint*.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21482>

src/amd/vulkan/radv_image.c

index 74fa1ea..cda526f 100644 (file)
@@ -943,6 +943,12 @@ gfx9_border_color_swizzle(const struct util_format_description *desc)
 {
    unsigned bc_swizzle = V_008F20_BC_SWIZZLE_XYZW;
 
+   if (desc->format == PIPE_FORMAT_S8_UINT) {
+      /* Swizzle of 8-bit stencil format is defined as _x__ but the hw expects XYZW. */
+      assert(desc->swizzle[1] == PIPE_SWIZZLE_X);
+      return bc_swizzle;
+   }
+
    if (desc->swizzle[3] == PIPE_SWIZZLE_X) {
       /* For the pre-defined border color values (white, opaque
        * black, transparent black), the only thing that matters is