st/mesa: GenerateMipmap should not be killed by conditional rendering
authorMarek Olšák <maraeo@gmail.com>
Sun, 29 May 2011 13:35:25 +0000 (15:35 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 30 May 2011 08:50:43 +0000 (10:50 +0200)
NOTE: This is a candidate for the 7.10 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_cb_condrender.c
src/mesa/state_tracker/st_context.h
src/mesa/state_tracker/st_gen_mipmap.c

index 7766ead48b59af3884dab662d5d31c044fbd8562..64c6c117fca4efa71bff4a7720b2bda4f111c848 100644 (file)
@@ -51,7 +51,8 @@ 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 = st_context(ctx)->pipe;
+   struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
    uint m;
 
    switch (mode) {
@@ -72,6 +73,9 @@ st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q,
       m = PIPE_RENDER_COND_WAIT;
    }
 
+   st->render_condition = stq->pq;
+   st->condition_mode = m;
+
    pipe->render_condition(pipe, stq->pq, m);
 }
 
@@ -82,9 +86,12 @@ st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q,
 static void
 st_EndConditionalRender(struct gl_context *ctx, struct gl_query_object *q)
 {
-   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
    (void) q;
+
    pipe->render_condition(pipe, NULL, 0);
+   st->render_condition = NULL;
 }
 
 
index c6fc31801d6451ffd1d49fa3ed44f92003d58853..ff207039d78a5169ebc62f2ea273ab4e0b293157 100644 (file)
@@ -200,6 +200,10 @@ struct st_context
       GLsizei stride;
    } user_attrib[PIPE_MAX_ATTRIBS];
    unsigned num_user_attribs;
+
+   /* Active render condition. */
+   struct pipe_query *render_condition;
+   unsigned condition_mode;
 };
 
 
index b34794f1b240fe9a54a45fc6b70699ce54d1dfdc..b0911294a7c488ef0f8745030bd18976668e9996 100644 (file)
@@ -91,9 +91,18 @@ st_render_mipmap(struct st_context *st,
       return FALSE;
    }
 
+   /* Disable conditional rendering. */
+   if (st->render_condition) {
+      pipe->render_condition(pipe, NULL, 0);
+   }
+
    util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel,
                    PIPE_TEX_FILTER_LINEAR);
 
+   if (st->render_condition) {
+      pipe->render_condition(pipe, st->render_condition, st->condition_mode);
+   }
+
    return TRUE;
 }