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.
This commit is contained in:
@@ -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).
|
||||
|
Reference in New Issue
Block a user