ac/llvm: vs_rel_patch_id can also be fixed up
It's currently used when LS store output to LDS. The LS/HS bug fix seems does not affect this case. But we'd better treat it as other fixed args. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22045>
This commit is contained in:
@@ -2907,8 +2907,8 @@ static LLVMValueRef visit_load_local_invocation_index(struct ac_nir_context *ctx
|
|||||||
ac_unpack_param(&ctx->ac, ac_get_arg(&ctx->ac, ctx->args->tcs_wave_id), 0, 3),
|
ac_unpack_param(&ctx->ac, ac_get_arg(&ctx->ac, ctx->args->tcs_wave_id), 0, 3),
|
||||||
LLVMConstInt(ctx->ac.i32, ctx->ac.wave_size, 0),
|
LLVMConstInt(ctx->ac.i32, ctx->ac.wave_size, 0),
|
||||||
ac_get_thread_id(&ctx->ac));
|
ac_get_thread_id(&ctx->ac));
|
||||||
} else if (ctx->args->vs_rel_patch_id.used) {
|
} else if (ctx->abi->vs_rel_patch_id) {
|
||||||
return ac_get_arg(&ctx->ac, ctx->args->vs_rel_patch_id);
|
return ctx->abi->vs_rel_patch_id;
|
||||||
} else if (ctx->args->merged_wave_info.used) {
|
} else if (ctx->args->merged_wave_info.used) {
|
||||||
/* Thread ID in threadgroup in merged ESGS. */
|
/* Thread ID in threadgroup in merged ESGS. */
|
||||||
LLVMValueRef wave_id = ac_unpack_param(&ctx->ac, ac_get_arg(&ctx->ac, ctx->args->merged_wave_info), 24, 4);
|
LLVMValueRef wave_id = ac_unpack_param(&ctx->ac, ac_get_arg(&ctx->ac, ctx->args->merged_wave_info), 24, 4);
|
||||||
|
@@ -44,6 +44,7 @@ struct ac_shader_abi {
|
|||||||
|
|
||||||
/* These input registers sometimes need to be fixed up. */
|
/* These input registers sometimes need to be fixed up. */
|
||||||
LLVMValueRef vertex_id;
|
LLVMValueRef vertex_id;
|
||||||
|
LLVMValueRef vs_rel_patch_id;
|
||||||
LLVMValueRef instance_id;
|
LLVMValueRef instance_id;
|
||||||
LLVMValueRef persp_centroid, linear_centroid;
|
LLVMValueRef persp_centroid, linear_centroid;
|
||||||
LLVMValueRef color0, color1;
|
LLVMValueRef color0, color1;
|
||||||
|
@@ -56,8 +56,6 @@ struct radv_shader_context {
|
|||||||
|
|
||||||
LLVMValueRef descriptor_sets[MAX_SETS];
|
LLVMValueRef descriptor_sets[MAX_SETS];
|
||||||
|
|
||||||
LLVMValueRef vs_rel_patch_id;
|
|
||||||
|
|
||||||
LLVMValueRef gs_wave_id;
|
LLVMValueRef gs_wave_id;
|
||||||
|
|
||||||
uint64_t output_mask;
|
uint64_t output_mask;
|
||||||
@@ -626,9 +624,9 @@ ac_nir_fixup_ls_hs_input_vgprs(struct radv_shader_context *ctx)
|
|||||||
ctx->abi.instance_id =
|
ctx->abi.instance_id =
|
||||||
LLVMBuildSelect(ctx->ac.builder, hs_empty, ac_get_arg(&ctx->ac, ctx->args->ac.vertex_id),
|
LLVMBuildSelect(ctx->ac.builder, hs_empty, ac_get_arg(&ctx->ac, ctx->args->ac.vertex_id),
|
||||||
ctx->abi.instance_id, "");
|
ctx->abi.instance_id, "");
|
||||||
ctx->vs_rel_patch_id =
|
ctx->abi.vs_rel_patch_id =
|
||||||
LLVMBuildSelect(ctx->ac.builder, hs_empty, ac_get_arg(&ctx->ac, ctx->args->ac.tcs_rel_ids),
|
LLVMBuildSelect(ctx->ac.builder, hs_empty, ac_get_arg(&ctx->ac, ctx->args->ac.tcs_rel_ids),
|
||||||
ctx->vs_rel_patch_id, "");
|
ctx->abi.vs_rel_patch_id, "");
|
||||||
ctx->abi.vertex_id =
|
ctx->abi.vertex_id =
|
||||||
LLVMBuildSelect(ctx->ac.builder, hs_empty, ac_get_arg(&ctx->ac, ctx->args->ac.tcs_patch_id),
|
LLVMBuildSelect(ctx->ac.builder, hs_empty, ac_get_arg(&ctx->ac, ctx->args->ac.tcs_patch_id),
|
||||||
ctx->abi.vertex_id, "");
|
ctx->abi.vertex_id, "");
|
||||||
@@ -744,7 +742,7 @@ ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm,
|
|||||||
if (args->ac.vertex_id.used)
|
if (args->ac.vertex_id.used)
|
||||||
ctx.abi.vertex_id = ac_get_arg(&ctx.ac, args->ac.vertex_id);
|
ctx.abi.vertex_id = ac_get_arg(&ctx.ac, args->ac.vertex_id);
|
||||||
if (args->ac.vs_rel_patch_id.used)
|
if (args->ac.vs_rel_patch_id.used)
|
||||||
ctx.vs_rel_patch_id = ac_get_arg(&ctx.ac, args->ac.vs_rel_patch_id);
|
ctx.abi.vs_rel_patch_id = ac_get_arg(&ctx.ac, args->ac.vs_rel_patch_id);
|
||||||
if (args->ac.instance_id.used)
|
if (args->ac.instance_id.used)
|
||||||
ctx.abi.instance_id = ac_get_arg(&ctx.ac, args->ac.instance_id);
|
ctx.abi.instance_id = ac_get_arg(&ctx.ac, args->ac.instance_id);
|
||||||
|
|
||||||
|
@@ -244,6 +244,8 @@ void si_llvm_create_main_func(struct si_shader_context *ctx)
|
|||||||
if (ctx->stage == MESA_SHADER_VERTEX) {
|
if (ctx->stage == MESA_SHADER_VERTEX) {
|
||||||
ctx->abi.vertex_id = ac_get_arg(&ctx->ac, ctx->args->ac.vertex_id);
|
ctx->abi.vertex_id = ac_get_arg(&ctx->ac, ctx->args->ac.vertex_id);
|
||||||
ctx->abi.instance_id = ac_get_arg(&ctx->ac, ctx->args->ac.instance_id);
|
ctx->abi.instance_id = ac_get_arg(&ctx->ac, ctx->args->ac.instance_id);
|
||||||
|
if (ctx->args->ac.vs_rel_patch_id.used)
|
||||||
|
ctx->abi.vs_rel_patch_id = ac_get_arg(&ctx->ac, ctx->args->ac.vs_rel_patch_id);
|
||||||
} else if (ctx->stage == MESA_SHADER_FRAGMENT) {
|
} else if (ctx->stage == MESA_SHADER_FRAGMENT) {
|
||||||
ctx->abi.persp_centroid = ac_get_arg(&ctx->ac, ctx->args->ac.persp_centroid);
|
ctx->abi.persp_centroid = ac_get_arg(&ctx->ac, ctx->args->ac.persp_centroid);
|
||||||
ctx->abi.linear_centroid = ac_get_arg(&ctx->ac, ctx->args->ac.linear_centroid);
|
ctx->abi.linear_centroid = ac_get_arg(&ctx->ac, ctx->args->ac.linear_centroid);
|
||||||
|
Reference in New Issue
Block a user