freedreno: a2xx: fix non-etc1 cubemaps
authorJonathan Marek <jonathan@marek.ca>
Thu, 1 Aug 2019 18:36:41 +0000 (14:36 -0400)
committerJonathan Marek <jonathan@marek.ca>
Fri, 2 Aug 2019 15:58:22 +0000 (15:58 +0000)
Not sure how this happened, but apparently all cubemaps need swapped XY.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Rob Clark <robdclark@chromium.org>
src/gallium/drivers/freedreno/a2xx/fd2_program.c
src/gallium/drivers/freedreno/a2xx/fd2_texture.c
src/gallium/drivers/freedreno/a2xx/fd2_texture.h
src/gallium/drivers/freedreno/a2xx/ir2_nir.c
src/gallium/drivers/freedreno/a2xx/ir2_private.h

index f09b74065066aeb7fd2986b58454d7029d521f3e..50c0f67325277decc2f5c063a35135cb427ae37f 100644 (file)
@@ -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);
-               }
        }
 }
 
index 16bdf6ce9a588c74f2dde816b2a76846711a5cc3..3e3add798bc0060852c0c6cd0d13e6ed9f04cbc4 100644 (file)
@@ -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)
 {
index 045be08ece1cda39660d248fc1b5aeb969ad66fe..b7ade85376362c539a436ce81664eb2d90137b85 100644 (file)
@@ -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_ */
index eefd597dbf31fa1681fbf48b0c456418b34c2df5..95047d903ac2976362f2c16fc8e925d06d98dc5e 100644 (file)
@@ -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;
index 57c35ae810236ff06502fad84a50495ca52341b7..5f71731aa4cbdb8e08c903d6ee8b5e81281bb64f 100644 (file)
@@ -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,