zink: handle conversion for vertices statistics query with LINE_LOOP draws

the converted number of vertices is 2x that of the "real" number of vertices,
so divide the results by 2

this works nicely since zink performs cpu readback for all queries, and shader
aggregation should be simple in the future as well

fixes:
KHR-GL46.pipeline_statistics_query_tests_ARB.functional_primitives_vertices_submitted_and_clipping_input_output_primitives

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15401>
This commit is contained in:
Mike Blumenkrantz 2022-03-08 17:40:22 -05:00 committed by Marge Bot
parent d25437d54f
commit fe33835091
5 changed files with 24 additions and 6 deletions

View file

@ -1,5 +1,4 @@
GTF-GL46.gtf32.GL3Tests.packed_pixels.packed_pixels_pbo,Fail
KHR-GL46.pipeline_statistics_query_tests_ARB.functional_primitives_vertices_submitted_and_clipping_input_output_primitives,Fail
KHR-GL46.tessellation_shader.single.isolines_tessellation,Fail
KHR-GL46.tessellation_shader.tessellation_control_to_tessellation_evaluation.data_pass_through,Fail
KHR-GL46.tessellation_shader.tessellation_invariance.invariance_rule3,Fail

View file

@ -1,4 +1,3 @@
KHR-GL46.pipeline_statistics_query_tests_ARB.functional_primitives_vertices_submitted_and_clipping_input_output_primitives,Fail
KHR-GL46.shader_ballot_tests.ShaderBallotAvailability,Crash
KHR-GL46.shader_ballot_tests.ShaderBallotFunctionRead,Crash
KHR-GL46.tessellation_shader.single.isolines_tessellation,Fail

View file

@ -565,7 +565,7 @@ zink_draw(struct pipe_context *pctx,
barrier_draw_buffers(ctx, dinfo, dindirect, index_buffer);
zink_query_update_gs_states(ctx);
zink_query_update_gs_states(ctx, dinfo->was_line_loop);
zink_batch_rp(ctx);

View file

@ -48,6 +48,7 @@ struct zink_query {
struct list_head stats_list; /* when active, statistics queries are added to ctx->primitives_generated_queries */
bool have_gs[NUM_QUERIES]; /* geometry shaders use GEOMETRY_SHADER_PRIMITIVES_BIT */
bool have_xfb[NUM_QUERIES]; /* xfb was active during this query */
bool was_line_loop[NUM_QUERIES];
bool has_draws; /* have_gs and have_xfb are valid for idx=curr_query */
struct zink_batch_usage *batch_id; //batch that the query was started in
@ -406,7 +407,14 @@ check_query_results(struct zink_query *query, union pipe_query_result *result,
result->b |= results[i] != results[i + 1];
break;
case PIPE_QUERY_PIPELINE_STATISTICS_SINGLE:
result->u64 += results[i];
switch (query->index) {
case PIPE_STAT_QUERY_IA_VERTICES:
result->u64 += query->was_line_loop[query->last_start + i] ? results[i] / 2 : results[i];
break;
default:
result->u64 += results[i];
break;
}
break;
default:
@ -579,6 +587,7 @@ reset_pool(struct zink_context *ctx, struct zink_batch *batch, struct zink_query
}
memset(q->have_gs, 0, sizeof(q->have_gs));
memset(q->have_xfb, 0, sizeof(q->have_xfb));
memset(q->was_line_loop, 0, sizeof(q->was_line_loop));
q->last_start = q->curr_query = 0;
q->needs_reset = false;
/* create new qbo for non-timestamp queries:
@ -871,7 +880,7 @@ zink_resume_queries(struct zink_context *ctx, struct zink_batch *batch)
}
void
zink_query_update_gs_states(struct zink_context *ctx)
zink_query_update_gs_states(struct zink_context *ctx, bool was_line_loop)
{
struct zink_query *query;
LIST_FOR_EACH_ENTRY(query, &ctx->primitives_generated_queries, stats_list) {
@ -890,6 +899,17 @@ zink_query_update_gs_states(struct zink_context *ctx)
query->have_xfb[query->curr_query] = have_xfb;
query->has_draws = true;
}
if (ctx->vertices_query) {
query = ctx->vertices_query;
assert(query->curr_query < ARRAY_SIZE(query->have_gs));
assert(query->active);
if (query->was_line_loop[query->curr_query] != was_line_loop) {
suspend_query(ctx, query);
begin_query(ctx, &ctx->batch, query);
}
query->was_line_loop[query->curr_query] = was_line_loop;
query->has_draws = true;
}
}
static void

View file

@ -46,7 +46,7 @@ void
zink_prune_query(struct zink_screen *screen, struct zink_batch_state *bs, struct zink_query *query);
void
zink_query_update_gs_states(struct zink_context *ctx);
zink_query_update_gs_states(struct zink_context *ctx, bool was_line_loop);
void
zink_start_conditional_render(struct zink_context *ctx);