-/* $Id: state.c,v 1.84 2002/06/06 16:31:24 brianp Exp $ */
+/* $Id: state.c,v 1.92 2002/09/27 02:45:38 brianp Exp $ */
/*
* Mesa 3-D graphics library
exec->LockArraysEXT = _mesa_LockArraysEXT;
exec->UnlockArraysEXT = _mesa_UnlockArraysEXT;
+ /* 148. GL_EXT_multi_draw_arrays */
+ exec->MultiDrawArraysEXT = _mesa_MultiDrawArraysEXT;
+ exec->MultiDrawElementsEXT = _mesa_MultiDrawElementsEXT;
+
/* 173. GL_INGR_blend_func_separate */
exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT;
exec->PointParameteriNV = _mesa_PointParameteriNV;
exec->PointParameterivNV = _mesa_PointParameterivNV;
+ /* 268. GL_EXT_stencil_two_side */
+ exec->ActiveStencilFaceEXT = _mesa_ActiveStencilFaceEXT;
+
/* ARB 1. GL_ARB_multitexture */
exec->ActiveTextureARB = _mesa_ActiveTextureARB;
exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB;
/**********************************************************************/
+/*
+ * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
+ * in ctx->_TriangleCaps if needed.
+ */
static void
update_polygon( GLcontext *ctx )
{
/* Any Polygon offsets enabled? */
ctx->Polygon._OffsetAny = GL_FALSE;
- ctx->_TriangleCaps &= ~DD_TRI_OFFSET;
-
if (ctx->Polygon.OffsetPoint ||
ctx->Polygon.OffsetLine ||
ctx->Polygon.OffsetFill) {
/* NOTE: This routine references Tranform attribute values to compute
* userclip positions in clip space, but is only called on
* _NEW_PROJECTION. The _mesa_ClipPlane() function keeps these values
- * uptodate across changes to the Transform attributes.
+ * up to date across changes to the Transform attributes.
*/
static void
update_projection( GLcontext *ctx )
static void
update_texture_state( GLcontext *ctx )
{
- GLuint i;
+ GLuint unit;
- ctx->Texture._ReallyEnabled = 0;
+ ctx->Texture._ReallyEnabled = 0; /* XXX obsolete */
+ ctx->Texture._EnabledUnits = 0;
ctx->Texture._GenFlags = 0;
ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN;
ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN;
/* Update texture unit state.
*/
- for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
texUnit->_ReallyEnabled = 0;
texUnit->_GenFlags = 0;
if (!texUnit->Enabled)
continue;
- /* Find the texture of highest dimensionality that is enabled
- * and complete. We'll use it for texturing.
+ /* Look for the highest-priority texture target that's enabled and
+ * complete. That's the one we'll use for texturing.
*/
- if (texUnit->Enabled & TEXTURE0_CUBE) {
+ if (texUnit->Enabled & TEXTURE_CUBE_BIT) {
struct gl_texture_object *texObj = texUnit->CurrentCubeMap;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
- texUnit->_ReallyEnabled = TEXTURE0_CUBE;
+ texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT;
texUnit->_Current = texObj;
}
}
- if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_3D)) {
+ if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_3D_BIT)) {
struct gl_texture_object *texObj = texUnit->Current3D;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
- texUnit->_ReallyEnabled = TEXTURE0_3D;
+ texUnit->_ReallyEnabled = TEXTURE_3D_BIT;
+ texUnit->_Current = texObj;
+ }
+ }
+
+ if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_RECT_BIT)) {
+ struct gl_texture_object *texObj = texUnit->CurrentRect;
+ if (!texObj->Complete) {
+ _mesa_test_texobj_completeness(ctx, texObj);
+ }
+ if (texObj->Complete) {
+ texUnit->_ReallyEnabled = TEXTURE_RECT_BIT;
texUnit->_Current = texObj;
}
}
- if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_2D)) {
+ if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_2D_BIT)) {
struct gl_texture_object *texObj = texUnit->Current2D;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
- texUnit->_ReallyEnabled = TEXTURE0_2D;
+ texUnit->_ReallyEnabled = TEXTURE_2D_BIT;
texUnit->_Current = texObj;
}
}
- if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_1D)) {
+ if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_1D_BIT)) {
struct gl_texture_object *texObj = texUnit->Current1D;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
- texUnit->_ReallyEnabled = TEXTURE0_1D;
+ texUnit->_ReallyEnabled = TEXTURE_1D_BIT;
texUnit->_Current = texObj;
}
}
continue;
}
+ /* Texture._ReallyEnabled records the enable state for all units in
+ * one word.
+ */
{
- GLuint flag = texUnit->_ReallyEnabled << (i * NUM_TEXTURE_TARGETS);
- ctx->Texture._ReallyEnabled |= flag;
+ GLuint flag = texUnit->_ReallyEnabled << (unit * NUM_TEXTURE_TARGETS);
+ ctx->Texture._ReallyEnabled |= flag; /* XXX obsolete field! */
+ if (texUnit->_ReallyEnabled)
+ ctx->Texture._EnabledUnits |= (1 << unit);
}
if (texUnit->TexGenEnabled) {
texUnit->_GenFlags |= texUnit->_GenBitR;
}
- ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(i);
+ ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
ctx->Texture._GenFlags |= texUnit->_GenFlags;
}
- if (ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY)
- ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
+ if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
+ ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
}
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) {
ASSERT(ctx->Driver.GetString);
ASSERT(ctx->Driver.UpdateState);
ASSERT(ctx->Driver.Clear);
- ASSERT(ctx->Driver.SetDrawBuffer);
ASSERT(ctx->Driver.GetBufferSize);
if (ctx->Visual.accumRedBits > 0) {
ASSERT(ctx->Driver.Accum);
ASSERT(ctx->Driver.CopyTexSubImage2D);
ASSERT(ctx->Driver.CopyTexSubImage3D);
if (ctx->Extensions.ARB_texture_compression) {
- ASSERT(ctx->Driver.BaseCompressedTexFormat);
- ASSERT(ctx->Driver.CompressedTextureSize);
- ASSERT(ctx->Driver.GetCompressedTexImage);
#if 0 /* HW drivers need these, but not SW rasterizers */
ASSERT(ctx->Driver.CompressedTexImage1D);
ASSERT(ctx->Driver.CompressedTexImage2D);