[Mesa-dev] [PATCH 11/22] mesa: Add a vao parameter to update_array_format

Fredrik Höglund fredrik at kde.org
Wed Mar 18 16:18:37 PDT 2015


This is needed to implement VertexArrayAttrib*Format.
---
 src/mesa/main/varray.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index a6b66a0..93cc0e3 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -264,6 +264,7 @@ get_legal_types_mask(const struct gl_context *ctx)
 static bool
 update_array_format(struct gl_context *ctx,
                     const char *func,
+                    struct gl_vertex_array_object *vao,
                     GLuint attrib, GLbitfield legalTypesMask,
                     GLint sizeMin, GLint sizeMax,
                     GLint size, GLenum type,
@@ -378,7 +379,7 @@ update_array_format(struct gl_context *ctx,
    elementSize = _mesa_bytes_per_vertex_attrib(size, type);
    assert(elementSize != -1);
 
-   array = &ctx->Array.VAO->VertexAttrib[attrib];
+   array = &vao->VertexAttrib[attrib];
    array->Size = size;
    array->Type = type;
    array->Format = format;
@@ -387,7 +388,7 @@ update_array_format(struct gl_context *ctx,
    array->RelativeOffset = relativeOffset;
    array->_ElementSize = elementSize;
 
-   ctx->Array.VAO->NewArrays |= VERT_BIT(attrib);
+   vao->NewArrays |= VERT_BIT(attrib);
    ctx->NewState |= _NEW_ARRAY;
 
    return true;
@@ -469,7 +470,8 @@ update_array(struct gl_context *ctx,
       return;
    }
 
-   if (!update_array_format(ctx, func, attrib, legalTypesMask, sizeMin,
+   if (!update_array_format(ctx, func, ctx->Array.VAO, attrib,
+                            legalTypesMask, sizeMin,
                             sizeMax, size, type, normalized, integer, 0)) {
       return;
    }
@@ -1792,9 +1794,10 @@ vertex_attrib_format(GLuint attribIndex, GLint size, GLenum type,
 
    FLUSH_VERTICES(ctx, 0);
 
-   update_array_format(ctx, func, VERT_ATTRIB_GENERIC(attribIndex),
-                       legalTypes, 1, maxSize, size, type, normalized,
-                       integer, relativeOffset);
+   update_array_format(ctx, func, ctx->Array.VAO,
+                       VERT_ATTRIB_GENERIC(attribIndex),
+                       legalTypes, 1, maxSize, size, type,
+                       normalized, integer, relativeOffset);
 }
 
 
-- 
1.8.5.3



More information about the mesa-dev mailing list