Mesa (master): tgsi/exec: Correctly reset NumOutputs before parsing the shader

Zack Rusin zack at kemper.freedesktop.org
Mon Mar 11 16:38:09 UTC 2013


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

Author: Zack Rusin <zackr at vmware.com>
Date:   Thu Mar  7 19:11:28 2013 -0800

tgsi/exec: Correctly reset NumOutputs before parsing the shader

Whenever we're binding the shaders we're incrementing NumOutputs,
assuming the parser spots an output decleration, but we were never
reseting the variable. That means that each subsequent bind of
a geometry shader would add its number of output to the number
of output bound by all previously ran shaders and our indexes
would get completely messed up.

Signed-off-by: Zack Rusin <zackr at vmware.com>
Reviewed-by: José Fonseca <jfonseca at vmware.com>

---

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

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index d3bba2c..4488397 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -681,6 +681,7 @@ tgsi_exec_machine_bind_shader(
 
    mach->Processor = parse.FullHeader.Processor.Processor;
    mach->ImmLimit = 0;
+   mach->NumOutputs = 0;
 
    if (mach->Processor == TGSI_PROCESSOR_GEOMETRY &&
        !mach->UsedGeometryShader) {
@@ -1484,12 +1485,15 @@ store_dest(struct tgsi_exec_machine *mach,
          + reg->Register.Index;
       dst = &mach->Outputs[offset + index].xyzw[chan_index];
 #if 0
+      debug_printf("NumOutputs = %d, TEMP_O_C/I = %d, redindex = %d\n",
+                   mach->NumOutputs, mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0],
+                   reg->Register.Index);
       if (TGSI_PROCESSOR_GEOMETRY == mach->Processor) {
-         fprintf(stderr, "STORING OUT[%d] mask(%d), = (", offset + index, execmask);
+         debug_printf("STORING OUT[%d] mask(%d), = (", offset + index, execmask);
          for (i = 0; i < TGSI_QUAD_SIZE; i++)
             if (execmask & (1 << i))
-               fprintf(stderr, "%f, ", chan->f[i]);
-         fprintf(stderr, ")\n");
+               debug_printf("%f, ", chan->f[i]);
+         debug_printf(")\n");
       }
 #endif
       break;




More information about the mesa-commit mailing list