aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2013-06-14 19:48:57 +0200
committerRoland Scheidegger <[email protected]>2013-06-18 18:01:24 +0200
commit793e8e3d7ed816cc9a066245dde798afdcf8b581 (patch)
treeb71d5597d0d8669df8ed896b989bc519c82659d2 /src/gallium/drivers/radeonsi
parent443dc15cf77edcaa7804c4277f0cce5d7c1d6b25 (diff)
gallium: add condition parameter to render_condition
For conditional rendering this makes it possible to skip rendering if either the predicate is true or false, as supported by d3d10 (in fact previously it was sort of implied skip rendering if predicate is false for occlusion predicate, and true for so_overflow predicate). There's no cap bit for this as presumably all drivers could do it trivially (but this patch does not implement it for the drivers using true hw predicates, nvxx, r600, radeonsi, no change is expected for OpenGL functionality). Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/r600_blit.c4
-rw-r--r--src/gallium/drivers/radeonsi/r600_query.c4
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pipe.c6
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pipe.h2
4 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/r600_blit.c b/src/gallium/drivers/radeonsi/r600_blit.c
index 724d481daad..34f14bae034 100644
--- a/src/gallium/drivers/radeonsi/r600_blit.c
+++ b/src/gallium/drivers/radeonsi/r600_blit.c
@@ -80,8 +80,9 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op
if ((op & R600_DISABLE_RENDER_COND) && rctx->current_render_cond) {
rctx->saved_render_cond = rctx->current_render_cond;
+ rctx->saved_render_cond_cond = rctx->current_render_cond_cond;
rctx->saved_render_cond_mode = rctx->current_render_cond_mode;
- rctx->context.render_condition(&rctx->context, NULL, 0);
+ rctx->context.render_condition(&rctx->context, NULL, FALSE, 0);
}
}
@@ -92,6 +93,7 @@ static void r600_blitter_end(struct pipe_context *ctx)
if (rctx->saved_render_cond) {
rctx->context.render_condition(&rctx->context,
rctx->saved_render_cond,
+ rctx->saved_render_cond_cond,
rctx->saved_render_cond_mode);
rctx->saved_render_cond = NULL;
}
diff --git a/src/gallium/drivers/radeonsi/r600_query.c b/src/gallium/drivers/radeonsi/r600_query.c
index bbf7c046f57..0162cce894a 100644
--- a/src/gallium/drivers/radeonsi/r600_query.c
+++ b/src/gallium/drivers/radeonsi/r600_query.c
@@ -69,6 +69,7 @@ static boolean r600_get_query_result(struct pipe_context *ctx,
static void r600_render_condition(struct pipe_context *ctx,
struct pipe_query *query,
+ boolean condition,
uint mode)
{
struct r600_context *rctx = (struct r600_context *)ctx;
@@ -78,12 +79,13 @@ static void r600_render_condition(struct pipe_context *ctx,
/* If we already have nonzero result, render unconditionally */
if (query != NULL && rquery->result.u64 != 0) {
if (rctx->current_render_cond) {
- r600_render_condition(ctx, NULL, 0);
+ r600_render_condition(ctx, NULL, FALSE, 0);
}
return;
}
rctx->current_render_cond = query;
+ rctx->current_render_cond_cond = condition;
rctx->current_render_cond_mode = mode;
if (query == NULL) {
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
index 382311f39bd..3f4cd78cd57 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
@@ -139,6 +139,7 @@ void radeonsi_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence,
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_fence **rfence = (struct r600_fence**)fence;
struct pipe_query *render_cond = NULL;
+ boolean render_cond_cond = FALSE;
unsigned render_cond_mode = 0;
if (rfence)
@@ -147,15 +148,16 @@ void radeonsi_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence,
/* Disable render condition. */
if (rctx->current_render_cond) {
render_cond = rctx->current_render_cond;
+ render_cond_cond = rctx->current_render_cond_cond;
render_cond_mode = rctx->current_render_cond_mode;
- ctx->render_condition(ctx, NULL, 0);
+ ctx->render_condition(ctx, NULL, FALSE, 0);
}
si_context_flush(rctx, flags);
/* Re-enable render condition. */
if (render_cond) {
- ctx->render_condition(ctx, render_cond, render_cond_mode);
+ ctx->render_condition(ctx, render_cond, render_cond_cond, render_cond_mode);
}
}
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index 67cb14b7cc0..90d67e28d21 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -153,8 +153,10 @@ struct r600_context {
struct si_cs_shader_state cs_shader_state;
struct pipe_query *current_render_cond;
unsigned current_render_cond_mode;
+ boolean current_render_cond_cond;
struct pipe_query *saved_render_cond;
unsigned saved_render_cond_mode;
+ boolean saved_render_cond_cond;
/* shader information */
unsigned sprite_coord_enable;
unsigned export_16bpc;