Module: Mesa Branch: master Commit: 2228835fb55225c68f059f86bdd64f81bcb92c74 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2228835fb55225c68f059f86bdd64f81bcb92c74
Author: Rhys Perry <[email protected]> Date: Thu Sep 17 14:41:27 2020 +0100 radv,aco: fix reading primitive ID in FS after TES Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3530 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6760> --- src/amd/compiler/aco_instruction_selection.cpp | 5 ++++- src/amd/vulkan/radv_nir_to_llvm.c | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 7aafe4a27c7..bfab27bd2ad 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -9851,7 +9851,10 @@ static void create_vs_exports(isel_context *ctx) if (outinfo->export_prim_id && !(ctx->stage & hw_ngg_gs)) { ctx->outputs.mask[VARYING_SLOT_PRIMITIVE_ID] |= 0x1; - ctx->outputs.temps[VARYING_SLOT_PRIMITIVE_ID * 4u] = get_arg(ctx, ctx->args->vs_prim_id); + if (ctx->stage & sw_tes) + ctx->outputs.temps[VARYING_SLOT_PRIMITIVE_ID * 4u] = get_arg(ctx, ctx->args->ac.tes_patch_id); + else + ctx->outputs.temps[VARYING_SLOT_PRIMITIVE_ID * 4u] = get_arg(ctx, ctx->args->vs_prim_id); } if (ctx->options->key.has_multiview_view_index) { diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index db21ad809b7..328a8d2942d 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -2012,8 +2012,12 @@ handle_vs_outputs_post(struct radv_shader_context *ctx, outputs[noutput].slot_name = VARYING_SLOT_PRIMITIVE_ID; outputs[noutput].slot_index = 0; outputs[noutput].usage_mask = 0x1; - outputs[noutput].values[0] = - ac_get_arg(&ctx->ac, ctx->args->vs_prim_id); + if (ctx->stage == MESA_SHADER_TESS_EVAL) + outputs[noutput].values[0] = + ac_get_arg(&ctx->ac, ctx->args->ac.tes_patch_id); + else + outputs[noutput].values[0] = + ac_get_arg(&ctx->ac, ctx->args->vs_prim_id); for (unsigned j = 1; j < 4; j++) outputs[noutput].values[j] = ctx->ac.f32_0; noutput++; _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
