[Mesa-dev] [PATCH 12/16] radeonsi: move param_offset out of shader->input[] and output[]

Marek Olšák maraeo at gmail.com
Sat Oct 4 15:42:15 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

Those are going away.
---
 src/gallium/drivers/radeonsi/si_shader.c     | 10 +++++-----
 src/gallium/drivers/radeonsi/si_shader.h     |  3 +++
 src/gallium/drivers/radeonsi/si_state_draw.c |  4 ++--
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index a4073a7..8fc895a 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -490,9 +490,9 @@ static void declare_input_fs(
 		return;
 	}
 
-	shader->input[input_index].param_offset = shader->nparam++;
+	shader->ps_input_param_offset[input_index] = shader->nparam++;
 	attr_number = lp_build_const_int32(gallivm,
-					   shader->input[input_index].param_offset);
+					   shader->ps_input_param_offset[input_index]);
 
 	switch (decl->Interp.Interpolate) {
 	case TGSI_INTERPOLATE_CONSTANT:
@@ -534,7 +534,7 @@ static void declare_input_fs(
 		LLVMValueRef face, is_face_positive;
 		LLVMValueRef back_attr_number =
 			lp_build_const_int32(gallivm,
-					     shader->input[input_index].param_offset + 1);
+					     shader->ps_input_param_offset[input_index] + 1);
 
 		face = LLVMGetParam(main_fn, SI_PARAM_FRONT_FACE);
 
@@ -1168,7 +1168,7 @@ handle_semantic:
 		case TGSI_SEMANTIC_COLOR:
 		case TGSI_SEMANTIC_BCOLOR:
 			target = V_008DFC_SQ_EXP_PARAM + param_count;
-			shader->output[i].param_offset = param_count;
+			shader->vs_output_param_offset[i] = param_count;
 			param_count++;
 			break;
 		case TGSI_SEMANTIC_CLIPDIST:
@@ -1183,7 +1183,7 @@ handle_semantic:
 		case TGSI_SEMANTIC_FOG:
 		case TGSI_SEMANTIC_GENERIC:
 			target = V_008DFC_SQ_EXP_PARAM + param_count;
-			shader->output[i].param_offset = param_count;
+			shader->vs_output_param_offset[i] = param_count;
 			param_count++;
 			break;
 		default:
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 80a3dec..3c9c2c2 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -174,6 +174,9 @@ struct si_shader {
 	struct si_shader_output	output[40];
 
 	unsigned		nparam;
+	unsigned		vs_output_param_offset[PIPE_MAX_SHADER_OUTPUTS];
+	unsigned		ps_input_param_offset[PIPE_MAX_SHADER_INPUTS];
+
 	bool			uses_instanceid;
 	bool			vs_out_misc_write;
 	bool			vs_out_point_size;
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 5460af9..d9a829d 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -502,7 +502,7 @@ static void si_update_spi_map(struct si_context *sctx)
 		unsigned name = psinfo->input_semantic_name[i];
 		unsigned index = psinfo->input_semantic_index[i];
 		unsigned interpolate = psinfo->input_interpolate[i];
-		unsigned param_offset = ps->input[i].param_offset;
+		unsigned param_offset = ps->ps_input_param_offset[i];
 
 		if (name == TGSI_SEMANTIC_POSITION)
 			/* Read from preloaded VGPRs, not parameters */
@@ -525,7 +525,7 @@ bcolor:
 		for (j = 0; j < vsinfo->num_outputs; j++) {
 			if (name == vsinfo->output_semantic_name[j] &&
 			    index == vsinfo->output_semantic_index[j]) {
-				tmp |= S_028644_OFFSET(vs->output[j].param_offset);
+				tmp |= S_028644_OFFSET(vs->vs_output_param_offset[j]);
 				break;
 			}
 		}
-- 
1.9.1



More information about the mesa-dev mailing list