*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "imports.h"
-#include "macros.h"
-#include "pixel.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "image.h"
#include "s_context.h"
#include "s_texcombine.h"
#if CHAN_TYPE == GL_FLOAT
const GLchan RGBmult = (GLfloat) (1 << RGBshift);
const GLchan Amult = (GLfloat) (1 << Ashift);
- static const GLchan one[4] = { 1.0, 1.0, 1.0, 1.0 };
- static const GLchan zero[4] = { 0.0, 0.0, 0.0, 0.0 };
#else
const GLint half = (CHAN_MAX + 1) / 2;
+#endif
static const GLchan one[4] = { CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX };
static const GLchan zero[4] = { 0, 0, 0, 0 };
-#endif
const GLuint numColorArgs = textureUnit->_CurrentCombine->_NumArgsRGB;
const GLuint numAlphaArgs = textureUnit->_CurrentCombine->_NumArgsA;
GLchan ccolor[3][MAX_WIDTH][4];
for (j = 0; j < numColorArgs; j++) {
const GLenum srcRGB = textureUnit->_CurrentCombine->SourceRGB[j];
-
switch (srcRGB) {
case GL_TEXTURE:
argRGB[j] = (const GLchan (*)[4])
* 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)
*/
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];
/* 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
}
}
}