diff options
-rw-r--r-- | src/gallium/drivers/nv50/nv50_query.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_query.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_query.c | 11 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_context.h | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_condrender.c | 2 |
7 files changed, 24 insertions, 5 deletions
diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c index 53f94820ce..59aa2f98a4 100644 --- a/src/gallium/drivers/nv50/nv50_query.c +++ b/src/gallium/drivers/nv50/nv50_query.c @@ -128,13 +128,19 @@ nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq, static void nv50_render_condition(struct pipe_context *pipe, - struct pipe_query *pq, uint mode) + struct pipe_query *pq, + boolean predicate, + uint mode) { struct nv50_context *nv50 = nv50_context(pipe); struct nouveau_channel *chan = nv50->screen->base.channel; struct nouveau_grobj *tesla = nv50->screen->tesla; struct nv50_query *q; + /* Mesa state tracker only uses FALSE so far: + */ + assert(predicate == FALSE); + if (!pq) { BEGIN_RING(chan, tesla, NV50TCL_COND_MODE, 1); OUT_RING (chan, NV50TCL_COND_MODE_ALWAYS); diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 7c08806368..d0a430b23f 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -172,6 +172,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe, static void r300_render_condition(struct pipe_context *pipe, struct pipe_query *query, + boolean predicate, uint mode) { struct r300_context *r300 = r300_context(pipe); @@ -186,7 +187,7 @@ static void r300_render_condition(struct pipe_context *pipe, r300->skip_rendering = FALSE; } - r300->skip_rendering = result == 0; + r300->skip_rendering = (result > 0) == predicate; } else { r300->skip_rendering = FALSE; } diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 401a28ad31..13ae91c9d5 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -184,11 +184,13 @@ softpipe_is_resource_referenced( struct pipe_context *pipe, static void softpipe_render_condition( struct pipe_context *pipe, struct pipe_query *query, + boolean predicate, uint mode ) { struct softpipe_context *softpipe = softpipe_context( pipe ); softpipe->render_cond_query = query; + softpipe->render_cond_predicate = predicate; softpipe->render_cond_mode = mode; } diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index e641a81d1f..bd0141dc5a 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -135,6 +135,7 @@ struct softpipe_context { /** Conditional query object and mode */ struct pipe_query *render_cond_query; + boolean render_cond_predicate; uint render_cond_mode; /** Software quad rendering pipeline */ diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c index 245f1b554c..23f65ef147 100644 --- a/src/gallium/drivers/softpipe/sp_query.c +++ b/src/gallium/drivers/softpipe/sp_query.c @@ -168,8 +168,15 @@ softpipe_check_render_cond(struct softpipe_context *sp) sp->render_cond_mode == PIPE_RENDER_COND_BY_REGION_WAIT); b = pipe->get_query_result(pipe, sp->render_cond_query, wait, &result); - if (b) - return result > 0; + if (b) { + /* Consider the condition TRUE if any fragments were rasterized. + */ + boolean predicate = (result > 0); + + /* Permit rendering if condition does not match render_cond_predicate. + */ + return predicate != sp->render_cond_predicate; + } else return TRUE; } diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 72afad60ba..8732eabe06 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -111,10 +111,12 @@ struct pipe_context { /** * Predicate subsequent rendering on occlusion query result * \param query the query predicate, or NULL if no predicate + * \param value the condition on which to permit rendering * \param mode one of PIPE_RENDER_COND_x */ void (*render_condition)( struct pipe_context *pipe, struct pipe_query *query, + boolean predicate_value, uint mode ); /** diff --git a/src/mesa/state_tracker/st_cb_condrender.c b/src/mesa/state_tracker/st_cb_condrender.c index b509d43b7c..f65f71ef82 100644 --- a/src/mesa/state_tracker/st_cb_condrender.c +++ b/src/mesa/state_tracker/st_cb_condrender.c @@ -72,7 +72,7 @@ st_BeginConditionalRender(GLcontext *ctx, struct gl_query_object *q, m = PIPE_RENDER_COND_WAIT; } - pipe->render_condition(pipe, stq->pq, m); + pipe->render_condition(pipe, stq->pq, FALSE, m); } |