mesa: plug in GL_ARB_draw_buffers_blend functions
[mesa.git] / src / mesa / main / condrender.c
index 52762133a0ee1c43fd5a7e1e764e9bcb5b64c1ef..352e2e2b165dbf8cea6a6e42b3edf840d3d1c844 100644 (file)
 #include "glheader.h"
 #include "condrender.h"
 #include "enums.h"
+#include "mtypes.h"
 #include "queryobj.h"
 
 
-GLAPI void GLAPIENTRY
+void GLAPIENTRY
 _mesa_BeginConditionalRender(GLuint queryId, GLenum mode)
 {
    struct gl_query_object *q;
    GET_CURRENT_CONTEXT(ctx);
 
-   if (ctx->Query.CondRenderQuery) {
+   if (!ctx->Extensions.NV_conditional_render || ctx->Query.CondRenderQuery) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginConditionalRender()");
       return;
    }
@@ -84,12 +85,14 @@ _mesa_BeginConditionalRender(GLuint queryId, GLenum mode)
 }
 
 
-GLAPI void APIENTRY
+void APIENTRY
 _mesa_EndConditionalRender(void)
 {
    GET_CURRENT_CONTEXT(ctx);
 
-   if (!ctx->Query.CondRenderQuery) {
+   FLUSH_VERTICES(ctx, 0x0);
+
+   if (!ctx->Extensions.NV_conditional_render || !ctx->Query.CondRenderQuery) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glEndConditionalRender()");
       return;
    }
@@ -103,17 +106,19 @@ _mesa_EndConditionalRender(void)
 
 
 /**
- * This function is called by software rendering commands to determine if
- * subsequent drawing commands should be executed or discarded depending
- * on the current conditional rendering state.
- * Ideally, this check would be implemented by the GPU when doing hardware
- * rendering.
- * XXX should this function be called via a new driver hook?
+ * This function is called by software rendering commands (all point,
+ * line triangle drawing, glClear, glDrawPixels, glCopyPixels, and
+ * glBitmap, glBlitFramebuffer) to determine if subsequent drawing
+ * commands should be
+ * executed or discarded depending on the current conditional
+ * rendering state.  Ideally, this check would be implemented by the
+ * GPU when doing hardware rendering.  XXX should this function be
+ * called via a new driver hook?
  *
  * \return GL_TRUE if we should render, GL_FALSE if we should discard
  */
 GLboolean
-_mesa_check_conditional_render(GLcontext *ctx)
+_mesa_check_conditional_render(struct gl_context *ctx)
 {
    struct gl_query_object *q = ctx->Query.CondRenderQuery;