mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-06 19:18:15 +02:00
nir/lower_point_size: support lowered i/o
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29248>
This commit is contained in:
parent
471ac97a4a
commit
0b582449f0
1 changed files with 16 additions and 8 deletions
|
|
@ -37,18 +37,26 @@ lower_point_size_intrin(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
|||
{
|
||||
float *minmax = (float *)data;
|
||||
|
||||
if (intr->intrinsic != nir_intrinsic_store_deref)
|
||||
return false;
|
||||
gl_varying_slot location = VARYING_SLOT_MAX;
|
||||
nir_src *psiz_src;
|
||||
|
||||
nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
|
||||
nir_variable *var = nir_deref_instr_get_variable(deref);
|
||||
if (var->data.location != VARYING_SLOT_PSIZ)
|
||||
if (intr->intrinsic == nir_intrinsic_store_deref) {
|
||||
nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
|
||||
nir_variable *var = nir_deref_instr_get_variable(deref);
|
||||
location = var->data.location;
|
||||
psiz_src = &intr->src[1];
|
||||
} else if (intr->intrinsic == nir_intrinsic_store_output) {
|
||||
location = nir_intrinsic_io_semantics(intr).location;
|
||||
psiz_src = &intr->src[0];
|
||||
}
|
||||
|
||||
if (location != VARYING_SLOT_PSIZ)
|
||||
return false;
|
||||
|
||||
b->cursor = nir_before_instr(&intr->instr);
|
||||
|
||||
assert(intr->src[1].ssa->num_components == 1);
|
||||
nir_def *psiz = intr->src[1].ssa;
|
||||
nir_def *psiz = psiz_src->ssa;
|
||||
assert(psiz->num_components == 1);
|
||||
|
||||
if (minmax[0] > 0.0f)
|
||||
psiz = nir_fmax(b, psiz, nir_imm_float(b, minmax[0]));
|
||||
|
|
@ -56,7 +64,7 @@ lower_point_size_intrin(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
|||
if (minmax[1] > 0.0f)
|
||||
psiz = nir_fmin(b, psiz, nir_imm_float(b, minmax[1]));
|
||||
|
||||
nir_src_rewrite(&intr->src[1], psiz);
|
||||
nir_src_rewrite(psiz_src, psiz);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue