ctx->_TriangleCaps should probably go away altogether someday...
}
+/**
+ * Helper to enable/disable client-side state.
+ */
static void
-client_state( GLcontext *ctx, GLenum cap, GLboolean state )
+client_state(GLcontext *ctx, GLenum cap, GLboolean state)
{
GLuint flag;
GLuint *var;
ctx->Array.ArrayObj->_Enabled &= ~flag;
if (ctx->Driver.Enable) {
- (*ctx->Driver.Enable)( ctx, cap, state );
+ ctx->Driver.Enable( ctx, cap, state );
}
}
/**
* Enable GL capability.
- *
- * \param cap capability.
- *
- * \sa glEnable().
+ * \param cap state to enable/disable.
*
* Get's the current context, assures that we're outside glBegin()/glEnd() and
* calls client_state().
/**
* Disable GL capability.
- *
- * \param cap capability.
- *
- * \sa glDisable().
+ * \param cap state to enable/disable.
*
* Get's the current context, assures that we're outside glBegin()/glEnd() and
* calls client_state().
/**
- * Perform glEnable() and glDisable() calls.
+ * Helper function to enable or disable state.
*
* \param ctx GL context.
- * \param cap capability.
+ * \param cap the state to enable/disable
* \param state whether to enable or disable the specified capability.
*
* Updates the current context and flushes the vertices as needed. For
* are effectivly present before updating. Notifies the driver via
* dd_function_table::Enable.
*/
-void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
+void
+_mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
{
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "%s %s (newstate is %x)\n",
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.CullFlag = state;
break;
-
case GL_CULL_VERTEX_EXT:
CHECK_EXTENSION(EXT_cull_vertex, cap);
if (ctx->Transform.CullVertexFlag == state)
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
ctx->Transform.CullVertexFlag = state;
break;
-
case GL_DEPTH_TEST:
if (state && ctx->DrawBuffer->Visual.depthBits == 0) {
_mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
return;
}
- if (ctx->Depth.Test==state)
+ if (ctx->Depth.Test == state)
return;
FLUSH_VERTICES(ctx, _NEW_DEPTH);
ctx->Depth.Test = state;
if (ctx->NoDither) {
state = GL_FALSE; /* MESA_NO_DITHER env var */
}
- if (ctx->Color.DitherFlag==state)
+ if (ctx->Color.DitherFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.DitherFlag = state;
break;
case GL_FOG:
- if (ctx->Fog.Enabled==state)
+ if (ctx->Fog.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Enabled = state;
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Enabled = state;
-
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
- ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
- else
- ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
-
break;
case GL_LINE_SMOOTH:
if (ctx->Line.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_LINE);
ctx->Line.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
break;
case GL_LINE_STIPPLE:
if (ctx->Line.StippleFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_LINE);
ctx->Line.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
break;
case GL_INDEX_LOGIC_OP:
if (ctx->Color.IndexLogicOpEnabled == state)
ctx->Transform.Normalize = state;
break;
case GL_POINT_SMOOTH:
- if (ctx->Point.SmoothFlag==state)
+ if (ctx->Point.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POINT);
ctx->Point.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
break;
case GL_POLYGON_SMOOTH:
- if (ctx->Polygon.SmoothFlag==state)
+ if (ctx->Polygon.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
break;
case GL_POLYGON_STIPPLE:
- if (ctx->Polygon.StippleFlag==state)
+ if (ctx->Polygon.StippleFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
break;
case GL_POLYGON_OFFSET_POINT:
- if (ctx->Polygon.OffsetPoint==state)
+ if (ctx->Polygon.OffsetPoint == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.OffsetPoint = state;
break;
case GL_POLYGON_OFFSET_LINE:
- if (ctx->Polygon.OffsetLine==state)
+ if (ctx->Polygon.OffsetLine == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.OffsetLine = state;
break;
case GL_POLYGON_OFFSET_FILL:
/*case GL_POLYGON_OFFSET_EXT:*/
- if (ctx->Polygon.OffsetFill==state)
+ if (ctx->Polygon.OffsetFill == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.OffsetFill = state;
ctx->Transform.RescaleNormals = state;
break;
case GL_SCISSOR_TEST:
- if (ctx->Scissor.Enabled==state)
+ if (ctx->Scissor.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_SCISSOR);
ctx->Scissor.Enabled = state;
"glEnable(GL_STENCIL_TEST) but no stencil buffer");
return;
}
- if (ctx->Stencil.Enabled==state)
+ if (ctx->Stencil.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.Enabled = state;
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.TestTwoSide = state;
- if (state) {
- ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
- } else {
- ctx->_TriangleCaps &= ~DD_TRI_TWOSTENCIL;
- }
break;
#if FEATURE_ARB_fragment_program
}
if (ctx->Driver.Enable) {
- (*ctx->Driver.Enable)( ctx, cap, state );
+ ctx->Driver.Enable( ctx, cap, state );
}
}
/**
- * Enable GL capability.
- *
- * \param cap capability.
- *
- * \sa glEnable().
- *
- * Get's the current context, assures that we're outside glBegin()/glEnd() and
- * calls _mesa_set_enable().
+ * Enable GL capability. Called by glEnable()
+ * \param cap state to enable.
*/
void GLAPIENTRY
_mesa_Enable( GLenum cap )
/**
- * Disable GL capability.
- *
- * \param cap capability.
- *
- * \sa glDisable().
- *
- * Get's the current context, assures that we're outside glBegin()/glEnd() and
- * calls _mesa_set_enable().
+ * Disable GL capability. Called by glDisable()
+ * \param cap state to disable.
*/
void GLAPIENTRY
_mesa_Disable( GLenum cap )
return GL_FALSE; \
}
+
/**
- * Test whether a capability is enabled.
+ * Return simple enable/disable state.
*
- * \param cap capability.
+ * \param cap state variable to query.
*
* Returns the state of the specified capability from the current GL context.
* For the capabilities associated with extensions verifies that those
#if FEATURE_EXT_texture_sRGB
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
#endif
- /* plus: shading language extensions, non-square uniform matrices */
+#ifdef FEATURE_ARB_shading_language_120
+ ctx->Extensions.ARB_shading_language_120 = GL_TRUE;
+#endif
}
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.3
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
_mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode));
if (mode != GL_FLAT && mode != GL_SMOOTH) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
+ _mesa_error(ctx, GL_INVALID_ENUM, "glShadeModel");
return;
}
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.ShadeModel = mode;
- ctx->_TriangleCaps ^= DD_FLATSHADE;
if (ctx->Driver.ShadeModel)
- (*ctx->Driver.ShadeModel)( ctx, mode );
+ ctx->Driver.ShadeModel( ctx, mode );
}
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Model.TwoSide = newbool;
-
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
- ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
- else
- ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
}
if (ctx->Driver.ColorMaterial)
- (*ctx->Driver.ColorMaterial)( ctx, face, mode );
+ ctx->Driver.ColorMaterial( ctx, face, mode );
}
-/**
- * \file lines.c
- * Line operations.
- */
-
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.5.3
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 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"),
* \param width line width in pixels.
*
* \sa glLineWidth().
- *
- * Verifies the parameter and updates gl_line_attrib::Width. On a change,
- * flushes the vertices, updates the clamped line width and marks the
- * DD_LINE_WIDTH flag in __GLcontextRec::_TriangleCaps for the drivers if the
- * width is different from one. Notifies the driver via the
- * dd_function_table::LineWidth callback.
*/
void GLAPIENTRY
_mesa_LineWidth( GLfloat width )
ctx->Const.MinLineWidth,
ctx->Const.MaxLineWidth);
-
- if (width != 1.0)
- ctx->_TriangleCaps |= DD_LINE_WIDTH;
- else
- ctx->_TriangleCaps &= ~DD_LINE_WIDTH;
-
if (ctx->Driver.LineWidth)
- (*ctx->Driver.LineWidth)(ctx, width);
+ ctx->Driver.LineWidth(ctx, width);
}
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 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"),
ctx->Point.MinSize,
ctx->Point.MaxSize);
- if (ctx->Point._Size == 1.0F)
- ctx->_TriangleCaps &= ~DD_POINT_SIZE;
- else
- ctx->_TriangleCaps |= DD_POINT_SIZE;
-
ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
ctx->Point.Params[1] != 0.0 ||
ctx->Point.Params[2] != 0.0);
-
- if (ctx->Point._Attenuated)
- ctx->_TriangleCaps |= DD_POINT_ATTEN;
- else
- ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
}
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 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"),
_mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
return;
}
-
- ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
- if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL)
- ctx->_TriangleCaps |= DD_TRI_UNFILLED;
-
- if (ctx->Driver.PolygonMode) {
- (*ctx->Driver.PolygonMode)( ctx, face, mode );
- }
}
#if _HAVE_FULL_GL
#endif
-/**********************************************************************/
-/** \name State Management */
-/*@{*/
-
-/*
- * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
- * in ctx->_TriangleCaps if needed.
- */
-void _mesa_update_polygon( GLcontext *ctx )
-{
- ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
-
- if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
- ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
-
- /* Any Polygon offsets enabled? */
- if (ctx->Polygon.OffsetPoint ||
- ctx->Polygon.OffsetLine ||
- ctx->Polygon.OffsetFill) {
- ctx->_TriangleCaps |= DD_TRI_OFFSET;
- }
-}
-
-/*@}*/
-
-
/**********************************************************************/
/** \name Initialization */
/*@{*/
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 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"),
extern void GLAPIENTRY
_mesa_GetPolygonStipple( GLubyte *mask );
-extern void
-_mesa_update_polygon( GLcontext *ctx );
-
extern void
_mesa_init_polygon( GLcontext * ctx );
/*@{*/
-static void
-update_separate_specular( GLcontext *ctx )
-{
- if (NEED_SECONDARY_COLOR(ctx))
- ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
- else
- ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
-}
-
-
/**
* Update state dependent on vertex arrays.
*/
/**
- * If __GLcontextRec::NewState is non-zero then this function \b must be called
- * before rendering any primitive. Basically, function pointers and
- * miscellaneous flags are updated to reflect the current state of the state
- * machine.
+ * Update the ctx->_TriangleCaps bitfield.
+ * XXX that bitfield should really go away someday!
+ * This function must be called after other update_*() functions since
+ * there are dependencies on some other derived values.
+ */
+static void
+update_tricaps(GLcontext *ctx, GLbitfield new_state)
+{
+ ctx->_TriangleCaps = 0;
+
+ /*
+ * Points
+ */
+ if (new_state & _NEW_POINT) {
+ if (ctx->Point.SmoothFlag)
+ ctx->_TriangleCaps |= DD_POINT_SMOOTH;
+ if (ctx->Point._Size != 1.0F)
+ ctx->_TriangleCaps |= DD_POINT_SIZE;
+ if (ctx->Point._Attenuated)
+ ctx->_TriangleCaps |= DD_POINT_ATTEN;
+ }
+
+ /*
+ * Lines
+ */
+ if (new_state & _NEW_LINE) {
+ if (ctx->Line.SmoothFlag)
+ ctx->_TriangleCaps |= DD_LINE_SMOOTH;
+ if (ctx->Line.StippleFlag)
+ ctx->_TriangleCaps |= DD_LINE_STIPPLE;
+ if (ctx->Line._Width != 1.0)
+ ctx->_TriangleCaps |= DD_LINE_WIDTH;
+ }
+
+ /*
+ * Polygons
+ */
+ if (new_state & _NEW_POLYGON) {
+ if (ctx->Polygon.SmoothFlag)
+ ctx->_TriangleCaps |= DD_TRI_SMOOTH;
+ if (ctx->Polygon.StippleFlag)
+ ctx->_TriangleCaps |= DD_TRI_STIPPLE;
+ if (ctx->Polygon.FrontMode != GL_FILL
+ || ctx->Polygon.BackMode != GL_FILL)
+ ctx->_TriangleCaps |= DD_TRI_UNFILLED;
+ if (ctx->Polygon.CullFlag
+ && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
+ ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
+ if (ctx->Polygon.OffsetPoint ||
+ ctx->Polygon.OffsetLine ||
+ ctx->Polygon.OffsetFill)
+ ctx->_TriangleCaps |= DD_TRI_OFFSET;
+ }
+
+ /*
+ * Lighting and shading
+ */
+ if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
+ ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
+ if (ctx->Light.ShadeModel == GL_FLAT)
+ ctx->_TriangleCaps |= DD_FLATSHADE;
+ if (NEED_SECONDARY_COLOR(ctx))
+ ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
+
+ /*
+ * Stencil
+ */
+ if (ctx->Stencil._TestTwoSide)
+ ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
+}
+
+
+/**
+ * Compute derived GL state.
+ * If __GLcontextRec::NewState is non-zero then this function \b must
+ * be called before rendering anything.
*
* Calls dd_function_table::UpdateState to perform any internal state
* management necessary.
*
* \sa _mesa_update_modelview_project(), _mesa_update_texture(),
- * _mesa_update_buffer_bounds(), _mesa_update_polygon(),
+ * _mesa_update_buffer_bounds(),
* _mesa_update_lighting() and _mesa_update_tnl_spaces().
*/
void
if (new_state & _NEW_POINT)
_mesa_update_point( ctx );
- if (new_state & _NEW_POLYGON)
- _mesa_update_polygon( ctx );
-
if (new_state & _NEW_LIGHT)
_mesa_update_lighting( ctx );
if (new_state & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_pixel( ctx, new_state );
- if (new_state & _DD_NEW_SEPARATE_SPECULAR)
- update_separate_specular( ctx );
-
if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
update_arrays( ctx );
if (new_state & _NEW_COLOR)
update_color( ctx );
+ if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
+ | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR))
+ update_tricaps( ctx, new_state );
+
if (ctx->_MaintainTexEnvProgram) {
if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG))
_mesa_UpdateTexEnvProgram(ctx);
/*@}*/
+
+