summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2012-01-23 14:22:38 -0800
committerIan Romanick <ian.d.romanick@intel.com>2012-01-27 18:02:42 -0800
commiteea63b7621740ad020b9a2448f9c2f809f4827f3 (patch)
tree1da034a66fa1924529671acc71b4008ce47dfef9
parent85a52bf7b5f5f0317d15a51f94f294fc5e72d936 (diff)
mesa: Rename gl_array_object::VBOonly to ::ARBsemantics
There are more differences between Apple and ARB than just requiring that all arrays be stored in VBOs. Additional uses will be added in following commits. Also, set the flag at Bind time instead of Gen time. The ARB_vao spec specifies that behavior. NOTE: This is a candidate for release branches. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit 09639901530da7df7347428512c2bee86af1ef8e)
-rw-r--r--src/mesa/main/arrayobj.c16
-rw-r--r--src/mesa/main/attrib.c2
-rw-r--r--src/mesa/main/mtypes.h17
-rw-r--r--src/mesa/main/varray.c2
4 files changed, 29 insertions, 8 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 4b3e07b8517..de1391f996a 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -359,6 +359,14 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE");
return;
}
+
+ /* 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 = genRequired;
save_array_object(ctx, newObj);
}
}
@@ -455,8 +463,7 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids)
* \param vboOnly Will arrays have to reside in VBOs?
*/
static void
-gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
- GLboolean vboOnly)
+gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays)
{
GLuint first;
GLint i;
@@ -483,7 +490,6 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArraysAPPLE");
return;
}
- obj->VBOonly = vboOnly;
save_array_object(ctx, obj);
arrays[i] = first + i;
}
@@ -498,7 +504,7 @@ void GLAPIENTRY
_mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays, GL_TRUE);
+ gen_vertex_arrays(ctx, n, arrays);
}
@@ -510,7 +516,7 @@ void GLAPIENTRY
_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays, GL_FALSE);
+ gen_vertex_arrays(ctx, n, arrays);
}
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 1c1ee5dde02..1cd1fc46791 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1320,7 +1320,7 @@ copy_array_object(struct gl_context *ctx,
/* skip RefCount */
/* In theory must be the same anyway, but on recreate make sure it matches */
- dest->VBOonly = src->VBOonly;
+ dest->ARBsemantics = src->ARBsemantics;
for (i = 0; i < Elements(src->VertexAttrib); i++)
_mesa_copy_client_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 30c5475cbdf..1d3700847f6 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1610,7 +1610,22 @@ struct gl_array_object
GLint RefCount;
_glthread_Mutex Mutex;
- GLboolean VBOonly; /**< require all arrays to live in VBOs? */
+
+ /**
+ * 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;
/** Vertex attribute arrays */
struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 9078d116126..77c1d7d9b27 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -194,7 +194,7 @@ update_array(struct gl_context *ctx,
return;
}
- if (ctx->Array.ArrayObj->VBOonly &&
+ if (ctx->Array.ArrayObj->ARBsemantics &&
!_mesa_is_bufferobj(ctx->Array.ArrayBufferObj)) {
/* GL_ARB_vertex_array_object requires that all arrays reside in VBOs.
* Generate GL_INVALID_OPERATION if that's not true.