/*
* Mesa 3-D graphics library
- * Version: 7.6
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* (C) Copyright IBM Corporation 2006
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL OR IBM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
#include "image.h"
#include "imports.h"
#include "context.h"
-#include "mfeatures.h"
#include "bufferobj.h"
#include "arrayobj.h"
#include "macros.h"
* non-existent.
*/
-static inline struct gl_array_object *
-lookup_arrayobj(struct gl_context *ctx, GLuint id)
+struct gl_array_object *
+_mesa_lookup_arrayobj(struct gl_context *ctx, GLuint id)
{
if (id == 0)
return NULL;
unbind_array_object_vbos(ctx, obj);
_mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj, NULL);
_glthread_DESTROY_MUTEX(obj->Mutex);
+ free(obj->Label);
free(obj);
}
/**
* Set ptr to arrayObj w/ reference counting.
+ * Note: this should only be called from the _mesa_reference_array_object()
+ * inline function.
*/
void
-_mesa_reference_array_object(struct gl_context *ctx,
- struct gl_array_object **ptr,
- struct gl_array_object *arrayObj)
+_mesa_reference_array_object_(struct gl_context *ctx,
+ struct gl_array_object **ptr,
+ struct gl_array_object *arrayObj)
{
- if (*ptr == arrayObj)
- return;
+ assert(*ptr != arrayObj);
if (*ptr) {
/* Unreference the old array object */
case VERT_ATTRIB_EDGEFLAG:
init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_EDGEFLAG], 1, GL_BOOL);
break;
-#if FEATURE_point_size_array
case VERT_ATTRIB_POINT_SIZE:
init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_POINT_SIZE], 1, GL_FLOAT);
break;
-#endif
default:
init_array(ctx, &obj->VertexAttrib[i], 4, GL_FLOAT);
break;
if (!ctx->VertexProgram._Current ||
ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
enabled = _mesa_array_object_get_enabled_ff(arrayObj);
- } else if (ctx->VertexProgram._Current->IsNVProgram) {
- enabled = _mesa_array_object_get_enabled_nv(arrayObj);
} else {
enabled = _mesa_array_object_get_enabled_arb(arrayObj);
}
{
struct gl_array_object * const oldObj = ctx->Array.ArrayObj;
struct gl_array_object *newObj = NULL;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
ASSERT(oldObj != NULL);
}
else {
/* non-default array object */
- newObj = lookup_arrayobj(ctx, id);
+ newObj = _mesa_lookup_arrayobj(ctx, id);
if (!newObj) {
if (genRequired) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexArray(id)");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexArray(non-gen name)");
return;
}
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE");
return;
}
+
save_array_object(ctx, newObj);
}
+
+ 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 = genRequired;
+ newObj->EverBound = GL_TRUE;
+ }
}
ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= VERT_BIT_ALL;
_mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, newObj);
/* Pass BindVertexArray call to device driver */
* \param ids Array of \c n array object IDs.
*/
void GLAPIENTRY
-_mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids)
+_mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
{
GET_CURRENT_CONTEXT(ctx);
GLsizei i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArrayAPPLE(n)");
}
for (i = 0; i < n; i++) {
- struct gl_array_object *obj = lookup_arrayobj(ctx, ids[i]);
+ struct gl_array_object *obj = _mesa_lookup_arrayobj(ctx, ids[i]);
if ( obj != NULL ) {
ASSERT( obj->Name == ids[i] );
* becomes current."
*/
if ( obj == ctx->Array.ArrayObj ) {
- CALL_BindVertexArrayAPPLE( ctx->Exec, (0) );
+ _mesa_BindVertexArray(0);
}
/* The ID is immediately freed for re-use */
* \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;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGenVertexArraysAPPLE");
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArraysAPPLE");
return;
}
- obj->VBOonly = vboOnly;
save_array_object(ctx, obj);
arrays[i] = first + i;
}
_mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays, GL_TRUE);
+ gen_vertex_arrays(ctx, n, arrays);
}
_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays, GL_FALSE);
+ gen_vertex_arrays(ctx, n, arrays);
}
* \c GL_FALSE otherwise.
*/
GLboolean GLAPIENTRY
-_mesa_IsVertexArrayAPPLE( GLuint id )
+_mesa_IsVertexArray( GLuint id )
{
struct gl_array_object * obj;
GET_CURRENT_CONTEXT(ctx);
if (id == 0)
return GL_FALSE;
- obj = lookup_arrayobj(ctx, id);
+ obj = _mesa_lookup_arrayobj(ctx, id);
+ if (obj == NULL)
+ return GL_FALSE;
- return (obj != NULL) ? GL_TRUE : GL_FALSE;
+ return obj->EverBound;
}