[Mesa-dev] [PATCH 3/5] draw: fix clipper invocation statistics

Brian Paul brianp at vmware.com
Tue Jun 11 08:16:28 PDT 2013


On 06/10/2013 08:31 AM, Zack Rusin wrote:
> We need to figure out the number of invocations of the clipper
> before the emit, because in the emit we are after clipping
> where the number of primitives will be equal to number of clipper
> invocations minus the clipped primitives. So our computations
> were always off by the number of clipped primitives.
>
> Signed-off-by: Zack Rusin <zackr at vmware.com>
> ---
>   src/gallium/auxiliary/draw/draw_pt_emit.c                |    6 ------
>   .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c        |   14 ++++++++++++++
>   .../auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c   |   13 +++++++++++++
>   3 files changed, 27 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
> index b3d3546..ea02554 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 6d1bd11..bd27dea 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,20 @@ static void fetch_pipeline_generic( struct draw_pt_middle_end *middle,
>       */
>      draw_pt_so_emit( fpme->so_emit, vert_info, prim_info );
>
> +   /* We need to figure out how many prmitivies we would have
> +    * sent to the clipper */
> +   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]);
> +      }
> +   }
> +
>      /*
>       * 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 ecb7a6b..da5e68e 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,19 @@ 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 );
>
> +   /* We need to figure out how many prmitivies we would have
> +    * sent to the clipper */
> +   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]);
> +      }
> +   }

Looks the same as the code above?  Could it be put into a function?


>      /*
>       * if there's no position, need to stop now, or the latter stages
>       * will try to access non-existent position output.
>

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list