tgsi/scan: add basic info about tessellation OUT and IN uses
authorMarek Olšák <marek.olsak@amd.com>
Sat, 18 Feb 2017 14:26:42 +0000 (15:26 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 21 Feb 2017 20:27:23 +0000 (21:27 +0100)
not all of them will be used immediately

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/tgsi/tgsi_scan.h

index a9aa36be46c0a8446a146e7ba4e2e268f349014a..7d5496c9603cb13fd51f5c02911280b2621a4647 100644 (file)
@@ -199,6 +199,28 @@ scan_src_operand(struct tgsi_shader_info *info,
       }
    }
 
+   if (info->processor == PIPE_SHADER_TESS_CTRL &&
+       src->Register.File == TGSI_FILE_OUTPUT) {
+      unsigned input;
+
+      if (src->Register.Indirect && src->Indirect.ArrayID)
+         input = info->output_array_first[src->Indirect.ArrayID];
+      else
+         input = src->Register.Index;
+
+      switch (info->output_semantic_name[input]) {
+      case TGSI_SEMANTIC_PATCH:
+         info->reads_perpatch_outputs = true;
+         break;
+      case TGSI_SEMANTIC_TESSINNER:
+      case TGSI_SEMANTIC_TESSOUTER:
+         info->reads_tessfactor_outputs = true;
+         break;
+      default:
+         info->reads_pervertex_outputs = true;
+      }
+   }
+
    /* check for indirect register reads */
    if (src->Register.Indirect) {
       info->indirect_files |= (1 << src->Register.File);
@@ -539,6 +561,10 @@ scan_declaration(struct tgsi_shader_info *info,
          case TGSI_SEMANTIC_SAMPLEMASK:
             info->reads_samplemask = TRUE;
             break;
+         case TGSI_SEMANTIC_TESSINNER:
+         case TGSI_SEMANTIC_TESSOUTER:
+            info->reads_tess_factors = true;
+            break;
          }
          break;
 
index 4add2f7a7e33fe5929c4b8733d49132e00bdcfdc..e3c24e950ed031ff5c6f9052d030d48c576b38d9 100644 (file)
@@ -84,11 +84,19 @@ struct tgsi_shader_info
 
    uint opcode_count[TGSI_OPCODE_LAST];  /**< opcode histogram */
 
+   /**
+    * If a tessellation control shader reads outputs, this describes which ones.
+    */
+   boolean reads_pervertex_outputs;
+   boolean reads_perpatch_outputs;
+   boolean reads_tessfactor_outputs;
+
    ubyte colors_read; /**< which color components are read by the FS */
    ubyte colors_written;
    boolean reads_position; /**< does fragment shader read position? */
    boolean reads_z; /**< does fragment shader read depth? */
    boolean reads_samplemask; /**< does fragment shader read sample mask? */
+   boolean reads_tess_factors; /**< If TES reads TESSINNER or TESSOUTER */
    boolean writes_z;  /**< does fragment shader write Z value? */
    boolean writes_stencil; /**< does fragment shader write stencil value? */
    boolean writes_samplemask; /**< does fragment shader write sample mask? */