mesa: move the NullBufferObj from GLcontext to gl_shared_state
Since shared array objects may point to the null/default buffer object, the null/default buffer object should be part of the shared state.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "mtypes.h"
|
||||
#include "hash.h"
|
||||
#include "arrayobj.h"
|
||||
#include "bufferobj.h"
|
||||
#include "shared.h"
|
||||
#include "shader/program.h"
|
||||
#include "shader/shader_api.h"
|
||||
@@ -92,6 +93,13 @@ _mesa_alloc_shared_state(GLcontext *ctx)
|
||||
shared->BufferObjects = _mesa_NewHashTable();
|
||||
#endif
|
||||
|
||||
/* Allocate the default buffer object and set refcount so high that
|
||||
* it never gets deleted.
|
||||
* XXX with recent/improved refcounting this may not longer be needed.
|
||||
*/
|
||||
shared->NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0);
|
||||
shared->NullBufferObj->RefCount = 1000;
|
||||
|
||||
shared->ArrayObjects = _mesa_NewHashTable();
|
||||
|
||||
/* Create default texture objects */
|
||||
@@ -341,6 +349,10 @@ _mesa_free_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
|
||||
_mesa_DeleteHashTable(shared->RenderBuffers);
|
||||
#endif
|
||||
|
||||
#if FEATURE_ARB_vertex_buffer_object
|
||||
_mesa_delete_buffer_object(ctx, shared->NullBufferObj);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Free texture objects (after FBOs since some textures might have
|
||||
* been bound to FBOs).
|
||||
|
Reference in New Issue
Block a user