From 57e980a4fbf2109c876f057f84e9a1119725773b Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Thu, 1 Aug 2019 14:36:41 -0400 Subject: freedreno: a2xx: fix non-etc1 cubemaps Not sure how this happened, but apparently all cubemaps need swapped XY. Signed-off-by: Jonathan Marek Reviewed-by: Rob Clark --- src/gallium/drivers/freedreno/a2xx/fd2_program.c | 4 ---- src/gallium/drivers/freedreno/a2xx/fd2_texture.c | 7 ------- src/gallium/drivers/freedreno/a2xx/fd2_texture.h | 2 -- src/gallium/drivers/freedreno/a2xx/ir2_nir.c | 2 +- src/gallium/drivers/freedreno/a2xx/ir2_private.h | 2 +- 5 files changed, 2 insertions(+), 15 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_program.c b/src/gallium/drivers/freedreno/a2xx/fd2_program.c index f09b7406506..50c0f673252 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_program.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_program.c @@ -210,10 +210,6 @@ patch_fetches(struct fd_context *ctx, struct ir2_shader_info *info, assert(instr->opc == TEX_FETCH); instr->tex.const_idx = fd2_get_const_idx(ctx, tex, fi->tex.samp_id); instr->tex.src_swiz = fi->tex.src_swiz; - if (fd2_texture_swap_xy(tex, fi->tex.samp_id)) { - unsigned x = instr->tex.src_swiz; - instr->tex.src_swiz = (x & 0x30) | (x & 3) << 2 | (x >> 2 & 3); - } } } diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c index 16bdf6ce9a5..3e3add798bc 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c @@ -238,13 +238,6 @@ fd2_get_const_idx(struct fd_context *ctx, struct fd_texture_stateobj *tex, return samp_id + ctx->tex[PIPE_SHADER_FRAGMENT].num_samplers; } -/* for reasons unknown, it appears ETC1 cubemap needs swapped xy coordinates */ -bool fd2_texture_swap_xy(struct fd_texture_stateobj *tex, unsigned samp_id) -{ - return tex->textures[samp_id]->format == PIPE_FORMAT_ETC1_RGB8 && - tex->textures[samp_id]->texture->target == PIPE_TEXTURE_CUBE; -} - void fd2_texture_init(struct pipe_context *pctx) { diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.h b/src/gallium/drivers/freedreno/a2xx/fd2_texture.h index 045be08ece1..b7ade853763 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.h +++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.h @@ -60,8 +60,6 @@ fd2_pipe_sampler_view(struct pipe_sampler_view *pview) unsigned fd2_get_const_idx(struct fd_context *ctx, struct fd_texture_stateobj *tex, unsigned samp_id); -bool fd2_texture_swap_xy(struct fd_texture_stateobj *tex, unsigned samp_id); - void fd2_texture_init(struct pipe_context *pctx); #endif /* FD2_TEXTURE_H_ */ diff --git a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c index eefd597dbf3..95047d903ac 100644 --- a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c +++ b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c @@ -716,7 +716,7 @@ emit_tex(struct ir2_context *ctx, nir_tex_instr * tex) instr = ir2_instr_create_fetch(ctx, &tex->dest, TEX_FETCH); instr->src[0] = src_coord; - instr->src[0].swizzle = is_cube ? IR2_SWIZZLE_XYW : 0; + instr->src[0].swizzle = is_cube ? IR2_SWIZZLE_YXW : 0; instr->fetch.tex.is_cube = is_cube; instr->fetch.tex.is_rect = is_rect; instr->fetch.tex.samp_id = tex->sampler_index; diff --git a/src/gallium/drivers/freedreno/a2xx/ir2_private.h b/src/gallium/drivers/freedreno/a2xx/ir2_private.h index 57c35ae8102..5f71731aa4c 100644 --- a/src/gallium/drivers/freedreno/a2xx/ir2_private.h +++ b/src/gallium/drivers/freedreno/a2xx/ir2_private.h @@ -207,7 +207,7 @@ enum { IR2_SWIZZLE_ZW = 2 << 0 | 2 << 2, - IR2_SWIZZLE_XYW = 0 << 0 | 0 << 2 | 1 << 4, + IR2_SWIZZLE_YXW = 1 << 0 | 3 << 2 | 1 << 4, IR2_SWIZZLE_XXXX = 0 << 0 | 3 << 2 | 2 << 4 | 1 << 6, IR2_SWIZZLE_YYYY = 1 << 0 | 0 << 2 | 3 << 4 | 2 << 6, -- cgit v1.2.3