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

Author: Zack Rusin <[email protected]>
Date:   Sat Apr 20 00:02:00 2013 -0700

tgsi/scan: set correct input limits for geometry shader

TGSI geometry shader input declerations are of the IN[][2] format
and the dimensions of the array have to be deduced from the input
primitive property.

Signed-off-by: Zack Rusin <[email protected]>
Reviewed-by: José Fonseca <[email protected]>

---

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

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 373391d..bd79405 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -36,6 +36,7 @@
 
 #include "util/u_debug.h"
 #include "util/u_math.h"
+#include "util/u_prim.h"
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_util.h"
 #include "tgsi/tgsi_scan.h"
@@ -261,6 +262,22 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
       case TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS:
          info->color0_writes_all_cbufs = info->properties[i].data[0];
          break;
+      case TGSI_PROPERTY_GS_INPUT_PRIM:
+         /* The dimensions of the IN decleration in geometry shader have
+          * to be deduced from the type of the input primitive.
+          */
+         if (procType == TGSI_PROCESSOR_GEOMETRY) {
+            unsigned input_primitive = info->properties[i].data[0];
+            int num_verts = u_vertices_per_prim(input_primitive);
+            unsigned j;
+            info->file_count[TGSI_FILE_INPUT] = num_verts;
+            info->file_max[TGSI_FILE_INPUT] =
+               MAX2(info->file_max[TGSI_FILE_INPUT], num_verts - 1);
+            for (j = 0; j < num_verts; ++j) {
+               info->file_mask[TGSI_FILE_INPUT] |= (1 << j);
+            }
+         }
+         break;
       default:
          ;
       }

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to