From 0ef4c1c04d5c0a9cadd344caff38d443509d496f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 23 Jul 2019 20:34:03 -0400 Subject: [PATCH] radeonsi: don't use lp_build_if for the wrapping if block in merged shaders --- src/gallium/drivers/radeonsi/gfx10_shader_ngg.c | 4 ++-- src/gallium/drivers/radeonsi/si_shader.c | 11 +++++++---- src/gallium/drivers/radeonsi/si_shader_internal.h | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c index f5899511138..27be0661006 100644 --- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c +++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c @@ -581,7 +581,7 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi, } } - lp_build_endif(&ctx->merged_wrap_if_state); + ac_build_endif(&ctx->ac, ctx->merged_wrap_if_label); LLVMValueRef prims_in_wave = si_unpack_param(ctx, ctx->param_merged_wave_info, 8, 8); LLVMValueRef vtx_in_wave = si_unpack_param(ctx, ctx->param_merged_wave_info, 0, 8); @@ -1058,7 +1058,7 @@ void gfx10_ngg_gs_emit_epilogue(struct si_shader_context *ctx) ac_build_endif(&ctx->ac, 5105); } - lp_build_endif(&ctx->merged_wrap_if_state); + ac_build_endif(&ctx->ac, ctx->merged_wrap_if_label); ac_build_s_barrier(&ctx->ac); diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index edac0ca1dd2..886ee092c22 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -3329,11 +3329,11 @@ static void si_llvm_emit_tcs_epilogue(struct ac_shader_abi *abi, if (ctx->screen->info.chip_class >= GFX9) { LLVMBasicBlockRef blocks[2] = { LLVMGetInsertBlock(builder), - ctx->merged_wrap_if_state.entry_block + ctx->merged_wrap_if_entry_block }; LLVMValueRef values[2]; - lp_build_endif(&ctx->merged_wrap_if_state); + ac_build_endif(&ctx->ac, ctx->merged_wrap_if_label); values[0] = rel_patch_id; values[1] = LLVMGetUndef(ctx->i32); @@ -3617,7 +3617,7 @@ static void emit_gs_epilogue(struct si_shader_context *ctx) si_get_gs_wave_id(ctx)); if (ctx->screen->info.chip_class >= GFX9) - lp_build_endif(&ctx->merged_wrap_if_state); + ac_build_endif(&ctx->ac, ctx->merged_wrap_if_label); } static void si_llvm_emit_gs_epilogue(struct ac_shader_abi *abi, @@ -6246,7 +6246,10 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx) LLVMValueRef ena = LLVMBuildICmp(ctx->ac.builder, LLVMIntULT, ac_get_thread_id(&ctx->ac), num_threads, ""); - lp_build_if(&ctx->merged_wrap_if_state, &ctx->gallivm, ena); + + ctx->merged_wrap_if_entry_block = LLVMGetInsertBlock(ctx->ac.builder); + ctx->merged_wrap_if_label = 11500; + ac_build_ifcc(&ctx->ac, ena, ctx->merged_wrap_if_label); if (nested_barrier) { /* Execute a barrier before the second shader in diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h index b4bee5e22e2..ae99bf5d374 100644 --- a/src/gallium/drivers/radeonsi/si_shader_internal.h +++ b/src/gallium/drivers/radeonsi/si_shader_internal.h @@ -112,7 +112,8 @@ struct si_shader_context { LLVMValueRef *imms; unsigned imms_num; - struct lp_build_if_state merged_wrap_if_state; + LLVMBasicBlockRef merged_wrap_if_entry_block; + int merged_wrap_if_label; struct tgsi_array_info *temp_arrays; LLVMValueRef *temp_array_allocas; -- 2.30.2