Mesa (master): tgsi_scan: add support to count number of output clip distances

Dave Airlie airlied at kemper.freedesktop.org
Wed Jan 11 00:23:28 PST 2012


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Jan  6 12:21:54 2012 +0000

tgsi_scan: add support to count number of output clip distances

Just add support to the scanner to count the number of clip distances.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

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

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 97d74e4..e4e9c03 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -191,6 +191,10 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
                   info->output_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index;
                   info->num_outputs++;
 
+                  if (procType == TGSI_PROCESSOR_VERTEX &&
+                      fulldecl->Semantic.Name == TGSI_SEMANTIC_CLIPDIST) {
+                     info->num_written_clipdistance += util_bitcount(fulldecl->Declaration.UsageMask);
+                  }
                   /* extra info for special outputs */
                   if (procType == TGSI_PROCESSOR_FRAGMENT &&
                       fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 482c106..235e6a3 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -75,6 +75,7 @@ struct tgsi_shader_info
    boolean pixel_center_integer;
    boolean color0_writes_all_cbufs;
 
+   unsigned num_written_clipdistance;
    /**
     * Bitmask indicating which register files are accessed with
     * indirect addressing.  The bits are (1 << TGSI_FILE_x), etc.



More information about the mesa-commit mailing list