[Mesa-dev] [RFC PATCH 8/9] ac/nir: rework handling of the interpolation parameters

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Mar 8 14:08:10 UTC 2018


Using the input_interp_{mode,loc} arrays which are filled
in ac_shader_info.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/common/ac_nir_to_llvm.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index b9c5f9840b..644c85e2eb 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -5530,22 +5530,8 @@ handle_fs_input_decl(struct radv_shader_context *ctx,
 		     struct nir_variable *variable)
 {
 	int idx = variable->data.location;
-	unsigned attrib_count = glsl_count_attribute_slots(variable->type, false);
-	LLVMValueRef interp;
 
 	variable->data.driver_location = idx * 4;
-
-	if (glsl_get_base_type(glsl_without_array(variable->type)) == GLSL_TYPE_FLOAT) {
-		unsigned interp_type =
-			ctx->shader_info->info.ps.input_interp_loc[idx];
-
-		interp = lookup_interp_param(&ctx->abi, variable->data.interpolation, interp_type);
-	} else
-		interp = NULL;
-
-	for (unsigned i = 0; i < attrib_count; ++i)
-		ctx->inputs[radeon_llvm_reg_index_soa(idx + i, 0)] = interp;
-
 }
 
 static void
@@ -5574,6 +5560,8 @@ static void
 handle_fs_inputs(struct radv_shader_context *ctx,
                  struct nir_shader *nir)
 {
+	struct ac_shader_info *info = &ctx->shader_info->info;
+
 	prepare_interp_optimize(ctx, nir);
 
 	nir_foreach_variable(variable, &nir->inputs)
@@ -5590,7 +5578,12 @@ handle_fs_inputs(struct radv_shader_context *ctx,
 
 		if (i >= VARYING_SLOT_VAR0 || i == VARYING_SLOT_PNTC ||
 		    i == VARYING_SLOT_PRIMITIVE_ID || i == VARYING_SLOT_LAYER) {
-			interp_param = *inputs;
+			unsigned interp_mode = info->ps.input_interp_mode[i];
+			unsigned interp_loc = info->ps.input_interp_loc[i];
+
+			interp_param = lookup_interp_param(&ctx->abi, interp_mode,
+							   interp_loc);
+
 			interp_fs_input(ctx, index, interp_param, ctx->abi.prim_mask,
 					inputs);
 
-- 
2.16.2



More information about the mesa-dev mailing list