freedreno/a6xx: fix border-color swizzles
authorRob Clark <robdclark@gmail.com>
Wed, 6 Mar 2019 15:34:53 +0000 (10:34 -0500)
committerRob Clark <robdclark@gmail.com>
Thu, 7 Mar 2019 20:33:42 +0000 (15:33 -0500)
Fixes nearly all of the remaining
dEQP-GLES31.functional.texture.border_clamp.formats.* fails

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
src/gallium/drivers/freedreno/a6xx/fd6_emit.c

index 6115fda3b1a86eb5f99d91db39294492650fa8af..95ac616a76c39b7ba51d507e1e03cd91f049579b 100644 (file)
@@ -196,7 +196,8 @@ setup_border_colors(struct fd_texture_stateobj *tex, struct bcolor_entry *entrie
                if ((i >= tex->num_textures) || !tex->textures[i])
                        continue;
 
-               enum pipe_format format = tex->textures[i]->format;
+               struct pipe_sampler_view *view = tex->textures[i];
+               enum pipe_format format = view->format;
                const struct util_format_description *desc =
                                util_format_description(format);
 
@@ -206,8 +207,14 @@ setup_border_colors(struct fd_texture_stateobj *tex, struct bcolor_entry *entrie
                e->rgb10a2 = 0;
                e->z24 = 0;
 
+               unsigned char swiz[4];
+
+               fd6_tex_swiz(format, swiz,
+                               view->swizzle_r, view->swizzle_g,
+                               view->swizzle_b, view->swizzle_a);
+
                for (j = 0; j < 4; j++) {
-                       int c = desc->swizzle[j];
+                       int c = swiz[j];
                        int cd = c;
 
                        /*