mesa: remove FBO texture depth/stencil test
[mesa.git] / src / mesa / main / shared.c
index ad6e6ce7cd3cef671397e4a662166cec0d5fe1da..643ad3354e7e617a6778ac9268443de3955b0108 100644 (file)
@@ -43,7 +43,9 @@
 #if FEATURE_ATI_fragment_shader
 #include "shader/atifragshader.h"
 #endif
-
+#if FEATURE_ARB_sync
+#include "syncobj.h"
+#endif
 
 /**
  * Allocate and initialize a shared context state structure.
@@ -127,6 +129,10 @@ _mesa_alloc_shared_state(GLcontext *ctx)
    shared->RenderBuffers = _mesa_NewHashTable();
 #endif
 
+#if FEATURE_ARB_sync
+   make_empty_list(& shared->SyncObjects);
+#endif
+
    return shared;
 }
 
@@ -196,7 +202,7 @@ delete_bufferobj_cb(GLuint id, void *data, void *userData)
 {
    struct gl_buffer_object *bufObj = (struct gl_buffer_object *) data;
    GLcontext *ctx = (GLcontext *) userData;
-   if (bufObj->Pointer) {
+   if (_mesa_bufferobj_mapped(bufObj)) {
       ctx->Driver.UnmapBuffer(ctx, 0, bufObj);
       bufObj->Pointer = NULL;
    }
@@ -336,6 +342,17 @@ _mesa_free_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
    ctx->Driver.DeleteBuffer(ctx, shared->NullBufferObj);
 #endif
 
+#if FEATURE_ARB_sync
+   {
+      struct simple_node *node;
+      struct simple_node *temp;
+
+      foreach_s(node, temp, & shared->SyncObjects) {
+        _mesa_unref_sync_object(ctx, (struct gl_sync_object *) node);
+      }
+   }
+#endif
+
    /*
     * Free texture objects (after FBOs since some textures might have
     * been bound to FBOs).