From 07b02cbbe9a383dfe8314d7f2d798b2200117adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Tue, 17 Jun 2014 09:02:19 +0000 Subject: [PATCH] [OPENGL32/MESA] - Get rid of APPLE_vertex_array_object, ARB_vertex_array_object and APPLE_object_purgeable CORE-7499 svn path=/trunk/; revision=63608 --- .../opengl/mesa/drivers/common/driverfuncs.c | 6 - reactos/dll/opengl/mesa/drivers/common/meta.c | 24 - reactos/dll/opengl/mesa/drivers/common/meta.h | 1 - reactos/dll/opengl/mesa/main/CMakeLists.txt | 1 - reactos/dll/opengl/mesa/main/api_arrayelt.c | 33 +- reactos/dll/opengl/mesa/main/api_exec.c | 16 - reactos/dll/opengl/mesa/main/api_validate.c | 18 +- reactos/dll/opengl/mesa/main/arrayobj.c | 533 ------------------ reactos/dll/opengl/mesa/main/arrayobj.h | 85 --- reactos/dll/opengl/mesa/main/attrib.c | 100 +--- reactos/dll/opengl/mesa/main/bufferobj.c | 292 +--------- reactos/dll/opengl/mesa/main/context.c | 6 +- reactos/dll/opengl/mesa/main/dd.h | 25 - reactos/dll/opengl/mesa/main/dispatch.h | 117 ---- reactos/dll/opengl/mesa/main/dlist.c | 17 - reactos/dll/opengl/mesa/main/enable.c | 66 +-- reactos/dll/opengl/mesa/main/extensions.c | 8 - reactos/dll/opengl/mesa/main/get.c | 16 +- reactos/dll/opengl/mesa/main/getstring.c | 16 +- reactos/dll/opengl/mesa/main/mtypes.h | 48 +- reactos/dll/opengl/mesa/main/precomp.h | 1 - reactos/dll/opengl/mesa/main/state.c | 35 +- reactos/dll/opengl/mesa/main/varray.c | 119 ++-- reactos/dll/opengl/mesa/main/varray.h | 8 +- reactos/dll/opengl/mesa/main/version.c | 3 +- reactos/dll/opengl/mesa/vbo/vbo_exec_array.c | 32 +- reactos/dll/opengl/mesa/vbo/vbo_save_api.c | 5 +- 27 files changed, 198 insertions(+), 1433 deletions(-) delete mode 100644 reactos/dll/opengl/mesa/main/arrayobj.c delete mode 100644 reactos/dll/opengl/mesa/main/arrayobj.h diff --git a/reactos/dll/opengl/mesa/drivers/common/driverfuncs.c b/reactos/dll/opengl/mesa/drivers/common/driverfuncs.c index 286aa9fe7a3..ac85009c581 100644 --- a/reactos/dll/opengl/mesa/drivers/common/driverfuncs.c +++ b/reactos/dll/opengl/mesa/drivers/common/driverfuncs.c @@ -26,7 +26,6 @@ #include "main/glheader.h" #include "main/imports.h" #include "main/accum.h" -#include "main/arrayobj.h" #include "main/context.h" #include "main/framebuffer.h" #include "main/readpix.h" @@ -147,11 +146,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) _mesa_init_texture_barrier_functions(driver); - /* APPLE_vertex_array_object */ - driver->NewArrayObject = _mesa_new_array_object; - driver->DeleteArrayObject = _mesa_delete_array_object; - driver->BindArrayObject = NULL; - /* T&L stuff */ driver->CurrentExecPrimitive = 0; driver->CurrentSavePrimitive = 0; diff --git a/reactos/dll/opengl/mesa/drivers/common/meta.c b/reactos/dll/opengl/mesa/drivers/common/meta.c index d7d79dcf6a2..ac4a8ac6146 100644 --- a/reactos/dll/opengl/mesa/drivers/common/meta.c +++ b/reactos/dll/opengl/mesa/drivers/common/meta.c @@ -34,7 +34,6 @@ #include "main/glheader.h" #include "main/mtypes.h" #include "main/imports.h" -#include "main/arrayobj.h" #include "main/blend.h" #include "main/bufferobj.h" #include "main/buffers.h" @@ -134,10 +133,6 @@ struct save_state GLbitfield TexGenEnabled; GLuint EnvMode; /* unit[0] only */ - /** MESA_META_VERTEX */ - struct gl_array_object *ArrayObj; - struct gl_buffer_object *ArrayBufferObj; - /** MESA_META_VIEWPORT */ GLint ViewportX, ViewportY, ViewportW, ViewportH; GLclampd DepthNear, DepthFar; @@ -406,15 +401,6 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) } } - if (state & MESA_META_VERTEX) { - /* save vertex array object state */ - _mesa_reference_array_object(ctx, &save->ArrayObj, - ctx->Array.ArrayObj); - _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, - ctx->Array.ArrayBufferObj); - /* set some default state? */ - } - if (state & MESA_META_VIEWPORT) { /* save viewport state */ save->ViewportX = ctx->Viewport.X; @@ -598,16 +584,6 @@ _mesa_meta_end(struct gl_context *ctx) } } - if (state & MESA_META_VERTEX) { - /* restore vertex buffer object */ - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, save->ArrayBufferObj->Name); - _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, NULL); - - /* restore vertex array object */ - _mesa_BindVertexArray(save->ArrayObj->Name); - _mesa_reference_array_object(ctx, &save->ArrayObj, NULL); - } - if (state & MESA_META_VIEWPORT) { if (save->ViewportX != ctx->Viewport.X || save->ViewportY != ctx->Viewport.Y || diff --git a/reactos/dll/opengl/mesa/drivers/common/meta.h b/reactos/dll/opengl/mesa/drivers/common/meta.h index 388f6aeb2ab..677ed05d3ff 100644 --- a/reactos/dll/opengl/mesa/drivers/common/meta.h +++ b/reactos/dll/opengl/mesa/drivers/common/meta.h @@ -47,7 +47,6 @@ #define MESA_META_STENCIL_TEST 0x400 #define MESA_META_TRANSFORM 0x800 /**< modelview/projection matrix state */ #define MESA_META_TEXTURE 0x1000 -#define MESA_META_VERTEX 0x2000 #define MESA_META_VIEWPORT 0x4000 #define MESA_META_CLIP 0x8000 #define MESA_META_SELECT_FEEDBACK 0x10000 diff --git a/reactos/dll/opengl/mesa/main/CMakeLists.txt b/reactos/dll/opengl/mesa/main/CMakeLists.txt index ecd653187f8..15e8651fba8 100644 --- a/reactos/dll/opengl/mesa/main/CMakeLists.txt +++ b/reactos/dll/opengl/mesa/main/CMakeLists.txt @@ -6,7 +6,6 @@ list(APPEND SOURCE api_validate.c accum.c attrib.c - arrayobj.c blend.c bufferobj.c buffers.c diff --git a/reactos/dll/opengl/mesa/main/api_arrayelt.c b/reactos/dll/opengl/mesa/main/api_arrayelt.c index 6cb6bd83a47..87b98439731 100644 --- a/reactos/dll/opengl/mesa/main/api_arrayelt.c +++ b/reactos/dll/opengl/mesa/main/api_arrayelt.c @@ -734,49 +734,48 @@ static void _ae_update_state( struct gl_context *ctx ) AEcontext *actx = AE_CONTEXT(ctx); AEarray *aa = actx->arrays; AEattrib *at = actx->attribs; - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; actx->nr_vbos = 0; /* conventional vertex arrays */ - if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { - aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]; + if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { + aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX]; aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) { - aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]; + if (ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) { + aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG]; aa->offset = _gloffset_EdgeFlagv; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { - aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]; + if (ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { + aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL]; aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { - aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]; + if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { + aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0]; aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { - aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]; + if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { + aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1]; aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) { - aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_FOG]; + if (ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) { + aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_FOG]; aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } { - struct gl_client_array *attribArray = &arrayObj->VertexAttrib[VERT_ATTRIB_TEX]; + struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[VERT_ATTRIB_TEX]; if (attribArray->Enabled) { /* NOTE: we use generic glVertexAttribNV functions here. * If we ever remove GL_NV_vertex_program this will have to change. @@ -793,14 +792,14 @@ static void _ae_update_state( struct gl_context *ctx ) } /* finally, vertex position */ - if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) { - aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_POS]; + if (ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) { + aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_POS]; aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - check_vbo(actx, arrayObj->ElementArrayBufferObj); + check_vbo(actx, ctx->Array.ElementArrayBufferObj); ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX); ASSERT(aa - actx->arrays < 32); diff --git a/reactos/dll/opengl/mesa/main/api_exec.c b/reactos/dll/opengl/mesa/main/api_exec.c index 245597cd294..d4d328d2f8c 100644 --- a/reactos/dll/opengl/mesa/main/api_exec.c +++ b/reactos/dll/opengl/mesa/main/api_exec.c @@ -308,12 +308,6 @@ _mesa_create_exec_table(void) /* glVertexAttrib*NV functions handled in api_loopback.c */ #endif - /* 273. GL_APPLE_vertex_array_object */ - SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE); - SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE); - SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE); - SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE); - /* 282. GL_NV_fragment_program */ #if FEATURE_NV_fragment_program SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV); @@ -367,16 +361,6 @@ _mesa_create_exec_table(void) SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange); #endif - /* GL_ARB_vertex_array_object */ - SET_BindVertexArray(exec, _mesa_BindVertexArray); - SET_GenVertexArrays(exec, _mesa_GenVertexArrays); - -#if FEATURE_APPLE_object_purgeable - SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE); - SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE); - SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE); -#endif - /* GL_EXT_texture_integer */ SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT); SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT); diff --git a/reactos/dll/opengl/mesa/main/api_validate.c b/reactos/dll/opengl/mesa/main/api_validate.c index 03f99f6ee5f..2e57c524c39 100644 --- a/reactos/dll/opengl/mesa/main/api_validate.c +++ b/reactos/dll/opengl/mesa/main/api_validate.c @@ -101,7 +101,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function) /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic * array [0]). */ - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled; + return ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled; } @@ -130,14 +130,14 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type, memset(&ib, 0, sizeof(ib)); ib.type = type; ib.ptr = indices; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.ElementArrayBufferObj; vbo_get_minmax_index(ctx, &prim, &ib, &min, &max); - if (max >= ctx->Array.ArrayObj->_MaxElement) { + if (max >= ctx->Array._MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)", - max, ctx->Array.ArrayObj->_MaxElement); + max, ctx->Array._MaxElement); return GL_FALSE; } @@ -197,10 +197,10 @@ _mesa_validate_DrawElements(struct gl_context *ctx, return GL_FALSE; /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ - if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) { + if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); return GL_FALSE; } @@ -258,10 +258,10 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, return GL_FALSE; /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ - if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) { + if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds"); return GL_FALSE; } @@ -305,7 +305,7 @@ _mesa_validate_DrawArrays(struct gl_context *ctx, return GL_FALSE; if (ctx->Const.CheckArrayBounds) { - if (start + count > (GLint) ctx->Array.ArrayObj->_MaxElement) + if (start + count > (GLint) ctx->Array._MaxElement) return GL_FALSE; } diff --git a/reactos/dll/opengl/mesa/main/arrayobj.c b/reactos/dll/opengl/mesa/main/arrayobj.c deleted file mode 100644 index 258d58eae31..00000000000 --- a/reactos/dll/opengl/mesa/main/arrayobj.c +++ /dev/null @@ -1,533 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.6 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * (C) Copyright IBM Corporation 2006 - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * 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. - */ - - -/** - * \file arrayobj.c - * Functions for the GL_APPLE_vertex_array_object extension. - * - * \todo - * The code in this file borrows a lot from bufferobj.c. There's a certain - * amount of cruft left over from that origin that may be unnecessary. - * - * \author Ian Romanick - * \author Brian Paul - */ - -#include - -/** - * Look up the array object for the given ID. - * - * \returns - * Either a pointer to the array object with the specified ID or \c NULL for - * a non-existent ID. The spec defines ID 0 as being technically - * non-existent. - */ - -static inline struct gl_array_object * -lookup_arrayobj(struct gl_context *ctx, GLuint id) -{ - if (id == 0) - return NULL; - else - return (struct gl_array_object *) - _mesa_HashLookup(ctx->Array.Objects, id); -} - - -/** - * For all the vertex arrays in the array object, unbind any pointers - * to any buffer objects (VBOs). - * This is done just prior to array object destruction. - */ -static void -unbind_array_object_vbos(struct gl_context *ctx, struct gl_array_object *obj) -{ - GLuint i; - - for (i = 0; i < Elements(obj->VertexAttrib); i++) - _mesa_reference_buffer_object(ctx, &obj->VertexAttrib[i].BufferObj, NULL); -} - - -/** - * Allocate and initialize a new vertex array object. - * - * This function is intended to be called via - * \c dd_function_table::NewArrayObject. - */ -struct gl_array_object * -_mesa_new_array_object( struct gl_context *ctx, GLuint name ) -{ - struct gl_array_object *obj = CALLOC_STRUCT(gl_array_object); - if (obj) - _mesa_initialize_array_object(ctx, obj, name); - return obj; -} - - -/** - * Delete an array object. - * - * This function is intended to be called via - * \c dd_function_table::DeleteArrayObject. - */ -void -_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj ) -{ - (void) ctx; - unbind_array_object_vbos(ctx, obj); - _mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj, NULL); - _glthread_DESTROY_MUTEX(obj->Mutex); - free(obj); -} - - -/** - * Set ptr to arrayObj w/ reference counting. - */ -void -_mesa_reference_array_object(struct gl_context *ctx, - struct gl_array_object **ptr, - struct gl_array_object *arrayObj) -{ - if (*ptr == arrayObj) - return; - - if (*ptr) { - /* Unreference the old array object */ - GLboolean deleteFlag = GL_FALSE; - struct gl_array_object *oldObj = *ptr; - - _glthread_LOCK_MUTEX(oldObj->Mutex); - ASSERT(oldObj->RefCount > 0); - oldObj->RefCount--; -#if 0 - printf("ArrayObj %p %d DECR to %d\n", - (void *) oldObj, oldObj->Name, oldObj->RefCount); -#endif - deleteFlag = (oldObj->RefCount == 0); - _glthread_UNLOCK_MUTEX(oldObj->Mutex); - - if (deleteFlag) { - ASSERT(ctx->Driver.DeleteArrayObject); - ctx->Driver.DeleteArrayObject(ctx, oldObj); - } - - *ptr = NULL; - } - ASSERT(!*ptr); - - if (arrayObj) { - /* reference new array object */ - _glthread_LOCK_MUTEX(arrayObj->Mutex); - if (arrayObj->RefCount == 0) { - /* this array's being deleted (look just above) */ - /* Not sure this can every really happen. Warn if it does. */ - _mesa_problem(NULL, "referencing deleted array object"); - *ptr = NULL; - } - else { - arrayObj->RefCount++; -#if 0 - printf("ArrayObj %p %d INCR to %d\n", - (void *) arrayObj, arrayObj->Name, arrayObj->RefCount); -#endif - *ptr = arrayObj; - } - _glthread_UNLOCK_MUTEX(arrayObj->Mutex); - } -} - - - -static void -init_array(struct gl_context *ctx, - struct gl_client_array *array, GLint size, GLint type) -{ - array->Size = size; - array->Type = type; - array->Stride = 0; - array->StrideB = 0; - array->Ptr = NULL; - array->Enabled = GL_FALSE; - array->Normalized = GL_FALSE; - array->Integer = GL_FALSE; - array->_ElementSize = size * _mesa_sizeof_type(type); - /* Vertex array buffers */ - _mesa_reference_buffer_object(ctx, &array->BufferObj, - ctx->Shared->NullBufferObj); -} - - -/** - * Initialize a gl_array_object's arrays. - */ -void -_mesa_initialize_array_object( struct gl_context *ctx, - struct gl_array_object *obj, - GLuint name ) -{ - GLuint i; - - obj->Name = name; - - _glthread_INIT_MUTEX(obj->Mutex); - obj->RefCount = 1; - - /* Init the individual arrays */ - for (i = 0; i < Elements(obj->VertexAttrib); i++) { - switch (i) { - case VERT_ATTRIB_WEIGHT: - init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_WEIGHT], 1, GL_FLOAT); - break; - case VERT_ATTRIB_NORMAL: - init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_NORMAL], 3, GL_FLOAT); - break; - case VERT_ATTRIB_COLOR1: - init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_COLOR1], 3, GL_FLOAT); - break; - case VERT_ATTRIB_FOG: - init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_FOG], 1, GL_FLOAT); - break; - case VERT_ATTRIB_COLOR_INDEX: - init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX], 1, GL_FLOAT); - break; - 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; - } - } - - _mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj, - ctx->Shared->NullBufferObj); -} - - -/** - * Add the given array object to the array object pool. - */ -static void -save_array_object( struct gl_context *ctx, struct gl_array_object *obj ) -{ - if (obj->Name > 0) { - /* insert into hash table */ - _mesa_HashInsert(ctx->Array.Objects, obj->Name, obj); - } -} - - -/** - * Remove the given array object from the array object pool. - * Do not deallocate the array object though. - */ -static void -remove_array_object( struct gl_context *ctx, struct gl_array_object *obj ) -{ - if (obj->Name > 0) { - /* remove from hash table */ - _mesa_HashRemove(ctx->Array.Objects, obj->Name); - } -} - - - -/** - * Helper for update_arrays(). - * \return min(current min, array->_MaxElement). - */ -static GLuint -update_min(GLuint min, struct gl_client_array *array) -{ - assert(array->Enabled); - _mesa_update_array_max_element(array); - return MIN2(min, array->_MaxElement); -} - - -/** - * Examine vertex arrays to update the gl_array_object::_MaxElement field. - */ -void -_mesa_update_array_object_max_element(struct gl_context *ctx, - struct gl_array_object *arrayObj) -{ - GLbitfield64 enabled = arrayObj->_Enabled; - GLuint min = ~0u; - - while (enabled) { - GLint attrib = _mesa_ffsll(enabled) - 1; - enabled &= ~BITFIELD64_BIT(attrib); - min = update_min(min, &arrayObj->VertexAttrib[attrib]); - } - - /* _MaxElement is one past the last legal array element */ - arrayObj->_MaxElement = min; -} - - -/**********************************************************************/ -/* API Functions */ -/**********************************************************************/ - - -/** - * Helper for _mesa_BindVertexArray() and _mesa_BindVertexArrayAPPLE(). - * \param genRequired specifies behavour when id was not generated with - * glGenVertexArrays(). - */ -static void -bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) -{ - struct gl_array_object * const oldObj = ctx->Array.ArrayObj; - struct gl_array_object *newObj = NULL; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - ASSERT(oldObj != NULL); - - if ( oldObj->Name == id ) - return; /* rebinding the same array object- no change */ - - /* - * Get pointer to new array object (newObj) - */ - if (id == 0) { - /* The spec says there is no array object named 0, but we use - * one internally because it simplifies things. - */ - newObj = ctx->Array.DefaultArrayObj; - } - else { - /* non-default array object */ - newObj = lookup_arrayobj(ctx, id); - if (!newObj) { - if (genRequired) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexArray(id)"); - return; - } - - /* For APPLE version, generate a new array object now */ - newObj = (*ctx->Driver.NewArrayObject)(ctx, id); - if (!newObj) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE"); - return; - } - - save_array_object(ctx, newObj); - } - - if (!newObj->_Used) { - /* 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->_Used = 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 */ - if (ctx->Driver.BindArrayObject && newObj) - ctx->Driver.BindArrayObject(ctx, newObj); -} - - -/** - * ARB version of glBindVertexArray() - * This function behaves differently from glBindVertexArrayAPPLE() in - * that this function requires all ids to have been previously generated - * by glGenVertexArrays[APPLE](). - */ -void GLAPIENTRY -_mesa_BindVertexArray( GLuint id ) -{ - GET_CURRENT_CONTEXT(ctx); - bind_vertex_array(ctx, id, GL_TRUE); -} - - -/** - * Bind a new array. - * - * \todo - * The binding could be done more efficiently by comparing the non-NULL - * pointers in the old and new objects. The only arrays that are "dirty" are - * the ones that are non-NULL in either object. - */ -void GLAPIENTRY -_mesa_BindVertexArrayAPPLE( GLuint id ) -{ - GET_CURRENT_CONTEXT(ctx); - bind_vertex_array(ctx, id, GL_FALSE); -} - - -/** - * Delete a set of array objects. - * - * \param n Number of array objects to delete. - * \param ids Array of \c n array object IDs. - */ -void GLAPIENTRY -_mesa_DeleteVertexArraysAPPLE(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)"); - return; - } - - for (i = 0; i < n; i++) { - struct gl_array_object *obj = lookup_arrayobj(ctx, ids[i]); - - if ( obj != NULL ) { - ASSERT( obj->Name == ids[i] ); - - /* If the array object is currently bound, the spec says "the binding - * for that object reverts to zero and the default vertex array - * becomes current." - */ - if ( obj == ctx->Array.ArrayObj ) { - CALL_BindVertexArrayAPPLE( ctx->Exec, (0) ); - } - - /* The ID is immediately freed for re-use */ - remove_array_object(ctx, obj); - - /* Unreference the array object. - * If refcount hits zero, the object will be deleted. - */ - _mesa_reference_array_object(ctx, &obj, NULL); - } - } -} - - -/** - * Generate a set of unique array object IDs and store them in \c arrays. - * Helper for _mesa_GenVertexArrays[APPLE]() functions below. - * \param n Number of IDs to generate. - * \param arrays Array of \c n locations to store the IDs. - * \param vboOnly Will arrays have to reside in VBOs? - */ -static void -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"); - return; - } - - if (!arrays) { - return; - } - - first = _mesa_HashFindFreeKeyBlock(ctx->Array.Objects, n); - - /* Allocate new, empty array objects and return identifiers */ - for (i = 0; i < n; i++) { - struct gl_array_object *obj; - GLuint name = first + i; - - obj = (*ctx->Driver.NewArrayObject)( ctx, name ); - if (!obj) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArraysAPPLE"); - return; - } - save_array_object(ctx, obj); - arrays[i] = first + i; - } -} - - -/** - * ARB version of glGenVertexArrays() - * All arrays will be required to live in VBOs. - */ -void GLAPIENTRY -_mesa_GenVertexArrays(GLsizei n, GLuint *arrays) -{ - GET_CURRENT_CONTEXT(ctx); - gen_vertex_arrays(ctx, n, arrays); -} - - -/** - * APPLE version of glGenVertexArraysAPPLE() - * Arrays may live in VBOs or ordinary memory. - */ -void GLAPIENTRY -_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays) -{ - GET_CURRENT_CONTEXT(ctx); - gen_vertex_arrays(ctx, n, arrays); -} - - -/** - * Determine if ID is the name of an array object. - * - * \param id ID of the potential array object. - * \return \c GL_TRUE if \c id is the name of a array object, - * \c GL_FALSE otherwise. - */ -GLboolean GLAPIENTRY -_mesa_IsVertexArrayAPPLE( GLuint id ) -{ - struct gl_array_object * obj; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - - if (id == 0) - return GL_FALSE; - - obj = lookup_arrayobj(ctx, id); - - return (obj != NULL) ? GL_TRUE : GL_FALSE; -} diff --git a/reactos/dll/opengl/mesa/main/arrayobj.h b/reactos/dll/opengl/mesa/main/arrayobj.h deleted file mode 100644 index 0b5a0130370..00000000000 --- a/reactos/dll/opengl/mesa/main/arrayobj.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.6 - * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. - * (C) Copyright IBM Corporation 2006 - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * 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. - */ - -#ifndef ARRAYOBJ_H -#define ARRAYOBJ_H - -#include "glheader.h" - -struct gl_context; - -/** - * \file arrayobj.h - * Functions for the GL_APPLE_vertex_array_object extension. - * - * \author Ian Romanick - * \author Brian Paul - */ - -/* - * Internal functions - */ - -extern struct gl_array_object * -_mesa_new_array_object( struct gl_context *ctx, GLuint name ); - -extern void -_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj ); - -extern void -_mesa_reference_array_object(struct gl_context *ctx, - struct gl_array_object **ptr, - struct gl_array_object *arrayObj); - -extern void -_mesa_initialize_array_object( struct gl_context *ctx, - struct gl_array_object *obj, GLuint name ); - - -extern void -_mesa_update_array_object_max_element(struct gl_context *ctx, - struct gl_array_object *arrayObj); - - -/* - * API functions - */ - - -void GLAPIENTRY _mesa_BindVertexArray( GLuint id ); - -void GLAPIENTRY _mesa_BindVertexArrayAPPLE( GLuint id ); - -void GLAPIENTRY _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids); - -void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays); - -void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer); - -GLboolean GLAPIENTRY _mesa_IsVertexArrayAPPLE( GLuint id ); - -#endif /* ARRAYOBJ_H */ diff --git a/reactos/dll/opengl/mesa/main/attrib.c b/reactos/dll/opengl/mesa/main/attrib.c index 761831ec0da..e3881373290 100644 --- a/reactos/dll/opengl/mesa/main/attrib.c +++ b/reactos/dll/opengl/mesa/main/attrib.c @@ -1056,31 +1056,6 @@ copy_pixelstore(struct gl_context *ctx, #define GL_CLIENT_PACK_BIT (1<<20) #define GL_CLIENT_UNPACK_BIT (1<<21) -/** - * Copy gl_array_object from src to dest. - * 'dest' must be in an initialized state. - */ -static void -copy_array_object(struct gl_context *ctx, - struct gl_array_object *dest, - struct gl_array_object *src) -{ - GLuint i; - - /* 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 < Elements(src->VertexAttrib); i++) - _mesa_copy_client_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]); - - /* _Enabled must be the same than on push */ - dest->_Enabled = src->_Enabled; - dest->_MaxElement = src->_MaxElement; -} - /** * Copy gl_array_attrib from src to dest. * 'dest' must be in an initialized state. @@ -1098,8 +1073,20 @@ copy_array_attrib(struct gl_context *ctx, /* skip NewState */ /* skip RebindArrays */ - if (!vbo_deleted) - copy_array_object(ctx, dest->ArrayObj, src->ArrayObj); + if (!vbo_deleted) + { + GLuint i; + + /* skip Name */ + /* skip RefCount */ + + for (i = 0; i < Elements(src->VertexAttrib); i++) + _mesa_copy_client_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]); + + /* _Enabled must be the same than on push */ + dest->_Enabled = src->_Enabled; + dest->_MaxElement = src->_MaxElement; + } /* skip ArrayBufferObj */ /* skip ElementArrayBufferObj */ @@ -1113,17 +1100,14 @@ save_array_attrib(struct gl_context *ctx, struct gl_array_attrib *dest, struct gl_array_attrib *src) { - /* Set the Name, needed for restore, but do never overwrite. - * Needs to match value in the object hash. */ - dest->ArrayObj->Name = src->ArrayObj->Name; /* And copy all of the rest. */ copy_array_attrib(ctx, dest, src, GL_FALSE); /* Just reference them here */ _mesa_reference_buffer_object(ctx, &dest->ArrayBufferObj, src->ArrayBufferObj); - _mesa_reference_buffer_object(ctx, &dest->ArrayObj->ElementArrayBufferObj, - src->ArrayObj->ElementArrayBufferObj); + _mesa_reference_buffer_object(ctx, &dest->ElementArrayBufferObj, + src->ElementArrayBufferObj); } /** @@ -1134,29 +1118,8 @@ restore_array_attrib(struct gl_context *ctx, struct gl_array_attrib *dest, struct gl_array_attrib *src) { - /* The ARB_vertex_array_object spec says: - * - * "BindVertexArray fails and an INVALID_OPERATION error is generated - * if array is not a name returned from a previous call to - * GenVertexArrays, or if such a name has since been deleted with - * 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 GLboolean arb_vao = (src->ArrayObj->Name != 0 - && src->ArrayObj->ARBsemantics); - - if (arb_vao && !_mesa_IsVertexArrayAPPLE(src->ArrayObj->Name)) - return; - - _mesa_BindVertexArrayAPPLE(src->ArrayObj->Name); - /* Restore or recreate the buffer objects by the names ... */ - if (!arb_vao - || src->ArrayBufferObj->Name == 0 + if (!src->ArrayBufferObj->Name == 0 || _mesa_IsBufferARB(src->ArrayBufferObj->Name)) { /* ... and restore its content */ copy_array_attrib(ctx, dest, src, GL_FALSE); @@ -1167,11 +1130,10 @@ restore_array_attrib(struct gl_context *ctx, copy_array_attrib(ctx, dest, src, GL_TRUE); } - if (!arb_vao - || src->ArrayObj->ElementArrayBufferObj->Name == 0 - || _mesa_IsBufferARB(src->ArrayObj->ElementArrayBufferObj->Name)) + if (src->ElementArrayBufferObj->Name == 0 + || _mesa_IsBufferARB(src->ElementArrayBufferObj->Name)) _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, - src->ArrayObj->ElementArrayBufferObj->Name); + src->ElementArrayBufferObj->Name); /* Better safe than sorry?! */ dest->RebindArrays = GL_TRUE; @@ -1181,20 +1143,7 @@ restore_array_attrib(struct gl_context *ctx, * FIXME: of the old ArrayObj->_Enabled and the new _Enabled. * ... just do it. */ - dest->NewState |= src->ArrayObj->_Enabled | dest->ArrayObj->_Enabled; -} - -/** - * init/alloc the fields of 'attrib'. - * Needs to the init part matching free_array_attrib_data below. - */ -static void -init_array_attrib_data(struct gl_context *ctx, - struct gl_array_attrib *attrib) -{ - /* Get a non driver gl_array_object. */ - attrib->ArrayObj = CALLOC_STRUCT( gl_array_object ); - _mesa_initialize_array_object(ctx, attrib->ArrayObj, 0); + dest->NewState |= src->_Enabled | dest->_Enabled; } /** @@ -1206,11 +1155,8 @@ static void free_array_attrib_data(struct gl_context *ctx, struct gl_array_attrib *attrib) { - /* We use a non driver array object, so don't just unref since we would - * end up using the drivers DeleteArrayObject function for deletion. */ - _mesa_delete_array_object(ctx, attrib->ArrayObj); - attrib->ArrayObj = 0; _mesa_reference_buffer_object(ctx, &attrib->ArrayBufferObj, NULL); + _mesa_free_varray_data(ctx, attrib); } @@ -1247,7 +1193,7 @@ _mesa_PushClientAttrib(GLbitfield mask) if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { struct gl_array_attrib *attr; attr = CALLOC_STRUCT( gl_array_attrib ); - init_array_attrib_data(ctx, attr); + _mesa_init_varray(ctx, attr); save_array_attrib(ctx, attr, &ctx->Array); save_attrib_data(&head, GL_CLIENT_VERTEX_ARRAY_BIT, attr); } diff --git a/reactos/dll/opengl/mesa/main/bufferobj.c b/reactos/dll/opengl/mesa/main/bufferobj.c index b237fa6a114..f4251036d23 100644 --- a/reactos/dll/opengl/mesa/main/bufferobj.c +++ b/reactos/dll/opengl/mesa/main/bufferobj.c @@ -58,7 +58,7 @@ get_buffer_target(struct gl_context *ctx, GLenum target) case GL_ARRAY_BUFFER_ARB: return &ctx->Array.ArrayBufferObj; case GL_ELEMENT_ARRAY_BUFFER_ARB: - return &ctx->Array.ArrayObj->ElementArrayBufferObj; + return &ctx->Array.ElementArrayBufferObj; default: return NULL; } @@ -658,7 +658,6 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) for (i = 0; i < n; i++) { struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]); if (bufObj) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint j; ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject); @@ -671,14 +670,14 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) } /* unbind any vertex pointers bound to this buffer */ - for (j = 0; j < Elements(arrayObj->VertexAttrib); j++) { - unbind(ctx, &arrayObj->VertexAttrib[j].BufferObj, bufObj); + for (j = 0; j < Elements(ctx->Array.VertexAttrib); j++) { + unbind(ctx, &ctx->Array.VertexAttrib[j].BufferObj, bufObj); } if (ctx->Array.ArrayBufferObj == bufObj) { _mesa_BindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); } - if (arrayObj->ElementArrayBufferObj == bufObj) { + if (ctx->Array.ElementArrayBufferObj == bufObj) { _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 ); } @@ -1326,286 +1325,3 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj); } - -#if FEATURE_APPLE_object_purgeable -static GLenum -buffer_object_purgeable(struct gl_context *ctx, GLuint name, GLenum option) -{ - struct gl_buffer_object *bufObj; - GLenum retval; - - bufObj = _mesa_lookup_bufferobj(ctx, name); - if (!bufObj) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glObjectPurgeable(name = 0x%x)", name); - return 0; - } - if (!_mesa_is_bufferobj(bufObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glObjectPurgeable(buffer 0)" ); - return 0; - } - - if (bufObj->Purgeable) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glObjectPurgeable(name = 0x%x) is already purgeable", name); - return GL_VOLATILE_APPLE; - } - - bufObj->Purgeable = GL_TRUE; - - retval = GL_VOLATILE_APPLE; - if (ctx->Driver.BufferObjectPurgeable) - retval = ctx->Driver.BufferObjectPurgeable(ctx, bufObj, option); - - return retval; -} - -static GLenum -texture_object_purgeable(struct gl_context *ctx, GLuint name, GLenum option) -{ - struct gl_texture_object *bufObj; - GLenum retval; - - bufObj = _mesa_lookup_texture(ctx, name); - if (!bufObj) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glObjectPurgeable(name = 0x%x)", name); - return 0; - } - - if (bufObj->Purgeable) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glObjectPurgeable(name = 0x%x) is already purgeable", name); - return GL_VOLATILE_APPLE; - } - - bufObj->Purgeable = GL_TRUE; - - retval = GL_VOLATILE_APPLE; - if (ctx->Driver.TextureObjectPurgeable) - retval = ctx->Driver.TextureObjectPurgeable(ctx, bufObj, option); - - return retval; -} - - -GLenum GLAPIENTRY -_mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option) -{ - GLenum retval; - - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); - - if (name == 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glObjectPurgeable(name = 0x%x)", name); - return 0; - } - - switch (option) { - case GL_VOLATILE_APPLE: - case GL_RELEASED_APPLE: - /* legal */ - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glObjectPurgeable(name = 0x%x) invalid option: %d", - name, option); - return 0; - } - - switch (objectType) { - case GL_TEXTURE: - retval = texture_object_purgeable(ctx, name, option); - break; - case GL_BUFFER_OBJECT_APPLE: - retval = buffer_object_purgeable(ctx, name, option); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glObjectPurgeable(name = 0x%x) invalid type: %d", - name, objectType); - return 0; - } - - /* In strict conformance to the spec, we must only return VOLATILE when - * when passed the VOLATILE option. Madness. - * - * XXX First fix the spec, then fix me. - */ - return option == GL_VOLATILE_APPLE ? GL_VOLATILE_APPLE : retval; -} - - -static GLenum -buffer_object_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option) -{ - struct gl_buffer_object *bufObj; - GLenum retval; - - bufObj = _mesa_lookup_bufferobj(ctx, name); - if (!bufObj) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glObjectUnpurgeable(name = 0x%x)", name); - return 0; - } - - if (! bufObj->Purgeable) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glObjectUnpurgeable(name = 0x%x) object is " - " already \"unpurged\"", name); - return 0; - } - - bufObj->Purgeable = GL_FALSE; - - retval = option; - if (ctx->Driver.BufferObjectUnpurgeable) - retval = ctx->Driver.BufferObjectUnpurgeable(ctx, bufObj, option); - - return retval; -} - -static GLenum -texture_object_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option) -{ - struct gl_texture_object *bufObj; - GLenum retval; - - bufObj = _mesa_lookup_texture(ctx, name); - if (!bufObj) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glObjectUnpurgeable(name = 0x%x)", name); - return 0; - } - - if (! bufObj->Purgeable) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glObjectUnpurgeable(name = 0x%x) object is" - " already \"unpurged\"", name); - return 0; - } - - bufObj->Purgeable = GL_FALSE; - - retval = option; - if (ctx->Driver.TextureObjectUnpurgeable) - retval = ctx->Driver.TextureObjectUnpurgeable(ctx, bufObj, option); - - return retval; -} - - -GLenum GLAPIENTRY -_mesa_ObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); - - if (name == 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glObjectUnpurgeable(name = 0x%x)", name); - return 0; - } - - switch (option) { - case GL_RETAINED_APPLE: - case GL_UNDEFINED_APPLE: - /* legal */ - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glObjectUnpurgeable(name = 0x%x) invalid option: %d", - name, option); - return 0; - } - - switch (objectType) { - case GL_BUFFER_OBJECT_APPLE: - return buffer_object_unpurgeable(ctx, name, option); - case GL_TEXTURE: - return texture_object_unpurgeable(ctx, name, option); - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glObjectUnpurgeable(name = 0x%x) invalid type: %d", - name, objectType); - return 0; - } -} - - -static void -get_buffer_object_parameteriv(struct gl_context *ctx, GLuint name, - GLenum pname, GLint *params) -{ - struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, name); - if (!bufObj) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetObjectParameteriv(name = 0x%x) invalid object", name); - return; - } - - switch (pname) { - case GL_PURGEABLE_APPLE: - *params = bufObj->Purgeable; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetObjectParameteriv(name = 0x%x) invalid enum: %d", - name, pname); - break; - } -} - -static void -get_texture_object_parameteriv(struct gl_context *ctx, GLuint name, - GLenum pname, GLint *params) -{ - struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name); - if (!texObj) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glObjectUnpurgeable(name = 0x%x)", name); - return; - } - - switch (pname) { - case GL_PURGEABLE_APPLE: - *params = texObj->Purgeable; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetObjectParameteriv(name = 0x%x) invalid enum: %d", - name, pname); - break; - } -} - - -void GLAPIENTRY -_mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname, - GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - - if (name == 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetObjectParameteriv(name = 0x%x)", name); - return; - } - - switch (objectType) { - case GL_TEXTURE: - get_texture_object_parameteriv(ctx, name, pname, params); - break; - case GL_BUFFER_OBJECT_APPLE: - get_buffer_object_parameteriv(ctx, name, pname, params); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetObjectParameteriv(name = 0x%x) invalid type: %d", - name, objectType); - } -} - -#endif /* FEATURE_APPLE_object_purgeable */ diff --git a/reactos/dll/opengl/mesa/main/context.c b/reactos/dll/opengl/mesa/main/context.c index 14e64c555f3..597567b6049 100644 --- a/reactos/dll/opengl/mesa/main/context.c +++ b/reactos/dll/opengl/mesa/main/context.c @@ -494,7 +494,7 @@ init_attrib_groups(struct gl_context *ctx) _mesa_init_scissor( ctx ); _mesa_init_stencil( ctx ); _mesa_init_transform( ctx ); - _mesa_init_varray( ctx ); + _mesa_init_varray(ctx, &ctx->Array); _mesa_init_viewport( ctx ); if (!_mesa_init_texture( ctx )) @@ -748,9 +748,7 @@ _mesa_free_context_data( struct gl_context *ctx ) _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); - _mesa_free_varray_data(ctx); - - _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj); + _mesa_free_varray_data(ctx, &ctx->Array); _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL); diff --git a/reactos/dll/opengl/mesa/main/dd.h b/reactos/dll/opengl/mesa/main/dd.h index 05c89781dd3..03a1a87f27c 100644 --- a/reactos/dll/opengl/mesa/main/dd.h +++ b/reactos/dll/opengl/mesa/main/dd.h @@ -563,31 +563,6 @@ struct dd_function_table { struct gl_buffer_object *obj ); /*@}*/ - /** - * \name Functions for GL_APPLE_object_purgeable - */ - /*@{*/ - /* variations on ObjectPurgeable */ - GLenum (*BufferObjectPurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); - GLenum (*RenderObjectPurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); - GLenum (*TextureObjectPurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); - - /* variations on ObjectUnpurgeable */ - GLenum (*BufferObjectUnpurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); - GLenum (*RenderObjectUnpurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); - GLenum (*TextureObjectUnpurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); - /*@}*/ - - - /** - * \name Vertex Array objects - */ - /*@{*/ - struct gl_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id); - void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); - void (*BindArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); - /*@}*/ - /** * \name Support for multiple T&L engines diff --git a/reactos/dll/opengl/mesa/main/dispatch.h b/reactos/dll/opengl/mesa/main/dispatch.h index 41c30e2eec7..3df758825af 100644 --- a/reactos/dll/opengl/mesa/main/dispatch.h +++ b/reactos/dll/opengl/mesa/main/dispatch.h @@ -478,8 +478,6 @@ typedef PROC _glapi_proc; #define _gloffset_GetActiveAttribARB 569 #define _gloffset_FlushMappedBufferRange 580 #define _gloffset_MapBufferRange 581 -#define _gloffset_BindVertexArray 583 -#define _gloffset_GenVertexArrays 584 #define _gloffset_TexStorage1D 685 #define _gloffset_TexStorage2D 686 #define _gloffset_TexStorage3D 687 @@ -623,10 +621,6 @@ typedef PROC _glapi_proc; #define _gloffset_PointParameteriNV 863 #define _gloffset_PointParameterivNV 864 #define _gloffset_ActiveStencilFaceEXT 865 -#define _gloffset_BindVertexArrayAPPLE 866 -#define _gloffset_DeleteVertexArraysAPPLE 867 -#define _gloffset_GenVertexArraysAPPLE 868 -#define _gloffset_IsVertexArrayAPPLE 869 #define _gloffset_GetProgramNamedParameterdvNV 870 #define _gloffset_GetProgramNamedParameterfvNV 871 #define _gloffset_ProgramNamedParameter4dNV 872 @@ -698,8 +692,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define VertexAttribDivisorARB_remap_index 171 #define FlushMappedBufferRange_remap_index 172 #define MapBufferRange_remap_index 173 -#define BindVertexArray_remap_index 175 -#define GenVertexArrays_remap_index 176 #define TexStorage1D_remap_index 277 #define TexStorage2D_remap_index 278 #define TexStorage3D_remap_index 279 @@ -844,10 +836,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define PointParameteriNV_remap_index 455 #define PointParameterivNV_remap_index 456 #define ActiveStencilFaceEXT_remap_index 457 -#define BindVertexArrayAPPLE_remap_index 458 -#define DeleteVertexArraysAPPLE_remap_index 459 -#define GenVertexArraysAPPLE_remap_index 460 -#define IsVertexArrayAPPLE_remap_index 461 #define GetProgramNamedParameterdvNV_remap_index 462 #define GetProgramNamedParameterfvNV_remap_index 463 #define ProgramNamedParameter4dNV_remap_index 464 @@ -912,8 +900,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index] #define _gloffset_FlushMappedBufferRange driDispatchRemapTable[FlushMappedBufferRange_remap_index] #define _gloffset_MapBufferRange driDispatchRemapTable[MapBufferRange_remap_index] -#define _gloffset_BindVertexArray driDispatchRemapTable[BindVertexArray_remap_index] -#define _gloffset_GenVertexArrays driDispatchRemapTable[GenVertexArrays_remap_index] #define _gloffset_TexStorage1D driDispatchRemapTable[TexStorage1D_remap_index] #define _gloffset_TexStorage2D driDispatchRemapTable[TexStorage2D_remap_index] #define _gloffset_TexStorage3D driDispatchRemapTable[TexStorage3D_remap_index] @@ -1057,10 +1043,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define _gloffset_PointParameteriNV driDispatchRemapTable[PointParameteriNV_remap_index] #define _gloffset_PointParameterivNV driDispatchRemapTable[PointParameterivNV_remap_index] #define _gloffset_ActiveStencilFaceEXT driDispatchRemapTable[ActiveStencilFaceEXT_remap_index] -#define _gloffset_BindVertexArrayAPPLE driDispatchRemapTable[BindVertexArrayAPPLE_remap_index] -#define _gloffset_DeleteVertexArraysAPPLE driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index] -#define _gloffset_GenVertexArraysAPPLE driDispatchRemapTable[GenVertexArraysAPPLE_remap_index] -#define _gloffset_IsVertexArrayAPPLE driDispatchRemapTable[IsVertexArrayAPPLE_remap_index] #define _gloffset_GetProgramNamedParameterdvNV driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index] #define _gloffset_GetProgramNamedParameterfvNV driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index] #define _gloffset_ProgramNamedParameter4dNV driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index] @@ -5577,28 +5559,6 @@ static inline void SET_MapBufferRange(struct _glapi_table *disp, GLvoid * (GLAPI SET_by_offset(disp, _gloffset_MapBufferRange, fn); } -typedef void (GLAPIENTRYP _glptr_BindVertexArray)(GLuint); -#define CALL_BindVertexArray(disp, parameters) \ - (* GET_BindVertexArray(disp)) parameters -static inline _glptr_BindVertexArray GET_BindVertexArray(struct _glapi_table *disp) { - return (_glptr_BindVertexArray) (GET_by_offset(disp, _gloffset_BindVertexArray)); -} - -static inline void SET_BindVertexArray(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) { - SET_by_offset(disp, _gloffset_BindVertexArray, fn); -} - -typedef void (GLAPIENTRYP _glptr_GenVertexArrays)(GLsizei, GLuint *); -#define CALL_GenVertexArrays(disp, parameters) \ - (* GET_GenVertexArrays(disp)) parameters -static inline _glptr_GenVertexArrays GET_GenVertexArrays(struct _glapi_table *disp) { - return (_glptr_GenVertexArrays) (GET_by_offset(disp, _gloffset_GenVertexArrays)); -} - -static inline void SET_GenVertexArrays(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) { - SET_by_offset(disp, _gloffset_GenVertexArrays, fn); -} - typedef void (GLAPIENTRYP _glptr_TexStorage1D)(GLenum, GLsizei, GLenum, GLsizei); #define CALL_TexStorage1D(disp, parameters) \ (* GET_TexStorage1D(disp)) parameters @@ -7172,50 +7132,6 @@ static inline void SET_ActiveStencilFaceEXT(struct _glapi_table *disp, void (GLA SET_by_offset(disp, _gloffset_ActiveStencilFaceEXT, fn); } -typedef void (GLAPIENTRYP _glptr_BindVertexArrayAPPLE)(GLuint); -#define CALL_BindVertexArrayAPPLE(disp, parameters) \ - (* GET_BindVertexArrayAPPLE(disp)) parameters -static inline _glptr_BindVertexArrayAPPLE GET_BindVertexArrayAPPLE(struct _glapi_table *disp) { - return (_glptr_BindVertexArrayAPPLE) (GET_by_offset(disp, _gloffset_BindVertexArrayAPPLE)); -} - -static inline void SET_BindVertexArrayAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) { - SET_by_offset(disp, _gloffset_BindVertexArrayAPPLE, fn); -} - -typedef void (GLAPIENTRYP _glptr_DeleteVertexArraysAPPLE)(GLsizei, const GLuint *); -#define CALL_DeleteVertexArraysAPPLE(disp, parameters) \ - (* GET_DeleteVertexArraysAPPLE(disp)) parameters -static inline _glptr_DeleteVertexArraysAPPLE GET_DeleteVertexArraysAPPLE(struct _glapi_table *disp) { - return (_glptr_DeleteVertexArraysAPPLE) (GET_by_offset(disp, _gloffset_DeleteVertexArraysAPPLE)); -} - -static inline void SET_DeleteVertexArraysAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) { - SET_by_offset(disp, _gloffset_DeleteVertexArraysAPPLE, fn); -} - -typedef void (GLAPIENTRYP _glptr_GenVertexArraysAPPLE)(GLsizei, GLuint *); -#define CALL_GenVertexArraysAPPLE(disp, parameters) \ - (* GET_GenVertexArraysAPPLE(disp)) parameters -static inline _glptr_GenVertexArraysAPPLE GET_GenVertexArraysAPPLE(struct _glapi_table *disp) { - return (_glptr_GenVertexArraysAPPLE) (GET_by_offset(disp, _gloffset_GenVertexArraysAPPLE)); -} - -static inline void SET_GenVertexArraysAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) { - SET_by_offset(disp, _gloffset_GenVertexArraysAPPLE, fn); -} - -typedef GLboolean (GLAPIENTRYP _glptr_IsVertexArrayAPPLE)(GLuint); -#define CALL_IsVertexArrayAPPLE(disp, parameters) \ - (* GET_IsVertexArrayAPPLE(disp)) parameters -static inline _glptr_IsVertexArrayAPPLE GET_IsVertexArrayAPPLE(struct _glapi_table *disp) { - return (_glptr_IsVertexArrayAPPLE) (GET_by_offset(disp, _gloffset_IsVertexArrayAPPLE)); -} - -static inline void SET_IsVertexArrayAPPLE(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) { - SET_by_offset(disp, _gloffset_IsVertexArrayAPPLE, fn); -} - typedef void (GLAPIENTRYP _glptr_GetProgramNamedParameterdvNV)(GLuint, GLsizei, const GLubyte *, GLdouble *); #define CALL_GetProgramNamedParameterdvNV(disp, parameters) \ (* GET_GetProgramNamedParameterdvNV(disp)) parameters @@ -7436,39 +7352,6 @@ static inline void SET_TextureRangeAPPLE(struct _glapi_table *disp, void (GLAPIE SET_by_offset(disp, _gloffset_TextureRangeAPPLE, fn); } -typedef void (GLAPIENTRYP _glptr_GetObjectParameterivAPPLE)(GLenum, GLuint, GLenum, GLint *); -#define CALL_GetObjectParameterivAPPLE(disp, parameters) \ - (* GET_GetObjectParameterivAPPLE(disp)) parameters -static inline _glptr_GetObjectParameterivAPPLE GET_GetObjectParameterivAPPLE(struct _glapi_table *disp) { - return (_glptr_GetObjectParameterivAPPLE) (GET_by_offset(disp, _gloffset_GetObjectParameterivAPPLE)); -} - -static inline void SET_GetObjectParameterivAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLint *)) { - SET_by_offset(disp, _gloffset_GetObjectParameterivAPPLE, fn); -} - -typedef GLenum (GLAPIENTRYP _glptr_ObjectPurgeableAPPLE)(GLenum, GLuint, GLenum); -#define CALL_ObjectPurgeableAPPLE(disp, parameters) \ - (* GET_ObjectPurgeableAPPLE(disp)) parameters -static inline _glptr_ObjectPurgeableAPPLE GET_ObjectPurgeableAPPLE(struct _glapi_table *disp) { - return (_glptr_ObjectPurgeableAPPLE) (GET_by_offset(disp, _gloffset_ObjectPurgeableAPPLE)); -} - -static inline void SET_ObjectPurgeableAPPLE(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLenum, GLuint, GLenum)) { - SET_by_offset(disp, _gloffset_ObjectPurgeableAPPLE, fn); -} - -typedef GLenum (GLAPIENTRYP _glptr_ObjectUnpurgeableAPPLE)(GLenum, GLuint, GLenum); -#define CALL_ObjectUnpurgeableAPPLE(disp, parameters) \ - (* GET_ObjectUnpurgeableAPPLE(disp)) parameters -static inline _glptr_ObjectUnpurgeableAPPLE GET_ObjectUnpurgeableAPPLE(struct _glapi_table *disp) { - return (_glptr_ObjectUnpurgeableAPPLE) (GET_by_offset(disp, _gloffset_ObjectUnpurgeableAPPLE)); -} - -static inline void SET_ObjectUnpurgeableAPPLE(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLenum, GLuint, GLenum)) { - SET_by_offset(disp, _gloffset_ObjectUnpurgeableAPPLE, fn); -} - typedef GLuint (GLAPIENTRYP _glptr_CreateShaderProgramEXT)(GLenum, const GLchar *); #define CALL_CreateShaderProgramEXT(disp, parameters) \ (* GET_CreateShaderProgramEXT(disp)) parameters diff --git a/reactos/dll/opengl/mesa/main/dlist.c b/reactos/dll/opengl/mesa/main/dlist.c index 2abbea7a32e..ea359e05c70 100644 --- a/reactos/dll/opengl/mesa/main/dlist.c +++ b/reactos/dll/opengl/mesa/main/dlist.c @@ -6730,16 +6730,6 @@ _mesa_create_save_table(void) SET_PointParameteriNV(table, save_PointParameteriNV); SET_PointParameterivNV(table, save_PointParameterivNV); - /* 273. GL_APPLE_vertex_array_object */ - SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE); - SET_DeleteVertexArraysAPPLE(table, _mesa_DeleteVertexArraysAPPLE); - SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE); - SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE); - - /* GL_ARB_vertex_array_object */ - SET_BindVertexArray(table, _mesa_BindVertexArray); - SET_GenVertexArrays(table, _mesa_GenVertexArrays); - /* ???. GL_EXT_depth_bounds_test */ SET_DepthBoundsEXT(table, save_DepthBoundsEXT); @@ -6775,13 +6765,6 @@ _mesa_create_save_table(void) SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */ #endif - /* 371. GL_APPLE_object_purgeable */ -#if FEATURE_APPLE_object_purgeable - SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE); - SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE); - SET_GetObjectParameterivAPPLE(table, _mesa_GetObjectParameterivAPPLE); -#endif - /* GL_EXT_texture_integer */ SET_ClearColorIiEXT(table, save_ClearColorIi); SET_ClearColorIuiEXT(table, save_ClearColorIui); diff --git a/reactos/dll/opengl/mesa/main/enable.c b/reactos/dll/opengl/mesa/main/enable.c index a70bc5928f9..9b9d52fab5f 100644 --- a/reactos/dll/opengl/mesa/main/enable.c +++ b/reactos/dll/opengl/mesa/main/enable.c @@ -41,78 +41,50 @@ static void client_state(struct gl_context *ctx, GLenum cap, GLboolean state) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLbitfield64 flag; GLboolean *var; switch (cap) { case GL_VERTEX_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled; + var = &ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled; flag = VERT_BIT_POS; break; case GL_NORMAL_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled; + var = &ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled; flag = VERT_BIT_NORMAL; break; case GL_COLOR_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled; + var = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled; flag = VERT_BIT_COLOR0; break; case GL_INDEX_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled; + var = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled; flag = VERT_BIT_COLOR_INDEX; break; case GL_TEXTURE_COORD_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_TEX].Enabled; + var = &ctx->Array.VertexAttrib[VERT_ATTRIB_TEX].Enabled; flag = VERT_BIT_TEX; break; case GL_EDGE_FLAG_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled; + var = &ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled; flag = VERT_BIT_EDGEFLAG; break; case GL_FOG_COORDINATE_ARRAY_EXT: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled; + var = &ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled; flag = VERT_BIT_FOG; break; case GL_SECONDARY_COLOR_ARRAY_EXT: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled; + var = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled; flag = VERT_BIT_COLOR1; break; #if FEATURE_point_size_array case GL_POINT_SIZE_ARRAY_OES: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; + var = &ctx->Array.VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; flag = VERT_BIT_POINT_SIZE; break; #endif -#if FEATURE_NV_vertex_program - case GL_VERTEX_ATTRIB_ARRAY0_NV: - case GL_VERTEX_ATTRIB_ARRAY1_NV: - case GL_VERTEX_ATTRIB_ARRAY2_NV: - case GL_VERTEX_ATTRIB_ARRAY3_NV: - case GL_VERTEX_ATTRIB_ARRAY4_NV: - case GL_VERTEX_ATTRIB_ARRAY5_NV: - case GL_VERTEX_ATTRIB_ARRAY6_NV: - case GL_VERTEX_ATTRIB_ARRAY7_NV: - case GL_VERTEX_ATTRIB_ARRAY8_NV: - case GL_VERTEX_ATTRIB_ARRAY9_NV: - case GL_VERTEX_ATTRIB_ARRAY10_NV: - case GL_VERTEX_ATTRIB_ARRAY11_NV: - case GL_VERTEX_ATTRIB_ARRAY12_NV: - case GL_VERTEX_ATTRIB_ARRAY13_NV: - case GL_VERTEX_ATTRIB_ARRAY14_NV: - case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXTENSION(NV_vertex_program, cap); - { - GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; - ASSERT(VERT_ATTRIB_GENERIC(n) < Elements(ctx->Array.ArrayObj->VertexAttrib)); - var = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(n)].Enabled; - flag = VERT_BIT_GENERIC(n); - } - break; -#endif /* FEATURE_NV_vertex_program */ - default: goto invalid_enum_error; } @@ -128,9 +100,9 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state) *var = state; if (state) - ctx->Array.ArrayObj->_Enabled |= flag; + ctx->Array._Enabled |= flag; else - ctx->Array.ArrayObj->_Enabled &= ~flag; + ctx->Array._Enabled &= ~flag; if (ctx->Driver.Enable) { ctx->Driver.Enable( ctx, cap, state ); @@ -906,24 +878,24 @@ _mesa_IsEnabled( GLenum cap ) /* client-side state */ case GL_VERTEX_ARRAY: - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled != 0); + return (ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled != 0); case GL_NORMAL_ARRAY: - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled != 0); + return (ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled != 0); case GL_COLOR_ARRAY: - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled != 0); + return (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled != 0); case GL_INDEX_ARRAY: - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled != 0); + return (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled != 0); case GL_TEXTURE_COORD_ARRAY: - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX] + return (ctx->Array.VertexAttrib[VERT_ATTRIB_TEX] .Enabled != 0); case GL_EDGE_FLAG_ARRAY: - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled != 0); + return (ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled != 0); case GL_FOG_COORDINATE_ARRAY_EXT: CHECK_EXTENSION(EXT_fog_coord); - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled != 0); + return (ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled != 0); case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXTENSION(EXT_secondary_color); - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled != 0); + return (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled != 0); #if FEATURE_point_size_array case GL_POINT_SIZE_ARRAY_OES: return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled != 0); diff --git a/reactos/dll/opengl/mesa/main/extensions.c b/reactos/dll/opengl/mesa/main/extensions.c index ec01949c09a..8062a59bbe6 100644 --- a/reactos/dll/opengl/mesa/main/extensions.c +++ b/reactos/dll/opengl/mesa/main/extensions.c @@ -73,7 +73,6 @@ static const struct extension extension_table[] = { { "GL_ARB_texture_mirrored_repeat", o(dummy_true), 2001 }, { "GL_ARB_texture_storage", o(ARB_texture_storage), 2011 }, { "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), 1999 }, - { "GL_ARB_vertex_array_object", o(ARB_vertex_array_object), 2006 }, { "GL_ARB_vertex_buffer_object", o(dummy_true), 2003 }, { "GL_ARB_window_pos", o(ARB_window_pos), 2001 }, /* EXT extensions */ @@ -112,9 +111,7 @@ static const struct extension extension_table[] = { { "GL_EXT_vertex_array", o(dummy_true), 1995 }, /* Vendor extensions */ - { "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), 2006 }, { "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), 2002 }, - { "GL_APPLE_vertex_array_object", o(APPLE_vertex_array_object), 2002 }, { "GL_ATI_blend_equation_separate", o(EXT_blend_equation_separate), 2003 }, { "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), 2002 }, { "GL_IBM_multimode_draw_arrays", o(IBM_multimode_draw_arrays), 1998 }, @@ -206,11 +203,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/ ctx->Extensions.ARB_texture_storage = GL_TRUE; - ctx->Extensions.ARB_vertex_array_object = GL_TRUE; - ctx->Extensions.APPLE_vertex_array_object = GL_TRUE; -#if FEATURE_APPLE_object_purgeable - ctx->Extensions.APPLE_object_purgeable = GL_TRUE; -#endif ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; diff --git a/reactos/dll/opengl/mesa/main/get.c b/reactos/dll/opengl/mesa/main/get.c index 43f90ac339a..bdd2ace5052 100644 --- a/reactos/dll/opengl/mesa/main/get.c +++ b/reactos/dll/opengl/mesa/main/get.c @@ -262,12 +262,10 @@ EXTRA_EXT(IBM_rasterpos_clip); EXTRA_EXT(NV_point_sprite); EXTRA_EXT(NV_light_max_exponent); EXTRA_EXT(EXT_depth_bounds_test); -EXTRA_EXT(APPLE_vertex_array_object); EXTRA_EXT(EXT_compiled_vertex_array); EXTRA_EXT2(NV_point_sprite, ARB_point_sprite); static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END }; -static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END }; static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END }; #define API_OPENGL_BIT (1 << API_OPENGL) @@ -739,10 +737,6 @@ static const struct value_desc values[] = { { GL_DEPTH_BOUNDS_EXT, CONTEXT_FLOAT2(Depth.BoundsMin), extra_EXT_depth_bounds_test }, - /* GL_APPLE_vertex_array_object */ - { GL_VERTEX_ARRAY_BINDING_APPLE, ARRAY_INT(Name), - extra_APPLE_vertex_array_object }, - /* GL_EXT_texture_integer */ { GL_RGBA_INTEGER_MODE_EXT, BUFFER_BOOL(_IntegerColor), extra_EXT_texture_integer }, @@ -929,7 +923,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_TEXTURE_COORD_ARRAY_SIZE: case GL_TEXTURE_COORD_ARRAY_TYPE: case GL_TEXTURE_COORD_ARRAY_STRIDE: - array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX]; + array = &ctx->Array.VertexAttrib[VERT_ATTRIB_TEX]; v->value_int = *(GLuint *) ((char *) array + d->offset); break; @@ -1032,7 +1026,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: buffer_obj = (struct gl_buffer_object **) - ((char *) ctx->Array.ArrayObj + d->offset); + ((char *) &ctx->Array + d->offset); v->value_int = (*buffer_obj)->Name; break; case GL_ARRAY_BUFFER_BINDING_ARB: @@ -1040,10 +1034,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu break; case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: v->value_int = - ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX].BufferObj->Name; + ctx->Array.VertexAttrib[VERT_ATTRIB_TEX].BufferObj->Name; break; case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - v->value_int = ctx->Array.ArrayObj->ElementArrayBufferObj->Name; + v->value_int = ctx->Array.ElementArrayBufferObj->Name; break; case GL_FOG_COLOR: @@ -1195,7 +1189,7 @@ find_value(const char *func, GLenum pname, void **p, union value *v) *p = ((char *) ctx + d->offset); return d; case LOC_ARRAY: - *p = ((char *) ctx->Array.ArrayObj + d->offset); + *p = ((char *)&ctx->Array + d->offset); return d; case LOC_TEXUNIT: unit = &ctx->Texture.Unit; diff --git a/reactos/dll/opengl/mesa/main/getstring.c b/reactos/dll/opengl/mesa/main/getstring.c index 5697d7b8f4b..ae511d1e9b9 100644 --- a/reactos/dll/opengl/mesa/main/getstring.c +++ b/reactos/dll/opengl/mesa/main/getstring.c @@ -125,28 +125,28 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) switch (pname) { case GL_VERTEX_ARRAY_POINTER: - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Ptr; + *params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Ptr; break; case GL_NORMAL_ARRAY_POINTER: - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Ptr; + *params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Ptr; break; case GL_COLOR_ARRAY_POINTER: - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Ptr; + *params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Ptr; break; case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT: - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Ptr; + *params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Ptr; break; case GL_FOG_COORDINATE_ARRAY_POINTER_EXT: - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Ptr; + *params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Ptr; break; case GL_INDEX_ARRAY_POINTER: - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr; + *params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr; break; case GL_TEXTURE_COORD_ARRAY_POINTER: - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX].Ptr; + *params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_TEX].Ptr; break; case GL_EDGE_FLAG_ARRAY_POINTER: - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr; + *params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr; break; case GL_FEEDBACK_BUFFER_POINTER: *params = ctx->Feedback.Buffer; diff --git a/reactos/dll/opengl/mesa/main/mtypes.h b/reactos/dll/opengl/mesa/main/mtypes.h index 41031579658..da69c74e7d4 100644 --- a/reactos/dll/opengl/mesa/main/mtypes.h +++ b/reactos/dll/opengl/mesa/main/mtypes.h @@ -1202,22 +1202,6 @@ struct gl_array_object GLint RefCount; _glthread_Mutex Mutex; - /** - * 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? */ @@ -1244,23 +1228,28 @@ struct gl_array_object */ struct gl_array_attrib { - /** Currently bound array object. See _mesa_BindVertexArrayAPPLE() */ - struct gl_array_object *ArrayObj; + /** Vertex attribute arrays */ + struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX]; - /** The default vertex array object */ - struct gl_array_object *DefaultArrayObj; + /** Mask of VERT_BIT_* values indicating which arrays are enabled */ + GLbitfield64 _Enabled; - /** Array objects (GL_ARB/APPLE_vertex_array_object) */ - struct _mesa_HashTable *Objects; + /** + * Min of all enabled arrays' _MaxElement. When arrays reside inside VBOs + * we can determine the max legal (in bounds) glDrawElements array index. + */ + GLuint _MaxElement; - GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */ - GLuint LockCount; /**< GL_EXT_compiled_vertex_array */ + struct gl_buffer_object *ElementArrayBufferObj; - GLbitfield64 NewState; /**< mask of VERT_BIT_* values */ - GLboolean RebindArrays; /**< whether the VBO module should rebind arrays */ + GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */ + GLuint LockCount; /**< GL_EXT_compiled_vertex_array */ - /* GL_ARB_vertex_buffer_object */ - struct gl_buffer_object *ArrayBufferObj; + GLbitfield64 NewState; /**< mask of VERT_BIT_* values */ + GLboolean RebindArrays; /**< whether the VBO module should rebind arrays */ + + /* GL_ARB_vertex_buffer_object */ + struct gl_buffer_object *ArrayBufferObj; }; @@ -1582,7 +1571,6 @@ struct gl_extensions GLboolean ARB_texture_env_dot3; GLboolean ARB_texture_storage; GLboolean ARB_transpose_matrix; - GLboolean ARB_vertex_array_object; GLboolean ARB_window_pos; GLboolean EXT_blend_color; GLboolean EXT_blend_equation_separate; @@ -1606,8 +1594,6 @@ struct gl_extensions GLboolean EXT_texture_integer; /* vendor extensions */ GLboolean APPLE_packed_pixels; - GLboolean APPLE_vertex_array_object; - GLboolean APPLE_object_purgeable; GLboolean ATI_texture_env_combine3; GLboolean IBM_rasterpos_clip; GLboolean IBM_multimode_draw_arrays; diff --git a/reactos/dll/opengl/mesa/main/precomp.h b/reactos/dll/opengl/mesa/main/precomp.h index e670fa37c6e..1dfbe5aa282 100644 --- a/reactos/dll/opengl/mesa/main/precomp.h +++ b/reactos/dll/opengl/mesa/main/precomp.h @@ -6,7 +6,6 @@ #include "api_exec.h" #include "api_loopback.h" #include "api_validate.h" -#include "arrayobj.h" #include "attrib.h" #include "blend.h" #include "bufferobj.h" diff --git a/reactos/dll/opengl/mesa/main/state.c b/reactos/dll/opengl/mesa/main/state.c index 94689bdd383..62221e34a73 100644 --- a/reactos/dll/opengl/mesa/main/state.c +++ b/reactos/dll/opengl/mesa/main/state.c @@ -61,7 +61,6 @@ update_min(GLuint min, struct gl_client_array *array) static void update_arrays( struct gl_context *ctx ) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint min = ~0; /* find min of _MaxElement values for all enabled arrays. @@ -70,46 +69,46 @@ update_arrays( struct gl_context *ctx ) */ /* 0 */ - if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) { - min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]); + if (ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) { + min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_POS]); } /* 2 */ - if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { - min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]); + if (ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { + min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL]); } /* 3 */ - if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { - min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]); + if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { + min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0]); } /* 4 */ - if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { - min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]); + if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { + min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1]); } /* 5 */ - if (arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) { - min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_FOG]); + if (ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) { + min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_FOG]); } /* 6 */ - if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { - min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]); + if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { + min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX]); } /* 8 */ - if (arrayObj->VertexAttrib[VERT_ATTRIB_TEX].Enabled) { - min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_TEX]); + if (ctx->Array.VertexAttrib[VERT_ATTRIB_TEX].Enabled) { + min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_TEX]); } - if (arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) { - min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]); + if (ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) { + min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG]); } /* _MaxElement is one past the last legal array element */ - arrayObj->_MaxElement = min; + ctx->Array._MaxElement = min; } static void diff --git a/reactos/dll/opengl/mesa/main/varray.c b/reactos/dll/opengl/mesa/main/varray.c index 71b3eab96ba..d570e865ef5 100644 --- a/reactos/dll/opengl/mesa/main/varray.c +++ b/reactos/dll/opengl/mesa/main/varray.c @@ -118,8 +118,7 @@ update_array(struct gl_context *ctx, return; } - if (ctx->Array.ArrayObj->ARBsemantics && - !_mesa_is_bufferobj(ctx->Array.ArrayBufferObj)) { + if (!_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. */ @@ -129,7 +128,7 @@ update_array(struct gl_context *ctx, elementSize = _mesa_sizeof_type(type) * size; - array = &ctx->Array.ArrayObj->VertexAttrib[attrib]; + array = &ctx->Array.VertexAttrib[attrib]; array->Size = size; array->Type = type; array->Stride = stride; @@ -609,46 +608,22 @@ _mesa_copy_client_array(struct gl_context *ctx, dst->_MaxElement = src->_MaxElement; } - - -/** - * Print vertex array's fields. - */ static void -print_array(const char *name, GLint index, const struct gl_client_array *array) +init_array(struct gl_context *ctx, + struct gl_client_array *array, GLint size, GLint type) { - if (index >= 0) - printf(" %s[%d]: ", name, index); - else - printf(" %s: ", name); - printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %lu), MaxElem=%u\n", - array->Ptr, array->Type, array->Size, - array->_ElementSize, array->StrideB, - array->BufferObj->Name, (unsigned long) array->BufferObj->Size, - array->_MaxElement); -} - - -/** - * Print current vertex object/array info. For debug. - */ -void -_mesa_print_arrays(struct gl_context *ctx) -{ - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; - - _mesa_update_array_object_max_element(ctx, arrayObj); - - printf("Array Object %u\n", arrayObj->Name); - if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) - print_array("Vertex", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]); - if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) - print_array("Normal", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]); - if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) - print_array("Color", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]); - if (arrayObj->VertexAttrib[VERT_ATTRIB_TEX].Enabled) - print_array("TexCoord", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_TEX]); - printf(" _MaxElement = %u\n", arrayObj->_MaxElement); + array->Size = size; + array->Type = type; + array->Stride = 0; + array->StrideB = 0; + array->Ptr = NULL; + array->Enabled = GL_FALSE; + array->Normalized = GL_FALSE; + array->Integer = GL_FALSE; + array->_ElementSize = size * _mesa_sizeof_type(type); + /* Vertex array buffers */ + _mesa_reference_buffer_object(ctx, &array->BufferObj, + ctx->Shared->NullBufferObj); } @@ -656,25 +631,41 @@ _mesa_print_arrays(struct gl_context *ctx) * Initialize vertex array state for given context. */ void -_mesa_init_varray(struct gl_context *ctx) +_mesa_init_varray(struct gl_context *ctx, struct gl_array_attrib *array) { - ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0); - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, - ctx->Array.DefaultArrayObj); + GLuint i; - ctx->Array.Objects = _mesa_NewHashTable(); -} - - -/** - * Callback for deleting an array object. Called by _mesa_HashDeleteAll(). - */ -static void -delete_arrayobj_cb(GLuint id, void *data, void *userData) -{ - struct gl_array_object *arrayObj = (struct gl_array_object *) data; - struct gl_context *ctx = (struct gl_context *) userData; - _mesa_delete_array_object(ctx, arrayObj); + /* Init the individual arrays */ + for (i = 0; i < Elements(array->VertexAttrib); i++) { + switch (i) { + case VERT_ATTRIB_WEIGHT: + init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_WEIGHT], 1, GL_FLOAT); + break; + case VERT_ATTRIB_NORMAL: + init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_NORMAL], 3, GL_FLOAT); + break; + case VERT_ATTRIB_COLOR1: + init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_COLOR1], 3, GL_FLOAT); + break; + case VERT_ATTRIB_FOG: + init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_FOG], 1, GL_FLOAT); + break; + case VERT_ATTRIB_COLOR_INDEX: + init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_COLOR_INDEX], 1, GL_FLOAT); + break; + case VERT_ATTRIB_EDGEFLAG: + init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_EDGEFLAG], 1, GL_BOOL); + break; + #if FEATURE_point_size_array + case VERT_ATTRIB_POINT_SIZE: + init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_POINT_SIZE], 1, GL_FLOAT); + break; + #endif + default: + init_array(ctx, &array->VertexAttrib[i], 4, GL_FLOAT); + break; + } + } } @@ -682,8 +673,14 @@ delete_arrayobj_cb(GLuint id, void *data, void *userData) * Free vertex array state for given context. */ void -_mesa_free_varray_data(struct gl_context *ctx) +_mesa_free_varray_data(struct gl_context *ctx, struct gl_array_attrib* array) { - _mesa_HashDeleteAll(ctx->Array.Objects, delete_arrayobj_cb, ctx); - _mesa_DeleteHashTable(ctx->Array.Objects); + GLuint i; + + /* Uninit the individual arrays */ + for (i = 0; i < Elements(array->VertexAttrib); i++) + { + _mesa_reference_buffer_object(ctx, &array->VertexAttrib[i].BufferObj, NULL); + memset(&array->VertexAttrib[i], 0, sizeof(struct gl_client_array)); + } } diff --git a/reactos/dll/opengl/mesa/main/varray.h b/reactos/dll/opengl/mesa/main/varray.h index 9b3b1c50604..8d0898261b7 100644 --- a/reactos/dll/opengl/mesa/main/varray.h +++ b/reactos/dll/opengl/mesa/main/varray.h @@ -175,15 +175,11 @@ _mesa_copy_client_array(struct gl_context *ctx, struct gl_client_array *dst, struct gl_client_array *src); - extern void -_mesa_print_arrays(struct gl_context *ctx); - -extern void -_mesa_init_varray( struct gl_context * ctx ); +_mesa_init_varray( struct gl_context * ctx, struct gl_array_attrib *array); extern void -_mesa_free_varray_data(struct gl_context *ctx); +_mesa_free_varray_data(struct gl_context *ctx, struct gl_array_attrib *array); #else diff --git a/reactos/dll/opengl/mesa/main/version.c b/reactos/dll/opengl/mesa/main/version.c index 19b10712ca1..63fe5b79300 100644 --- a/reactos/dll/opengl/mesa/main/version.c +++ b/reactos/dll/opengl/mesa/main/version.c @@ -78,8 +78,7 @@ compute_version(struct gl_context *ctx) ctx->Extensions.EXT_blend_equation_separate); const GLboolean ver_2_1 = (ver_2_0); const GLboolean ver_3_0 = (ver_2_1 && - ctx->Extensions.ARB_map_buffer_range && - ctx->Extensions.APPLE_vertex_array_object); + ctx->Extensions.ARB_map_buffer_range); if (ver_3_0) { diff --git a/reactos/dll/opengl/mesa/vbo/vbo_exec_array.c b/reactos/dll/opengl/mesa/vbo/vbo_exec_array.c index 29f97208e69..f03430fce39 100644 --- a/reactos/dll/opengl/mesa/vbo/vbo_exec_array.c +++ b/reactos/dll/opengl/mesa/vbo/vbo_exec_array.c @@ -224,15 +224,14 @@ static void check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, const void *elements, GLint basevertex) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; const void *elemMap; GLint i, k; - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) { elemMap = ctx->Driver.MapBufferRange(ctx, 0, - ctx->Array.ArrayObj->ElementArrayBufferObj->Size, + ctx->Array.ElementArrayBufferObj->Size, GL_MAP_READ_BIT, - ctx->Array.ArrayObj->ElementArrayBufferObj); + ctx->Array.ElementArrayBufferObj); elements = ADD_POINTERS(elements, elemMap); } @@ -255,17 +254,17 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, } /* check element j of each enabled array */ - for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) { - check_array_data(ctx, &arrayObj->VertexAttrib[k], k, j); + for (k = 0; k < Elements(ctx->Array.VertexAttrib); k++) { + check_array_data(ctx, &ctx->Array.VertexAttrib[k], k, j); } } - if (_mesa_is_bufferobj(arrayObj->ElementArrayBufferObj)) { - ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj); + if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) { + ctx->Driver.UnmapBuffer(ctx, ctx->Array.ElementArrayBufferObj); } - for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) { - unmap_array_buffer(ctx, &arrayObj->VertexAttrib[k]); + for (k = 0; k < Elements(ctx->Array.VertexAttrib); k++) { + unmap_array_buffer(ctx, &ctx->Array.VertexAttrib[k]); } } @@ -289,7 +288,6 @@ print_draw_arrays(struct gl_context *ctx, { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; int i; printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n", @@ -305,7 +303,7 @@ print_draw_arrays(struct gl_context *ctx, exec->array.inputs[i]->Size, stride, /*exec->array.inputs[i]->Enabled,*/ - arrayObj->VertexAttrib[VERT_ATTRIB(i)].Enabled, + ctx->Array.VertexAttrib[VERT_ATTRIB(i)].Enabled, exec->array.inputs[i]->Ptr, bufName); @@ -342,7 +340,7 @@ recalculate_input_bindings(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; - struct gl_client_array *vertexAttrib = ctx->Array.ArrayObj->VertexAttrib; + struct gl_client_array *vertexAttrib = ctx->Array.VertexAttrib; const struct gl_client_array **inputs = &exec->array.inputs[0]; GLbitfield64 const_inputs = 0x0; GLuint i; @@ -546,7 +544,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, ib.count = count; ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.ElementArrayBufferObj; ib.ptr = indices; prim[0].begin = 1; @@ -619,7 +617,7 @@ vbo_exec_DrawRangeElements(GLenum mode, return; if (end < start || - end >= ctx->Array.ArrayObj->_MaxElement) { + end >= ctx->Array._MaxElement) { /* The application requested we draw using a range of indices that's * outside the bounds of the current VBO. This is invalid and appears * to give undefined results. The safest thing to do is to simply @@ -633,7 +631,7 @@ vbo_exec_DrawRangeElements(GLenum mode, "\trange is outside VBO bounds (max=%u); ignoring.\n" "\tThis should be fixed in the application.", start, end, count, type, indices, - ctx->Array.ArrayObj->_MaxElement - 1); + ctx->Array._MaxElement - 1); } index_bounds_valid = GL_FALSE; } @@ -658,7 +656,7 @@ vbo_exec_DrawRangeElements(GLenum mode, printf("glDraw[Range]Elements" "(start %u, end %u, type 0x%x, count %d) ElemBuf %u\n", start, end, type, count, - ctx->Array.ArrayObj->ElementArrayBufferObj->Name); + ctx->Array.ElementArrayBufferObj->Name); } #if 0 diff --git a/reactos/dll/opengl/mesa/vbo/vbo_save_api.c b/reactos/dll/opengl/mesa/vbo/vbo_save_api.c index 280b73cf412..f0585ee4641 100644 --- a/reactos/dll/opengl/mesa/vbo/vbo_save_api.c +++ b/reactos/dll/opengl/mesa/vbo/vbo_save_api.c @@ -1084,9 +1084,8 @@ _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type, _ae_map_vbos(ctx); - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) - indices = - ADD_POINTERS(ctx->Array.ArrayObj->ElementArrayBufferObj->Pointer, indices); + if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) + indices = ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Pointer, indices); vbo_save_NotifyBegin(ctx, (mode | VBO_SAVE_PRIM_WEAK | VBO_SAVE_PRIM_NO_CURRENT_UPDATE));