mesa: data structure updates for GL_EXT_provoking_vertex
[mesa.git] / src / mesa / main / shared.c
index ae8dd2a83643abf79ec173c014d24c1e6a87177e..759883743dae4b3be18c7eac6d795dc3699286d1 100644 (file)
@@ -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).