[Mesa-dev] [PATCH 11/11] mesa/vbo/tnl: Move gl_vertex_array related stuff to tnl.

Brian Paul brianp at vmware.com
Wed May 9 02:22:43 UTC 2018


One comment needs updating below.

On 05/07/2018 12:15 AM, Mathias.Froehlich at gmx.net wrote:
> From: Mathias Fröhlich <mathias.froehlich at web.de>
> 
> The only remaining users of gl_vertex_array are tnl based
> drivers. So move everything related to that into tnl and
> rename it accordingly.
> 
> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
> ---
>   src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 38 +++++------
>   src/mesa/main/mtypes.h                       | 14 ----
>   src/mesa/main/varray.h                       | 12 ----
>   src/mesa/state_tracker/st_draw.h             |  1 -
>   src/mesa/tnl/t_context.c                     |  4 +-
>   src/mesa/tnl/t_context.h                     | 41 +++++++++++-
>   src/mesa/tnl/t_draw.c                        | 95 ++++++++++++++++++++++++++--
>   src/mesa/tnl/t_rebase.c                      |  4 +-
>   src/mesa/tnl/t_rebase.h                      |  2 +-
>   src/mesa/tnl/t_split.c                       |  2 +-
>   src/mesa/tnl/t_split.h                       |  4 +-
>   src/mesa/tnl/t_split_copy.c                  | 34 ++++++----
>   src/mesa/tnl/t_split_inplace.c               |  4 +-
>   src/mesa/tnl/tnl.h                           | 24 +++++--
>   src/mesa/vbo/vbo.h                           | 37 -----------
>   src/mesa/vbo/vbo_exec.c                      | 86 -------------------------
>   16 files changed, 199 insertions(+), 203 deletions(-)
> 

[...]

