Mesa (master): tgsi: new tgsi_shader_info fields for system values

Brian Paul brianp at kemper.freedesktop.org
Sat Jan 15 17:25:55 UTC 2011


Module: Mesa
Branch: master
Commit: b550d8d76b42ef5ba5e8293dcc24220d5b683369
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b550d8d76b42ef5ba5e8293dcc24220d5b683369

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Dec  8 18:19:47 2010 -0700

tgsi: new tgsi_shader_info fields for system values

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c |   19 ++++++++++++++++++-
 src/gallium/auxiliary/tgsi/tgsi_scan.h |    4 ++++
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 6585da3..83c6ac7 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -143,7 +143,7 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
                info->file_count[file]++;
                info->file_max[file] = MAX2(info->file_max[file], (int)reg);
 
-               if (file == TGSI_FILE_INPUT || file == TGSI_FILE_SYSTEM_VALUE) {
+               if (file == TGSI_FILE_INPUT) {
                   info->input_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name;
                   info->input_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index;
                   info->input_interpolate[reg] = (ubyte)fulldecl->Declaration.Interpolate;
@@ -151,6 +151,23 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
                   info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Declaration.CylindricalWrap;
                   info->num_inputs++;
                }
+               else if (file == TGSI_FILE_SYSTEM_VALUE) {
+                  unsigned index = fulldecl->Range.First;
+                  unsigned semName = fulldecl->Semantic.Name;
+
+                  info->system_value_semantic_name[index] = semName;
+                  info->num_system_values = MAX2(info->num_system_values,
+                                                 index + 1);
+
+                  /*
+                  info->system_value_semantic_name[info->num_system_values++] = 
+                     fulldecl->Semantic.Name;
+                  */
+
+                  if (fulldecl->Semantic.Name == TGSI_SEMANTIC_INSTANCEID) {
+                     info->uses_instanceid = TRUE;
+                  }
+               }
                else if (file == TGSI_FILE_OUTPUT) {
                   info->output_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name;
                   info->output_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 104097f..53ab3d5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -51,6 +51,9 @@ struct tgsi_shader_info
    ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */
    ubyte output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
 
+   ubyte num_system_values;
+   ubyte system_value_semantic_name[PIPE_MAX_SHADER_INPUTS];
+
    uint file_mask[TGSI_FILE_COUNT];  /**< bitmask of declared registers */
    uint file_count[TGSI_FILE_COUNT];  /**< number of declared registers */
    int file_max[TGSI_FILE_COUNT];  /**< highest index of declared registers */
@@ -64,6 +67,7 @@ struct tgsi_shader_info
    boolean writes_stencil; /**< does fragment shader write stencil value? */
    boolean writes_edgeflag; /**< vertex shader outputs edgeflag */
    boolean uses_kill;  /**< KIL or KILP instruction used? */
+   boolean uses_instanceid;
 
    /**
     * Bitmask indicating which register files are accessed with




More information about the mesa-commit mailing list