From: Timothy Arceri Date: Sat, 22 Apr 2017 07:30:27 +0000 (+1000) Subject: mesa: tidy up left over APPLE_vertex_array_object semantics X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2895d96a057b91214b7fe9919fb665faab59b849;p=mesa.git mesa: tidy up left over APPLE_vertex_array_object semantics Reviewed-by: Nicolai Hähnle --- diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index c52a07b3062..82c00fbe826 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 87d327621df..dbcfb4edc7b 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 2e3a423ff57..002e692b699 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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? */ diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 78dc004637f..709f6d4ec94 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;