ac/radeonsi: add emit_kill to the abi
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 7 Mar 2018 22:46:42 +0000 (09:46 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 8 Mar 2018 00:28:37 +0000 (11:28 +1100)
This should fix a regression with Rocket League grass rendering
on the NIR backend.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104717

src/amd/common/ac_nir_to_llvm.c
src/amd/common/ac_shader_abi.h
src/gallium/drivers/radeonsi/si_shader.c

index 29bffefd79e4afb5699bda275eb98325ecf72cc9..c785244dcc4438307b62398f98d004dd81ce7c67 100644 (file)
@@ -3872,6 +3872,12 @@ static void emit_barrier(struct ac_llvm_context *ac, gl_shader_stage stage)
                           ac->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT);
 }
 
+static void radv_emit_kill(struct ac_shader_abi *abi, LLVMValueRef visible)
+{
+       struct radv_shader_context *ctx = radv_shader_context_from_abi(abi);
+       ac_build_kill_if_false(&ctx->ac, visible);
+}
+
 static void emit_discard(struct ac_nir_context *ctx,
                         const nir_intrinsic_instr *instr)
 {
@@ -3886,7 +3892,7 @@ static void emit_discard(struct ac_nir_context *ctx,
                cond = LLVMConstInt(ctx->ac.i1, false, 0);
        }
 
-       ac_build_kill_if_false(&ctx->ac, cond);
+       ctx->abi->emit_kill(ctx->abi, cond);
 }
 
 static LLVMValueRef
@@ -6955,6 +6961,7 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
                        ctx.abi.lookup_interp_param = lookup_interp_param;
                        ctx.abi.load_sample_position = load_sample_position;
                        ctx.abi.load_sample_mask_in = load_sample_mask_in;
+                       ctx.abi.emit_kill = radv_emit_kill;
                }
 
                if (i)
index 09fe32c1363f6d55c85f19d12484e40c0b889350..901e49b1f97e29ce94fefc64f035c7df9ec95874 100644 (file)
@@ -86,6 +86,8 @@ struct ac_shader_abi {
        void (*emit_primitive)(struct ac_shader_abi *abi,
                               unsigned stream);
 
+       void (*emit_kill)(struct ac_shader_abi *abi, LLVMValueRef visible);
+
        LLVMValueRef (*load_inputs)(struct ac_shader_abi *abi,
                                    unsigned location,
                                    unsigned driver_location,
index 343a5d57bf38132d4d53508bdb8837de58a7e213..fa7a19cb3ac67619aece0adae4be52e2ee127cb7 100644 (file)
@@ -6062,6 +6062,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
                ctx->abi.lookup_interp_param = si_nir_lookup_interp_param;
                ctx->abi.load_sample_position = load_sample_position;
                ctx->abi.load_sample_mask_in = load_sample_mask_in;
+               ctx->abi.emit_kill = si_llvm_emit_kill;
                break;
        case PIPE_SHADER_COMPUTE:
                ctx->abi.load_local_group_size = get_block_size;