diff options
author | Marek Olšák <[email protected]> | 2012-09-12 23:33:50 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-09-30 18:57:56 +0200 |
commit | 84d2f2295e8274c1b3676b59fedfc173836d378e (patch) | |
tree | a1f67048a654f2efe9551f96f639edd65d2f394f /src/gallium/auxiliary | |
parent | 59dfe0af604e13445b3cc7d267d6f9f1e4ea0411 (diff) |
gallium/u_blitter: add ability to disable and restore the render condition
Tested-by: Michel Dänzer <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/util/u_blitter.c | 36 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_blitter.h | 12 |
2 files changed, 48 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 3f0d1b17d01..a47fba6e1eb 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -467,6 +467,26 @@ static void blitter_check_saved_fb_state(struct blitter_context_priv *ctx) assert(ctx->base.saved_fb_state.nr_cbufs != ~0); } +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); + } +} + +static void blitter_restore_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, ctx->base.saved_render_cond_query, + ctx->base.saved_render_cond_mode); + ctx->base.saved_render_cond_query = NULL; + } +} + static void blitter_restore_fb_state(struct blitter_context_priv *ctx) { struct pipe_context *pipe = ctx->base.pipe; @@ -947,6 +967,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, blitter_set_running_flag(ctx); blitter_check_saved_vertex_states(ctx); blitter_check_saved_fragment_states(ctx); + blitter_disable_render_cond(ctx); /* bind states */ if (custom_blend) { @@ -989,6 +1010,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, blitter_restore_vertex_states(ctx); blitter_restore_fragment_states(ctx); + blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); } @@ -1212,6 +1234,7 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, blitter_check_saved_fragment_states(ctx); blitter_check_saved_textures(ctx); blitter_check_saved_fb_state(ctx); + blitter_disable_render_cond(ctx); /* Initialize framebuffer state. */ fb_state.width = dst->width; @@ -1329,6 +1352,7 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, blitter_restore_fragment_states(ctx); blitter_restore_textures(ctx); blitter_restore_fb_state(ctx); + blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); } @@ -1352,6 +1376,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter, blitter_check_saved_vertex_states(ctx); blitter_check_saved_fragment_states(ctx); blitter_check_saved_fb_state(ctx); + blitter_disable_render_cond(ctx); /* bind states */ pipe->bind_blend_state(pipe, ctx->blend_write_color); @@ -1376,6 +1401,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter, blitter_restore_vertex_states(ctx); blitter_restore_fragment_states(ctx); blitter_restore_fb_state(ctx); + blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); } @@ -1402,6 +1428,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter, blitter_check_saved_vertex_states(ctx); blitter_check_saved_fragment_states(ctx); blitter_check_saved_fb_state(ctx); + blitter_disable_render_cond(ctx); /* bind states */ pipe->bind_blend_state(pipe, ctx->blend_keep_color); @@ -1442,6 +1469,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter, blitter_restore_vertex_states(ctx); blitter_restore_fragment_states(ctx); blitter_restore_fb_state(ctx); + blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); } @@ -1465,6 +1493,7 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter, blitter_check_saved_vertex_states(ctx); blitter_check_saved_fragment_states(ctx); blitter_check_saved_fb_state(ctx); + blitter_disable_render_cond(ctx); /* bind states */ pipe->bind_blend_state(pipe, ctx->blend_write_color); @@ -1495,6 +1524,7 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter, blitter_restore_vertex_states(ctx); blitter_restore_fragment_states(ctx); blitter_restore_fb_state(ctx); + blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); } @@ -1536,6 +1566,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, blitter_set_running_flag(ctx); blitter_check_saved_vertex_states(ctx); + blitter_disable_render_cond(ctx); vb.buffer = src; vb.buffer_offset = srcx; @@ -1554,6 +1585,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 4); blitter_restore_vertex_states(ctx); + blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); pipe_so_target_reference(&so_target, NULL); } @@ -1576,6 +1608,7 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter, blitter_set_running_flag(ctx); blitter_check_saved_vertex_states(ctx); blitter_check_saved_fragment_states(ctx); + blitter_disable_render_cond(ctx); /* bind states */ pipe->bind_blend_state(pipe, custom_blend); @@ -1615,6 +1648,7 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter, blitter_restore_fb_state(ctx); blitter_restore_vertex_states(ctx); blitter_restore_fragment_states(ctx); + blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); pipe_surface_reference(&srcsurf, NULL); @@ -1638,6 +1672,7 @@ void util_blitter_custom_color(struct blitter_context *blitter, blitter_check_saved_vertex_states(ctx); blitter_check_saved_fragment_states(ctx); blitter_check_saved_fb_state(ctx); + blitter_disable_render_cond(ctx); /* bind states */ pipe->bind_blend_state(pipe, custom_blend); @@ -1663,5 +1698,6 @@ void util_blitter_custom_color(struct blitter_context *blitter, blitter_restore_vertex_states(ctx); blitter_restore_fragment_states(ctx); blitter_restore_fb_state(ctx); + blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); } diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index d458f692702..43b732699e3 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -108,6 +108,9 @@ struct blitter_context int saved_num_so_targets; struct pipe_stream_output_target *saved_so_targets[PIPE_MAX_SO_BUFFERS]; + + struct pipe_query *saved_render_cond_query; + uint saved_render_cond_mode; }; /** @@ -475,6 +478,15 @@ util_blitter_save_sample_mask(struct blitter_context *blitter, blitter->saved_sample_mask = sample_mask; } +static INLINE void +util_blitter_save_render_condition(struct blitter_context *blitter, + struct pipe_query *query, + uint mode) +{ + blitter->saved_render_cond_query = query; + blitter->saved_render_cond_mode = mode; +} + #ifdef __cplusplus } #endif |