summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
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/llvmpipe
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/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.h1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_query.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_surface.c2
4 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index a6d7e594cd6..9a6d13b5bf0 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -112,12 +112,14 @@ do_flush( struct pipe_context *pipe,
static void
llvmpipe_render_condition ( struct pipe_context *pipe,
struct pipe_query *query,
+ boolean condition,
uint mode )
{
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
llvmpipe->render_cond_query = query;
llvmpipe->render_cond_mode = mode;
+ llvmpipe->render_cond_cond = condition;
}
struct pipe_context *
diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h
index 051596878d9..27e8b0134d0 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_context.h
@@ -149,6 +149,7 @@ struct llvmpipe_context {
/** Conditional query object and mode */
struct pipe_query *render_cond_query;
uint render_cond_mode;
+ boolean render_cond_cond;
};
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
index 0fd91c044a8..973c6898dd6 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -284,12 +284,13 @@ llvmpipe_check_render_cond(struct llvmpipe_context *lp)
if (!lp->render_cond_query)
return TRUE; /* no query predicate, draw normally */
+
wait = (lp->render_cond_mode == PIPE_RENDER_COND_WAIT ||
lp->render_cond_mode == PIPE_RENDER_COND_BY_REGION_WAIT);
b = pipe->get_query_result(pipe, lp->render_cond_query, wait, (void*)&result);
if (b)
- return result > 0;
+ return (!result == lp->render_cond_cond);
else
return TRUE;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
index a40fe1be99a..7b1f9391b7e 100644
--- a/src/gallium/drivers/llvmpipe/lp_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_surface.c
@@ -227,7 +227,7 @@ static void lp_blit(struct pipe_context *pipe,
lp->num_sampler_views[PIPE_SHADER_FRAGMENT],
lp->sampler_views[PIPE_SHADER_FRAGMENT]);
util_blitter_save_render_condition(lp->blitter, lp->render_cond_query,
- lp->render_cond_mode);
+ lp->render_cond_cond, lp->render_cond_mode);
util_blitter_blit(lp->blitter, &info);
}