i915: Map sampler indices to texture units correctly for fragment shaders.
authorEric Anholt <eric@anholt.net>
Tue, 20 Apr 2010 19:26:49 +0000 (12:26 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 20 Apr 2010 19:46:23 +0000 (12:46 -0700)
Fixes hang with "gst-launch-0.10 videotestsrc ! video/x-raw-rgb !
glupload !  gleffects effect=heat ! glimagesink" which uses 2 samplers
pointing at GL_TEXTURE1 and GL_TEXTURE2, and piglit
glsl-fs-sampler-numbering.

src/mesa/drivers/dri/i915/i915_fragprog.c

index 906d5855a756e75bef1217e8474bf986818486ed..9f12e2c632ef63cc9eb7213a62c1f4d7084f3a7e 100644 (file)
@@ -255,8 +255,10 @@ translate_tex_src_target(struct i915_fragment_program *p, GLubyte bit)
 #define EMIT_TEX( OP )                                         \
 do {                                                           \
    GLuint dim = translate_tex_src_target( p, inst->TexSrcTarget );     \
+   const struct gl_fragment_program *program = p->ctx->FragmentProgram._Current; \
+   GLuint unit = program->Base.SamplerUnits[inst->TexSrcUnit]; \
    GLuint sampler = i915_emit_decl(p, REG_TYPE_S,              \
-                                 inst->TexSrcUnit, dim);       \
+                                  unit, dim);                  \
    GLuint coord = src_vector( p, &inst->SrcReg[0], program);   \
    /* Texel lookup */                                          \
                                                                \