mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
pco: amend tg4 lowering
Use lower_tg4_offsets to take care of explicit offsets, and just swizzle the texels in the order defined by textureGather* Fixes:46c9239c11("pvr, pco: initial texture gather support with gather sampler") Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Frank Binns <frank.binns@imgtec.com> (cherry picked from commit56b8dc92a9) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41269>
This commit is contained in:
parent
2919eff898
commit
2201b6ff96
3 changed files with 7 additions and 12 deletions
|
|
@ -854,7 +854,7 @@
|
|||
"description": "pco: amend tg4 lowering",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "46c9239c11147b835659df2dedaa1e72263b99b2",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -902,6 +902,7 @@ void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data)
|
|||
nir_lower_tex,
|
||||
&(nir_lower_tex_options){
|
||||
.lower_txd_cube_map = true,
|
||||
.lower_tg4_offsets = true,
|
||||
});
|
||||
NIR_PASS(_, nir, pco_nir_lower_tex, data, ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -407,19 +407,13 @@ nir_intrinsic_instr *pco_emit_nir_smp(nir_builder *b, pco_smp_params *params)
|
|||
static nir_def *
|
||||
lower_tex_gather(nir_builder *b, nir_tex_instr *tex, nir_def *raw_data)
|
||||
{
|
||||
unsigned swiz[ARRAY_SIZE(tex->tg4_offsets)];
|
||||
for (unsigned u = 0; u < ARRAY_SIZE(tex->tg4_offsets); ++u) {
|
||||
unsigned offset = ARRAY_SIZE(*tex->tg4_offsets) * tex->tg4_offsets[u][0];
|
||||
offset += tex->tg4_offsets[u][1];
|
||||
offset *= ARRAY_SIZE(tex->tg4_offsets);
|
||||
offset += tex->component;
|
||||
assert(!nir_tex_instr_has_explicit_tg4_offsets(tex));
|
||||
|
||||
swiz[u] = offset;
|
||||
}
|
||||
#define TG4_SEL(sample) (((sample) * 4) + tex->component)
|
||||
unsigned swiz[] = { TG4_SEL(2), TG4_SEL(3), TG4_SEL(1), TG4_SEL(0) };
|
||||
#undef TG4_SEL
|
||||
|
||||
nir_def *result = nir_swizzle(b, raw_data, swiz, ARRAY_SIZE(swiz));
|
||||
|
||||
return result;
|
||||
return nir_swizzle(b, raw_data, swiz, ARRAY_SIZE(swiz));
|
||||
}
|
||||
|
||||
static nir_def *lower_tex_shadow(nir_builder *b,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue