Mesa (master): tgsi/ureg: Add ureg_DECL_gs_input().

Michał Król michal at kemper.freedesktop.org
Mon Dec 14 08:30:07 PST 2009


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

Author: Michal Krol <michal at vmware.com>
Date:   Mon Dec 14 17:23:22 2009 +0100

tgsi/ureg: Add ureg_DECL_gs_input().

Allows one to declare GS input registers.

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c |   31 +++++++++++++++++++++++++++++--
 src/gallium/auxiliary/tgsi/tgsi_ureg.h |    4 ++++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 3f94384..1e730e5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -90,6 +90,11 @@ struct ureg_program
    unsigned vs_inputs[UREG_MAX_INPUT/32];
 
    struct {
+      unsigned index;
+   } gs_input[UREG_MAX_INPUT];
+   unsigned nr_gs_inputs;
+
+   struct {
       unsigned semantic_name;
       unsigned semantic_index;
    } output[UREG_MAX_OUTPUT];
@@ -278,6 +283,22 @@ ureg_DECL_vs_input( struct ureg_program *ureg,
 }
 
 
+struct ureg_src
+ureg_DECL_gs_input(struct ureg_program *ureg,
+                   unsigned index)
+{
+   if (ureg->nr_gs_inputs < UREG_MAX_INPUT) {
+      ureg->gs_input[ureg->nr_gs_inputs].index = index;
+      ureg->nr_gs_inputs++;
+   } else {
+      set_bad(ureg);
+   }
+
+   /* XXX: Add suport for true 2D input registers. */
+   return ureg_src_register(TGSI_FILE_INPUT, index);
+}
+
+
 struct ureg_dst 
 ureg_DECL_output( struct ureg_program *ureg,
                   unsigned name,
@@ -964,8 +985,7 @@ static void emit_decls( struct ureg_program *ureg )
             emit_decl_range( ureg, TGSI_FILE_INPUT, i, 1 );
          }
       }
-   }
-   else {
+   } else if (ureg->processor == TGSI_PROCESSOR_FRAGMENT) {
       for (i = 0; i < ureg->nr_fs_inputs; i++) {
          emit_decl( ureg, 
                     TGSI_FILE_INPUT, 
@@ -974,6 +994,13 @@ static void emit_decls( struct ureg_program *ureg )
                     ureg->fs_input[i].semantic_index,
                     ureg->fs_input[i].interp );
       }
+   } else {
+      for (i = 0; i < ureg->nr_gs_inputs; i++) {
+         emit_decl_range(ureg, 
+                         TGSI_FILE_INPUT, 
+                         ureg->gs_input[i].index,
+                         1);
+      }
    }
 
    for (i = 0; i < ureg->nr_outputs; i++) {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 94cc70a..7e3e7bc 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -133,6 +133,10 @@ struct ureg_src
 ureg_DECL_vs_input( struct ureg_program *,
                     unsigned index );
 
+struct ureg_src
+ureg_DECL_gs_input(struct ureg_program *,
+                   unsigned index);
+
 struct ureg_dst
 ureg_DECL_output( struct ureg_program *,
                   unsigned semantic_name,



More information about the mesa-commit mailing list