tgsi/ureg: add support for GS input array declarations
authorMarek Olšák <marek.olsak@amd.com>
Sun, 10 May 2015 14:17:35 +0000 (16:17 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 5 Jun 2015 17:44:32 +0000 (19:44 +0200)
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 ad13f64c58622509f2066bb55f7e17ea83d2d240..b1aebfa1cb90bca2dd13ad0d09a9aed51dc3b18c 100644 (file)
@@ -302,11 +302,13 @@ ureg_DECL_vs_input( struct ureg_program *ureg,
 
 struct ureg_src
 ureg_DECL_input(struct ureg_program *ureg,
-                   unsigned semantic_name,
-                   unsigned semantic_index)
+                unsigned semantic_name,
+                unsigned semantic_index,
+                unsigned array_id,
+                unsigned array_size)
 {
    return ureg_DECL_fs_input_cyl_centroid(ureg, semantic_name, semantic_index,
-                                          0, 0, 0, 0, 1);
+                                          0, 0, 0, array_id, array_size);
 }
 
 
@@ -1252,12 +1254,14 @@ ureg_label_insn(struct ureg_program *ureg,
 static void
 emit_decl_semantic(struct ureg_program *ureg,
                    unsigned file,
-                   unsigned index,
+                   unsigned first,
+                   unsigned last,
                    unsigned semantic_name,
                    unsigned semantic_index,
-                   unsigned usage_mask)
+                   unsigned usage_mask,
+                   unsigned array_id)
 {
-   union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3);
+   union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, array_id ? 4 : 3);
 
    out[0].value = 0;
    out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
@@ -1265,14 +1269,20 @@ emit_decl_semantic(struct ureg_program *ureg,
    out[0].decl.File = file;
    out[0].decl.UsageMask = usage_mask;
    out[0].decl.Semantic = 1;
+   out[0].decl.Array = array_id != 0;
 
    out[1].value = 0;
-   out[1].decl_range.First = index;
-   out[1].decl_range.Last = index;
+   out[1].decl_range.First = first;
+   out[1].decl_range.Last = last;
 
    out[2].value = 0;
    out[2].decl_semantic.Name = semantic_name;
    out[2].decl_semantic.Index = semantic_index;
+
+   if (array_id) {
+      out[3].value = 0;
+      out[3].array.ArrayID = array_id;
+   }
 }
 
 
@@ -1485,9 +1495,11 @@ static void emit_decls( struct ureg_program *ureg )
          emit_decl_semantic(ureg,
                             TGSI_FILE_INPUT,
                             ureg->input[i].first,
+                            ureg->input[i].last,
                             ureg->input[i].semantic_name,
                             ureg->input[i].semantic_index,
-                            TGSI_WRITEMASK_XYZW);
+                            TGSI_WRITEMASK_XYZW,
+                            ureg->input[i].array_id);
       }
    }
 
@@ -1495,18 +1507,19 @@ static void emit_decls( struct ureg_program *ureg )
       emit_decl_semantic(ureg,
                          TGSI_FILE_SYSTEM_VALUE,
                          ureg->system_value[i].index,
+                         ureg->system_value[i].index,
                          ureg->system_value[i].semantic_name,
                          ureg->system_value[i].semantic_index,
-                         TGSI_WRITEMASK_XYZW);
+                         TGSI_WRITEMASK_XYZW, 0);
    }
 
    for (i = 0; i < ureg->nr_outputs; i++) {
       emit_decl_semantic(ureg,
                          TGSI_FILE_OUTPUT,
-                         i,
+                         i, i,
                          ureg->output[i].semantic_name,
                          ureg->output[i].semantic_index,
-                         ureg->output[i].usage_mask);
+                         ureg->output[i].usage_mask, 0);
    }
 
    for (i = 0; i < ureg->nr_samplers; i++) {
index 7ad4c93981c27bb8557bf2624d0fae8b1e07971a..e6304697938cfc6db5fc7e7f2c0133169e5829ba 100644 (file)
@@ -211,7 +211,9 @@ ureg_DECL_vs_input( struct ureg_program *,
 struct ureg_src
 ureg_DECL_input(struct ureg_program *,
                 unsigned semantic_name,
-                unsigned semantic_index);
+                unsigned semantic_index,
+                unsigned array_id,
+                unsigned array_size);
 
 struct ureg_src
 ureg_DECL_system_value(struct ureg_program *,
index c1810b692475d2de78c5200dec735b38572debb8..959681207309f4ef244532fd98ed109ba06ce27b 100644 (file)
@@ -5203,7 +5203,7 @@ st_translate_program(
       for (i = 0; i < numInputs; i++) {
          t->inputs[i] = ureg_DECL_input(ureg,
                                         inputSemanticName[i],
-                                        inputSemanticIndex[i]);
+                                        inputSemanticIndex[i], 0, 1);
       }
 
       for (i = 0; i < numOutputs; i++) {
index 8efbc6fd69e6f2dd52348dd521084d0e958f5f8a..896e239ee681b7ab896cd934b5c347d744354b43 100644 (file)
@@ -1097,7 +1097,7 @@ st_translate_mesa_program(
       for (i = 0; i < numInputs; i++) {
          t->inputs[i] = ureg_DECL_input(ureg,
                                         inputSemanticName[i],
-                                        inputSemanticIndex[i]);
+                                        inputSemanticIndex[i], 0, 1);
       }
 
       for (i = 0; i < numOutputs; i++) {