broadcom/vc5: Fix up channel swizzling for textures on 4.x.
authorEric Anholt <eric@anholt.net>
Fri, 12 Jan 2018 21:20:38 +0000 (13:20 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 13 Jan 2018 05:58:04 +0000 (21:58 -0800)
I had 3.x putting swizzling in the texture state only for 16-bit texture
returns, and in the shader for 32-bit.  This may be due to having mixed up
the return channel setup on 3.x back before I had moved it into the
compiler.  On 4.x, the non-border-color texwrap tests are passing nicely
with both 16 and 32-bit returns with swizzling in the texture state.

src/gallium/drivers/vc5/vc5_program.c

index 4d74089b81ba875bb4a92ded11c6a4420d714328..ddb51b7f02aedc9aa2b5592b4f554b50aa42a8d0 100644 (file)
@@ -275,7 +275,8 @@ vc5_setup_shared_key(struct vc5_context *vc5, struct v3d_key *key,
                         continue;
 
                 key->tex[i].return_size =
-                        vc5_get_tex_return_size(devinfo, sampler->format,
+                        vc5_get_tex_return_size(devinfo,
+                                                sampler->format,
                                                 sampler_state->compare_mode);
 
                 /* For 16-bit, we set up the sampler to always return 2
@@ -284,13 +285,15 @@ vc5_setup_shared_key(struct vc5_context *vc5, struct v3d_key *key,
                  */
                 if (key->tex[i].return_size == 16) {
                         key->tex[i].return_channels = 2;
+                } else if (devinfo->ver > 40) {
+                        key->tex[i].return_channels = 4;
                 } else {
                         key->tex[i].return_channels =
                                 vc5_get_tex_return_channels(devinfo,
                                                             sampler->format);
                 }
 
-                if (key->tex[i].return_size == 32) {
+                if (key->tex[i].return_size == 32 && devinfo->ver < 40) {
                         memcpy(key->tex[i].swizzle,
                                vc5_sampler->swizzle,
                                sizeof(vc5_sampler->swizzle));