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@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17581>
This commit is contained in:
Timur Kristóf
2022-07-17 21:34:06 +02:00
committed by Marge Bot
parent 22796d91ea
commit dd781c1ccb

View File

@@ -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);