diff options
5 files changed, 33 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index e8480f6ba73..81b3068553d 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -37,6 +37,7 @@ #include "util/u_cpu_detect.h" #include "util/u_inlines.h" #include "util/u_helpers.h" +#include "util/u_prim.h" #include "draw_context.h" #include "draw_vs.h" #include "draw_gs.h" @@ -925,3 +926,27 @@ draw_collect_pipeline_statistics(struct draw_context *draw, { draw->collect_statistics = enable; } + +/** + * Computes clipper invocation statistics. + * + * Figures out how many primitives would have been + * sent to the clipper given the specified + * prim info data. + */ +void +draw_stats_clipper_primitives(struct draw_context *draw, + const struct draw_prim_info *prim_info) +{ + if (draw->collect_statistics) { + unsigned start, i; + for (start = i = 0; + i < prim_info->primitive_count; + start += prim_info->primitive_lengths[i], i++) + { + draw->statistics.c_invocations += + u_decomposed_prims_for_vertices(prim_info->prim, + prim_info->primitive_lengths[i]); + } + } +} diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 8777e8617f7..e08173580b7 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -461,6 +461,10 @@ draw_get_rasterizer_no_cull( struct draw_context *draw, boolean scissor, boolean flatshade ); +void +draw_stats_clipper_primitives(struct draw_context *draw, + const struct draw_prim_info *prim_info); + /** * Return index i from the index buffer. diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c index b3d3546402d..ea02554f83c 100644 --- a/src/gallium/auxiliary/draw/draw_pt_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_emit.c @@ -180,12 +180,6 @@ draw_pt_emit(struct pt_emit *emit, i < prim_info->primitive_count; start += prim_info->primitive_lengths[i], i++) { - if (draw->collect_statistics) { - draw->statistics.c_invocations += - u_decomposed_prims_for_vertices(prim_info->prim, - prim_info->primitive_lengths[i]); - } - render->draw_elements(render, elts + start, prim_info->primitive_lengths[i]); diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 6d1bd116ba7..84f86ae75ee 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -317,6 +317,8 @@ static void fetch_pipeline_generic( struct draw_pt_middle_end *middle, */ draw_pt_so_emit( fpme->so_emit, vert_info, prim_info ); + draw_stats_clipper_primitives(draw, prim_info); + /* * if there's no position, need to stop now, or the latter stages * will try to access non-existent position output. diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index ecb7a6b8f75..2e47fad551a 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -411,6 +411,8 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle, /* stream output needs to be done before clipping */ draw_pt_so_emit( fpme->so_emit, vert_info, prim_info ); + draw_stats_clipper_primitives(draw, prim_info); + /* * if there's no position, need to stop now, or the latter stages * will try to access non-existent position output. |