summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/cso_cache
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2013-06-14 19:48:57 +0200
committerRoland Scheidegger <sroland@vmware.com>2013-06-18 18:01:24 +0200
commit793e8e3d7ed816cc9a066245dde798afdcf8b581 (patch)
treeb71d5597d0d8669df8ed896b989bc519c82659d2 /src/gallium/auxiliary/cso_cache
parent443dc15cf77edcaa7804c4277f0cce5d7c1d6b25 (diff)
downloadexternal_mesa3d-793e8e3d7ed816cc9a066245dde798afdcf8b581.zip
external_mesa3d-793e8e3d7ed816cc9a066245dde798afdcf8b581.tar.gz
external_mesa3d-793e8e3d7ed816cc9a066245dde798afdcf8b581.tar.bz2
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 <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/cso_cache')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c13
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h3
2 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index b06a070..6805427 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -111,6 +111,7 @@ struct cso_context {
void *velements, *velements_saved;
struct pipe_query *render_condition, *render_condition_saved;
uint render_condition_mode, render_condition_mode_saved;
+ boolean render_condition_cond, render_condition_cond_saved;
struct pipe_clip_state clip;
struct pipe_clip_state clip_saved;
@@ -723,13 +724,17 @@ void cso_restore_stencil_ref(struct cso_context *ctx)
}
void cso_set_render_condition(struct cso_context *ctx,
- struct pipe_query *query, uint mode)
+ struct pipe_query *query,
+ boolean condition, uint mode)
{
struct pipe_context *pipe = ctx->pipe;
- if (ctx->render_condition != query || ctx->render_condition_mode != mode) {
- pipe->render_condition(pipe, query, mode);
+ if (ctx->render_condition != query ||
+ ctx->render_condition_mode != mode ||
+ ctx->render_condition_cond != condition) {
+ pipe->render_condition(pipe, query, condition, mode);
ctx->render_condition = query;
+ ctx->render_condition_cond = condition;
ctx->render_condition_mode = mode;
}
}
@@ -737,12 +742,14 @@ void cso_set_render_condition(struct cso_context *ctx,
void cso_save_render_condition(struct cso_context *ctx)
{
ctx->render_condition_saved = ctx->render_condition;
+ ctx->render_condition_cond_saved = ctx->render_condition_cond;
ctx->render_condition_mode_saved = ctx->render_condition_mode;
}
void cso_restore_render_condition(struct cso_context *ctx)
{
cso_set_render_condition(ctx, ctx->render_condition_saved,
+ ctx->render_condition_cond_saved,
ctx->render_condition_mode_saved);
}
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index 20ab4ef..82c8e18 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -170,7 +170,8 @@ void cso_save_stencil_ref(struct cso_context *cso);
void cso_restore_stencil_ref(struct cso_context *cso);
void cso_set_render_condition(struct cso_context *cso,
- struct pipe_query *query, uint mode);
+ struct pipe_query *query,
+ boolean condition, uint mode);
void cso_save_render_condition(struct cso_context *cso);
void cso_restore_render_condition(struct cso_context *cso);