[Mesa-dev] [PATCH 02/21] cso: add set_index_buffer and draw_vbo passthrough functions

Brian Paul brian.e.paul at gmail.com
Wed Apr 11 18:32:35 PDT 2012


On Wed, Apr 11, 2012 at 9:38 AM, Marek Olšák <maraeo at gmail.com> wrote:
> ---
>  src/gallium/auxiliary/cso_cache/cso_context.c |   18 ++++++++++++++++++
>  src/gallium/auxiliary/cso_cache/cso_context.h |   25 +++++++++++++++++++++++++
>  2 files changed, 43 insertions(+), 0 deletions(-)
>
> diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
> index 43b8343..5fea531 100644
> --- a/src/gallium/auxiliary/cso_cache/cso_context.c
> +++ b/src/gallium/auxiliary/cso_cache/cso_context.c
> @@ -1290,3 +1290,21 @@ cso_restore_stream_outputs(struct cso_context *ctx)
>    ctx->nr_so_targets = ctx->nr_so_targets_saved;
>    ctx->nr_so_targets_saved = 0;
>  }
> +
> +/* drawing */
> +
> +void
> +cso_set_index_buffer(struct cso_context *cso,
> +                     const struct pipe_index_buffer *ib)
> +{
> +   struct pipe_context *pipe = cso->pipe;
> +   pipe->set_index_buffer(pipe, ib);
> +}
> +
> +void
> +cso_draw_vbo(struct cso_context *cso,
> +             const struct pipe_draw_info *info)
> +{
> +   struct pipe_context *pipe = cso->pipe;
> +   pipe->draw_vbo(pipe, info);
> +}
> diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
> index 8cc1bbf..84203e6 100644
> --- a/src/gallium/auxiliary/cso_cache/cso_context.h
> +++ b/src/gallium/auxiliary/cso_cache/cso_context.h
> @@ -217,6 +217,31 @@ cso_save_vertex_sampler_views(struct cso_context *cso);
>  void
>  cso_restore_vertex_sampler_views(struct cso_context *cso);
>
> +/* drawing */
> +
> +void
> +cso_set_index_buffer(struct cso_context *cso,
> +                     const struct pipe_index_buffer *ib);
> +
> +void
> +cso_draw_vbo(struct cso_context *cso,
> +             const struct pipe_draw_info *info);
> +
> +static INLINE void
> +cso_draw_arrays(struct cso_context *cso, uint mode, uint start, uint count)
> +{
> +   struct pipe_draw_info info = {0};
> +
> +   info.instance_count = 1;
> +   info.max_index = 0xffffffff;
> +   info.mode = mode;
> +   info.start = start;
> +   info.count = count;
> +   info.min_index = start;
> +   info.max_index = start + count - 1;

We have a util_draw_init_info() function that could be used there.

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


More information about the mesa-dev mailing list