tgsi/ureg: rename and simplify ureg_DECL_gs_input
authorMarek Olšák <marek.olsak@amd.com>
Sun, 10 May 2015 11:10:03 +0000 (13:10 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 5 Jun 2015 17:44:32 +0000 (19:44 +0200)
There is nothing special about it and it's used for tessellation shaders
too.

src/gallium/auxiliary/tgsi/tgsi_ureg.c
src/gallium/auxiliary/tgsi/tgsi_ureg.h
src/mesa/state_tracker/st_glsl_to_tgsi.cpp
src/mesa/state_tracker/st_mesa_to_tgsi.c

index ca2589ac996de6f6808b71b32d074e4b14286ce4..a8f0867cf2fc50540e5d006f1049c3ba0bddb2dc 100644 (file)
@@ -116,8 +116,8 @@ struct ureg_program
       unsigned index;
       unsigned semantic_name;
       unsigned semantic_index;
-   } gs_input[UREG_MAX_INPUT];
-   unsigned nr_gs_inputs;
+   } input[UREG_MAX_INPUT];
+   unsigned nr_inputs;
 
    struct {
       unsigned index;
@@ -308,22 +308,23 @@ ureg_DECL_vs_input( struct ureg_program *ureg,
 
 
 struct ureg_src
-ureg_DECL_gs_input(struct ureg_program *ureg,
-                   unsigned index,
+ureg_DECL_input(struct ureg_program *ureg,
                    unsigned semantic_name,
                    unsigned semantic_index)
 {
-   if (ureg->nr_gs_inputs < UREG_MAX_INPUT) {
-      ureg->gs_input[ureg->nr_gs_inputs].index = index;
-      ureg->gs_input[ureg->nr_gs_inputs].semantic_name = semantic_name;
-      ureg->gs_input[ureg->nr_gs_inputs].semantic_index = semantic_index;
-      ureg->nr_gs_inputs++;
+   int i = 0;
+
+   if (ureg->nr_inputs < UREG_MAX_INPUT) {
+      i = ureg->nr_inputs;
+      ureg->input[i].index = i;
+      ureg->input[i].semantic_name = semantic_name;
+      ureg->input[i].semantic_index = semantic_index;
+      ureg->nr_inputs++;
    } else {
       set_bad(ureg);
    }
 
-   /* XXX: Add suport for true 2D input registers. */
-   return ureg_src_register(TGSI_FILE_INPUT, index);
+   return ureg_src_register(TGSI_FILE_INPUT, i);
 }
 
 
@@ -1498,12 +1499,12 @@ static void emit_decls( struct ureg_program *ureg )
                       ureg->fs_input[i].array_id);
       }
    } else {
-      for (i = 0; i < ureg->nr_gs_inputs; i++) {
+      for (i = 0; i < ureg->nr_inputs; i++) {
          emit_decl_semantic(ureg,
                             TGSI_FILE_INPUT,
-                            ureg->gs_input[i].index,
-                            ureg->gs_input[i].semantic_name,
-                            ureg->gs_input[i].semantic_index,
+                            ureg->input[i].index,
+                            ureg->input[i].semantic_name,
+                            ureg->input[i].semantic_index,
                             TGSI_WRITEMASK_XYZW);
       }
    }
index 37846d5be8d43841d06f80102538137bc16b377a..7ad4c93981c27bb8557bf2624d0fae8b1e07971a 100644 (file)
@@ -209,10 +209,9 @@ ureg_DECL_vs_input( struct ureg_program *,
                     unsigned index );
 
 struct ureg_src
-ureg_DECL_gs_input(struct ureg_program *,
-                   unsigned index,
-                   unsigned semantic_name,
-                   unsigned semantic_index);
+ureg_DECL_input(struct ureg_program *,
+                unsigned semantic_name,
+                unsigned semantic_index);
 
 struct ureg_src
 ureg_DECL_system_value(struct ureg_program *,
index 72b47b7421b0049731bfefb5ec3557d898d5835c..c1810b692475d2de78c5200dec735b38572debb8 100644 (file)
@@ -5201,10 +5201,9 @@ st_translate_program(
    }
    else if (procType == TGSI_PROCESSOR_GEOMETRY) {
       for (i = 0; i < numInputs; i++) {
-         t->inputs[i] = ureg_DECL_gs_input(ureg,
-                                           i,
-                                           inputSemanticName[i],
-                                           inputSemanticIndex[i]);
+         t->inputs[i] = ureg_DECL_input(ureg,
+                                        inputSemanticName[i],
+                                        inputSemanticIndex[i]);
       }
 
       for (i = 0; i < numOutputs; i++) {
index a88d7a87ff4042d5b797c374013a4bfe0ea97932..8efbc6fd69e6f2dd52348dd521084d0e958f5f8a 100644 (file)
@@ -1095,10 +1095,9 @@ st_translate_mesa_program(
    }
    else if (procType == TGSI_PROCESSOR_GEOMETRY) {
       for (i = 0; i < numInputs; i++) {
-         t->inputs[i] = ureg_DECL_gs_input(ureg,
-                                           i,
-                                           inputSemanticName[i],
-                                           inputSemanticIndex[i]);
+         t->inputs[i] = ureg_DECL_input(ureg,
+                                        inputSemanticName[i],
+                                        inputSemanticIndex[i]);
       }
 
       for (i = 0; i < numOutputs; i++) {