summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_query.c
diff options
context:
space:
mode:
authorRafael Antognolli <[email protected]>2019-03-06 16:59:44 -0800
committerRafael Antognolli <[email protected]>2019-03-20 16:46:25 -0700
commitce830a364e0aec8c9769729162bfe7501feb028b (patch)
treec7b430aa32ed52d988c676ed3a2288f774e696d2 /src/gallium/drivers/iris/iris_query.c
parent131b42f0aa574cc654c5970ba48c4d1896f6d502 (diff)
iris: Add iris_resolve_conditional_render().
This function can be used to stall on the CPU and resolve the predicate for the conditional render. It will convert ice->state.predicate from IRIS_PREDICATE_STATE_USE_BIT to either IRIS_PREDICATE_STATE_RENDER or IRIS_PREDICATE_STATE_DONT_RENDER, depending on the result of the query. v2: - return void (Ken) - update the stored condition (Ken) - simplify the code leading to resolve the predicate (Ken) Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_query.c')
-rw-r--r--src/gallium/drivers/iris/iris_query.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_query.c b/src/gallium/drivers/iris/iris_query.c
index ec9050b6390..76816a7c0fd 100644
--- a/src/gallium/drivers/iris/iris_query.c
+++ b/src/gallium/drivers/iris/iris_query.c
@@ -1069,6 +1069,8 @@ iris_render_condition(struct pipe_context *ctx,
/* The old condition isn't relevant; we'll update it if necessary */
ice->state.compute_predicate = NULL;
+ ice->condition.query = q;
+ ice->condition.condition = condition;
if (!q) {
ice->state.predicate = IRIS_PREDICATE_STATE_RENDER;
@@ -1090,6 +1092,23 @@ iris_render_condition(struct pipe_context *ctx,
}
void
+iris_resolve_conditional_render(struct iris_context *ice)
+{
+ struct pipe_context *ctx = (void *) ice;
+ struct iris_query *q = ice->condition.query;
+ struct pipe_query *query = (void *) q;
+ union pipe_query_result result;
+
+ if (ice->state.predicate != IRIS_PREDICATE_STATE_USE_BIT)
+ return;
+
+ assert(q);
+
+ iris_get_query_result(ctx, query, true, &result);
+ set_predicate_enable(ice, (q->result != 0) ^ ice->condition.condition);
+}
+
+void
iris_init_query_functions(struct pipe_context *ctx)
{
ctx->create_query = iris_create_query;