From ff77ca8a3b67f6209af5d70711004cd1937bd711 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 12 Jan 2018 13:20:38 -0800 Subject: [PATCH] broadcom/vc5: Fix up channel swizzling for textures on 4.x. 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/vc5/vc5_program.c b/src/gallium/drivers/vc5/vc5_program.c index 4d74089b81b..ddb51b7f02a 100644 --- a/src/gallium/drivers/vc5/vc5_program.c +++ b/src/gallium/drivers/vc5/vc5_program.c @@ -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)); -- 2.30.2