From 4495f85b08b4f2d7d1311392055703eb7d596036 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 3 Feb 2023 09:41:30 -0500 Subject: [PATCH] asahi: Lower clip distances late This pass works either early or late, so run it late. It creates some nir_variables as a side effect, which is weird, but it doesn't matter because the AGX backend doesn't look at variables and the metadata and lowered I/O intrinsics are all correct. This is the last step to moving I/O lowering (and hence shader preprocessing) to CSO create time. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 9e1f2f06d54..289d795f812 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -1370,14 +1370,6 @@ agx_compile_variant(struct agx_device *dev, struct agx_uncompiled_shader *so, nir_shader *nir = nir_shader_clone(NULL, so->nir); - if (nir->info.stage == MESA_SHADER_FRAGMENT) { - struct asahi_fs_shader_key *key = &key_->fs; - - if (key->clip_plane_enable) { - NIR_PASS_V(nir, nir_lower_clip_fs, key->clip_plane_enable, false); - } - } - agx_preprocess_nir(nir); if (nir->info.stage == MESA_SHADER_VERTEX) { @@ -1412,6 +1404,10 @@ agx_compile_variant(struct agx_device *dev, struct agx_uncompiled_shader *so, key->sprite_coord_enable, false /* point coord is sysval */); } + + if (key->clip_plane_enable) { + NIR_PASS_V(nir, nir_lower_clip_fs, key->clip_plane_enable, false); + } } struct agx_shader_key base_key = {0};