From: Nicolai Hähnle Date: Wed, 24 Apr 2019 13:52:35 +0000 (+0200) Subject: radeonsi: make si_restore_qbo_state externally available X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=064f195ef01fbcd0cf49b32cb48cc03b91470527;p=mesa.git radeonsi: make si_restore_qbo_state externally available Acked-by: Bas Nieuwenhuizen --- diff --git a/src/gallium/drivers/radeonsi/si_query.c b/src/gallium/drivers/radeonsi/si_query.c index a2b5937d69f..fabb7544047 100644 --- a/src/gallium/drivers/radeonsi/si_query.c +++ b/src/gallium/drivers/radeonsi/si_query.c @@ -1461,20 +1461,6 @@ bool si_query_hw_get_result(struct si_context *sctx, return true; } -static void si_restore_qbo_state(struct si_context *sctx, - struct si_qbo_state *st) -{ - sctx->b.bind_compute_state(&sctx->b, st->saved_compute); - - sctx->b.set_constant_buffer(&sctx->b, PIPE_SHADER_COMPUTE, 0, &st->saved_const0); - pipe_resource_reference(&st->saved_const0.buffer, NULL); - - sctx->b.set_shader_buffers(&sctx->b, PIPE_SHADER_COMPUTE, 0, 3, st->saved_ssbo, - st->saved_ssbo_writable_mask); - for (unsigned i = 0; i < 3; ++i) - pipe_resource_reference(&st->saved_ssbo[i].buffer, NULL); -} - static void si_query_hw_get_result_resource(struct si_context *sctx, struct si_query *squery, bool wait, diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 77ecf08565d..143783d4c87 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -1371,6 +1371,19 @@ void si_save_qbo_state(struct si_context *sctx, struct si_qbo_state *st) } } +void si_restore_qbo_state(struct si_context *sctx, struct si_qbo_state *st) +{ + sctx->b.bind_compute_state(&sctx->b, st->saved_compute); + + sctx->b.set_constant_buffer(&sctx->b, PIPE_SHADER_COMPUTE, 0, &st->saved_const0); + pipe_resource_reference(&st->saved_const0.buffer, NULL); + + sctx->b.set_shader_buffers(&sctx->b, PIPE_SHADER_COMPUTE, 0, 3, st->saved_ssbo, + st->saved_ssbo_writable_mask); + for (unsigned i = 0; i < 3; ++i) + pipe_resource_reference(&st->saved_ssbo[i].buffer, NULL); +} + static void si_emit_db_render_state(struct si_context *sctx) { struct si_state_rasterizer *rs = sctx->queued.named.rasterizer; diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 761e61899b1..d1fc1c09c66 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -557,6 +557,7 @@ si_create_sampler_view_custom(struct pipe_context *ctx, void si_update_fb_dirtiness_after_rendering(struct si_context *sctx); void si_update_ps_iter_samples(struct si_context *sctx); void si_save_qbo_state(struct si_context *sctx, struct si_qbo_state *st); +void si_restore_qbo_state(struct si_context *sctx, struct si_qbo_state *st); void si_set_occlusion_query_state(struct si_context *sctx, bool old_perfect_enable);