From 5f566faa46078500d0d70f510d3ce3e75d1f6e83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 5 Oct 2017 20:36:34 +0200 Subject: [PATCH] radeonsi: don't save and restore vertex buffers and elements for u_blitter MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- 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 47042e4e826..a5c1f178a60 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -552,7 +552,6 @@ void util_blitter_unset_running_flag(struct blitter_context *blitter) 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); @@ -568,13 +567,17 @@ void util_blitter_restore_vertex_states(struct blitter_context *blitter) 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); diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index 0a0528a5534..b3f44c3c9a8 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -54,8 +54,6 @@ 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); -- 2.30.2