mesa/st: don't calculate unused input_flags data
[mesa.git] / src / mesa / state_tracker / st_program.c
index a9be80ce8f31be68bae8b197ad40e3397d5c4439..fd1b213eb81d8cfd9c3bffdf51e438b9efb74701 100644 (file)
@@ -69,19 +69,15 @@ st_translate_vertex_program(struct st_context *st,
    GLuint attr, i;
    GLuint num_generic = 0;
 
-   ubyte vs_input_semantic_name[PIPE_MAX_SHADER_INPUTS];
-   ubyte vs_input_semantic_index[PIPE_MAX_SHADER_INPUTS];
    uint vs_num_inputs = 0;
 
    ubyte vs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
    ubyte vs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
    uint vs_num_outputs = 0;
 
-   GLbitfield input_flags[MAX_PROGRAM_INPUTS];
    GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
 
 //   memset(&vs, 0, sizeof(vs));
-   memset(input_flags, 0, sizeof(input_flags));
    memset(output_flags, 0, sizeof(output_flags));
 
    if (stvp->Base.IsPositionInvariant)
@@ -93,79 +89,10 @@ st_translate_vertex_program(struct st_context *st,
     */
    for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
       if (stvp->Base.Base.InputsRead & (1 << attr)) {
-         const GLuint slot = vs_num_inputs;
+         stvp->input_to_index[attr] = vs_num_inputs;
+         stvp->index_to_input[vs_num_inputs] = attr;
 
          vs_num_inputs++;
-
-         stvp->input_to_index[attr] = slot;
-         stvp->index_to_input[slot] = attr;
-
-         switch (attr) {
-         case VERT_ATTRIB_POS:
-            vs_input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
-            vs_input_semantic_index[slot] = 0;
-            break;
-         case VERT_ATTRIB_WEIGHT:
-            /* fall-through */
-         case VERT_ATTRIB_NORMAL:
-            /* just label as a generic */
-            vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
-            vs_input_semantic_index[slot] = 0;
-            break;
-         case VERT_ATTRIB_COLOR0:
-            vs_input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
-            vs_input_semantic_index[slot] = 0;
-            break;
-         case VERT_ATTRIB_COLOR1:
-            vs_input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
-            vs_input_semantic_index[slot] = 1;
-            break;
-         case VERT_ATTRIB_FOG:
-            vs_input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
-            vs_input_semantic_index[slot] = 0;
-            break;
-         case VERT_ATTRIB_POINT_SIZE:
-            vs_input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
-            vs_input_semantic_index[slot] = 0;
-            break;
-         case VERT_ATTRIB_TEX0:
-         case VERT_ATTRIB_TEX1:
-         case VERT_ATTRIB_TEX2:
-         case VERT_ATTRIB_TEX3:
-         case VERT_ATTRIB_TEX4:
-         case VERT_ATTRIB_TEX5:
-         case VERT_ATTRIB_TEX6:
-         case VERT_ATTRIB_TEX7:
-            assert(slot < Elements(vs_input_semantic_name));
-            vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
-            vs_input_semantic_index[slot] = num_generic++;
-            break;
-         case VERT_ATTRIB_GENERIC0:
-         case VERT_ATTRIB_GENERIC1:
-         case VERT_ATTRIB_GENERIC2:
-         case VERT_ATTRIB_GENERIC3:
-         case VERT_ATTRIB_GENERIC4:
-         case VERT_ATTRIB_GENERIC5:
-         case VERT_ATTRIB_GENERIC6:
-         case VERT_ATTRIB_GENERIC7:
-         case VERT_ATTRIB_GENERIC8:
-         case VERT_ATTRIB_GENERIC9:
-         case VERT_ATTRIB_GENERIC10:
-         case VERT_ATTRIB_GENERIC11:
-         case VERT_ATTRIB_GENERIC12:
-         case VERT_ATTRIB_GENERIC13:
-         case VERT_ATTRIB_GENERIC14:
-         case VERT_ATTRIB_GENERIC15:
-            assert(attr < VERT_ATTRIB_MAX);
-            assert(slot < Elements(vs_input_semantic_name));
-            vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
-            vs_input_semantic_index[slot] = num_generic++;
-            break;
-         default:
-            assert(0);
-         }
-
-         input_flags[slot] = stvp->Base.Base.InputFlags[attr];
       }
    }
 
@@ -330,10 +257,9 @@ st_translate_vertex_program(struct st_context *st,
                                 /* inputs */
                                 vs_num_inputs,
                                 stvp->input_to_index,
-                                vs_input_semantic_name,
-                                vs_input_semantic_index,
+                                NULL, /* input semantic name */
+                                NULL, /* input semantic index */
                                 NULL,
-                                input_flags,
                                 /* outputs */
                                 vs_num_outputs,
                                 outputMapping,
@@ -383,11 +309,9 @@ st_translate_fragment_program(struct st_context *st,
    ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
    uint fs_num_outputs = 0;
 
-   GLbitfield input_flags[MAX_PROGRAM_INPUTS];
    GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
 
 //   memset(&fs, 0, sizeof(fs));
-   memset(input_flags, 0, sizeof(input_flags));
    memset(output_flags, 0, sizeof(output_flags));
 
    /* which vertex output goes to the first fragment input: */
@@ -459,8 +383,6 @@ st_translate_fragment_program(struct st_context *st,
             stfp->input_semantic_index[slot] = num_generic++;
             interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
          }
-
-         input_flags[slot] = stfp->Base.Base.InputFlags[attr];
       }
    }
 
@@ -518,7 +440,6 @@ st_translate_fragment_program(struct st_context *st,
                                 stfp->input_semantic_name,
                                 stfp->input_semantic_index,
                                 interpMode,
-                                input_flags,
                                 /* outputs */
                                 fs_num_outputs,
                                 outputMapping,