> diff --git a/src/mesa/tnl/t_split_copy.c b/src/mesa/tnl/t_split_copy.c
> index f76a470b5f..cbb7eb409f 100644
> --- a/src/mesa/tnl/t_split_copy.c
> +++ b/src/mesa/tnl/t_split_copy.c
> @@ -53,7 +53,7 @@
>    */
>   struct copy_context {
>      struct gl_context *ctx;
> -   const struct gl_vertex_array *array;
> +   const struct tnl_vertex_array *array;
>      const struct _mesa_prim *prim;
>      GLuint nr_prims;
>      const struct _mesa_index_buffer *ib;
> @@ -64,7 +64,7 @@ struct copy_context {
>      struct {
>         GLuint attr;
>         GLuint size;
> -      const struct gl_vertex_array *array;
> +      const struct tnl_vertex_array *array;
>         const GLubyte *src_ptr;
>   
>         struct gl_vertex_buffer_binding dstbinding;
> @@ -73,7 +73,7 @@ struct copy_context {
>      } varying[VERT_ATTRIB_MAX];
>      GLuint nr_varying;
>   
> -   struct gl_vertex_array dstarray[VERT_ATTRIB_MAX];
> +   struct tnl_vertex_array dstarray[VERT_ATTRIB_MAX];
>      struct _mesa_index_buffer dstib;
>   
>      GLuint *translated_elt_buf;
> @@ -112,6 +112,18 @@ attr_size(const struct gl_array_attributes *attrib)
>   }
>   
>   
> +/**
> + * Shallow copy one vertex array to another.
> + */
> +static inline void
> +copy_vertex_array(struct tnl_vertex_array *dst,
> +                  const struct tnl_vertex_array *src)
> +{
> +   dst->VertexAttrib = src->VertexAttrib;
> +   dst->BufferBinding = src->BufferBinding;
> +}
> +
> +
>   /**
>    * Starts returning true slightly before the buffer fills, to ensure
>    * that there is sufficient room for any remaining vertices to finish
> @@ -142,7 +154,7 @@ check_flush(struct copy_context *copy)
>    */
>   static void
>   dump_draw_info(struct gl_context *ctx,
> -               const struct gl_vertex_array *arrays,
> +               const struct tnl_vertex_array *arrays,
>                  const struct _mesa_prim *prims,
>                  GLuint nr_prims,
>                  const struct _mesa_index_buffer *ib,
> @@ -157,7 +169,7 @@ dump_draw_info(struct gl_context *ctx,
>         printf("  Prim mode 0x%x\n", prims[i].mode);
>         printf("  IB: %p\n", (void*) ib);
>         for (j = 0; j < VERT_ATTRIB_MAX; j++) {
> -         const struct gl_vertex_array *array = &arrays[j];
> +         const struct tnl_vertex_array *array = &arrays[j];
>            const struct gl_vertex_buffer_binding *binding
>               = array->BufferBinding;
>            const struct gl_array_attributes *attrib = array->VertexAttrib;
> @@ -254,7 +266,7 @@ elt(struct copy_context *copy, GLuint elt_idx)
>         GLuint i;
>   
>         for (i = 0; i < copy->nr_varying; i++) {
> -         const struct gl_vertex_array *srcarray = copy->varying[i].array;
> +         const struct tnl_vertex_array *srcarray = copy->varying[i].array;
>            const struct gl_vertex_buffer_binding* srcbinding
>               = srcarray->BufferBinding;
>            const GLubyte *srcptr
> @@ -432,11 +444,11 @@ replay_init(struct copy_context *copy)
>       */
>      copy->vertex_size = 0;
>      for (i = 0; i < VERT_ATTRIB_MAX; i++) {
> -      const struct gl_vertex_array *array = &copy->array[i];
> +      const struct tnl_vertex_array *array = &copy->array[i];
>         const struct gl_vertex_buffer_binding *binding = array->BufferBinding;
>   
>         if (binding->Stride == 0) {
> -         _mesa_copy_vertex_array(&copy->dstarray[i], array);
> +         copy_vertex_array(&copy->dstarray[i], array);
>         }
>         else {
>            const struct gl_array_attributes *attrib = array->VertexAttrib;
> @@ -517,9 +529,9 @@ replay_init(struct copy_context *copy)
>      /* Setup new vertex arrays to point into the output buffer:
>       */
>      for (offset = 0, i = 0; i < copy->nr_varying; i++) {
> -      const struct gl_vertex_array *src = copy->varying[i].array;
> +      const struct tnl_vertex_array *src = copy->varying[i].array;
>         const struct gl_array_attributes *srcattr = src->VertexAttrib;
> -      struct gl_vertex_array *dst = &copy->dstarray[i];
> +      struct tnl_vertex_array *dst = &copy->dstarray[i];
>         struct gl_vertex_buffer_binding *dstbind = &copy->varying[i].dstbinding;
>         struct gl_array_attributes *dstattr = &copy->varying[i].dstattribs;
>   
> @@ -591,7 +603,7 @@ replay_finish(struct copy_context *copy)
>    */
>   void
>   _tnl_split_copy(struct gl_context *ctx,
> -                const struct gl_vertex_array *arrays,
> +                const struct tnl_vertex_array *arrays,
>                   const struct _mesa_prim *prim,
>                   GLuint nr_prims,
>                   const struct _mesa_index_buffer *ib,
> diff --git a/src/mesa/tnl/t_split_inplace.c b/src/mesa/tnl/t_split_inplace.c
> index 15a09861c7..8e9ecb7046 100644
> --- a/src/mesa/tnl/t_split_inplace.c
> +++ b/src/mesa/tnl/t_split_inplace.c
> @@ -43,7 +43,7 @@
>    */
>   struct split_context {
>      struct gl_context *ctx;
> -   const struct gl_vertex_array *array;
> +   const struct tnl_vertex_array *array;
>      const struct _mesa_prim *prim;
>      GLuint nr_prims;
>      const struct _mesa_index_buffer *ib;
> @@ -265,7 +265,7 @@ split_prims(struct split_context *split)
>   
>   void
>   _tnl_split_inplace(struct gl_context *ctx,
> -                   const struct gl_vertex_array *arrays,
> +                   const struct tnl_vertex_array *arrays,
>                      const struct _mesa_prim *prim,
>                      GLuint nr_prims,
>                      const struct _mesa_index_buffer *ib,
> diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
> index 4b6d5ec391..42de7f4f29 100644
> --- a/src/mesa/tnl/tnl.h
> +++ b/src/mesa/tnl/tnl.h
> @@ -30,7 +30,6 @@
>   
>   #include "main/glheader.h"
>   
> -struct gl_vertex_array;
>   struct gl_context;
>   struct gl_program;
>   struct gl_buffer_object;
> @@ -66,7 +65,22 @@ _tnl_wakeup( struct gl_context *ctx );
>   extern void
>   _tnl_need_projected_coords( struct gl_context *ctx, GLboolean flag );
>   
> -extern const struct gl_vertex_array*
> +
> +/**
> + * Vertex array information which is derived from gl_array_attributes
> + * and gl_vertex_buffer_binding information.  Used by the VBO module and
> + * device drivers.

I think that comment needs to be updated.  The tnl_vertex_array is only 
used by the tnl module now, right?


> + */
> +struct tnl_vertex_array
> +{
> +   /** Vertex attribute array */
> +   const struct gl_array_attributes *VertexAttrib;
> +   /** Vertex buffer binding */
> +   const struct gl_vertex_buffer_binding *BufferBinding;
> +};
> +
> +
> +extern const struct tnl_vertex_array*
>   _tnl_bind_inputs( struct gl_context *ctx );
>   
>   
> @@ -86,7 +100,7 @@ struct _mesa_index_buffer;
>   
>   void
>   _tnl_draw_prims(struct gl_context *ctx,
> -                const struct gl_vertex_array *arrays,
> +                const struct tnl_vertex_array *arrays,
>   		     const struct _mesa_prim *prim,
>   		     GLuint nr_prims,
>   		     const struct _mesa_index_buffer *ib,
> @@ -153,7 +167,7 @@ _tnl_validate_shine_tables( struct gl_context *ctx );
>    *                  This may be deprecated in the future
>    */
>   typedef void (*tnl_draw_func)(struct gl_context *ctx,
> -                              const struct gl_vertex_array* arrays,
> +                              const struct tnl_vertex_array* arrays,
>                                 const struct _mesa_prim *prims,
>                                 GLuint nr_prims,
>                                 const struct _mesa_index_buffer *ib,
> @@ -181,7 +195,7 @@ struct split_limits
>   
>   void
>   _tnl_split_prims(struct gl_context *ctx,
> -                 const struct gl_vertex_array *arrays,
> +                 const struct tnl_vertex_array *arrays,
>                    const struct _mesa_prim *prim,
>                    GLuint nr_prims,
>                    const struct _mesa_index_buffer *ib,


More information about the mesa-dev mailing list