gallium: pass the current context to the flush_front state tracker function
[mesa.git] / src / mesa / state_tracker / st_cb_condrender.c
index 780b40c206502da5303e3dd6f56a834f87b7edbd..1ced560e1607e98834085af31014556cfa4a1dc4 100644 (file)
 #include "st_context.h"
 #include "st_cb_queryobj.h"
 #include "st_cb_condrender.h"
+#include "st_cb_bitmap.h"
 
 
 /**
  * Called via ctx->Driver.BeginConditionalRender()
  */
 static void
-st_BeginConditionalRender(GLcontext *ctx, struct gl_query_object *q,
+st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q,
                           GLenum mode)
 {
    struct st_query_object *stq = st_query_object(q);
-   struct pipe_context *pipe = ctx->st->pipe;
+   struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
    uint m;
 
+   st_flush_bitmap_cache(st);
+
    switch (mode) {
    case GL_QUERY_WAIT:
       m = PIPE_RENDER_COND_WAIT;
@@ -69,8 +73,12 @@ st_BeginConditionalRender(GLcontext *ctx, struct gl_query_object *q,
       break;
    default:
       assert(0 && "bad mode in st_BeginConditionalRender");
+      m = PIPE_RENDER_COND_WAIT;
    }
 
+   st->render_condition = stq->pq;
+   st->condition_mode = m;
+
    pipe->render_condition(pipe, stq->pq, m);
 }
 
@@ -79,11 +87,16 @@ st_BeginConditionalRender(GLcontext *ctx, struct gl_query_object *q,
  * Called via ctx->Driver.BeginConditionalRender()
  */
 static void
-st_EndConditionalRender(GLcontext *ctx, struct gl_query_object *q)
+st_EndConditionalRender(struct gl_context *ctx, struct gl_query_object *q)
 {
-   struct pipe_context *pipe = ctx->st->pipe;
+   struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
    (void) q;
+
+   st_flush_bitmap_cache(st);
+
    pipe->render_condition(pipe, NULL, 0);
+   st->render_condition = NULL;
 }