aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-08-05 08:19:36 -0600
committerBrian Paul <[email protected]>2013-08-05 10:11:33 -0600
commit3e4b5c6c9c14b80964bb20dc882f59c19d6b6f9d (patch)
tree02cada12a3f1c52d2d6c6085903677409840487e
parent95829e202951b2532d72d20a1f5b4450b11de2c1 (diff)
tgsi: clean up tgsi_scan_shader() function
Replace "fulldecl->Semantic.Name/Index" with semName/semIndex. Simplify if/else logic for TGSI_FILE_OUTPUT code. Remove old comment. Fix indentation. Reviewed-by: Jose Fonseca <[email protected]>
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c83
1 files changed, 42 insertions, 41 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index e7bf6e660e0..3578ccfbbc5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -152,6 +152,8 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
for (reg = fulldecl->Range.First;
reg <= fulldecl->Range.Last;
reg++) {
+ unsigned semName = fulldecl->Semantic.Name;
+ unsigned semIndex = fulldecl->Semantic.Index;
/* only first 32 regs will appear in this bitfield */
info->file_mask[file] |= (1 << reg);
@@ -159,82 +161,81 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
info->file_max[file] = MAX2(info->file_max[file], (int)reg);
if (file == TGSI_FILE_INPUT) {
- info->input_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name;
- info->input_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index;
+ info->input_semantic_name[reg] = (ubyte) semName;
+ info->input_semantic_index[reg] = (ubyte) semIndex;
info->input_interpolate[reg] = (ubyte)fulldecl->Interp.Interpolate;
info->input_centroid[reg] = (ubyte)fulldecl->Interp.Centroid;
info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Interp.CylindricalWrap;
info->num_inputs++;
if (procType == TGSI_PROCESSOR_FRAGMENT) {
- if (fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION)
+ if (semName == TGSI_SEMANTIC_POSITION)
info->reads_position = TRUE;
- else if (fulldecl->Semantic.Name == TGSI_SEMANTIC_PRIMID)
+ else if (semName == TGSI_SEMANTIC_PRIMID)
info->uses_primid = TRUE;
- else if (fulldecl->Semantic.Name == TGSI_SEMANTIC_FACE)
+ else if (semName == TGSI_SEMANTIC_FACE)
info->uses_frontface = TRUE;
}
}
else if (file == TGSI_FILE_SYSTEM_VALUE) {
unsigned index = fulldecl->Range.First;
- unsigned semName = fulldecl->Semantic.Name;
info->system_value_semantic_name[index] = semName;
info->num_system_values = MAX2(info->num_system_values,
index + 1);
- /*
- info->system_value_semantic_name[info->num_system_values++] =
- fulldecl->Semantic.Name;
- */
-
- if (fulldecl->Semantic.Name == TGSI_SEMANTIC_INSTANCEID) {
+ if (semName == TGSI_SEMANTIC_INSTANCEID) {
info->uses_instanceid = TRUE;
}
- else if (fulldecl->Semantic.Name == TGSI_SEMANTIC_VERTEXID) {
+ else if (semName == TGSI_SEMANTIC_VERTEXID) {
info->uses_vertexid = TRUE;
- } else if (fulldecl->Semantic.Name == TGSI_SEMANTIC_PRIMID) {
+ }
+ else if (semName == TGSI_SEMANTIC_PRIMID) {
info->uses_primid = TRUE;
}
}
else if (file == TGSI_FILE_OUTPUT) {
- info->output_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name;
- info->output_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index;
+ info->output_semantic_name[reg] = (ubyte) semName;
+ info->output_semantic_index[reg] = (ubyte) semIndex;
info->num_outputs++;
- if ((procType == TGSI_PROCESSOR_VERTEX || procType == TGSI_PROCESSOR_GEOMETRY) &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_CLIPDIST) {
- info->num_written_clipdistance += util_bitcount(fulldecl->Declaration.UsageMask);
- }
- if ((procType == TGSI_PROCESSOR_VERTEX || procType == TGSI_PROCESSOR_GEOMETRY) &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_CULLDIST) {
- info->num_written_culldistance += util_bitcount(fulldecl->Declaration.UsageMask);
+ if (procType == TGSI_PROCESSOR_VERTEX ||
+ procType == TGSI_PROCESSOR_GEOMETRY) {
+ if (semName == TGSI_SEMANTIC_CLIPDIST) {
+ info->num_written_clipdistance +=
+ util_bitcount(fulldecl->Declaration.UsageMask);
+ }
+ else if (semName == TGSI_SEMANTIC_CULLDIST) {
+ info->num_written_culldistance +=
+ util_bitcount(fulldecl->Declaration.UsageMask);
+ }
}
- /* extra info for special outputs */
- if (procType == TGSI_PROCESSOR_FRAGMENT &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION)
+
+ if (procType == TGSI_PROCESSOR_FRAGMENT) {
+ if (semName == TGSI_SEMANTIC_POSITION) {
info->writes_z = TRUE;
- if (procType == TGSI_PROCESSOR_FRAGMENT &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_STENCIL)
+ }
+ else if (semName == TGSI_SEMANTIC_STENCIL) {
info->writes_stencil = TRUE;
- if (procType == TGSI_PROCESSOR_VERTEX &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_EDGEFLAG) {
- info->writes_edgeflag = TRUE;
+ }
}
- if (procType == TGSI_PROCESSOR_GEOMETRY &&
- fulldecl->Semantic.Name ==
- TGSI_SEMANTIC_VIEWPORT_INDEX) {
- info->writes_viewport_index = TRUE;
+ if (procType == TGSI_PROCESSOR_VERTEX) {
+ if (semName == TGSI_SEMANTIC_EDGEFLAG) {
+ info->writes_edgeflag = TRUE;
+ }
}
- if (procType == TGSI_PROCESSOR_GEOMETRY &&
- fulldecl->Semantic.Name ==
- TGSI_SEMANTIC_LAYER) {
- info->writes_layer = TRUE;
+
+ if (procType == TGSI_PROCESSOR_GEOMETRY) {
+ if (semName == TGSI_SEMANTIC_VIEWPORT_INDEX) {
+ info->writes_viewport_index = TRUE;
+ }
+ else if (semName == TGSI_SEMANTIC_LAYER) {
+ info->writes_layer = TRUE;
+ }
}
}
-
- }
+ }
}
break;