mesa: tidy up left over APPLE_vertex_array_object semantics
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
+7
-16
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1508,22 +1508,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?
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user