amd: join emit_kill() from radv and radeonsi in ac_nir_to_llvm
authorDaniel Schürmann <daniel@schuermann.dev>
Wed, 4 Mar 2020 16:49:06 +0000 (17:49 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 9 Mar 2020 12:29:32 +0000 (12:29 +0000)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4047>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4047>

src/amd/llvm/ac_nir_to_llvm.c
src/amd/llvm/ac_shader_abi.h
src/amd/vulkan/radv_nir_to_llvm.c
src/gallium/drivers/radeonsi/si_shader_llvm_ps.c

index 81ef47651eb9cd6f1827d5720ed5c04b57c0904d..0ecf56c8e309f5b14052653d78da2022503e826e 100644 (file)
@@ -2970,7 +2970,7 @@ static void emit_discard(struct ac_nir_context *ctx,
                cond = ctx->ac.i1false;
        }
 
-       ctx->abi->emit_kill(ctx->abi, cond);
+       ac_build_kill_if_false(&ctx->ac, cond);
 }
 
 static void emit_demote(struct ac_nir_context *ctx,
index ea977fc0cfa6ebe7e3d29f0c01a1c508ba0ed915..f73465b014f6a3f45e89382cd8d823589f01e0ed 100644 (file)
@@ -80,8 +80,6 @@ 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 49c91aeb04e78dc9914c7f897e053086338dbbdf..5bce7b156c38eede5e28b2d843426d5478782457 100644 (file)
@@ -880,13 +880,6 @@ load_gs_input(struct ac_shader_abi *abi,
        return result;
 }
 
-
-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 uint32_t
 radv_get_sample_pos_offset(uint32_t num_samples)
 {
@@ -4141,7 +4134,6 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm,
                } else if (shaders[i]->info.stage == MESA_SHADER_FRAGMENT) {
                        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 (shaders[i]->info.stage == MESA_SHADER_VERTEX &&
index ea8077dcc2800f2d2c8daef2a7d08fb8d4917da9..c2efcc88e991f366e5a4c74d85bd48d3cccf3a64 100644 (file)
@@ -616,14 +616,6 @@ static void si_llvm_emit_polygon_stipple(struct si_shader_context *ctx,
        ac_build_kill_if_false(&ctx->ac, bit);
 }
 
-static void si_llvm_emit_kill(struct ac_shader_abi *abi, LLVMValueRef visible)
-{
-       struct si_shader_context *ctx = si_shader_context_from_abi(abi);
-       LLVMBuilderRef builder = ctx->ac.builder;
-
-       ac_build_kill_if_false(&ctx->ac, visible);
-}
-
 /**
  * Build the pixel shader prolog function. This handles:
  * - two-side color selection and interpolation
@@ -1046,5 +1038,4 @@ void si_llvm_init_ps_callbacks(struct si_shader_context *ctx)
        ctx->abi.load_sample_position = load_sample_position;
        ctx->abi.load_sample_mask_in = load_sample_mask_in;
        ctx->abi.emit_fbfetch = si_nir_emit_fbfetch;
-       ctx->abi.emit_kill = si_llvm_emit_kill;
 }