summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_context.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-09-22 12:34:05 +0800
committerChia-I Wu <[email protected]>2014-09-22 12:51:42 +0800
commitd69faf851fff5d41086c9940b2fcf2aa72c40e60 (patch)
tree2ac6eb887dcfd5d3db183d813fea7436979e5bd4 /src/gallium/drivers/ilo/ilo_context.c
parent295a3a3ff0c93ac81b73d756e2148cde5f42caf3 (diff)
ilo: handle conditional rendering in the context
Conditional rendering is not limited to draw_vbo(). Move the support to ilo_context, and replace ilo_3d_pass_render_condition() by ilo_skip_rendering().
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_context.c')
-rw-r--r--src/gallium/drivers/ilo/ilo_context.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/gallium/drivers/ilo/ilo_context.c b/src/gallium/drivers/ilo/ilo_context.c
index 4bd2ee86ecb..a4a4dc2986b 100644
--- a/src/gallium/drivers/ilo/ilo_context.c
+++ b/src/gallium/drivers/ilo/ilo_context.c
@@ -66,6 +66,48 @@ ilo_flush(struct pipe_context *pipe,
}
static void
+ilo_render_condition(struct pipe_context *pipe,
+ struct pipe_query *query,
+ boolean condition,
+ uint mode)
+{
+ struct ilo_context *ilo = ilo_context(pipe);
+
+ /* reference count? */
+ ilo->render_condition.query = query;
+ ilo->render_condition.condition = condition;
+ ilo->render_condition.mode = mode;
+}
+
+bool
+ilo_skip_rendering(struct ilo_context *ilo)
+{
+ uint64_t result;
+ bool wait;
+
+ if (!ilo->render_condition.query)
+ return false;
+
+ switch (ilo->render_condition.mode) {
+ case PIPE_RENDER_COND_WAIT:
+ case PIPE_RENDER_COND_BY_REGION_WAIT:
+ wait = true;
+ break;
+ case PIPE_RENDER_COND_NO_WAIT:
+ case PIPE_RENDER_COND_BY_REGION_NO_WAIT:
+ default:
+ wait = false;
+ break;
+ }
+
+ if (ilo->base.get_query_result(&ilo->base, ilo->render_condition.query,
+ wait, (union pipe_query_result *) &result))
+ return ((bool) result == ilo->render_condition.condition);
+ else
+ return false;
+}
+
+static void
ilo_context_destroy(struct pipe_context *pipe)
{
struct ilo_context *ilo = ilo_context(pipe);
@@ -127,6 +169,7 @@ ilo_context_create(struct pipe_screen *screen, void *priv)
ilo->base.destroy = ilo_context_destroy;
ilo->base.flush = ilo_flush;
+ ilo->base.render_condition = ilo_render_condition;
ilo_init_3d_functions(ilo);
ilo_init_query_functions(ilo);