mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
radeonsi/ngg: reuse the pipeline stats buffer when using atomics
To support PIPE_STAT_QUERY_GS_INVOCATIONS and PIPE_STAT_QUERY_GS_PRIMITIVES being used at the same time we have to reuse the same buffer. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15861>
This commit is contained in:
parent
0cb6fd0b00
commit
061f64f351
3 changed files with 12 additions and 1 deletions
|
|
@ -218,6 +218,7 @@ static void si_destroy_context(struct pipe_context *context)
|
|||
si_resource_reference(&sctx->wait_mem_scratch, NULL);
|
||||
si_resource_reference(&sctx->wait_mem_scratch_tmz, NULL);
|
||||
si_resource_reference(&sctx->small_prim_cull_info_buf, NULL);
|
||||
si_resource_reference(&sctx->pipeline_stats_query_buf, NULL);
|
||||
|
||||
if (sctx->cs_preamble_state)
|
||||
si_pm4_free_state(sctx, sctx->cs_preamble_state, ~0);
|
||||
|
|
|
|||
|
|
@ -1268,6 +1268,8 @@ struct si_context {
|
|||
int num_pipeline_stat_emulated_queries;
|
||||
struct list_head active_queries;
|
||||
unsigned num_cs_dw_queries_suspend;
|
||||
/* Shared buffer for pipeline stats queries implemented with an atomic op */
|
||||
struct si_resource *pipeline_stats_query_buf;
|
||||
|
||||
/* Render condition. */
|
||||
struct pipe_query *render_cond;
|
||||
|
|
|
|||
|
|
@ -890,9 +890,17 @@ static void si_query_hw_emit_start(struct si_context *sctx, struct si_query_hw *
|
|||
{
|
||||
uint64_t va;
|
||||
|
||||
if (!si_query_buffer_alloc(sctx, &query->buffer, query->ops->prepare_buffer, query->result_size))
|
||||
if (!query->buffer.buf && query->flags & SI_QUERY_EMULATE_GS_COUNTERS)
|
||||
si_resource_reference(&query->buffer.buf, sctx->pipeline_stats_query_buf);
|
||||
|
||||
/* Don't realloc pipeline_stats_query_buf */
|
||||
if ((!(query->flags & SI_QUERY_EMULATE_GS_COUNTERS) || !sctx->pipeline_stats_query_buf) &&
|
||||
!si_query_buffer_alloc(sctx, &query->buffer, query->ops->prepare_buffer, query->result_size))
|
||||
return;
|
||||
|
||||
if (query->flags & SI_QUERY_EMULATE_GS_COUNTERS)
|
||||
si_resource_reference(&sctx->pipeline_stats_query_buf, query->buffer.buf);
|
||||
|
||||
si_update_occlusion_query_state(sctx, query->b.type, 1);
|
||||
si_update_prims_generated_query_state(sctx, query->b.type, 1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue