summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-08-26 14:46:58 -0600
committerBrian Paul <brianp@vmware.com>2009-08-26 14:46:58 -0600
commita9a6399cd32ffe47b98d5171225fe7143552ca27 (patch)
tree374834d438832363159a575e19000be22b32fabd
parent81a101b5be0b3b98b745af33b2b0a72125e3137c (diff)
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.
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_glsl.c6
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 c68056df6f..7c210abbce 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;