diff options
author | Roland Scheidegger <[email protected]> | 2013-06-14 19:48:57 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-06-18 18:01:24 +0200 |
commit | 793e8e3d7ed816cc9a066245dde798afdcf8b581 (patch) | |
tree | b71d5597d0d8669df8ed896b989bc519c82659d2 /src/gallium/auxiliary | |
parent | 443dc15cf77edcaa7804c4277f0cce5d7c1d6b25 (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/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.c | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.h | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/hud/hud_context.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/postprocess/pp_run.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_blit.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_blitter.c | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_blitter.h | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_gen_mipmap.c | 2 |
8 files changed, 21 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b06a070ad83..6805427b816 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 20ab4ef1aaa..82c8e18def0 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); diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index cbd00a9614a..9817083144e 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -456,7 +456,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) cso_set_geometry_shader_handle(cso, NULL); cso_set_vertex_shader_handle(cso, hud->vs); cso_set_vertex_elements(cso, 2, hud->velems); - cso_set_render_condition(cso, NULL, 0); + cso_set_render_condition(cso, NULL, FALSE, 0); cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, 1, &hud->font_sampler_view); cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 1, sampler_states); diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index 8b3f451640a..54253f41828 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -90,7 +90,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, cso_set_sample_mask(cso, ~0); cso_set_stream_outputs(cso, 0, NULL, 0); cso_set_geometry_shader_handle(cso, NULL); - cso_set_render_condition(cso, NULL, 0); + cso_set_render_condition(cso, NULL, FALSE, 0); // Kept only for this frame. pipe_resource_reference(&ppq->depth, indepth); diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index cda66d15749..07418be45e8 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -679,7 +679,7 @@ util_blit_pixels(struct blit_state *ctx, cso_set_rasterizer(ctx->cso, &ctx->rasterizer); cso_set_vertex_elements(ctx->cso, 2, ctx->velem); cso_set_stream_outputs(ctx->cso, 0, NULL, 0); - cso_set_render_condition(ctx->cso, NULL, 0); + cso_set_render_condition(ctx->cso, NULL, FALSE, 0); /* default sampler state */ ctx->sampler.normalized_coords = normalized; diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index e9ac170f796..be839d4390e 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -492,7 +492,7 @@ static void blitter_disable_render_cond(struct blitter_context_priv *ctx) struct pipe_context *pipe = ctx->base.pipe; if (ctx->base.saved_render_cond_query) { - pipe->render_condition(pipe, NULL, 0); + pipe->render_condition(pipe, NULL, FALSE, 0); } } @@ -502,6 +502,7 @@ static void blitter_restore_render_cond(struct blitter_context_priv *ctx) if (ctx->base.saved_render_cond_query) { pipe->render_condition(pipe, ctx->base.saved_render_cond_query, + ctx->base.saved_render_cond_cond, ctx->base.saved_render_cond_mode); ctx->base.saved_render_cond_query = NULL; } diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index e52d5acc95f..d9cefde500a 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -125,6 +125,7 @@ struct blitter_context struct pipe_query *saved_render_cond_query; uint saved_render_cond_mode; + boolean saved_render_cond_cond; }; /** @@ -515,10 +516,12 @@ util_blitter_save_sample_mask(struct blitter_context *blitter, static INLINE void util_blitter_save_render_condition(struct blitter_context *blitter, struct pipe_query *query, + boolean condition, uint mode) { blitter->saved_render_cond_query = query; blitter->saved_render_cond_mode = mode; + blitter->saved_render_cond_cond = condition; } #ifdef __cplusplus diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 7974b1d7612..a885f2b0f28 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1578,7 +1578,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_set_sample_mask(ctx->cso, ~0); cso_set_vertex_elements(ctx->cso, 2, ctx->velem); cso_set_stream_outputs(ctx->cso, 0, NULL, 0); - cso_set_render_condition(ctx->cso, NULL, 0); + cso_set_render_condition(ctx->cso, NULL, FALSE, 0); set_fragment_shader(ctx, type, is_depth); set_vertex_shader(ctx); |