Mesa (arb_geometry_shader4): gs: semi work (at least don't crash)

Zack Rusin zack at kemper.freedesktop.org
Tue Jul 14 15:42:03 UTC 2009


Module: Mesa
Branch: arb_geometry_shader4
Commit: 718b7ae756d2084036d563ad216df7236de4d01d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=718b7ae756d2084036d563ad216df7236de4d01d

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Jul 14 11:45:51 2009 -0400

gs: semi work (at least don't crash)

the primitive assembly is busted though

---

 src/gallium/auxiliary/draw/draw_gs.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 7ee5978..9132ded 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -151,20 +151,19 @@ void draw_geometry_shader_run(struct draw_geometry_shader *shader,
    struct tgsi_exec_machine *machine = shader->machine;
    unsigned int i, j, k;
    unsigned slot;
-   int num_vertices = num_vertices_for_prim(shader->state.input_type);
+   unsigned num_vertices = num_vertices_for_prim(shader->state.input_type);
+   unsigned num_primitives = count/num_vertices;
 
    machine->Consts = constants;
 
-   for (i = 0; i < count; i += MAX_TGSI_PRIMITIVES) {
-      unsigned int max_primitives = MIN2(MAX_TGSI_PRIMITIVES, count - i);
+   for (i = 0; i < num_primitives; i += MAX_TGSI_PRIMITIVES) {
+      unsigned int max_primitives = MIN2(MAX_TGSI_PRIMITIVES, num_primitives - i);
 
-      /* Swizzle inputs.
-       */
       for (k = 0; k < max_primitives; ++k) {
          for (j = 0; j < num_vertices; j++) {
             int idx = (k * num_vertices + j) * shader->info.num_inputs;
-#if 0
-            debug_printf("%d) Input vert:\n", i + j);
+#if 1
+            debug_printf("%d) Prim, %d) Input vert:\n", i, idx);
             for (slot = 0; slot < shader->info.num_inputs; slot++) {
                debug_printf("\t%d: %f %f %f %f\n", slot,
                             input[idx + slot][0],




More information about the mesa-commit mailing list