fix GL_DOT3_RGBA texture combiner mode in generated fragment programs (bug #11030)
[mesa.git] / src / mesa / swrast / s_texcombine.c
index ac26c9cebb21d1327a298e3b2141754c92633d44..4ac7222daa585a0fd034cf149101fde8728cd370 100644 (file)
@@ -1073,14 +1073,13 @@ texture_apply( const GLcontext *ctx,
  * Apply texture mapping to a span of fragments.
  */
 void
-_swrast_texture_span( GLcontext *ctx, struct sw_span *span )
+_swrast_texture_span( GLcontext *ctx, SWspan *span )
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLchan primary_rgba[MAX_WIDTH][4];
    GLuint unit;
 
    ASSERT(span->end < MAX_WIDTH);
-   ASSERT(span->arrayMask & SPAN_TEXTURE);
 
    /*
     * Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR)
@@ -1094,6 +1093,9 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
     */
    for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
       if (ctx->Texture.Unit[unit]._ReallyEnabled) {
+         const GLfloat (*texcoords)[4]
+            = (const GLfloat (*)[4])
+            span->array->attribs[FRAG_ATTRIB_TEX0 + unit];
          const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
          const struct gl_texture_object *curObj = texUnit->_Current;
          GLfloat *lambda = span->array->lambda[unit];
@@ -1127,12 +1129,17 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
 
          /* Sample the texture (span->end = number of fragments) */
          swrast->TextureSample[unit]( ctx, texUnit->_Current, span->end,
-                         (const GLfloat (*)[4]) span->array->texcoords[unit],
-                         lambda, texels );
+                                      texcoords, lambda, texels );
 
          /* GL_SGI_texture_color_table */
          if (texUnit->ColorTableEnabled) {
-            _mesa_lookup_rgba_chan(&texUnit->ColorTable, span->end, texels);
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+            _mesa_lookup_rgba_ubyte(&texUnit->ColorTable, span->end, texels);
+#elif CHAN_TYPE == GL_UNSIGNED_SHORT
+            _mesa_lookup_rgba_ubyte(&texUnit->ColorTable, span->end, texels);
+#else
+            _mesa_lookup_rgba_float(&texUnit->ColorTable, span->end, texels);
+#endif
          }
       }
    }