[Mesa-dev] [PATCH 4/8] mesa: Track position/generic0 aliasing in the VAO.

Emil Velikov emil.l.velikov at gmail.com
Fri Feb 2 11:08:11 UTC 2018


On 1 February 2018 at 07:32,  <Mathias.Froehlich at gmx.net> wrote:
> From: Mathias Fröhlich <mathias.froehlich at web.de>
>
> Since the first material attribute no longer aliases with
> the generic0 attribute, only aliasing between generic0 and
> position is left and entirely dependent on the enabled
> state of the VAO. So introduce a gl_attribute_map_mode
> in the VAO that is used to track how the position
> and the generic 0 attribute alias.
> Provide a static const array that can be used to
> map from vertex program input indices to VERT_ATTRIB_*
> indices. The outer dimension of the array is meant to
> be indexed directly by the new VAO member variable.
> Also provide methods on the VAO to convert bitmasks of
> VERT_BIT's from the VAO numbering to the vertex processing
> inputs numbering.
>
> v2: s,unsigned char,GLubyte,g
>     s,_ATTRIBUTE_MAP_MODE_MAX,ATTRIBUTE_MAP_MODE_MAX,g
>     Change comment style, add comments.
>
> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
> ---
>  src/mesa/main/arrayobj.c | 131 +++++++++++++++++++++++++++++++++++++++++++++++
>  src/mesa/main/arrayobj.h |  74 ++++++++++++++++++++++++++
>  src/mesa/main/enable.c   |   5 ++
>  src/mesa/main/mtypes.h   |  18 +++++++
>  src/mesa/main/varray.c   |  18 +++++--
>  5 files changed, 242 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
> index 7208f4c534..360d097ec1 100644
> --- a/src/mesa/main/arrayobj.c
> +++ b/src/mesa/main/arrayobj.c
> @@ -54,6 +54,135 @@
>  #include "util/bitscan.h"
>
>
> +const GLubyte
> +_mesa_vao_attribute_map[ATTRIBUTE_MAP_MODE_MAX][VERT_ATTRIB_MAX] =
> +{
> +   /* ATTRIBUTE_MAP_MODE_IDENTITY
> +    *
> +    * Grab vertex processing attribute VERT_ATTRIB_POS from
> +    * the VAO attribute VERT_ATTRIB_POS, and grab vertex processing
> +    * attribute VERT_ATTRIB_GENERIC0 from the VAO attribute
> +    * VERT_ATTRIB_GENERIC0.
> +    */
> +   {
> +      VERT_ATTRIB_POS,                 /* VERT_ATTRIB_POS */
Feel free to use C99 designated initializers. All supported compilers
understand them.
Even MSVC 2013 Update 4 ;-)

-Emil


More information about the mesa-dev mailing list