diff options
author | Timothy Arceri <[email protected]> | 2018-01-19 09:09:29 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-01-23 09:18:37 +1100 |
commit | 3bc5fa69f5c8061ba9eaf30972eb21ace6593dc9 (patch) | |
tree | 197dbd4eea67b759cae5413e75faef3e195789ac | |
parent | dd4591b79481ac98967af1f93e9e4b52197e6dc7 (diff) |
ac/radeonsi: add emit primitive to the abi
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 6 | ||||
-rw-r--r-- | src/amd/common/ac_shader_abi.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 76edb8d06a3..1e592db57a8 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -4207,8 +4207,9 @@ visit_emit_vertex(struct ac_shader_abi *abi, unsigned stream, LLVMValueRef *addr } static void -visit_end_primitive(struct nir_to_llvm_context *ctx, unsigned stream) +visit_end_primitive(struct ac_shader_abi *abi, unsigned stream) { + struct nir_to_llvm_context *ctx = nir_to_llvm_context_from_abi(abi); ac_build_sendmsg(&ctx->ac, AC_SENDMSG_GS_OP_CUT | AC_SENDMSG_GS | (stream << 8), ctx->gs_wave_id); } @@ -4457,7 +4458,7 @@ static void visit_intrinsic(struct ac_nir_context *ctx, ctx->abi->emit_vertex(ctx->abi, 0, ctx->outputs); break; case nir_intrinsic_end_primitive: - visit_end_primitive(ctx->nctx, nir_intrinsic_stream_id(instr)); + ctx->abi->emit_primitive(ctx->abi, nir_intrinsic_stream_id(instr)); break; case nir_intrinsic_load_tess_coord: { LLVMTypeRef type = ctx->nctx ? @@ -6819,6 +6820,7 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm, ctx.gs_next_vertex = ac_build_alloca(&ctx.ac, ctx.ac.i32, "gs_next_vertex"); ctx.gs_max_out_vertices = shaders[i]->info.gs.vertices_out; ctx.abi.load_inputs = load_gs_input; + ctx.abi.emit_primitive = visit_end_primitive; } else if (shaders[i]->info.stage == MESA_SHADER_TESS_CTRL) { ctx.tcs_outputs_read = shaders[i]->info.outputs_read; ctx.tcs_patch_outputs_read = shaders[i]->info.patch_outputs_read; diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h index 3e9e7a47861..3aab3bf95b3 100644 --- a/src/amd/common/ac_shader_abi.h +++ b/src/amd/common/ac_shader_abi.h @@ -67,6 +67,9 @@ struct ac_shader_abi { unsigned stream, LLVMValueRef *addrs); + void (*emit_primitive)(struct ac_shader_abi *abi, + unsigned stream); + LLVMValueRef (*load_inputs)(struct ac_shader_abi *abi, unsigned location, unsigned driver_location, diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index f29bd61c9cd..4717366d07b 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6030,6 +6030,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx, bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_gs; ctx->abi.load_inputs = si_nir_load_input_gs; ctx->abi.emit_vertex = si_llvm_emit_vertex; + ctx->abi.emit_primitive = si_llvm_emit_primitive; ctx->abi.emit_outputs = si_llvm_emit_gs_epilogue; bld_base->emit_epilogue = si_tgsi_emit_gs_epilogue; break; |