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

Author: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Date:   Wed Jul 31 09:57:47 2019 +0200

ac: drop now useless lookup_interp_param from ABI

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/amd/common/ac_nir_to_llvm.c          | 36 ++++++++++++++++++++++++++++----
 src/amd/common/ac_shader_abi.h           |  4 ----
 src/amd/vulkan/radv_nir_to_llvm.c        | 31 ---------------------------
 src/gallium/drivers/radeonsi/si_shader.c |  1 -
 4 files changed, 32 insertions(+), 40 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index d4b30e4a330..5acac64665b 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3077,10 +3077,38 @@ static LLVMValueRef load_sample_pos(struct 
ac_nir_context *ctx)
        return ac_build_gather_values(&ctx->ac, values, 2);
 }
 
+static LLVMValueRef lookup_interp_param(struct ac_nir_context *ctx,
+                                       enum glsl_interp_mode interp, unsigned 
location)
+{
+       switch (interp) {
+       case INTERP_MODE_FLAT:
+       default:
+               return NULL;
+       case INTERP_MODE_SMOOTH:
+       case INTERP_MODE_NONE:
+               if (location == INTERP_CENTER)
+                       return ctx->abi->persp_center;
+               else if (location == INTERP_CENTROID)
+                       return ctx->abi->persp_centroid;
+               else if (location == INTERP_SAMPLE)
+                       return ctx->abi->persp_sample;
+               break;
+       case INTERP_MODE_NOPERSPECTIVE:
+               if (location == INTERP_CENTER)
+                       return ctx->abi->linear_center;
+               else if (location == INTERP_CENTROID)
+                       return ctx->abi->linear_centroid;
+               else if (location == INTERP_SAMPLE)
+                       return ctx->abi->linear_sample;
+               break;
+       }
+       return NULL;
+}
+
 static LLVMValueRef barycentric_center(struct ac_nir_context *ctx,
                                       unsigned mode)
 {
-       LLVMValueRef interp_param = ctx->abi->lookup_interp_param(ctx->abi, 
mode, INTERP_CENTER);
+       LLVMValueRef interp_param = lookup_interp_param(ctx, mode, 
INTERP_CENTER);
        return LLVMBuildBitCast(ctx->ac.builder, interp_param, ctx->ac.v2i32, 
"");
 }
 
@@ -3088,7 +3116,7 @@ static LLVMValueRef barycentric_offset(struct 
ac_nir_context *ctx,
                                       unsigned mode,
                                       LLVMValueRef offset)
 {
-       LLVMValueRef interp_param = ctx->abi->lookup_interp_param(ctx->abi, 
mode, INTERP_CENTER);
+       LLVMValueRef interp_param = lookup_interp_param(ctx, mode, 
INTERP_CENTER);
        LLVMValueRef src_c0 = ac_to_float(&ctx->ac, 
LLVMBuildExtractElement(ctx->ac.builder, offset, ctx->ac.i32_0, ""));
        LLVMValueRef src_c1 = ac_to_float(&ctx->ac, 
LLVMBuildExtractElement(ctx->ac.builder, offset, ctx->ac.i32_1, ""));
 
@@ -3130,7 +3158,7 @@ static LLVMValueRef barycentric_offset(struct 
ac_nir_context *ctx,
 static LLVMValueRef barycentric_centroid(struct ac_nir_context *ctx,
                                         unsigned mode)
 {
-       LLVMValueRef interp_param = ctx->abi->lookup_interp_param(ctx->abi, 
mode, INTERP_CENTROID);
+       LLVMValueRef interp_param = lookup_interp_param(ctx, mode, 
INTERP_CENTROID);
        return LLVMBuildBitCast(ctx->ac.builder, interp_param, ctx->ac.v2i32, 
"");
 }
 
@@ -3160,7 +3188,7 @@ static LLVMValueRef barycentric_at_sample(struct 
ac_nir_context *ctx,
 static LLVMValueRef barycentric_sample(struct ac_nir_context *ctx,
                                       unsigned mode)
 {
-       LLVMValueRef interp_param = ctx->abi->lookup_interp_param(ctx->abi, 
mode, INTERP_SAMPLE);
+       LLVMValueRef interp_param = lookup_interp_param(ctx, mode, 
INTERP_SAMPLE);
        return LLVMBuildBitCast(ctx->ac.builder, interp_param, ctx->ac.v2i32, 
"");
 }
 
diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h
index 935355fbffa..61f1b735c49 100644
--- a/src/amd/common/ac_shader_abi.h
+++ b/src/amd/common/ac_shader_abi.h
@@ -196,10 +196,6 @@ struct ac_shader_abi {
                                      unsigned desc_set,
                                      unsigned binding);
 
-       LLVMValueRef (*lookup_interp_param)(struct ac_shader_abi *abi,
-                                           enum glsl_interp_mode interp,
-                                           unsigned location);
-
        LLVMValueRef (*load_sample_position)(struct ac_shader_abi *abi,
                                             LLVMValueRef sample_id);
 
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c 
b/src/amd/vulkan/radv_nir_to_llvm.c
index 94d51b31b81..9378bab1a04 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -1759,36 +1759,6 @@ static void radv_emit_kill(struct ac_shader_abi *abi, 
LLVMValueRef visible)
        ac_build_kill_if_false(&ctx->ac, visible);
 }
 
-static LLVMValueRef lookup_interp_param(struct ac_shader_abi *abi,
-                                       enum glsl_interp_mode interp, unsigned 
location)
-{
-       struct radv_shader_context *ctx = radv_shader_context_from_abi(abi);
-
-       switch (interp) {
-       case INTERP_MODE_FLAT:
-       default:
-               return NULL;
-       case INTERP_MODE_SMOOTH:
-       case INTERP_MODE_NONE:
-               if (location == INTERP_CENTER)
-                       return ctx->abi.persp_center;
-               else if (location == INTERP_CENTROID)
-                       return ctx->abi.persp_centroid;
-               else if (location == INTERP_SAMPLE)
-                       return ctx->abi.persp_sample;
-               break;
-       case INTERP_MODE_NOPERSPECTIVE:
-               if (location == INTERP_CENTER)
-                       return ctx->abi.linear_center;
-               else if (location == INTERP_CENTROID)
-                       return ctx->abi.linear_centroid;
-               else if (location == INTERP_SAMPLE)
-                       return ctx->abi.linear_sample;
-               break;
-       }
-       return NULL;
-}
-
 static uint32_t
 radv_get_sample_pos_offset(uint32_t num_samples)
 {
@@ -4425,7 +4395,6 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct 
ac_llvm_compiler *ac_llvm,
                        ctx.abi.load_base_vertex = radv_load_base_vertex;
                } else if (shaders[i]->info.stage == MESA_SHADER_FRAGMENT) {
                        shader_info->fs.can_discard = 
shaders[i]->info.fs.uses_discard;
-                       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;
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 171c1393aef..cd75c084043 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -6118,7 +6118,6 @@ static bool si_compile_tgsi_main(struct si_shader_context 
*ctx)
                ctx->load_input = declare_input_fs;
                ctx->abi.emit_outputs = si_llvm_return_fs_outputs;
                bld_base->emit_epilogue = si_tgsi_emit_epilogue;
-               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_fbfetch = si_nir_emit_fbfetch;

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

Reply via email to