Mesa (master): st/mesa: additional assertions in dst_register()

Brian Paul brianp at kemper.freedesktop.org
Mon May 10 11:52:05 PDT 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon May 10 12:31:35 2010 -0600

st/mesa: additional assertions in dst_register()

---

 src/mesa/state_tracker/st_mesa_to_tgsi.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 0991e99..bda8267 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -156,6 +156,16 @@ dst_register( struct st_translate *t,
    case PROGRAM_OUTPUT:
       if (index == VERT_RESULT_PSIZ)
          t->prevInstWrotePsiz = GL_TRUE;
+
+      if (t->procType == TGSI_PROCESSOR_VERTEX)
+         assert(index < VERT_RESULT_MAX);
+      else if (t->procType == TGSI_PROCESSOR_FRAGMENT)
+         assert(index < FRAG_RESULT_MAX);
+      else
+         assert(0 && "geom shaders not handled in dst_register() yet");
+
+      assert(t->outputMapping[index] < Elements(t->outputs));
+
       return t->outputs[t->outputMapping[index]];
 
    case PROGRAM_ADDRESS:



More information about the mesa-commit mailing list