GLfloat fy = v2->win[1] - v0->win[1];
GLfloat c = ex*fy-ey*fx;
- if (c * SWRAST_CONTEXT(ctx)->_backface_sign > 0)
+ if (c * SWRAST_CONTEXT(ctx)->_BackfaceSign > 0)
return 0;
return 1;
SWcontext *swrast = SWRAST_CONTEXT(ctx); \
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
const GLint b = obj->BaseLevel; \
- const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
- const GLfloat theight = (GLfloat) obj->Image[b]->Height; \
- const GLint twidth_log2 = obj->Image[b]->WidthLog2; \
- const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \
- const GLint smask = obj->Image[b]->Width - 1; \
- const GLint tmask = obj->Image[b]->Height - 1; \
+ 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; \
if (!texture) { \
/* this shouldn't happen */ \
return; \
SWcontext *swrast = SWRAST_CONTEXT(ctx); \
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
const GLint b = obj->BaseLevel; \
- const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
- const GLfloat theight = (GLfloat) obj->Image[b]->Height; \
- const GLint twidth_log2 = obj->Image[b]->WidthLog2; \
- const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \
- const GLint smask = obj->Image[b]->Width - 1; \
- const GLint tmask = obj->Image[b]->Height - 1; \
+ 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; \
if (!texture) { \
/* this shouldn't happen */ \
return; \
struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
struct gl_texture_object *obj = unit->Current2D; \
const GLint b = obj->BaseLevel; \
- const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
- const GLfloat theight = (GLfloat) obj->Image[b]->Height; \
- info.texture = (const GLchan *) obj->Image[b]->Data; \
- info.twidth_log2 = obj->Image[b]->WidthLog2; \
- info.smask = obj->Image[b]->Width - 1; \
- info.tmask = obj->Image[b]->Height - 1; \
- info.format = obj->Image[b]->Format; \
+ 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]->Format; \
info.filter = obj->MinFilter; \
info.envmode = unit->EnvMode; \
span.arrayMask |= SPAN_RGBA; \
case GL_ALPHA: \
case GL_LUMINANCE: \
case GL_INTENSITY: \
- info.tbytesline = obj->Image[b]->Width; \
+ info.tbytesline = obj->Image[0][b]->Width; \
break; \
case GL_LUMINANCE_ALPHA: \
- info.tbytesline = obj->Image[b]->Width * 2; \
+ info.tbytesline = obj->Image[0][b]->Width * 2; \
break; \
case GL_RGB: \
- info.tbytesline = obj->Image[b]->Width * 3; \
+ info.tbytesline = obj->Image[0][b]->Width * 3; \
break; \
case GL_RGBA: \
- info.tbytesline = obj->Image[b]->Width * 4; \
+ info.tbytesline = obj->Image[0][b]->Width * 4; \
break; \
default: \
_mesa_problem(NULL, "Bad texture format in affine_texture_triangle");\
return; \
} \
- info.tsize = obj->Image[b]->Height * info.tbytesline;
+ info.tsize = obj->Image[0][b]->Height * info.tbytesline;
#define RENDER_SPAN( span ) affine_span(ctx, &span, &info);
const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
const struct gl_texture_object *obj = unit->Current2D; \
const GLint b = obj->BaseLevel; \
- info.texture = (const GLchan *) obj->Image[b]->Data; \
- info.twidth_log2 = obj->Image[b]->WidthLog2; \
- info.smask = obj->Image[b]->Width - 1; \
- info.tmask = obj->Image[b]->Height - 1; \
- info.format = obj->Image[b]->Format; \
+ 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]->Format; \
info.filter = obj->MinFilter; \
info.envmode = unit->EnvMode; \
\
case GL_ALPHA: \
case GL_LUMINANCE: \
case GL_INTENSITY: \
- info.tbytesline = obj->Image[b]->Width; \
+ info.tbytesline = obj->Image[0][b]->Width; \
break; \
case GL_LUMINANCE_ALPHA: \
- info.tbytesline = obj->Image[b]->Width * 2; \
+ info.tbytesline = obj->Image[0][b]->Width * 2; \
break; \
case GL_RGB: \
- info.tbytesline = obj->Image[b]->Width * 3; \
+ info.tbytesline = obj->Image[0][b]->Width * 3; \
break; \
case GL_RGBA: \
- info.tbytesline = obj->Image[b]->Width * 4; \
+ info.tbytesline = obj->Image[0][b]->Width * 4; \
break; \
default: \
_mesa_problem(NULL, "Bad texture format in persp_textured_triangle");\
return; \
} \
- info.tsize = obj->Image[b]->Height * info.tbytesline;
+ info.tsize = obj->Image[0][b]->Height * info.tbytesline;
#define RENDER_SPAN( span ) \
span.interpMask &= ~SPAN_RGBA; \
+/*
+ * Special tri function for occlusion testing
+ */
#define NAME occlusion_zless_triangle
#define DO_OCCLUSION_TEST
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define SETUP_CODE \
- if (ctx->OcclusionResult) { \
- return; \
+#define SETUP_CODE \
+ if (ctx->OcclusionResult && !ctx->Occlusion.Active) { \
+ return; \
}
#define RENDER_SPAN( span ) \
GLuint i; \
GLdepth z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
ctx->OcclusionResult = GL_TRUE; \
- return; \
+ ctx->Occlusion.PassedCounter++; \
} \
span.z += span.zStep; \
}
return;
}
- if (ctx->Depth.OcclusionTest &&
+ /* special case for occlusion testing */
+ if ((ctx->Depth.OcclusionTest || ctx->Occlusion.Active) &&
ctx->Depth.Test &&
ctx->Depth.Mask == GL_FALSE &&
ctx->Depth.Func == GL_LESS &&
}
}
- if (ctx->Texture._EnabledCoordUnits) {
+ if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram.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;
GLenum minFilter, magFilter, envMode;
GLint format;
texObj2D = ctx->Texture.Unit[0].Current2D;
- texImg = texObj2D ? texObj2D->Image[texObj2D->BaseLevel] : NULL;
+ 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;
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
&& texObj2D->WrapS==GL_REPEAT
&& texObj2D->WrapT==GL_REPEAT
+ && texObj2D->_IsPowerOfTwo
&& texImg->Border==0
&& texImg->Width == texImg->RowStride
&& (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA)