summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_blitter.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-09-12 23:33:50 +0200
committerMarek Olšák <[email protected]>2012-09-30 18:57:56 +0200
commit84d2f2295e8274c1b3676b59fedfc173836d378e (patch)
treea1f67048a654f2efe9551f96f639edd65d2f394f /src/gallium/auxiliary/util/u_blitter.c
parent59dfe0af604e13445b3cc7d267d6f9f1e4ea0411 (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/util/u_blitter.c')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c36
1 files changed, 36 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);
}