mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 01:28:07 +02:00
freedreno: a2xx: fix non-etc1 cubemaps
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>
This commit is contained in:
parent
2e029acbe2
commit
57e980a4fb
5 changed files with 2 additions and 15 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue