mesa/st: Support ARB_conditional_render_inverted modes
authorTobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Sun, 17 Aug 2014 22:41:12 +0000 (00:41 +0200)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 19 Aug 2014 13:02:29 +0000 (09:02 -0400)
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
src/mesa/state_tracker/st_cb_condrender.c
src/mesa/state_tracker/st_extensions.c

index 8776985f961277a4d24946f4fc0938f0aab1d2c8..f02472aec8b632a7c8a2ebbcc1744056850412f2 100644 (file)
@@ -55,6 +55,8 @@ st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q,
    struct st_query_object *stq = st_query_object(q);
    struct st_context *st = st_context(ctx);
    uint m;
+   /* Don't invert the condition for rendering by default */
+   boolean inverted = FALSE;
 
    st_flush_bitmap_cache(st);
 
@@ -71,12 +73,28 @@ st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q,
    case GL_QUERY_BY_REGION_NO_WAIT:
       m = PIPE_RENDER_COND_BY_REGION_NO_WAIT;
       break;
+   case GL_QUERY_WAIT_INVERTED:
+      m = PIPE_RENDER_COND_WAIT;
+      inverted = TRUE;
+      break;
+   case GL_QUERY_NO_WAIT_INVERTED:
+      m = PIPE_RENDER_COND_NO_WAIT;
+      inverted = TRUE;
+      break;
+   case GL_QUERY_BY_REGION_WAIT_INVERTED:
+      m = PIPE_RENDER_COND_BY_REGION_WAIT;
+      inverted = TRUE;
+      break;
+   case GL_QUERY_BY_REGION_NO_WAIT_INVERTED:
+      m = PIPE_RENDER_COND_BY_REGION_NO_WAIT;
+      inverted = TRUE;
+      break;
    default:
       assert(0 && "bad mode in st_BeginConditionalRender");
       m = PIPE_RENDER_COND_WAIT;
    }
 
-   cso_set_render_condition(st->cso_context, stq->pq, FALSE, m);
+   cso_set_render_condition(st->cso_context, stq->pq, inverted, m);
 }
 
 
index 24e886ccb807be516cc7e62f17a8726efc9067f6..4110eb5dd5fec3663c291c45cef4073abc642dbf 100644 (file)
@@ -460,6 +460,7 @@ void st_init_extensions(struct pipe_screen *screen,
       { o(ARB_sample_shading),               PIPE_CAP_SAMPLE_SHADING                   },
       { o(ARB_draw_indirect),                PIPE_CAP_DRAW_INDIRECT                    },
       { o(ARB_derivative_control),           PIPE_CAP_TGSI_FS_FINE_DERIVATIVE          },
+      { o(ARB_conditional_render_inverted),  PIPE_CAP_CONDITIONAL_RENDER_INVERTED      },
    };
 
    /* Required: render target and sampler support */