[Mesa-dev] [PATCH 2/3] tgsi: Fix index printed in tgsi_dump and dst outputs

Marcos Paulo de Souza marcos.souza.org at gmail.com
Sun Aug 16 09:23:17 PDT 2015


From: Marcos Paulo de Souza <marcos.souza.org at gmail.com>

Before this patch, the tgsi_dumps was printing declaration as:
DCL IN[][0][0], GENERIC[0]

and now it is parsed correctly:
DCL IN[][0], GENERIC[0]

In the same way, for tess stages, the output addr now is parsed correctly, doing like src parser from:
LRP OUT[0][3], TEMP[1].xxxx, TEMP[3], TEMP[2]

to:
LRP OUT[ADDR[1].x][3], TEMP[1].xxxx, TEMP[3], TEMP[2]
---
 src/gallium/auxiliary/tgsi/tgsi_text.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 24e2dbd..141a3b1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -684,7 +684,13 @@ parse_register_dcl(
        * input primitive. so we want to declare just
        * the index relevant to the semantics which is in
        * the second bracket */
-      if (ctx->processor == TGSI_PROCESSOR_GEOMETRY && *file == TGSI_FILE_INPUT) {
+
+      /* tessellation has similar constraints to geometry shader */
+      bool is_in = *file == TGSI_FILE_INPUT;
+      bool is_out = *file == TGSI_FILE_OUTPUT;
+      if ((ctx->processor == TGSI_PROCESSOR_GEOMETRY && is_i) ||
+          (ctx->processor == TGSI_PROCESSOR_TESS_EVAL && is_in) ||
+          (ctx->processor == TGSI_PROCESSOR_TESS_CTRL && (is_in || is_out))) {
          brackets[0] = brackets[1];
          *num_brackets = 1;
       } else {
@@ -740,6 +746,14 @@ parse_dst_operand(
       dst->Dimension.Indirect = 0;
       dst->Dimension.Dimension = 0;
       dst->Dimension.Index = bracket[0].index;
+
+      if (bracket[0].ind_file != TGSI_FILE_NULL) {
+         dst->Dimension.Indirect = 1;
+         dst->DimIndirect.File = bracket[0].ind_file;
+         dst->DimIndirect.Index = bracket[0].ind_index;
+         dst->DimIndirect.Swizzle = bracket[0].ind_comp;
+         dst->DimIndirect.ArrayID = bracket[0].ind_array;
+      }
       bracket[0] = bracket[1];
    }
    dst->Register.Index = bracket[0].index;
-- 
2.4.3



More information about the mesa-dev mailing list