Move context ASSERT/FLUSH macros to context.h
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 18 Sep 2003 16:45:44 +0000 (16:45 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 18 Sep 2003 16:45:44 +0000 (16:45 +0000)
src/mesa/main/context.h
src/mesa/main/mtypes.h

index edd78e302d883f5e1b20fcefb222f74c1a6daf7b..be65be821478c085a956eebda3581b2c8ff9db82 100644 (file)
@@ -257,4 +257,108 @@ _mesa_Flush( void );
 
 /*@}*/
 
+
+
+/**********************************************************************/
+/** \name Macros for contexts/flushing. */
+/*@{*/
+
+/**
+ * Flush vertices.
+ *
+ * \param ctx GL context.
+ * \param newstate new state.
+ *
+ * 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__);        \
+   if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES)          \
+      ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES);   \
+   ctx->NewState |= newstate;                                  \
+} while (0)
+
+/**
+ * Flush current state.
+ *
+ * \param ctx GL context.
+ * \param newstate new state.
+ *
+ * Checks if dd_function_table::NeedFlush is marked to flush current state,
+ * and calls dd_function_table::FlushVertices if so. Marks
+ * __GLcontextRec::NewState with \p newstate.
+ */
+#define FLUSH_CURRENT(ctx, newstate)                           \
+do {                                                           \
+   if (MESA_VERBOSE & VERBOSE_STATE)                           \
+      _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \
+   if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)           \
+      ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT);    \
+   ctx->NewState |= newstate;                                  \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair, with return value.
+ * 
+ * \param ctx GL context.
+ * \param retval value to return value in case the assertion fails.
+ */
+#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval)              \
+do {                                                                   \
+   if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {   \
+      _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" );           \
+      return retval;                                                   \
+   }                                                                   \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair.
+ * 
+ * \param ctx GL context.
+ */
+#define ASSERT_OUTSIDE_BEGIN_END(ctx)                                  \
+do {                                                                   \
+   if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {   \
+      _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" );           \
+      return;                                                          \
+   }                                                                   \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair and flush the vertices.
+ * 
+ * \param ctx GL context.
+ */
+#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx)                                \
+do {                                                                   \
+   ASSERT_OUTSIDE_BEGIN_END(ctx);                                      \
+   FLUSH_VERTICES(ctx, 0);                                             \
+} while (0)
+
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair and flush the vertices, with return value.
+ * 
+ * \param ctx GL context.
+ * \param retval value to return value in case the assertion fails.
+ */
+#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)    \
+do {                                                                   \
+   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval);                  \
+   FLUSH_VERTICES(ctx, 0);                                             \
+} while (0)
+
+
+/*@}*/
+
+
 #endif
index 9a5bec693e6ed0d04ba071b85b71417086bc7524..c996dbbe7bec4ffa9597f130f39fcd8f1b009a72 100644 (file)
@@ -2274,99 +2274,4 @@ enum _debug {
 #define Elements(x) sizeof(x)/sizeof(*(x))
 
 
-/**
- * Flush vertices.
- *
- * \param ctx GL context.
- * \param newstate new state.
- *
- * 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__);        \
-   if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES)          \
-      ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES);   \
-   ctx->NewState |= newstate;                                  \
-} while (0)
-
-/**
- * Flush current state.
- *
- * \param ctx GL context.
- * \param newstate new state.
- *
- * Checks if dd_function_table::NeedFlush is marked to flush current state,
- * and calls dd_function_table::FlushVertices if so. Marks
- * __GLcontextRec::NewState with \p newstate.
- */
-#define FLUSH_CURRENT(ctx, newstate)                           \
-do {                                                           \
-   if (MESA_VERBOSE & VERBOSE_STATE)                           \
-      _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \
-   if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)           \
-      ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT);    \
-   ctx->NewState |= newstate;                                  \
-} while (0)
-
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair, with return value.
- * 
- * \param ctx GL context.
- * \param retval value to return value in case the assertion fails.
- */
-#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval)              \
-do {                                                                   \
-   if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {   \
-      _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" );           \
-      return retval;                                                   \
-   }                                                                   \
-} while (0)
-
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair.
- * 
- * \param ctx GL context.
- */
-#define ASSERT_OUTSIDE_BEGIN_END(ctx)                                  \
-do {                                                                   \
-   if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {   \
-      _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" );           \
-      return;                                                          \
-   }                                                                   \
-} while (0)
-
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair and flush the vertices.
- * 
- * \param ctx GL context.
- */
-#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx)                                \
-do {                                                                   \
-   ASSERT_OUTSIDE_BEGIN_END(ctx);                                      \
-   FLUSH_VERTICES(ctx, 0);                                             \
-} while (0)
-
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair and flush the vertices, with return value.
- * 
- * \param ctx GL context.
- * \param retval value to return value in case the assertion fails.
- */
-#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)    \
-do {                                                                   \
-   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval);                  \
-   FLUSH_VERTICES(ctx, 0);                                             \
-} while (0)
-
-
 #endif /* TYPES_H */