Mesa (master): i965: fix incorrect tex unit in emit_tex() and emit_txb()

Brian Paul brianp at kemper.freedesktop.org
Wed Aug 26 20:49:44 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Aug 26 14:46:58 2009 -0600

i965: fix incorrect tex unit in emit_tex() and emit_txb()

The instructions we're translating already went through the brw_wm_pass_fp()
function which does the sampler->texture unit mapping.  We were applying
the sample->unit mapping a second time in the GLSL texture emitters.
Often, this made no difference but other times it could lead to accessing
an invalid texture and could cause a GPU lockup.

---

 src/mesa/drivers/dri/i965/brw_wm_glsl.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index c68056d..7c210ab 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -2623,7 +2623,8 @@ static void emit_txb(struct brw_wm_compile *c,
 {
     struct brw_compile *p = &c->func;
     struct brw_reg dst[4], src[4], payload_reg;
-    GLuint unit = c->fp->program.Base.SamplerUnits[inst->TexSrcUnit];
+    /* Note: TexSrcUnit was already looked up through SamplerTextures[] */
+    const GLuint unit = inst->TexSrcUnit;
     GLuint i;
     GLuint msg_type;
 
@@ -2689,7 +2690,8 @@ static void emit_tex(struct brw_wm_compile *c,
 {
     struct brw_compile *p = &c->func;
     struct brw_reg dst[4], src[4], payload_reg;
-    GLuint unit = c->fp->program.Base.SamplerUnits[inst->TexSrcUnit];
+    /* Note: TexSrcUnit was already looked up through SamplerTextures[] */
+    const GLuint unit = inst->TexSrcUnit;
     GLuint msg_len;
     GLuint i, nr;
     GLuint emit;




More information about the mesa-commit mailing list