aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorKristian H. Kristensen <[email protected]>2019-11-25 16:40:37 -0800
committerKristian H. Kristensen <[email protected]>2019-12-19 09:56:05 -0800
commitb59222640e9f5787feba9119100861cd6eca51e9 (patch)
tree430d1c55ca768faadc9d47989831e29210a5862c /src/gallium/drivers/freedreno
parenta2f6c44a1c314d8b5f85bba0453523efb7221820 (diff)
freedreno/a6xx: Program sampler swap based on resource tiling
It doesn't matter whether or not the level in question is linear. Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Kristian H. Kristensen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2848>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_format.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.c b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
index 6e9b26b5726..e703de8e12b 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_format.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
@@ -478,32 +478,20 @@ fd6_tex_const_0(struct pipe_resource *prsc,
unsigned swizzle_b, unsigned swizzle_a)
{
struct fd_resource *rsc = fd_resource(prsc);
- uint32_t swap, texconst0 = 0;
unsigned char swiz[4];
- if (util_format_is_srgb(format)) {
- texconst0 |= A6XX_TEX_CONST_0_SRGB;
- }
-
- if (rsc->layout.tile_mode && !fd_resource_level_linear(prsc, level)) {
- texconst0 |= A6XX_TEX_CONST_0_TILE_MODE(rsc->layout.tile_mode);
- swap = WZYX;
- } else {
- swap = fd6_pipe2swap(format);
- }
-
fd6_tex_swiz(format, swiz,
swizzle_r, swizzle_g,
swizzle_b, swizzle_a);
- texconst0 |=
+ return
A6XX_TEX_CONST_0_FMT(fd6_pipe2tex(format)) |
A6XX_TEX_CONST_0_SAMPLES(fd_msaa_samples(prsc->nr_samples)) |
- A6XX_TEX_CONST_0_SWAP(swap) |
+ A6XX_TEX_CONST_0_SWAP(rsc->layout.tile_mode ? WZYX : fd6_pipe2swap(format)) |
+ A6XX_TEX_CONST_0_TILE_MODE(fd_resource_tile_mode(prsc, level)) |
+ COND(util_format_is_srgb(format), A6XX_TEX_CONST_0_SRGB) |
A6XX_TEX_CONST_0_SWIZ_X(fd6_pipe2swiz(swiz[0])) |
A6XX_TEX_CONST_0_SWIZ_Y(fd6_pipe2swiz(swiz[1])) |
A6XX_TEX_CONST_0_SWIZ_Z(fd6_pipe2swiz(swiz[2])) |
A6XX_TEX_CONST_0_SWIZ_W(fd6_pipe2swiz(swiz[3]));
-
- return texconst0;
}