summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_texture.c
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2017-06-16 17:02:29 +0200
committerChristian Gmeiner <[email protected]>2017-06-26 19:56:39 +0200
commit751ae6afbefd6e0b3cbf9323995465d5a078c9fb (patch)
treec5a279ce23c6bc4bc5aa57038068ef4d14e3d826 /src/gallium/drivers/etnaviv/etnaviv_texture.c
parent0ddcccac4f73f33e8d22368fa663e0991a704cc8 (diff)
etnaviv: add support for swizzled texture formats
Passes all ext_texture_swizzle piglits. Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-By: Wladimir J. van der Laan <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_texture.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_texture.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c
index f973bcb77eb..05fc7da58f8 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c
@@ -163,6 +163,9 @@ etna_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
struct etna_context *ctx = etna_context(pctx);
const uint32_t format = translate_texture_format(so->format);
const bool ext = !!(format & EXT_FORMAT);
+ const uint32_t swiz = get_texture_swiz(so->format, so->swizzle_r,
+ so->swizzle_g, so->swizzle_b,
+ so->swizzle_a);
if (!sv)
return NULL;
@@ -217,11 +220,7 @@ etna_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
}
sv->TE_SAMPLER_CONFIG1 = COND(ext, VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(format)) |
- VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_R(so->swizzle_r) |
- VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_G(so->swizzle_g) |
- VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_B(so->swizzle_b) |
- VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_A(so->swizzle_a) |
- VIVS_TE_SAMPLER_CONFIG1_HALIGN(res->halign);
+ VIVS_TE_SAMPLER_CONFIG1_HALIGN(res->halign) | swiz;
sv->TE_SAMPLER_SIZE = VIVS_TE_SAMPLER_SIZE_WIDTH(res->base.width0) |
VIVS_TE_SAMPLER_SIZE_HEIGHT(res->base.height0);
sv->TE_SAMPLER_LOG_SIZE =