summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-09-09 16:18:05 -0700
committerEric Anholt <[email protected]>2014-09-09 20:39:29 -0700
commit7d5c57f8e9b35ce903737332c80b2f2a5fdaadde (patch)
treeedc56eb9e39a73cddcf8a4eabc04c22f5e052f9d /src/gallium/drivers/vc4
parent1e77c9334047d1f084714c64f6996d010833f73f (diff)
vc4: Add support for texture swizzles.
Fixes depth-tex-modes.
Diffstat (limited to 'src/gallium/drivers/vc4')
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 0252b995d74..b6284bb1a55 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -42,6 +42,7 @@ struct vc4_key {
struct pipe_shader_state *shader_state;
struct {
enum pipe_format format;
+ uint8_t swizzle[4];
} tex[VC4_MAX_TEXTURE_SAMPLERS];
};
@@ -516,7 +517,9 @@ tgsi_to_qir_tex(struct vc4_compile *c,
unpacked[i] = qir_R4_UNPACK(c, r4, i);
}
- const uint8_t *swiz = vc4_get_format_swizzle(format);
+ const uint8_t *format_swiz = vc4_get_format_swizzle(format);
+ uint8_t swiz[4];
+ util_format_compose_swizzles(format_swiz, c->key->tex[unit].swizzle, swiz);
for (int i = 0; i < 4; i++) {
if (!(tgsi_inst->Dst[0].Register.WriteMask & (1 << i)))
continue;
@@ -1434,6 +1437,10 @@ vc4_setup_shared_key(struct vc4_key *key, struct vc4_texture_stateobj *texstate)
if (sampler) {
struct pipe_resource *prsc = sampler->texture;
key->tex[i].format = prsc->format;
+ key->tex[i].swizzle[0] = sampler->swizzle_r;
+ key->tex[i].swizzle[1] = sampler->swizzle_g;
+ key->tex[i].swizzle[2] = sampler->swizzle_b;
+ key->tex[i].swizzle[3] = sampler->swizzle_a;
}
}
}