mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 17:30:20 +01:00
panvk: rewrite pan_nir_lower_static_noperspective
Really this should be using the common code I added in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36501 but one thing at a time. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-by: Olivia Lee <olivia.lee@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36600>
This commit is contained in:
parent
dff1d91c64
commit
94a2740cab
4 changed files with 8 additions and 34 deletions
|
|
@ -200,9 +200,11 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir,
|
|||
panfrost_device_gpu_prod_id(dev) < 0x700);
|
||||
}
|
||||
|
||||
if (s->info.stage == MESA_SHADER_VERTEX)
|
||||
NIR_PASS(_, s, pan_nir_lower_static_noperspective,
|
||||
if (s->info.stage == MESA_SHADER_VERTEX) {
|
||||
NIR_PASS(_, s, nir_inline_sysval,
|
||||
nir_intrinsic_load_noperspective_varyings_pan,
|
||||
key->vs.noperspective_varyings);
|
||||
}
|
||||
|
||||
NIR_PASS(_, s, panfrost_nir_lower_sysvals, dev->arch, &out->sysvals);
|
||||
|
||||
|
|
|
|||
|
|
@ -350,8 +350,6 @@ bool pan_nir_lower_image_ms(nir_shader *shader);
|
|||
bool pan_nir_lower_frag_coord_zw(nir_shader *shader);
|
||||
bool pan_nir_lower_noperspective_vs(nir_shader *shader);
|
||||
bool pan_nir_lower_noperspective_fs(nir_shader *shader);
|
||||
bool pan_nir_lower_static_noperspective(nir_shader *shader,
|
||||
uint32_t noperspective_varyings);
|
||||
|
||||
bool pan_lower_helper_invocation(nir_shader *shader);
|
||||
bool pan_lower_sample_pos(nir_shader *shader);
|
||||
|
|
|
|||
|
|
@ -295,31 +295,3 @@ pan_nir_lower_noperspective_fs(nir_shader *shader)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
lower_static_noperspective(nir_builder *b, nir_intrinsic_instr *intrin,
|
||||
void *data)
|
||||
{
|
||||
uint32_t *noperspective_varyings = data;
|
||||
|
||||
if (intrin->intrinsic != nir_intrinsic_load_noperspective_varyings_pan)
|
||||
return false;
|
||||
|
||||
b->cursor = nir_after_instr(&intrin->instr);
|
||||
nir_def *val = nir_imm_int(b, *noperspective_varyings);
|
||||
nir_def_replace(&intrin->def, val);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower loads from the noperspective_varyings_pan sysval to a constant.
|
||||
*/
|
||||
bool
|
||||
pan_nir_lower_static_noperspective(nir_shader *shader,
|
||||
uint32_t noperspective_varyings)
|
||||
{
|
||||
return nir_shader_intrinsics_pass(shader, lower_static_noperspective,
|
||||
nir_metadata_control_flow,
|
||||
(void *)&noperspective_varyings);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -927,9 +927,11 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir,
|
|||
if (PAN_ARCH < 9 && stage == MESA_SHADER_VERTEX)
|
||||
NIR_PASS(_, nir, pan_lower_image_index, MAX_VS_ATTRIBS);
|
||||
|
||||
if (noperspective_varyings && stage == MESA_SHADER_VERTEX)
|
||||
NIR_PASS(_, nir, pan_nir_lower_static_noperspective,
|
||||
if (noperspective_varyings && stage == MESA_SHADER_VERTEX) {
|
||||
NIR_PASS(_, nir, nir_inline_sysval,
|
||||
nir_intrinsic_load_noperspective_varyings_pan,
|
||||
*noperspective_varyings);
|
||||
}
|
||||
|
||||
struct panvk_lower_sysvals_context lower_sysvals_ctx = {
|
||||
.shader = shader,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue