Mesa (master): draw/tgsi: fix geometry shader input/output swizzling

Zack Rusin zack at kemper.freedesktop.org
Fri Dec 25 02:55:46 PST 2009


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

Author: Zack Rusin <zackr at vmware.com>
Date:   Thu Dec 24 08:15:29 2009 -0500

draw/tgsi: fix geometry shader input/output swizzling

---

 src/gallium/auxiliary/draw/draw_gs.c   |    1 +
 src/gallium/auxiliary/tgsi/tgsi_exec.c |   10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 1154228..0a742cb 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -210,6 +210,7 @@ static void draw_fetch_geometry_input(struct draw_geometry_shader *shader,
                const float (*input)[4];
                input = (const float (*)[4])(
                   (const char *)prim_ptr + (k * input_vertex_stride));
+               vidx = k * TGSI_EXEC_MAX_INPUT_ATTRIBS + slot;
                debug_printf("\t%d)(%d) Input vert:\n", vidx, k);
 #if 1
                assert(!util_is_inf_or_nan(input[vs_slot][0]));
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index e2f2878..ba89f2f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -292,6 +292,14 @@ tgsi_exec_machine_bind_shader(
                                    * sizeof(struct tgsi_full_declaration));
             maxDeclarations += 10;
          }
+         if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_OUTPUT) {
+            unsigned reg;
+            for (reg = parse.FullToken.FullDeclaration.Range.First;
+                 reg <= parse.FullToken.FullDeclaration.Range.Last;
+                 ++reg) {
+               ++mach->NumOutputs;
+            }
+         }
          memcpy(declarations + numDeclarations,
                 &parse.FullToken.FullDeclaration,
                 sizeof(declarations[0]));
@@ -1471,7 +1479,7 @@ store_dest(
       dst = &mach->Outputs[offset + index].xyzw[chan_index];
 #if 0
       if (TGSI_PROCESSOR_GEOMETRY == mach->Processor) {
-         fprintf(stderr, "STORING OUT[%d] mask(%d), = (", index, execmask);
+         fprintf(stderr, "STORING OUT[%d] mask(%d), = (", offset + index, execmask);
          for (i = 0; i < QUAD_SIZE; i++)
             if (execmask & (1 << i))
                fprintf(stderr, "%f, ", chan->f[i]);



More information about the mesa-commit mailing list