replace color table FloatTable boolean with Type enum
[mesa.git] / src / mesa / main / context.h
index be65be821478c085a956eebda3581b2c8ff9db82..e55b383dec6400175ff20ef1e77606275273c9be 100644 (file)
@@ -49,6 +49,7 @@
 
 
 #include "glapi.h"
+#include "imports.h"
 #include "mtypes.h"
 
 
@@ -132,15 +133,15 @@ _mesa_destroy_framebuffer( GLframebuffer *buffer );
 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 );
@@ -249,10 +250,10 @@ extern void
 _mesa_record_error( GLcontext *ctx, GLenum error );
 
 
-extern void
+extern void GLAPIENTRY
 _mesa_Finish( void );
 
-extern void
+extern void GLAPIENTRY
 _mesa_Flush( void );
 
 /*@}*/
@@ -263,6 +264,7 @@ _mesa_Flush( void );
 /** \name Macros for contexts/flushing. */
 /*@{*/
 
+
 /**
  * Flush vertices.
  *
@@ -272,13 +274,11 @@ _mesa_Flush( void );
  * 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;                                  \
@@ -297,7 +297,7 @@ do {                                                                \
 #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;                                  \
@@ -361,4 +361,35 @@ do {                                                                       \
 /*@}*/
 
 
+
+/**
+ * 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