diff options
author | Brian Paul <[email protected]> | 2008-07-04 10:29:15 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-07-04 10:29:15 -0600 |
commit | 2fa7b3f78639114aec42fcbbfc29d3645832708b (patch) | |
tree | a0dc1ff3b4181e61f5bdf16ffbc3238f22c5c8f8 /src/mesa/main/context.c | |
parent | 9ca1c62a963ca7024c4bccf83af3f90955cd5068 (diff) |
mesa: Implement mutex/locking around texture object reference counting.
Use new _mesa_reference_texobj() function for referencing/unreferencing
textures. Add new assertions/tests to try to detect invalid usage of
deleted textures.
cherry-picked from master (9e01b915f1243a3f551cb795b7124bd1e52ca15f)
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r-- | src/mesa/main/context.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 33f6d2c0d0c..279880cf401 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -500,19 +500,12 @@ alloc_shared_state( GLcontext *ctx ) if (!ss->Default2DArray) goto cleanup; - /* Effectively bind the default textures to all texture units */ - ss->Default1D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default2D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default3D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->DefaultCubeMap->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->DefaultRect->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default1DArray->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default2DArray->RefCount += MAX_TEXTURE_IMAGE_UNITS; + /* sanity check */ + assert(ss->Default1D->RefCount == 1); _glthread_INIT_MUTEX(ss->TexMutex); ss->TextureStateStamp = 0; - #if FEATURE_EXT_framebuffer_object ss->FrameBuffers = _mesa_NewHashTable(); if (!ss->FrameBuffers) @@ -522,10 +515,9 @@ alloc_shared_state( GLcontext *ctx ) goto cleanup; #endif - return GL_TRUE; - cleanup: +cleanup: /* Ran out of memory at some point. Free everything and return NULL */ if (ss->DisplayList) _mesa_DeleteHashTable(ss->DisplayList); |