[Mesa-dev] [PATCH 4/9] gallium: add a cap to force compute minmax indices

Marek Olšák maraeo at gmail.com
Tue Apr 2 14:09:55 UTC 2019


On Fri, Mar 15, 2019 at 9:30 PM Qiang Yu <yuq825 at gmail.com> wrote:

> From: Erico Nunes <nunes.erico at gmail.com>
>
> pipe_draw_info has min_index and max_index fields that can be useful in
> indexed drawing, however gallium may decide to not compute them in some
> cases to avoid impacting performance if the driver won't need them.
> However, some drivers may need to always compute these values to build a
> valid command stream for indexed draw.
> Instead of reimplementing this functionality or having to explicitly
> compute those in driver specific code, this new cap can be used to
> ensure that gallium will not skip the computation.
> Drivers that set this cap will be able to rely on those values to build
> the command stream.
>
> For more details on this patch:
> https://lists.freedesktop.org/archives/mesa-dev/2018-March/189251.html
>
> Signed-off-by: Erico Nunes <nunes.erico at gmail.com>
> ---
>  src/gallium/auxiliary/util/u_screen.c | 3 +++
>  src/gallium/include/pipe/p_defines.h  | 1 +
>  src/mesa/state_tracker/st_draw.c      | 5 ++++-
>  3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/util/u_screen.c
> b/src/gallium/auxiliary/util/u_screen.c
> index 50964f3b3ef..e8fbdf56e2f 100644
> --- a/src/gallium/auxiliary/util/u_screen.c
> +++ b/src/gallium/auxiliary/util/u_screen.c
> @@ -341,6 +341,9 @@ u_pipe_screen_get_param_defaults(struct pipe_screen
> *pscreen,
>     case PIPE_CAP_MAX_VARYINGS:
>        return 8;
>
> +   case PIPE_CAP_FORCE_COMPUTE_MINMAX_INDICES:
> +      return 0;
> +
>     default:
>        unreachable("bad PIPE_CAP_*");
>     }
> diff --git a/src/gallium/include/pipe/p_defines.h
> b/src/gallium/include/pipe/p_defines.h
> index e2b0104ce43..495ba88e521 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -858,6 +858,7 @@ enum pipe_cap
>     PIPE_CAP_DEST_SURFACE_SRGB_CONTROL,
>     PIPE_CAP_NIR_COMPACT_ARRAYS,
>     PIPE_CAP_MAX_VARYINGS,
> +   PIPE_CAP_FORCE_COMPUTE_MINMAX_INDICES,
>  };
>
>  /**
> diff --git a/src/mesa/state_tracker/st_draw.c
> b/src/mesa/state_tracker/st_draw.c
> index 7485fc82b18..501c09817c0 100644
> --- a/src/mesa/state_tracker/st_draw.c
> +++ b/src/mesa/state_tracker/st_draw.c
> @@ -195,9 +195,12 @@ st_draw_vbo(struct gl_context *ctx,
>
>     if (ib) {
>        struct gl_buffer_object *bufobj = ib->obj;
> +      struct pipe_screen *screen = st->pipe->screen;
> +      bool needs_minmax_index = st->draw_needs_minmax_index ||
> +         screen->get_param(screen, PIPE_CAP_FORCE_COMPUTE_MINMAX_INDICES);
>

Can you call this only once at context creation?

Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190402/94af1541/attachment.html>


More information about the mesa-dev mailing list