pan: Move point size and viewport lowering to postprocess
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Panvk calls pan_preprocess_nir() from its preprocess hook that it hands
off to the Vulkan pipeline code.  That hook gets called before we have
the opportunity to lower geometry shaders.  This means that we get our
viewports lowered for the VS and then the geometry shader is trying to
work on lowered viewports, which is wrong.  Instead, we want to lower
later and only apply the viewport transform in the shader that runs as
the hardware VS.

Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38265>
This commit is contained in:
Faith Ekstrand 2025-11-05 12:07:59 -05:00 committed by Marge Bot
parent 6c5f981ba8
commit 69d7fcd613
2 changed files with 6 additions and 7 deletions

View file

@ -5946,9 +5946,6 @@ bifrost_preprocess_nir(nir_shader *nir, unsigned gpu_id)
if (pan_arch(gpu_id) <= 7)
NIR_PASS(_, nir, pan_nir_lower_vertex_id);
NIR_PASS(_, nir, nir_lower_viewport_transform);
NIR_PASS(_, nir, nir_lower_point_size, 1.0, 0.0);
nir_variable *psiz = nir_find_variable_with_location(
nir, nir_var_shader_out, VARYING_SLOT_PSIZ);
if (psiz != NULL)
@ -6011,6 +6008,8 @@ bifrost_postprocess_nir(nir_shader *nir, unsigned gpu_id)
NIR_PASS(_, nir, bifrost_nir_lower_load_output);
} else if (nir->info.stage == MESA_SHADER_VERTEX) {
NIR_PASS(_, nir, nir_lower_viewport_transform);
NIR_PASS(_, nir, nir_lower_point_size, 1.0, 0.0);
NIR_PASS(_, nir, pan_nir_lower_noperspective_vs);
if (pan_arch(gpu_id) >= 9) {

View file

@ -377,11 +377,8 @@ midgard_preprocess_nir(nir_shader *nir, UNUSED unsigned gpu_id)
*/
NIR_PASS(_, nir, nir_lower_vars_to_ssa);
if (nir->info.stage == MESA_SHADER_VERTEX) {
if (nir->info.stage == MESA_SHADER_VERTEX)
NIR_PASS(_, nir, pan_nir_lower_vertex_id);
NIR_PASS(_, nir, nir_lower_viewport_transform);
NIR_PASS(_, nir, nir_lower_point_size, 1.0, 0.0);
}
NIR_PASS(_, nir, nir_lower_var_copies);
NIR_PASS(_, nir, nir_lower_vars_to_ssa);
@ -398,6 +395,9 @@ midgard_postprocess_nir(nir_shader *nir, UNUSED unsigned gpu_id)
midgard_lower_texture_nir(nir, gpu_id);
if (nir->info.stage == MESA_SHADER_VERTEX) {
NIR_PASS(_, nir, nir_lower_viewport_transform);
NIR_PASS(_, nir, nir_lower_point_size, 1.0, 0.0);
/* nir_lower[_explicit]_io is lazy and emits mul+add chains even
* for offsets it could figure out are constant. Do some
* constant folding before pan_nir_lower_store_component below.