aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2019-12-02 14:37:42 +1000
committerDave Airlie <[email protected]>2019-12-06 06:48:30 +1000
commit5f8af9731e36cb8854f7096cd372b83022a004b4 (patch)
treefbd333c77fce99d191f57b2a91594dbb8470a8b8 /src/gallium/auxiliary
parentf137672197936c00fae305e53eef12a665bc87ce (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c9
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h3
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_so_emit.c15
4 files changed, 28 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 59bcd0dd510..5e2e2580fb6 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -1156,6 +1156,15 @@ draw_collect_pipeline_statistics(struct draw_context *draw,
}
/**
+ * Enable/disable primitives generated gathering.
+ */
+void draw_collect_primitives_generated(struct draw_context *draw,
+ bool enable)
+{
+ draw->collect_primgen = enable;
+}
+
+/**
* Computes clipper invocation statistics.
*
* Figures out how many primitives would have been
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index fefda821338..0170f13e735 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -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
*/
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 3aa355b179e..86e90c76f88 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -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;
diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
index ea3169f32b1..6cb38fb9a5e 100644
--- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
@@ -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;