mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
pco: track how many tg4/raw sample comps are needed
Rather than always emitting and swizzling 16 components for raw samples, scale it by the number actually needed as defined by the selected tg4 channel/components. Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40687>
This commit is contained in:
parent
b80a5f9b7d
commit
57791c4a99
3 changed files with 9 additions and 5 deletions
|
|
@ -3017,7 +3017,7 @@ intrinsic("smp_coeffs_pco", src_comp=[16, 4, 4], dest_comp=16, indices=[SMP_FLAG
|
|||
# smp_raw_pco(data, tex_state, smp_state)
|
||||
# Returns the raw sampling data for the given data and state words.
|
||||
# Actually outputs 4/8/12/16 components, but NIR doesn't support num_components == 12, so fake it as 8 for now.
|
||||
intrinsic("smp_raw_pco", src_comp=[16, 4, 4], dest_comp=16, indices=[SMP_FLAGS_PCO, RANGE], bit_sizes=[32])
|
||||
intrinsic("smp_raw_pco", src_comp=[16, 4, 4], dest_comp=16, indices=[SMP_FLAGS_PCO, RANGE, ENABLED_CHANNELS], bit_sizes=[32])
|
||||
|
||||
# smp_write_pco(data, tex_state, smp_state)
|
||||
# Performs a sample write for the given data and state words.
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ nir_intrinsic_instr *pco_emit_nir_smp(nir_builder *b, pco_smp_params *params)
|
|||
|
||||
if (params->sample_raw) {
|
||||
assert(!params->sample_coeffs);
|
||||
assert(!params->sample_components);
|
||||
assert(params->sample_components >= 1 && params->sample_components <= 4);
|
||||
assert(!params->write_data);
|
||||
|
||||
nir_def *def = nir_smp_raw_pco(b,
|
||||
|
|
@ -378,7 +378,8 @@ nir_intrinsic_instr *pco_emit_nir_smp(nir_builder *b, pco_smp_params *params)
|
|||
params->tex_state,
|
||||
params->smp_state,
|
||||
.smp_flags_pco = smp_flags._,
|
||||
.range = count);
|
||||
.range = count,
|
||||
.enabled_channels = params->sample_components);
|
||||
|
||||
return nir_def_as_intrinsic(def);
|
||||
}
|
||||
|
|
@ -419,7 +420,7 @@ lower_tex_gather(nir_builder *b, nir_tex_instr *tex, nir_def *raw_data)
|
|||
{
|
||||
assert(!nir_tex_instr_has_explicit_tg4_offsets(tex));
|
||||
|
||||
#define TG4_SEL(sample) (((sample) * 4) + tex->component)
|
||||
#define TG4_SEL(sample) (((sample) * (tex->component + 1)) + tex->component)
|
||||
unsigned swiz[] = { TG4_SEL(2), TG4_SEL(3), TG4_SEL(1), TG4_SEL(0) };
|
||||
#undef TG4_SEL
|
||||
|
||||
|
|
@ -739,6 +740,7 @@ static bool lower_tex(nir_builder *b, nir_tex_instr *tex, void *cb_data)
|
|||
|
||||
case nir_texop_tg4:
|
||||
params.sample_raw = true;
|
||||
params.sample_components = tex->component + 1;
|
||||
smp = pco_emit_nir_smp(b, ¶ms);
|
||||
result = lower_tex_gather(b, tex, &smp->def);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1708,7 +1708,9 @@ static pco_instr *lower_smp(trans_ctx *tctx,
|
|||
break;
|
||||
|
||||
case nir_intrinsic_smp_raw_pco:
|
||||
chans = 4;
|
||||
chans = nir_intrinsic_enabled_channels(intr);
|
||||
/* Shrink the destination to its actual size. */
|
||||
*dest = pco_ref_chans(*dest, chans * 4);
|
||||
sb_mode = PCO_SB_MODE_RAWDATA;
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue