summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c36
-rw-r--r--src/gallium/auxiliary/util/u_blitter.h12
-rw-r--r--src/gallium/drivers/r600/r600_blit.c17
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h2
4 files changed, 53 insertions, 14 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
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 09fb6239221..3da583c5d09 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -84,23 +84,16 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op
}
if ((op & R600_DISABLE_RENDER_COND) && rctx->current_render_cond) {
- rctx->saved_render_cond = rctx->current_render_cond;
- rctx->saved_render_cond_mode = rctx->current_render_cond_mode;
- rctx->context.render_condition(&rctx->context, NULL, 0);
- }
-
+ util_blitter_save_render_condition(rctx->blitter,
+ rctx->current_render_cond,
+ rctx->current_render_cond_mode);
+ }
}
static void r600_blitter_end(struct pipe_context *ctx)
{
struct r600_context *rctx = (struct r600_context *)ctx;
- if (rctx->saved_render_cond) {
- rctx->context.render_condition(&rctx->context,
- rctx->saved_render_cond,
- rctx->saved_render_cond_mode);
- rctx->saved_render_cond = NULL;
- }
- r600_resume_nontimer_queries(rctx);
+ r600_resume_nontimer_queries(rctx);
}
static unsigned u_max_layer(struct pipe_resource *r, unsigned level)
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 68800609979..e66766a9844 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -385,8 +385,6 @@ struct r600_context {
struct r600_pipe_state spi;
struct pipe_query *current_render_cond;
unsigned current_render_cond_mode;
- struct pipe_query *saved_render_cond;
- unsigned saved_render_cond_mode;
/* shader information */
boolean two_side;
boolean spi_dirty;