Mesa (main): ac/nir/ngg: Create output variable for primitive ID export.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jul 21 22:18:47 UTC 2022
Module: Mesa
Branch: main
Commit: dd781c1ccb2e76837f76e2d49ae4ab8fefcc97c9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dd781c1ccb2e76837f76e2d49ae4ab8fefcc97c9
Author: Timur Kristóf <timur.kristof at gmail.com>
Date: Sun Jul 17 21:34:06 2022 +0200
ac/nir/ngg: Create output variable for primitive ID export.
This makes the RADV/LLVM backend happy and mitigates a crash.
Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Qiang Yu <yuq825 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17581>
---
src/amd/common/ac_nir_lower_ngg.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c
index fdb38279e3b..24b465194fa 100644
--- a/src/amd/common/ac_nir_lower_ngg.c
+++ b/src/amd/common/ac_nir_lower_ngg.c
@@ -1406,6 +1406,14 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
const bool need_prim_id_store_shared =
export_prim_id && shader->info.stage == MESA_SHADER_VERTEX;
+ if (export_prim_id) {
+ nir_variable *prim_id_var = nir_variable_create(shader, nir_var_shader_out, glsl_uint_type(), "ngg_prim_id");
+ prim_id_var->data.location = VARYING_SLOT_PRIMITIVE_ID;
+ prim_id_var->data.driver_location = VARYING_SLOT_PRIMITIVE_ID;
+ prim_id_var->data.interpolation = INTERP_MODE_NONE;
+ shader->info.outputs_written |= VARYING_BIT_PRIMITIVE_ID;
+ }
+
nir_builder builder;
nir_builder *b = &builder; /* This is to avoid the & */
nir_builder_init(b, impl);
More information about the mesa-commit
mailing list