/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.3
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
/*
- * Render a flat-shaded color index triangle.
+ * Render a smooth or flat-shaded color index triangle.
*/
-#define NAME flat_ci_triangle
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define SETUP_CODE \
- span.interpMask |= SPAN_INDEX; \
- span.index = FloatToFixed(v2->index);\
- span.indexStep = 0;
-#define RENDER_SPAN( span ) _swrast_write_index_span(ctx, &span);
-#include "s_tritemp.h"
-
-
-
-/*
- * Render a smooth-shaded color index triangle.
- */
-#define NAME smooth_ci_triangle
+#define NAME ci_triangle
#define INTERP_Z 1
#define INTERP_FOG 1
#define INTERP_INDEX 1
* Render an RGB, GL_DECAL, textured triangle.
* Interpolate S,T only w/out mipmapping or perspective correction.
*
- * No fog.
+ * No fog. No depth testing.
*/
#define NAME simple_textured_triangle
#define INTERP_INT_TEX 1
#define RENDER_SPAN( span ) \
GLuint i; \
+ GLchan rgb[MAX_WIDTH][3]; \
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
span.intTex[1] -= FIXED_HALF; \
for (i = 0; i < span.end; i++) { \
GLint t = FixedToInt(span.intTex[1]) & tmask; \
GLint pos = (t << twidth_log2) + s; \
pos = pos + pos + pos; /* multiply by 3 */ \
- span.array->rgb[i][RCOMP] = texture[pos]; \
- span.array->rgb[i][GCOMP] = texture[pos+1]; \
- span.array->rgb[i][BCOMP] = texture[pos+2]; \
+ rgb[i][RCOMP] = texture[pos]; \
+ rgb[i][GCOMP] = texture[pos+1]; \
+ rgb[i][BCOMP] = texture[pos+2]; \
span.intTex[0] += span.intTexStep[0]; \
span.intTex[1] += span.intTexStep[1]; \
} \
- rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, span.array->rgb, NULL);
+ rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, rgb, NULL);
#include "s_tritemp.h"
#define RENDER_SPAN( span ) \
GLuint i; \
+ GLchan rgb[MAX_WIDTH][3]; \
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
span.intTex[1] -= FIXED_HALF; \
for (i = 0; i < span.end; i++) { \
GLint t = FixedToInt(span.intTex[1]) & tmask; \
GLint pos = (t << twidth_log2) + s; \
pos = pos + pos + pos; /* multiply by 3 */ \
- span.array->rgb[i][RCOMP] = texture[pos]; \
- span.array->rgb[i][GCOMP] = texture[pos+1]; \
- span.array->rgb[i][BCOMP] = texture[pos+2]; \
+ rgb[i][RCOMP] = texture[pos]; \
+ rgb[i][GCOMP] = texture[pos+1]; \
+ rgb[i][BCOMP] = texture[pos+2]; \
zRow[i] = z; \
span.array->mask[i] = 1; \
} \
span.intTex[1] += span.intTexStep[1]; \
span.z += span.zStep; \
} \
- rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, \
- span.array->rgb, span.array->mask);
+ rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, rgb, span.array->mask);
#include "s_tritemp.h"
* texture env modes.
*/
static INLINE void
-affine_span(GLcontext *ctx, struct sw_span *span,
+affine_span(GLcontext *ctx, SWspan *span,
struct affine_info *info)
{
GLchan sample[4]; /* the filtered texture sample */
static INLINE void
-fast_persp_span(GLcontext *ctx, struct sw_span *span,
+fast_persp_span(GLcontext *ctx, SWspan *span,
struct persp_info *info)
{
GLchan sample[4]; /* the filtered texture sample */
const GLuint savedTexEnable = ctx->Texture._EnabledUnits;
ctx->Texture._EnabledUnits = 0;
- tex_coord[0] = span->tex[0][0] * (info->smask + 1);
- tex_step[0] = span->texStepX[0][0] * (info->smask + 1);
- tex_coord[1] = span->tex[0][1] * (info->tmask + 1);
- tex_step[1] = span->texStepX[0][1] * (info->tmask + 1);
- /* span->tex[0][2] only if 3D-texturing, here only 2D */
- tex_coord[2] = span->tex[0][3];
- tex_step[2] = span->texStepX[0][3];
+ tex_coord[0] = span->attrStart[FRAG_ATTRIB_TEX0][0] * (info->smask + 1);
+ tex_step[0] = span->attrStepX[FRAG_ATTRIB_TEX0][0] * (info->smask + 1);
+ tex_coord[1] = span->attrStart[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1);
+ tex_step[1] = span->attrStepX[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1);
+ /* span->attrStart[FRAG_ATTRIB_TEX0][2] only if 3D-texturing, here only 2D */
+ tex_coord[2] = span->attrStart[FRAG_ATTRIB_TEX0][3];
+ tex_step[2] = span->attrStepX[FRAG_ATTRIB_TEX0][3];
switch (info->filter) {
case GL_NEAREST:
#define INTERP_FOG 1
#define INTERP_RGB 1
#define INTERP_ALPHA 1
-#define INTERP_TEX 1
+#define INTERP_ATTRIBS 1
#define SETUP_CODE \
struct persp_info info; \
/*
- * Render a smooth-shaded, textured, RGBA triangle.
- * Interpolate S,T,R with perspective correction, w/out mipmapping.
+ * Render an RGBA triangle with arbitrary attributes.
*/
-#define NAME general_textured_triangle
+#define NAME general_triangle
#define INTERP_Z 1
#define INTERP_W 1
#define INTERP_FOG 1
#define INTERP_RGB 1
#define INTERP_SPEC 1
#define INTERP_ALPHA 1
-#define INTERP_TEX 1
+#define INTERP_ATTRIBS 1
#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span);
#include "s_tritemp.h"
-/*
- * This is the big one!
- * Interpolate Z, RGB, Alpha, specular, fog, N sets of texture coordinates, and varying floats.
- * Yup, it's slow.
- */
-#define NAME multitextured_triangle
-#define INTERP_Z 1
-#define INTERP_W 1
-#define INTERP_FOG 1
-#define INTERP_RGB 1
-#define INTERP_ALPHA 1
-#define INTERP_SPEC 1
-#define INTERP_MULTITEX 1\r
-#define INTERP_VARYING 1
-#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span);
-#include "s_tritemp.h"
-
-
/*
* Special tri function for occlusion testing
return; \
}
#define RENDER_SPAN( span ) \
- if (ctx->Visual.depthBits <= 16) { \
+ if (rb->DepthBits <= 16) { \
GLuint i; \
const GLushort *zRow = (const GLushort *) \
rb->GetPointer(ctx, rb, span.x, span.y); \
}
}
- if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Active ||\r
- ctx->ATIFragmentShader._Enabled || ctx->ShaderObjects._FragmentShaderPresent) {
+ if (!rgbmode) {
+ USE(ci_triangle);
+ return;
+ }
+
+ if (ctx->Texture._EnabledCoordUnits ||
+ ctx->FragmentProgram._Current ||
+ ctx->ATIFragmentShader._Enabled) {
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
const struct gl_texture_object *texObj2D;
const struct gl_texture_image *texImg;
/* First see if we can use an optimized 2-D texture function */
if (ctx->Texture._EnabledCoordUnits == 0x1
- && !ctx->FragmentProgram._Active
- && !ctx->ATIFragmentShader._Enabled\r
- && !ctx->ShaderObjects._FragmentShaderPresent
+ && !ctx->FragmentProgram._Current
+ && !ctx->ATIFragmentShader._Enabled
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
&& texObj2D->WrapS == GL_REPEAT
&& texObj2D->WrapT == GL_REPEAT
&& ctx->Depth.Mask == GL_TRUE)
|| swrast->_RasterMask == TEXTURE_BIT)
&& ctx->Polygon.StippleFlag == GL_FALSE
- && ctx->Visual.depthBits <= 16) {
+ && ctx->DrawBuffer->Visual.depthBits <= 16) {
if (swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT)) {
USE(simple_z_textured_triangle);
}
}
else {
#if (CHAN_BITS == 16 || CHAN_BITS == 32)
- USE(general_textured_triangle);
+ USE(general_triangle);
#else
USE(affine_textured_triangle);
#endif
}
else {
#if (CHAN_BITS == 16 || CHAN_BITS == 32)
- USE(general_textured_triangle);
+ USE(general_triangle);
#else
USE(persp_textured_triangle);
#endif
}
else {
/* general case textured triangles */
- if (ctx->Texture._EnabledCoordUnits > 1) {
- USE(multitextured_triangle);
- }
- else {
- USE(general_textured_triangle);
- }
+ USE(general_triangle);
}
}
else {
ASSERT(!ctx->Texture._EnabledCoordUnits);
if (ctx->Light.ShadeModel==GL_SMOOTH) {
/* smooth shaded, no texturing, stippled or some raster ops */
- if (rgbmode) {
- USE(smooth_rgba_triangle);
- }
- else {
- USE(smooth_ci_triangle);
- }
+ USE(smooth_rgba_triangle);
}
else {
/* flat shaded, no texturing, stippled or some raster ops */
- if (rgbmode) {
- USE(flat_rgba_triangle);
- }
- else {
- USE(flat_ci_triangle);
- }
+ USE(flat_rgba_triangle);
}
}
}