OSDN Git Service

Make IsVertexArray() return false before BindVertexArray()
authorMatt Turner <mattst88@gmail.com>
Thu, 20 Dec 2012 04:20:34 +0000 (20:20 -0800)
committerMatt Turner <mattst88@gmail.com>
Sat, 22 Dec 2012 04:03:30 +0000 (20:03 -0800)
Rename existing _Used flag to EverBound.

The GL 4.3 and ES 3.0 specs say

   These names are marked as used, for the purposes of GenVertexArrays
   only, but they do not acquire array state until they are first bound.

This also affects Apple VAOs, which is fine since the
APPLE_vertex_array_object spec says

   A vertex array object is created by binding an unused name. This
   binding is accomplished by calling BindVertexArrayAPPLE with id set
   to the name of the new vertex array object.

Fixes arb_vertex_array_object_isvertexarray.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/arrayobj.c
src/mesa/main/mtypes.h

index a909e0e..032af43 100644 (file)
@@ -373,7 +373,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
          save_array_object(ctx, newObj);
       }
 
-      if (!newObj->_Used) {
+      if (!newObj->EverBound) {
          /* The "Interactions with APPLE_vertex_array_object" section of the
           * GL_ARB_vertex_array_object spec says:
           *
@@ -381,7 +381,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
           *     BindVertexArrayAPPLE, determines the semantic of the object."
           */
          newObj->ARBsemantics = genRequired;
-         newObj->_Used = GL_TRUE;
+         newObj->EverBound = GL_TRUE;
       }
    }
 
@@ -551,6 +551,8 @@ _mesa_IsVertexArray( GLuint id )
       return GL_FALSE;
 
    obj = lookup_arrayobj(ctx, id);
+   if (obj == NULL)
+      return GL_FALSE;
 
-   return (obj != NULL) ? GL_TRUE : GL_FALSE;
+   return obj->EverBound;
 }
index a14520f..7c513a1 100644 (file)
@@ -1595,7 +1595,7 @@ struct gl_array_object
    /**
     * Has this array object been bound?
     */
-   GLboolean _Used;
+   GLboolean EverBound;
 
    /** Vertex attribute arrays */
    struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];