diff options
author | Kristian H. Kristensen <[email protected]> | 2019-02-08 16:27:25 -0800 |
---|---|---|
committer | Kristian H. Kristensen <[email protected]> | 2019-02-11 12:26:21 -0800 |
commit | f03ba155d50f66d1001de9b2b78c50c7590f9024 (patch) | |
tree | 1eda236bcbe12571f4a3d63539cba1d85bb87ca2 /src/gallium | |
parent | bc8c813d5ae1f893b39a50d17f71bcfc2f76df01 (diff) |
freedreno/a6xx: Add format argument to fd6_tex_swiz()
We need to allow overriding the format with that of the image or
sampler view, so we can't take it from the resource in fd6_tex_swiz().
Reviewed-by: Rob Clark <[email protected]>
Signed-off-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_format.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_format.h | 5 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_image.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_texture.c | 2 |
4 files changed, 10 insertions, 8 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.c b/src/gallium/drivers/freedreno/a6xx/fd6_format.c index dc1a54243a3..35186f020db 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_format.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_format.c @@ -435,11 +435,12 @@ fd6_pipe2swiz(unsigned swiz) } uint32_t -fd6_tex_swiz(struct pipe_resource *prsc, unsigned swizzle_r, unsigned swizzle_g, - unsigned swizzle_b, unsigned swizzle_a) +fd6_tex_swiz(struct pipe_resource *prsc, enum pipe_format format, + unsigned swizzle_r, unsigned swizzle_g, + unsigned swizzle_b, unsigned swizzle_a) { const struct util_format_description *desc = - util_format_description(prsc->format); + util_format_description(format); unsigned char swiz[4] = { swizzle_r, swizzle_g, swizzle_b, swizzle_a, }, rswiz[4], *swizp; @@ -450,7 +451,7 @@ fd6_tex_swiz(struct pipe_resource *prsc, unsigned swizzle_r, unsigned swizzle_g, /* for tiled modes, we don't get SWAP, so manually apply that * extra step of swizzle: */ - enum a3xx_color_swap swap = fd6_pipe2swap(prsc->format); + enum a3xx_color_swap swap = fd6_pipe2swap(format); unsigned char swapswiz[][4] = { [WZYX] = { 0, 1, 2, 3 }, [WXYZ] = { 2, 1, 0, 3 }, diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.h b/src/gallium/drivers/freedreno/a6xx/fd6_format.h index bc188ca17a8..321794771b3 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_format.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_format.h @@ -40,8 +40,9 @@ enum a6xx_tex_fetchsize fd6_pipe2fetchsize(enum pipe_format format); enum a6xx_depth_format fd6_pipe2depth(enum pipe_format format); enum a6xx_tex_swiz fd6_pipe2swiz(unsigned swiz); -uint32_t fd6_tex_swiz(struct pipe_resource *prsc, unsigned swizzle_r, - unsigned swizzle_g, unsigned swizzle_b, unsigned swizzle_a); +uint32_t fd6_tex_swiz(struct pipe_resource *prsc, enum pipe_format format, + unsigned swizzle_r, + unsigned swizzle_g, unsigned swizzle_b, unsigned swizzle_a); static inline enum a6xx_2d_ifmt fd6_ifmt(enum a6xx_color_fmt fmt) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_image.c b/src/gallium/drivers/freedreno/a6xx/fd6_image.c index f7419d8d9ac..cc33a00c4cd 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_image.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_image.c @@ -114,7 +114,7 @@ static void emit_image_tex(struct fd_ringbuffer *ring, unsigned slot, OUT_RING(ring, CP_LOAD_STATE6_2_EXT_SRC_ADDR_HI(0)); OUT_RING(ring, A6XX_TEX_CONST_0_FMT(img->fmt) | - fd6_tex_swiz(img->prsc, PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, + fd6_tex_swiz(img->prsc, img->fmt, PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W) | COND(img->srgb, A6XX_TEX_CONST_0_SRGB)); OUT_RING(ring, A6XX_TEX_CONST_1_WIDTH(img->width) | diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c index af5f49fd3f2..0e2d9ee65d8 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c @@ -246,7 +246,7 @@ fd6_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, so->texconst0 = A6XX_TEX_CONST_0_FMT(fd6_pipe2tex(format)) | A6XX_TEX_CONST_0_SAMPLES(fd_msaa_samples(prsc->nr_samples)) | - fd6_tex_swiz(prsc, cso->swizzle_r, cso->swizzle_g, + fd6_tex_swiz(prsc, cso->format, cso->swizzle_r, cso->swizzle_g, cso->swizzle_b, cso->swizzle_a); /* NOTE: since we sample z24s8 using 8888_UINT format, the swizzle |