draw: add support for collecting primitives generated outside streamout

GL/gallium require gathering primitives generated outside streamout
stats. This introduces the draw interfaces to enabling collecting this.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
Dave Airlie 2019-12-02 14:37:42 +10:00
parent f137672197
commit 5f8af9731e
4 changed files with 28 additions and 1 deletions

View file

@ -1155,6 +1155,15 @@ draw_collect_pipeline_statistics(struct draw_context *draw,
draw->collect_statistics = enable;
}
/**
* Enable/disable primitives generated gathering.
*/
void draw_collect_primitives_generated(struct draw_context *draw,
bool enable)
{
draw->collect_primgen = enable;
}
/**
* Computes clipper invocation statistics.
*

View file

@ -312,6 +312,9 @@ void draw_set_force_passthrough( struct draw_context *draw,
void draw_collect_pipeline_statistics(struct draw_context *draw,
boolean enable);
void draw_collect_primitives_generated(struct draw_context *draw,
bool eanble);
/*******************************************************************************
* Draw pipeline
*/

View file

@ -348,6 +348,8 @@ struct draw_context
struct pipe_query_data_pipeline_statistics statistics;
boolean collect_statistics;
bool collect_primgen;
struct draw_assembler *ia;
void *driver_private;

View file

@ -36,6 +36,7 @@
#include "pipe/p_state.h"
#include "util/u_math.h"
#include "util/u_prim.h"
#include "util/u_memory.h"
struct pt_so_emit {
@ -273,8 +274,20 @@ void draw_pt_so_emit( struct pt_so_emit *emit,
struct vbuf_render *render = draw->render;
unsigned start, i, stream;
if (!emit->has_so)
if (!emit->has_so) {
if (draw->collect_primgen) {
unsigned i;
unsigned total = 0;
for (i = 0; i < input_prims->primitive_count; i++) {
total +=
u_decomposed_prims_for_vertices(input_prims->prim,
input_prims->primitive_lengths[i]);
}
render->set_stream_output_info(render,
0, 0, total);
}
return;
}
if (!draw->so.num_targets)
return;