[Mesa-dev] [PATCH 21/25] radeonsi: use smaller types for some si_shader members

Marek Olšák maraeo at gmail.com
Mon Feb 15 23:59:32 UTC 2016


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

in order to decrease the shader size for a shader cache.
---
 src/gallium/drivers/radeonsi/si_shader.c | 3 +++
 src/gallium/drivers/radeonsi/si_shader.h | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 2789788..3758009 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1889,6 +1889,7 @@ handle_semantic:
 		case TGSI_SEMANTIC_COLOR:
 		case TGSI_SEMANTIC_BCOLOR:
 			target = V_008DFC_SQ_EXP_PARAM + param_count;
+			assert(i < ARRAY_SIZE(shader->vs_output_param_offset));
 			shader->vs_output_param_offset[i] = param_count;
 			param_count++;
 			break;
@@ -1903,6 +1904,7 @@ handle_semantic:
 		case TGSI_SEMANTIC_TEXCOORD:
 		case TGSI_SEMANTIC_GENERIC:
 			target = V_008DFC_SQ_EXP_PARAM + param_count;
+			assert(i < ARRAY_SIZE(shader->vs_output_param_offset));
 			shader->vs_output_param_offset[i] = param_count;
 			param_count++;
 			break;
@@ -5268,6 +5270,7 @@ static bool si_get_vs_epilog(struct si_screen *sscreen,
 		unsigned offset = shader->nr_param_exports++;
 
 		epilog_key.vs_epilog.prim_id_param_offset = offset;
+		assert(index < ARRAY_SIZE(shader->vs_output_param_offset));
 		shader->vs_output_param_offset[index] = offset;
 	}
 
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index ee81621..a77e54a 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -359,10 +359,10 @@ struct si_shader {
 	ubyte			num_input_vgprs;
 	char			face_vgpr_index;
 
-	unsigned		vs_output_param_offset[PIPE_MAX_SHADER_OUTPUTS];
+	ubyte			vs_output_param_offset[40];
 	bool			uses_instanceid;
-	unsigned		nr_pos_exports;
-	unsigned		nr_param_exports;
+	ubyte			nr_pos_exports;
+	ubyte			nr_param_exports;
 };
 
 struct si_shader_part {
-- 
2.5.0



More information about the mesa-dev mailing list