diff options
author | Wladimir J. van der Laan <[email protected]> | 2017-08-25 14:25:18 +0000 |
---|---|---|
committer | Wladimir J. van der Laan <[email protected]> | 2018-03-31 06:17:59 +0000 |
commit | fb413727618608e65013b13f3601ceefe6d36f9b (patch) | |
tree | 33b0e2e9d38a9016059ccd561dcb4f4cf52a7a8c /src/gallium/drivers/freedreno | |
parent | faed84a6151076f0e38d85ea403bb576710fa207 (diff) |
freedreno: a2xx: Fix fd2_tex_swiz
Compose swizzles using util_format_compose_swizzles instead
of the custom code (which somehow had a bug).
This makes the GL_ALPHA internal format work.
Signed-off-by: Wladimir J. van der Laan <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_util.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_util.c b/src/gallium/drivers/freedreno/a2xx/fd2_util.c index 0bdcfcd4bc5..25f2bf419cf 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_util.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_util.c @@ -309,14 +309,14 @@ fd2_tex_swiz(enum pipe_format format, unsigned swizzle_r, unsigned swizzle_g, { const struct util_format_description *desc = util_format_description(format); - uint8_t swiz[] = { - swizzle_r, swizzle_g, swizzle_b, swizzle_a, - PIPE_SWIZZLE_0, PIPE_SWIZZLE_1, - PIPE_SWIZZLE_1, PIPE_SWIZZLE_1, - }; + unsigned char swiz[4] = { + swizzle_r, swizzle_g, swizzle_b, swizzle_a, + }, rswiz[4]; - return A2XX_SQ_TEX_3_SWIZ_X(tex_swiz(swiz[desc->swizzle[0]])) | - A2XX_SQ_TEX_3_SWIZ_Y(tex_swiz(swiz[desc->swizzle[1]])) | - A2XX_SQ_TEX_3_SWIZ_Z(tex_swiz(swiz[desc->swizzle[2]])) | - A2XX_SQ_TEX_3_SWIZ_W(tex_swiz(swiz[desc->swizzle[3]])); + util_format_compose_swizzles(desc->swizzle, swiz, rswiz); + + return A2XX_SQ_TEX_3_SWIZ_X(tex_swiz(rswiz[0])) | + A2XX_SQ_TEX_3_SWIZ_Y(tex_swiz(rswiz[1])) | + A2XX_SQ_TEX_3_SWIZ_Z(tex_swiz(rswiz[2])) | + A2XX_SQ_TEX_3_SWIZ_W(tex_swiz(rswiz[3])); } |