Mesa (master): mesa: tidy up left over APPLE_vertex_array_object semantics

Timothy Arceri tarceri at kemper.freedesktop.org
Wed Apr 26 00:25:19 UTC 2017


Module: Mesa
Branch: master
Commit: 2895d96a057b91214b7fe9919fb665faab59b849
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2895d96a057b91214b7fe9919fb665faab59b849

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Sat Apr 22 17:30:27 2017 +1000

mesa: tidy up left over APPLE_vertex_array_object semantics

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/mesa/main/arrayobj.c | 11 +----------
 src/mesa/main/attrib.c   | 23 +++++++----------------
 src/mesa/main/mtypes.h   | 16 ----------------
 src/mesa/main/varray.c   |  2 +-
 4 files changed, 9 insertions(+), 43 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index c52a07b306..82c00fbe82 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -450,16 +450,7 @@ _mesa_BindVertexArray( GLuint id )
          return;
       }
 
-      if (!newObj->EverBound) {
-         /* The "Interactions with APPLE_vertex_array_object" section of the
-          * GL_ARB_vertex_array_object spec says:
-          *
-          *     "The first bind call, either BindVertexArray or
-          *     BindVertexArrayAPPLE, determines the semantic of the object."
-          */
-         newObj->ARBsemantics = GL_TRUE;
-         newObj->EverBound = GL_TRUE;
-      }
+      newObj->EverBound = GL_TRUE;
    }
 
    if (ctx->Array.DrawMethod == DRAW_ARRAYS) {
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 87d327621d..dbcfb4edc7 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1479,9 +1479,6 @@ copy_array_object(struct gl_context *ctx,
    /* skip Name */
    /* skip RefCount */
 
-   /* In theory must be the same anyway, but on recreate make sure it matches */
-   dest->ARBsemantics = src->ARBsemantics;
-
    for (i = 0; i < ARRAY_SIZE(src->VertexAttrib); i++) {
       _mesa_copy_client_array(ctx, &dest->_VertexAttrib[i], &src->_VertexAttrib[i]);
       _mesa_copy_vertex_attrib_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]);
@@ -1557,6 +1554,8 @@ restore_array_attrib(struct gl_context *ctx,
                      struct gl_array_attrib *dest,
                      struct gl_array_attrib *src)
 {
+   bool is_vao_name_zero = src->VAO->Name == 0;
+
    /* The ARB_vertex_array_object spec says:
     *
     *     "BindVertexArray fails and an INVALID_OPERATION error is generated
@@ -1565,22 +1564,15 @@ restore_array_attrib(struct gl_context *ctx,
     *     DeleteVertexArrays."
     *
     * Therefore popping a deleted VAO cannot magically recreate it.
-    *
-    * The semantics of objects created using APPLE_vertex_array_objects behave
-    * differently.  These objects expect to be recreated by pop.  Alas.
     */
-   const bool arb_vao = (src->VAO->Name != 0
-			 && src->VAO->ARBsemantics);
-
-   if (arb_vao && !_mesa_IsVertexArray(src->VAO->Name))
+   if (!is_vao_name_zero && !_mesa_IsVertexArray(src->VAO->Name))
       return;
 
    _mesa_BindVertexArray(src->VAO->Name);
 
    /* Restore or recreate the buffer objects by the names ... */
-   if (!arb_vao
-       || src->ArrayBufferObj->Name == 0
-       || _mesa_IsBuffer(src->ArrayBufferObj->Name)) {
+   if (is_vao_name_zero || src->ArrayBufferObj->Name == 0 ||
+       _mesa_IsBuffer(src->ArrayBufferObj->Name)) {
       /* ... and restore its content */
       copy_array_attrib(ctx, dest, src, false);
 
@@ -1590,9 +1582,8 @@ restore_array_attrib(struct gl_context *ctx,
       copy_array_attrib(ctx, dest, src, true);
    }
 
-   if (!arb_vao
-       || src->VAO->IndexBufferObj->Name == 0
-       || _mesa_IsBuffer(src->VAO->IndexBufferObj->Name))
+   if (is_vao_name_zero || src->VAO->IndexBufferObj->Name == 0 ||
+       _mesa_IsBuffer(src->VAO->IndexBufferObj->Name))
       _mesa_BindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,
 			  src->VAO->IndexBufferObj->Name);
 }
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 2e3a423ff5..002e692b69 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1509,22 +1509,6 @@ struct gl_vertex_array_object
    GLchar *Label;       /**< GL_KHR_debug */
 
    /**
-    * Does the VAO use ARB semantics or Apple semantics?
-    *
-    * There are several ways in which ARB_vertex_array_object and
-    * APPLE_vertex_array_object VAOs have differing semantics.  At the very
-    * least,
-    *
-    *     - ARB VAOs require that all array data be sourced from vertex buffer
-    *       objects, but Apple VAOs do not.
-    *
-    *     - ARB VAOs require that names come from GenVertexArrays.
-    *
-    * This flag notes which behavior governs this VAO.
-    */
-   GLboolean ARBsemantics;
-
-   /**
     * Has this array object been bound?
     */
    GLboolean EverBound;
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 78dc004637..709f6d4ec9 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -509,7 +509,7 @@ validate_array(struct gl_context *ctx, const char *func,
     *       to the ARRAY_BUFFER buffer object binding point (see section
     *       2.9.6), and the pointer argument is not NULL."
     */
-   if (ptr != NULL && vao->ARBsemantics &&
+   if (ptr != NULL && vao != ctx->Array.DefaultVAO &&
        !_mesa_is_bufferobj(ctx->Array.ArrayBufferObj)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-VBO array)", func);
       return;




More information about the mesa-commit mailing list