Module: Mesa
Branch: master
Commit: 50cc97d98a5365b65988b2e6a827d744404f93ab
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50cc97d98a5365b65988b2e6a827d744404f93ab

Author: Timothy Arceri <tarc...@itsqueeze.com>
Date:   Thu Mar  8 09:37:10 2018 +1100

radeonsi: add si_llvm_emit_kill() helper

Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/drivers/radeonsi/si_shader_internal.h |  2 ++
 src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 31 ++++++++++++++---------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h 
b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 8decd062c3..1730a1fef1 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -258,6 +258,8 @@ LLVMValueRef si_llvm_emit_fetch(struct 
lp_build_tgsi_context *bld_base,
                                enum tgsi_opcode_type type,
                                unsigned swizzle);
 
+void si_llvm_emit_kill(struct ac_shader_abi *abi, LLVMValueRef visible);
+
 LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi,
                                   LLVMTypeRef type,
                                   LLVMValueRef vertex_index,
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
index 201e4988fa..854f7ec8a6 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
@@ -53,20 +53,10 @@ static void kill_if_fetch_args(struct lp_build_tgsi_context 
*bld_base,
        emit_data->args[0] = conds[0];
 }
 
-static void kil_emit(const struct lp_build_tgsi_action *action,
-                    struct lp_build_tgsi_context *bld_base,
-                    struct lp_build_emit_data *emit_data)
+void si_llvm_emit_kill(struct ac_shader_abi *abi, LLVMValueRef visible)
 {
-       struct si_shader_context *ctx = si_shader_context(bld_base);
+       struct si_shader_context *ctx = si_shader_context_from_abi(abi);
        LLVMBuilderRef builder = ctx->ac.builder;
-       LLVMValueRef visible;
-
-       if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL_IF) {
-               visible = emit_data->args[0];
-       } else {
-               assert(emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL);
-               visible = LLVMConstInt(ctx->i1, false, 0);
-       }
 
        if (ctx->shader->selector->force_correct_derivs_after_kill) {
                /* LLVM 6.0 can kill immediately while maintaining WQM. */
@@ -84,6 +74,23 @@ static void kil_emit(const struct lp_build_tgsi_action 
*action,
        ac_build_kill_if_false(&ctx->ac, visible);
 }
 
+static void kil_emit(const struct lp_build_tgsi_action *action,
+                    struct lp_build_tgsi_context *bld_base,
+                    struct lp_build_emit_data *emit_data)
+{
+       struct si_shader_context *ctx = si_shader_context(bld_base);
+       LLVMValueRef visible;
+
+       if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL_IF) {
+               visible = emit_data->args[0];
+       } else {
+               assert(emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL);
+               visible = LLVMConstInt(ctx->i1, false, 0);
+       }
+
+       si_llvm_emit_kill(&ctx->abi, visible);
+}
+
 static void emit_icmp(const struct lp_build_tgsi_action *action,
                      struct lp_build_tgsi_context *bld_base,
                      struct lp_build_emit_data *emit_data)

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to