aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-09-03 18:12:33 +0200
committerSamuel Pitoiset <[email protected]>2019-09-06 15:52:20 +0200
commit3e8bda66aee72360420b3f64bebf5f6deb36a7d7 (patch)
treeb3f0ae5734fdd8732edf7df5adfc10bd4f35f98e
parent1877e87f1ebe05065b582d7059fb4e76e17c9e67 (diff)
radv: gather primitive ID in the shader info pass
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r--src/amd/vulkan/radv_nir_to_llvm.c3
-rw-r--r--src/amd/vulkan/radv_shader_info.c17
2 files changed, 17 insertions, 3 deletions
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
index 334ee1883b4..e0503908ee3 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -2828,8 +2828,6 @@ handle_vs_outputs_post(struct radv_shader_context *ctx,
/* Export PrimitiveID. */
if (export_prim_id) {
- outinfo->export_prim_id = true;
-
outputs[noutput].slot_name = VARYING_SLOT_PRIMITIVE_ID;
outputs[noutput].slot_index = 0;
outputs[noutput].usage_mask = 0x1;
@@ -3256,7 +3254,6 @@ handle_ngg_outputs_post(struct radv_shader_context *ctx)
radv_export_param(ctx, param_count, values, 0x1);
outinfo->vs_output_param_offset[VARYING_SLOT_PRIMITIVE_ID] = param_count++;
- outinfo->export_prim_id = true;
outinfo->param_exports = param_count;
}
}
diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c
index ce9823f8485..7f2d9752948 100644
--- a/src/amd/vulkan/radv_shader_info.c
+++ b/src/amd/vulkan/radv_shader_info.c
@@ -687,6 +687,23 @@ radv_nir_shader_info_pass(const struct nir_shader *nir,
}
}
+ /* Make sure to export the PrimitiveID if the fragment shader needs it. */
+ if (options->key.vs_common_out.export_prim_id) {
+ switch (nir->info.stage) {
+ case MESA_SHADER_VERTEX:
+ info->vs.outinfo.export_prim_id = true;
+ break;
+ case MESA_SHADER_TESS_EVAL:
+ info->tes.outinfo.export_prim_id = true;
+ break;
+ case MESA_SHADER_GEOMETRY:
+ info->vs.outinfo.export_prim_id = true;
+ break;
+ default:
+ break;
+ }
+ }
+
if (nir->info.stage == MESA_SHADER_FRAGMENT)
info->ps.num_interp = nir->num_inputs;