summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shared.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2009-08-31 14:57:50 -0700
committerIan Romanick <[email protected]>2009-09-03 11:22:46 -0700
commit16b393d05990b6e917e144f9de87d0103b4c3e6d (patch)
treecdb95979b5f2e5606ce803127e195951f95fcf53 /src/mesa/main/shared.c
parentf5a22721c5731c7a4c20f86d9925d9e58324c7a5 (diff)
ARB sync: Fix delete behavior and context destruction behavior
I believe this resolves the outstanding issues WRT sync object deletetion. I have also added a large comment at the top of syncobj.c describing the expected memory management behavior. I'm still a little uncertain about the locking on ctx->Shared.
Diffstat (limited to 'src/mesa/main/shared.c')
-rw-r--r--src/mesa/main/shared.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index 93bbccd3c7f..643ad3354e7 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -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;
}
@@ -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).