[Mesa-dev] [PATCH 09/12] radeonsi: don't save and restore vertex buffers and elements for u_blitter
Marek Olšák
maraeo at gmail.com
Fri Oct 6 14:10:12 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/util/u_blitter.c | 15 +++++++++------
src/gallium/drivers/radeonsi/si_blit.c | 2 --
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 47042e4..a5c1f17 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -545,43 +545,46 @@ void util_blitter_unset_running_flag(struct blitter_context *blitter)
_debug_printf("u_blitter:%i: Caught recursion. This is a driver bug.\n",
__LINE__);
}
blitter->running = false;
blitter->pipe->set_active_query_state(blitter->pipe, true);
}
static void blitter_check_saved_vertex_states(struct blitter_context_priv *ctx)
{
- assert(ctx->base.saved_velem_state != INVALID_PTR);
assert(ctx->base.saved_vs != INVALID_PTR);
assert(!ctx->has_geometry_shader || ctx->base.saved_gs != INVALID_PTR);
assert(!ctx->has_tessellation || ctx->base.saved_tcs != INVALID_PTR);
assert(!ctx->has_tessellation || ctx->base.saved_tes != INVALID_PTR);
assert(!ctx->has_stream_out || ctx->base.saved_num_so_targets != ~0u);
assert(ctx->base.saved_rs_state != INVALID_PTR);
}
void util_blitter_restore_vertex_states(struct blitter_context *blitter)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
unsigned i;
/* Vertex buffer. */
- pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1,
- &ctx->base.saved_vertex_buffer);
- pipe_vertex_buffer_unreference(&ctx->base.saved_vertex_buffer);
+ if (ctx->base.saved_vertex_buffer.buffer.resource) {
+ pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1,
+ &ctx->base.saved_vertex_buffer);
+ pipe_vertex_buffer_unreference(&ctx->base.saved_vertex_buffer);
+ }
/* Vertex elements. */
- pipe->bind_vertex_elements_state(pipe, ctx->base.saved_velem_state);
- ctx->base.saved_velem_state = INVALID_PTR;
+ if (ctx->base.saved_velem_state != INVALID_PTR) {
+ pipe->bind_vertex_elements_state(pipe, ctx->base.saved_velem_state);
+ ctx->base.saved_velem_state = INVALID_PTR;
+ }
/* Vertex shader. */
pipe->bind_vs_state(pipe, ctx->base.saved_vs);
ctx->base.saved_vs = INVALID_PTR;
/* Geometry shader. */
if (ctx->has_geometry_shader) {
pipe->bind_gs_state(pipe, ctx->base.saved_gs);
ctx->base.saved_gs = INVALID_PTR;
}
diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index 0a0528a..b3f44c3 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -47,22 +47,20 @@ enum si_blitter_op /* bitmask */
SI_DECOMPRESS = SI_SAVE_FRAMEBUFFER | SI_SAVE_FRAGMENT_STATE |
SI_DISABLE_RENDER_COND,
SI_COLOR_RESOLVE = SI_SAVE_FRAMEBUFFER | SI_SAVE_FRAGMENT_STATE
};
static void si_blitter_begin(struct pipe_context *ctx, enum si_blitter_op op)
{
struct si_context *sctx = (struct si_context *)ctx;
- util_blitter_save_vertex_buffer_slot(sctx->blitter, sctx->vertex_buffer);
- util_blitter_save_vertex_elements(sctx->blitter, sctx->vertex_elements);
util_blitter_save_vertex_shader(sctx->blitter, sctx->vs_shader.cso);
util_blitter_save_tessctrl_shader(sctx->blitter, sctx->tcs_shader.cso);
util_blitter_save_tesseval_shader(sctx->blitter, sctx->tes_shader.cso);
util_blitter_save_geometry_shader(sctx->blitter, sctx->gs_shader.cso);
util_blitter_save_so_targets(sctx->blitter, sctx->b.streamout.num_targets,
(struct pipe_stream_output_target**)sctx->b.streamout.targets);
util_blitter_save_rasterizer(sctx->blitter, sctx->queued.named.rasterizer);
if (op & SI_SAVE_FRAGMENT_STATE) {
util_blitter_save_blend(sctx->blitter, sctx->queued.named.blend);
--
2.7.4
More information about the mesa-dev
mailing list