Mesa (master): nvc0: catch too high GENERIC indices to prevent GRAPH traps

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Tue Jan 8 15:14:36 UTC 2013


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

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Mon Jan  7 15:46:31 2013 +0100

nvc0: catch too high GENERIC indices to prevent GRAPH traps

---

 src/gallium/drivers/nvc0/nvc0_program.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nvc0/nvc0_program.c b/src/gallium/drivers/nvc0/nvc0_program.c
index 8bcb206..39393a1 100644
--- a/src/gallium/drivers/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nvc0/nvc0_program.c
@@ -43,8 +43,14 @@ nvc0_mesa_varying_hack(struct nv50_ir_varying *var)
       for (c = 0; c < 4; ++c)
          var->slot[c] = (0x2e0 + c * 0x4) / 4;
    else
+   if (var->si <= 39)
       for (c = 0; c < 4; ++c) /* move down user varyings (first has index 8) */
          var->slot[c] -= 0x80 / 4;
+   else {
+      NOUVEAU_ERR("too many varyings / invalid location: %u !\n", var->si);
+      for (c = 0; c < 4; ++c)
+         var->slot[c] = (0x270 + c * 0x4) / 4; /* catch invalid indices */
+   }
 }
 
 static uint32_t




More information about the mesa-commit mailing list