#include "main/colormac.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "main/texformat.h"
-#include "shader/prog_instruction.h"
+#include "main/mtypes.h"
+#include "main/state.h"
+#include "program/prog_instruction.h"
#include "s_aatriangle.h"
#include "s_context.h"
* \return GL_TRUE if the triangle is to be culled, GL_FALSE otherwise.
*/
GLboolean
-_swrast_culltriangle( GLcontext *ctx,
+_swrast_culltriangle( struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2 )
-/*
- * Render a smooth or flat-shaded color index triangle.
- */
-#define NAME ci_triangle
-#define INTERP_Z 1
-#define INTERP_ATTRIBS 1 /* just for fog */
-#define INTERP_INDEX 1
-#define RENDER_SPAN( span ) _swrast_write_index_span(ctx, &span);
-#include "s_tritemp.h"
-
-
-
/*
* Render a flat-shaded RGBA triangle.
*/
#define SETUP_CODE \
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \
- struct gl_texture_object *obj = \
+ const struct gl_texture_object *obj = \
ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
- const GLint b = obj->BaseLevel; \
- const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
- const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
- const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \
- const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \
- const GLint smask = obj->Image[0][b]->Width - 1; \
- const GLint tmask = obj->Image[0][b]->Height - 1; \
+ const struct gl_texture_image *texImg = \
+ obj->Image[0][obj->BaseLevel]; \
+ const struct swrast_texture_image *swImg = \
+ swrast_texture_image_const(texImg); \
+ const GLfloat twidth = (GLfloat) texImg->Width; \
+ const GLfloat theight = (GLfloat) texImg->Height; \
+ const GLint twidth_log2 = texImg->WidthLog2; \
+ const GLubyte *texture = (const GLubyte *) swImg->Map; \
+ const GLint smask = texImg->Width - 1; \
+ const GLint tmask = texImg->Height - 1; \
+ ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \
if (!rb || !texture) { \
return; \
}
#define RENDER_SPAN( span ) \
GLuint i; \
- GLchan rgb[MAX_WIDTH][3]; \
+ GLubyte rgba[MAX_WIDTH][4]; \
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 */ \
- rgb[i][RCOMP] = texture[pos]; \
- rgb[i][GCOMP] = texture[pos+1]; \
- rgb[i][BCOMP] = texture[pos+2]; \
+ rgba[i][RCOMP] = texture[pos+2]; \
+ rgba[i][GCOMP] = texture[pos+1]; \
+ rgba[i][BCOMP] = texture[pos+0]; \
+ rgba[i][ACOMP] = 0xff; \
span.intTex[0] += span.intTexStep[0]; \
span.intTex[1] += span.intTexStep[1]; \
} \
- rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, rgb, NULL);
+ _swrast_put_row(ctx, rb, GL_UNSIGNED_BYTE, span.end, \
+ span.x, span.y, rgba, NULL);
#include "s_tritemp.h"
#define SETUP_CODE \
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \
- struct gl_texture_object *obj = \
+ const struct gl_texture_object *obj = \
ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
- const GLint b = obj->BaseLevel; \
- const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
- const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
- const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \
- const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \
- const GLint smask = obj->Image[0][b]->Width - 1; \
- const GLint tmask = obj->Image[0][b]->Height - 1; \
+ const struct gl_texture_image *texImg = \
+ obj->Image[0][obj->BaseLevel]; \
+ const struct swrast_texture_image *swImg = \
+ swrast_texture_image_const(texImg); \
+ const GLfloat twidth = (GLfloat) texImg->Width; \
+ const GLfloat theight = (GLfloat) texImg->Height; \
+ const GLint twidth_log2 = texImg->WidthLog2; \
+ const GLubyte *texture = (const GLubyte *) swImg->Map; \
+ const GLint smask = texImg->Width - 1; \
+ const GLint tmask = texImg->Height - 1; \
+ ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \
if (!rb || !texture) { \
return; \
}
#define RENDER_SPAN( span ) \
GLuint i; \
- GLchan rgb[MAX_WIDTH][3]; \
+ GLubyte rgba[MAX_WIDTH][4]; \
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 */ \
- rgb[i][RCOMP] = texture[pos]; \
- rgb[i][GCOMP] = texture[pos+1]; \
- rgb[i][BCOMP] = texture[pos+2]; \
+ rgba[i][RCOMP] = texture[pos+2]; \
+ rgba[i][GCOMP] = texture[pos+1]; \
+ rgba[i][BCOMP] = texture[pos+0]; \
+ rgba[i][ACOMP] = 0xff; \
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, rgb, span.array->mask);
+ _swrast_put_row(ctx, rb, GL_UNSIGNED_BYTE, \
+ span.end, span.x, span.y, rgba, span.array->mask);
#include "s_tritemp.h"
};
-static INLINE GLint
+static inline GLint
ilerp(GLint t, GLint a, GLint b)
{
return a + ((t * (b - a)) >> FIXED_SHIFT);
}
-static INLINE GLint
+static inline GLint
ilerp_2d(GLint ia, GLint ib, GLint v00, GLint v10, GLint v01, GLint v11)
{
const GLint temp0 = ilerp(ia, v00, v10);
* textures with GL_REPLACE, GL_MODULATE, GL_BLEND, GL_DECAL or GL_ADD
* texture env modes.
*/
-static INLINE void
-affine_span(GLcontext *ctx, SWspan *span,
+static inline void
+affine_span(struct gl_context *ctx, SWspan *span,
struct affine_info *info)
{
GLchan sample[4]; /* the filtered texture sample */
* unused variables (for instance tf,sf,ti,si in case of GL_NEAREST).
*/
-#define NEAREST_RGB \
- sample[RCOMP] = tex00[RCOMP]; \
- sample[GCOMP] = tex00[GCOMP]; \
- sample[BCOMP] = tex00[BCOMP]; \
- sample[ACOMP] = CHAN_MAX
+#define NEAREST_RGB \
+ sample[RCOMP] = tex00[2]; \
+ sample[GCOMP] = tex00[1]; \
+ sample[BCOMP] = tex00[0]; \
+ sample[ACOMP] = CHAN_MAX;
#define LINEAR_RGB \
- sample[RCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\
+ sample[RCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\
sample[GCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\
- sample[BCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\
+ sample[BCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\
sample[ACOMP] = CHAN_MAX;
-#define NEAREST_RGBA COPY_CHAN4(sample, tex00)
+#define NEAREST_RGBA \
+ sample[RCOMP] = tex00[3]; \
+ sample[GCOMP] = tex00[2]; \
+ sample[BCOMP] = tex00[1]; \
+ sample[ACOMP] = tex00[0];
#define LINEAR_RGBA \
- sample[RCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\
- sample[GCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\
- sample[BCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\
- sample[ACOMP] = ilerp_2d(sf, tf, tex00[3], tex01[3], tex10[3], tex11[3])
+ sample[RCOMP] = ilerp_2d(sf, tf, tex00[3], tex01[3], tex10[3], tex11[3]);\
+ sample[GCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\
+ sample[BCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\
+ sample[ACOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0])
#define MODULATE \
dest[RCOMP] = span->red * (sample[RCOMP] + 1u) >> (FIXED_SHIFT + 8); \
dest[2] = sample[2]; \
dest[3] = FixedToInt(span->alpha);
-#define NEAREST_RGBA_REPLACE COPY_CHAN4(dest, tex00)
+#define NEAREST_RGBA_REPLACE \
+ dest[RCOMP] = tex00[3]; \
+ dest[GCOMP] = tex00[2]; \
+ dest[BCOMP] = tex00[1]; \
+ dest[ACOMP] = tex00[0]
#define SPAN_NEAREST(DO_TEX, COMPS) \
for (i = 0; i < span->end; i++) { \
switch (info->filter) {
case GL_NEAREST:
switch (info->format) {
- case GL_RGB:
+ case MESA_FORMAT_RGB888:
switch (info->envmode) {
case GL_MODULATE:
SPAN_NEAREST(NEAREST_RGB;MODULATE,3);
return;
}
break;
- case GL_RGBA:
+ case MESA_FORMAT_RGBA8888:
switch(info->envmode) {
case GL_MODULATE:
SPAN_NEAREST(NEAREST_RGBA;MODULATE,4);
span->intTex[0] -= FIXED_HALF;
span->intTex[1] -= FIXED_HALF;
switch (info->format) {
- case GL_RGB:
+ case MESA_FORMAT_RGB888:
switch (info->envmode) {
case GL_MODULATE:
SPAN_LINEAR(LINEAR_RGB;MODULATE,3);
return;
}
break;
- case GL_RGBA:
+ case MESA_FORMAT_RGBA8888:
switch (info->envmode) {
case GL_MODULATE:
SPAN_LINEAR(LINEAR_RGBA;MODULATE,4);
#define SETUP_CODE \
struct affine_info info; \
struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
- struct gl_texture_object *obj = \
+ const struct gl_texture_object *obj = \
ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
- const GLint b = obj->BaseLevel; \
- const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
- const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
- info.texture = (const GLchan *) obj->Image[0][b]->Data; \
- info.twidth_log2 = obj->Image[0][b]->WidthLog2; \
- info.smask = obj->Image[0][b]->Width - 1; \
- info.tmask = obj->Image[0][b]->Height - 1; \
- info.format = obj->Image[0][b]->_BaseFormat; \
- info.filter = obj->MinFilter; \
+ const struct gl_texture_image *texImg = \
+ obj->Image[0][obj->BaseLevel]; \
+ const struct swrast_texture_image *swImg = \
+ swrast_texture_image_const(texImg); \
+ const GLfloat twidth = (GLfloat) texImg->Width; \
+ const GLfloat theight = (GLfloat) texImg->Height; \
+ info.texture = (const GLchan *) swImg->Map; \
+ info.twidth_log2 = texImg->WidthLog2; \
+ info.smask = texImg->Width - 1; \
+ info.tmask = texImg->Height - 1; \
+ info.format = texImg->TexFormat; \
+ info.filter = obj->Sampler.MinFilter; \
info.envmode = unit->EnvMode; \
+ info.er = 0; \
+ info.eg = 0; \
+ info.eb = 0; \
span.arrayMask |= SPAN_RGBA; \
\
if (info.envmode == GL_BLEND) { \
} \
\
switch (info.format) { \
- case GL_ALPHA: \
- case GL_LUMINANCE: \
- case GL_INTENSITY: \
- info.tbytesline = obj->Image[0][b]->Width; \
+ case MESA_FORMAT_RGB888: \
+ info.tbytesline = texImg->Width * 3; \
break; \
- case GL_LUMINANCE_ALPHA: \
- info.tbytesline = obj->Image[0][b]->Width * 2; \
- break; \
- case GL_RGB: \
- info.tbytesline = obj->Image[0][b]->Width * 3; \
- break; \
- case GL_RGBA: \
- info.tbytesline = obj->Image[0][b]->Width * 4; \
+ case MESA_FORMAT_RGBA8888: \
+ info.tbytesline = texImg->Width * 4; \
break; \
default: \
_mesa_problem(NULL, "Bad texture format in affine_texture_triangle");\
return; \
} \
- info.tsize = obj->Image[0][b]->Height * info.tbytesline;
+ info.tsize = texImg->Height * info.tbytesline;
#define RENDER_SPAN( span ) affine_span(ctx, &span, &info);
};
-static INLINE void
-fast_persp_span(GLcontext *ctx, SWspan *span,
+static inline void
+fast_persp_span(struct gl_context *ctx, SWspan *span,
struct persp_info *info)
{
GLchan sample[4]; /* the filtered texture sample */
switch (info->filter) {
case GL_NEAREST:
switch (info->format) {
- case GL_RGB:
+ case MESA_FORMAT_RGB888:
switch (info->envmode) {
case GL_MODULATE:
SPAN_NEAREST(NEAREST_RGB;MODULATE,3);
return;
}
break;
- case GL_RGBA:
+ case MESA_FORMAT_RGBA8888:
switch(info->envmode) {
case GL_MODULATE:
SPAN_NEAREST(NEAREST_RGBA;MODULATE,4);
case GL_LINEAR:
switch (info->format) {
- case GL_RGB:
+ case MESA_FORMAT_RGB888:
switch (info->envmode) {
case GL_MODULATE:
SPAN_LINEAR(LINEAR_RGB;MODULATE,3);
return;
}
break;
- case GL_RGBA:
+ case MESA_FORMAT_RGBA8888:
switch (info->envmode) {
case GL_MODULATE:
SPAN_LINEAR(LINEAR_RGBA;MODULATE,4);
#define SETUP_CODE \
struct persp_info info; \
const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
- struct gl_texture_object *obj = \
+ const struct gl_texture_object *obj = \
ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
- const GLint b = obj->BaseLevel; \
- info.texture = (const GLchan *) obj->Image[0][b]->Data; \
- info.twidth_log2 = obj->Image[0][b]->WidthLog2; \
- info.smask = obj->Image[0][b]->Width - 1; \
- info.tmask = obj->Image[0][b]->Height - 1; \
- info.format = obj->Image[0][b]->_BaseFormat; \
- info.filter = obj->MinFilter; \
+ const struct gl_texture_image *texImg = \
+ obj->Image[0][obj->BaseLevel]; \
+ const struct swrast_texture_image *swImg = \
+ swrast_texture_image_const(texImg); \
+ info.texture = (const GLchan *) swImg->Map; \
+ info.twidth_log2 = texImg->WidthLog2; \
+ info.smask = texImg->Width - 1; \
+ info.tmask = texImg->Height - 1; \
+ info.format = texImg->TexFormat; \
+ info.filter = obj->Sampler.MinFilter; \
info.envmode = unit->EnvMode; \
+ info.er = 0; \
+ info.eg = 0; \
+ info.eb = 0; \
\
if (info.envmode == GL_BLEND) { \
/* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \
} \
\
switch (info.format) { \
- case GL_ALPHA: \
- case GL_LUMINANCE: \
- case GL_INTENSITY: \
- info.tbytesline = obj->Image[0][b]->Width; \
- break; \
- case GL_LUMINANCE_ALPHA: \
- info.tbytesline = obj->Image[0][b]->Width * 2; \
+ case MESA_FORMAT_RGB888: \
+ info.tbytesline = texImg->Width * 3; \
break; \
- case GL_RGB: \
- info.tbytesline = obj->Image[0][b]->Width * 3; \
- break; \
- case GL_RGBA: \
- info.tbytesline = obj->Image[0][b]->Width * 4; \
+ case MESA_FORMAT_RGBA8888: \
+ info.tbytesline = texImg->Width * 4; \
break; \
default: \
_mesa_problem(NULL, "Bad texture format in persp_textured_triangle");\
return; \
} \
- info.tsize = obj->Image[0][b]->Height * info.tbytesline;
+ info.tsize = texImg->Height * info.tbytesline;
#define RENDER_SPAN( span ) \
span.interpMask &= ~SPAN_RGBA; \
/*
* Special tri function for occlusion testing
*/
-#define NAME occlusion_zless_triangle
+#define NAME occlusion_zless_16_triangle
#define INTERP_Z 1
#define SETUP_CODE \
- struct gl_renderbuffer *rb = ctx->DrawBuffer->_DepthBuffer; \
+ struct gl_renderbuffer *rb = \
+ ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; \
struct gl_query_object *q = ctx->Query.CurrentOcclusionObject; \
ASSERT(ctx->Depth.Test); \
ASSERT(!ctx->Depth.Mask); \
ASSERT(ctx->Depth.Func == GL_LESS); \
+ assert(rb->Format == MESA_FORMAT_Z16); \
if (!q) { \
return; \
}
#define RENDER_SPAN( span ) \
- if (rb->DepthBits <= 16) { \
+ { \
GLuint i; \
const GLushort *zRow = (const GLushort *) \
- rb->GetPointer(ctx, rb, span.x, span.y); \
+ _swrast_pixel_address(rb, span.x, span.y); \
for (i = 0; i < span.end; i++) { \
GLuint z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
} \
span.z += span.zStep; \
} \
- } \
- else { \
- GLuint i; \
- const GLuint *zRow = (const GLuint *) \
- rb->GetPointer(ctx, rb, span.x, span.y); \
- for (i = 0; i < span.end; i++) { \
- if ((GLuint)span.z < zRow[i]) { \
- q->Result++; \
- } \
- span.z += span.zStep; \
- } \
}
#include "s_tritemp.h"
static void
-nodraw_triangle( GLcontext *ctx,
+nodraw_triangle( struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2 )
* Inefficient, but seldom needed.
*/
void
-_swrast_add_spec_terms_triangle(GLcontext *ctx, const SWvertex *v0,
+_swrast_add_spec_terms_triangle(struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2)
{
SWvertex *ncv0 = (SWvertex *)v0; /* drop const qualifier */
* remove tests to this code.
*/
void
-_swrast_choose_triangle( GLcontext *ctx )
+_swrast_choose_triangle( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLboolean rgbmode = ctx->Visual.rgbMode;
if (ctx->Polygon.CullFlag &&
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) {
}
if (ctx->RenderMode==GL_RENDER) {
+ struct gl_renderbuffer *depthRb =
+ ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
if (ctx->Polygon.SmoothFlag) {
_swrast_set_aa_triangle_function(ctx);
ctx->Depth.Test &&
ctx->Depth.Mask == GL_FALSE &&
ctx->Depth.Func == GL_LESS &&
- !ctx->Stencil._Enabled) {
- if ((rgbmode &&
- ctx->Color.ColorMask[0] == 0 &&
- ctx->Color.ColorMask[1] == 0 &&
- ctx->Color.ColorMask[2] == 0 &&
- ctx->Color.ColorMask[3] == 0)
- ||
- (!rgbmode && ctx->Color.IndexMask == 0)) {
- USE(occlusion_zless_triangle);
+ !ctx->Stencil._Enabled &&
+ depthRb &&
+ depthRb->Format == MESA_FORMAT_Z16) {
+ if (ctx->Color.ColorMask[0][0] == 0 &&
+ ctx->Color.ColorMask[0][1] == 0 &&
+ ctx->Color.ColorMask[0][2] == 0 &&
+ ctx->Color.ColorMask[0][3] == 0) {
+ USE(occlusion_zless_16_triangle);
return;
}
}
- if (!rgbmode) {
- USE(ci_triangle);
- return;
- }
-
/*
* XXX should examine swrast->_ActiveAttribMask to determine what
* needs to be interpolated.
if (ctx->Texture._EnabledCoordUnits ||
ctx->FragmentProgram._Current ||
ctx->ATIFragmentShader._Enabled ||
- NEED_SECONDARY_COLOR(ctx) ||
+ _mesa_need_secondary_color(ctx) ||
swrast->_FogEnabled) {
/* 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;
+ const struct swrast_texture_image *swImg;
GLenum minFilter, magFilter, envMode;
- GLint format;
+ gl_format format;
texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL;
- format = texImg ? texImg->TexFormat->MesaFormat : -1;
- minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0;
- magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0;
+ swImg = swrast_texture_image_const(texImg);
+
+ format = texImg ? texImg->TexFormat : MESA_FORMAT_NONE;
+ minFilter = texObj2D ? texObj2D->Sampler.MinFilter : GL_NONE;
+ magFilter = texObj2D ? texObj2D->Sampler.MagFilter : GL_NONE;
envMode = ctx->Texture.Unit[0].EnvMode;
/* First see if we can use an optimized 2-D texture function */
if (ctx->Texture._EnabledCoordUnits == 0x1
&& !ctx->FragmentProgram._Current
&& !ctx->ATIFragmentShader._Enabled
+ && ctx->Texture._EnabledUnits == 0x1
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
- && texObj2D->WrapS == GL_REPEAT
- && texObj2D->WrapT == GL_REPEAT
+ && texObj2D->Sampler.WrapS == GL_REPEAT
+ && texObj2D->Sampler.WrapT == GL_REPEAT
&& texObj2D->_Swizzle == SWIZZLE_NOOP
- && texImg->_IsPowerOfTwo
+ && swImg->_IsPowerOfTwo
&& texImg->Border == 0
- && texImg->Width == texImg->RowStride
- && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA)
+ && texImg->Width == swImg->RowStride
+ && (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888)
&& minFilter == magFilter
&& ctx->Light.Model.ColorControl == GL_SINGLE_COLOR
&& !swrast->_FogEnabled
&& ctx->Texture.Unit[0].EnvMode != GL_COMBINE4_NV) {
if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) {
if (minFilter == GL_NEAREST
- && format == MESA_FORMAT_RGB
+ && format == MESA_FORMAT_RGB888
&& (envMode == GL_REPLACE || envMode == GL_DECAL)
&& ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT)
&& ctx->Depth.Func == GL_LESS
#if CHAN_BITS != 8
USE(general_triangle);
#else
- USE(affine_textured_triangle);
+ if (format == MESA_FORMAT_RGBA8888 && !_mesa_little_endian()) {
+ /* We only handle RGBA8888 correctly on little endian
+ * in the optimized code above.
+ */
+ USE(general_triangle);
+ }
+ else {
+ USE(affine_textured_triangle);
+ }
#endif
}
}
}
else {
ASSERT(!swrast->_FogEnabled);
- ASSERT(!NEED_SECONDARY_COLOR(ctx));
+ ASSERT(!_mesa_need_secondary_color(ctx));
if (ctx->Light.ShadeModel==GL_SMOOTH) {
/* smooth shaded, no texturing, stippled or some raster ops */
#if CHAN_BITS != 8