[Mesa-dev] [PATCH 11/20] mesa: reduce the size of gl_vertex_array_object

Ian Romanick idr at freedesktop.org
Wed Nov 22 22:10:18 UTC 2017


On 11/21/2017 10:01 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> RelativeOffset should actually be uint, not intptr,
> according to ARB_vertex_attrib_binding.
> 
> gl_vertex_array_object: 3632 -> 3112 bytes
> ---
>  src/mesa/main/mtypes.h | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 6ddef05..773fa57 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1492,32 +1492,33 @@ struct gl_vertex_array
>   *
>   * Note that the Stride field corresponds to VERTEX_ATTRIB_ARRAY_STRIDE
>   * and is only present for backwards compatibility reasons.
>   * Rendering always uses VERTEX_BINDING_STRIDE.
>   * The gl*Pointer() functions will set VERTEX_ATTRIB_ARRAY_STRIDE
>   * and VERTEX_BINDING_STRIDE to the same value, while
>   * glBindVertexBuffer() will only set VERTEX_BINDING_STRIDE.
>   */
>  struct gl_array_attributes
>  {
> -   GLint Size;              /**< Components per element (1,2,3,4) */
> +   GLuint RelativeOffset; /**< Offset of the first element relative to the binding offset */
                            ^
More spaces before the comment.

>     GLenum16 Type;           /**< Datatype: GL_FLOAT, GL_INT, etc */
>     GLenum16 Format;         /**< Default: GL_RGBA, but may be GL_BGRA */
> -   GLsizei Stride;          /**< Stride as specified with gl*Pointer() */
> -   const GLubyte *Ptr;      /**< Points to client array data. Not used when a VBO is bound */
> -   GLintptr RelativeOffset; /**< Offset of the first element relative to the binding offset */
> +   GLshort Stride;          /**< Stride as specified with gl*Pointer() */
> +   GLubyte Size;            /**< Components per element (1,2,3,4) */
>     GLboolean Enabled;       /**< Whether the array is enabled */
>     GLboolean Normalized;    /**< Fixed-point values are normalized when converted to floats */
>     GLboolean Integer;       /**< Fixed-point values are not converted to floats */
>     GLboolean Doubles;       /**< double precision values are not converted to floats */
>     GLuint _ElementSize;     /**< Size of each element in bytes */
>     GLuint BufferBindingIndex;    /**< Vertex buffer binding */

Do these two fields need to be 32-bits?

> +
> +   const GLubyte *Ptr;      /**< Points to client array data. Not used when a VBO is bound */
>  };
>  
>  
>  /**
>   * This describes the buffer object used for a vertex array (or
>   * multiple vertex arrays).  If BufferObj points to the default/null
>   * buffer object, then the vertex array lives in user memory and not a VBO.
>   */
>  struct gl_vertex_buffer_binding
>  {
> @@ -1536,38 +1537,36 @@ struct gl_vertex_buffer_binding
>  struct gl_vertex_array_object
>  {
>     /** Name of the VAO as received from glGenVertexArray. */
>     GLuint Name;
>  
>     GLint RefCount;
>  
>     GLchar *Label;       /**< GL_KHR_debug */
>  
>     /**
> -    * Has this array object been bound?
> -    */
> -   GLboolean EverBound;
> -
> -   /**
>      * Derived vertex attribute arrays
>      *
>      * This is a legacy data structure created from gl_vertex_attrib_array and
>      * gl_vertex_buffer_binding, for compatibility with existing driver code.
>      */
>     struct gl_vertex_array _VertexAttrib[VERT_ATTRIB_MAX];
>  
>     /** Vertex attribute arrays */
>     struct gl_array_attributes VertexAttrib[VERT_ATTRIB_MAX];
>  
>     /** Vertex buffer bindings */
>     struct gl_vertex_buffer_binding BufferBinding[VERT_ATTRIB_MAX];
>  
> +   /** Has this array object been bound? */
> +   GLboolean EverBound;
> +
>     /** Mask indicating which vertex arrays have vertex buffer associated. */
>     GLbitfield VertexAttribBufferMask;
>  
>     /** Mask of VERT_BIT_* values indicating which arrays are enabled */
>     GLbitfield _Enabled;
>  
>     /** Mask of VERT_BIT_* values indicating changed/dirty arrays */
>     GLbitfield NewArrays;
>  
>     /** The index buffer (also known as the element array buffer in OpenGL). */
> 



More information about the mesa-dev mailing list