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>
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);
- }
}
}
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)
{
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_ */
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;
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,