#include "glapi.h"
+#include "imports.h"
#include "mtypes.h"
extern GLcontext *
_mesa_create_context( const GLvisual *visual,
GLcontext *share_list,
- void *driver_ctx,
- GLboolean direct );
+ const struct dd_function_table *driverFunctions,
+ void *driverContext );
extern GLboolean
_mesa_initialize_context( GLcontext *ctx,
const GLvisual *visual,
GLcontext *share_list,
- void *driver_ctx,
- GLboolean direct );
+ const struct dd_function_table *driverFunctions,
+ void *driverContext );
extern void
_mesa_free_context_data( GLcontext *ctx );
_mesa_record_error( GLcontext *ctx, GLenum error );
-extern void
+extern void GLAPIENTRY
_mesa_Finish( void );
-extern void
+extern void GLAPIENTRY
_mesa_Flush( void );
/*@}*/
/** \name Macros for contexts/flushing. */
/*@{*/
+
/**
* Flush vertices.
*
* Checks if dd_function_table::NeedFlush is marked to flush stored vertices,
* and calls dd_function_table::FlushVertices if so. Marks
* __GLcontextRec::NewState with \p newstate.
- *
- * \todo Eventually let the driver specify what state changes require a flush:
*/
#define FLUSH_VERTICES(ctx, newstate) \
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
- _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", __FUNCTION__); \
+ _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\
if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
ctx->NewState |= newstate; \
#define FLUSH_CURRENT(ctx, newstate) \
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
- _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \
+ _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION); \
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
ctx->NewState |= newstate; \
/*@}*/
+
+/**
+ * Macros to help evaluate current state conditions
+ */
+
+/*@{*/
+
+/**
+ * Is the secondary color needed?
+ */
+#define NEED_SECONDARY_COLOR(CTX) \
+ (((CTX)->Light.Enabled && \
+ (CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \
+ || (CTX)->Fog.ColorSumEnabled \
+ || ((CTX)->VertexProgram.Enabled && \
+ ((CTX)->VertexProgram.Current->InputsRead & VERT_BIT_COLOR1)) \
+ || ((CTX)->FragmentProgram.Enabled && \
+ ((CTX)->FragmentProgram.Current->InputsRead & FRAG_BIT_COL1)) \
+ )
+
+
+/**
+ * Is two-sided lighting in effect?
+ */
+#define NEED_TWO_SIDED_LIGHTING(CTX) \
+ (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
+
+
+/*@}*/
+
+
#endif