As Vasily discovered, the bit 7 of the word 1 of the texture descriptor
is set when reloading the framebuffer, to use framebuffer-based offset
rather than normalized one. This bit also works for regular textures to
enable accessing with non-normalized offset.
Add support for rectangle texture by setting this bit for
PIPE_TEXTURE_RECT.
Suggested-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
lima_tex_desc *td = cpu + lima_reload_tex_desc_offset;
memset(td, 0, lima_min_tex_desc_size);
lima_texture_desc_set_res(ctx, td, fb->base.cbufs[0]->texture, 0, 0);
- td->unknown_1_1 = 0x80;
+ td->unnorm_coords = 1;
td->texture_2d = 1;
td->min_img_filter_nearest = 1;
td->mag_img_filter_nearest = 1;
case PIPE_BUFFER:
case PIPE_TEXTURE_1D:
case PIPE_TEXTURE_2D:
+ case PIPE_TEXTURE_RECT:
break;
default:
return false;
/* 2D texture */
desc->texture_2d = 1;
+ if (!sampler->base.normalized_coords)
+ desc->unnorm_coords = 1;
+
first_level = texture->base.u.tex.first_level;
last_level = texture->base.u.tex.last_level;
if (last_level - first_level >= LIMA_MAX_MIP_LEVELS)
uint32_t unknown_0_2: 1;
/* Word 1-3 */
- uint32_t unknown_1_1: 10;
+ uint32_t unknown_1_1: 7;
+ uint32_t unnorm_coords: 1;
+ uint32_t unknown_1_2: 2;
uint32_t texture_2d: 1;
- uint32_t unknown_1_2: 13;
+ uint32_t unknown_1_3: 13;
uint32_t miplevels: 4;
uint32_t min_mipfilter_1: 9; /* 0x0 for linear, 0x1ff for nearest */
uint32_t unknown_2_1: 3;