From: Timothy Arceri Date: Thu, 9 Nov 2017 02:34:37 +0000 (+1100) Subject: radeonsi: add nir support for gs epilogue X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e51ecbe980b56a312b43afd668b3990c8799a348;p=mesa.git radeonsi: add nir support for gs epilogue v2: add emit_gs_epilogue() helper function to reduce duplication. Reviewed-by: Nicolai Hähnle Reviewed-by: Marek Olšák --- diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index aa9af1541de..e8b4ec7b986 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -3247,10 +3247,8 @@ static LLVMValueRef si_get_gs_wave_id(struct si_shader_context *ctx) return LLVMGetParam(ctx->main_fn, ctx->param_gs_wave_id); } -static void si_llvm_emit_gs_epilogue(struct lp_build_tgsi_context *bld_base) +static void emit_gs_epilogue(struct si_shader_context *ctx) { - struct si_shader_context *ctx = si_shader_context(bld_base); - ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_NOP | AC_SENDMSG_GS_DONE, si_get_gs_wave_id(ctx)); @@ -3258,6 +3256,24 @@ static void si_llvm_emit_gs_epilogue(struct lp_build_tgsi_context *bld_base) lp_build_endif(&ctx->merged_wrap_if_state); } +static void si_llvm_emit_gs_epilogue(struct ac_shader_abi *abi, + unsigned max_outputs, + LLVMValueRef *addrs) +{ + struct si_shader_context *ctx = si_shader_context_from_abi(abi); + struct tgsi_shader_info UNUSED *info = &ctx->shader->selector->info; + + assert(info->num_outputs <= max_outputs); + + emit_gs_epilogue(ctx); +} + +static void si_tgsi_emit_gs_epilogue(struct lp_build_tgsi_context *bld_base) +{ + struct si_shader_context *ctx = si_shader_context(bld_base); + emit_gs_epilogue(ctx); +} + static void si_llvm_emit_vs_epilogue(struct ac_shader_abi *abi, unsigned max_outputs, LLVMValueRef *addrs) @@ -5758,7 +5774,8 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx, case PIPE_SHADER_GEOMETRY: bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_gs; ctx->abi.emit_vertex = si_llvm_emit_vertex; - bld_base->emit_epilogue = si_llvm_emit_gs_epilogue; + ctx->abi.emit_outputs = si_llvm_emit_gs_epilogue; + bld_base->emit_epilogue = si_tgsi_emit_gs_epilogue; break; case PIPE_SHADER_FRAGMENT: ctx->load_input = declare_input_fs;