diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/context.c | 36 | ||||
-rw-r--r-- | src/mesa/main/depth.c | 10 | ||||
-rw-r--r-- | src/mesa/main/occlude.c | 54 | ||||
-rw-r--r-- | src/mesa/main/occlude.h | 7 |
4 files changed, 68 insertions, 39 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 67f797f96ea..fd3174c0fa2 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -894,8 +894,10 @@ alloc_shared_state( GLcontext *ctx ) if (ss->DefaultFragmentProgram) ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); #endif +#if FEATURE_ARB_vertex_buffer_object if (ss->BufferObjects) _mesa_DeleteHashTable(ss->BufferObjects); +#endif if (ss->Default1D) (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); @@ -941,6 +943,13 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) /* Free texture objects */ ASSERT(ctx->Driver.DeleteTexture); + /* the default textures */ + (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); + (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); + (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); + (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); + (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); + /* all other textures */ while (1) { GLuint texName = _mesa_HashFirstEntry(ss->TexObjects); if (texName) { @@ -973,9 +982,16 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) } _mesa_DeleteHashTable(ss->Programs); #endif +#if FEATURE_ARB_vertex_program + _mesa_delete_program(ctx, ss->DefaultVertexProgram); +#endif +#if FEATURE_ARB_fragment_program + _mesa_delete_program(ctx, ss->DefaultFragmentProgram); +#endif +#if FEATURE_ARB_vertex_buffer_object _mesa_DeleteHashTable(ss->BufferObjects); - +#endif _glthread_DESTROY_MUTEX(ss->Mutex); FREE(ss); @@ -1530,19 +1546,11 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); _mesa_free_colortables_data( ctx ); -#if FEATURE_NV_vertex_program - if (ctx->VertexProgram.Current) { - ctx->VertexProgram.Current->Base.RefCount--; - if (ctx->VertexProgram.Current->Base.RefCount <= 0) - ctx->Driver.DeleteProgram(ctx, &(ctx->VertexProgram.Current->Base)); - } -#endif -#if FEATURE_NV_fragment_program - if (ctx->FragmentProgram.Current) { - ctx->FragmentProgram.Current->Base.RefCount--; - if (ctx->FragmentProgram.Current->Base.RefCount <= 0) - ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base)); - } + _mesa_free_program_data(ctx); + _mesa_free_occlude_data(ctx); + +#if FEATURE_ARB_vertex_buffer_object + _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj); #endif /* Shared context state (display lists, textures, etc) */ diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index eb8c8b821b2..d92423dcee1 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -177,10 +177,4 @@ void _mesa_init_depth( GLcontext * ctx ) ctx->DepthMaxF = (GLfloat) ctx->DepthMax; } ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ - -#if FEATURE_ARB_occlusion_query - ctx->Occlusion.QueryObjects = _mesa_NewHashTable(); -#endif - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; } diff --git a/src/mesa/main/occlude.c b/src/mesa/main/occlude.c index d329f11f098..bc61a475d66 100644 --- a/src/mesa/main/occlude.c +++ b/src/mesa/main/occlude.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 6.0.2 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -45,20 +45,6 @@ struct occlusion_query }; - -void -_mesa_init_occlude(GLcontext *ctx) -{ -#if FEATURE_ARB_occlusion_query - ctx->Occlusion.QueryObjects = _mesa_NewHashTable(); -#endif - - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; -} - - - /** * Allocate a new occlusion query object. * \param target - must be GL_SAMPLES_PASSED_ARB at this time @@ -327,3 +313,41 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) return; } } + + + +/** + * Allocate/init the context state related to occlusion query objects. + */ +void +_mesa_init_occlude(GLcontext *ctx) +{ +#if FEATURE_ARB_occlusion_query + ctx->Occlusion.QueryObjects = _mesa_NewHashTable(); +#endif + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; +} + + +/** + * Free the context state related to occlusion query objects. + */ +void +_mesa_free_occlude_data(GLcontext *ctx) +{ + while (1) { + GLuint query = _mesa_HashFirstEntry(ctx->Occlusion.QueryObjects); + if (query) { + struct occlusion_query *q = (struct occlusion_query *) + _mesa_HashLookup(ctx->Occlusion.QueryObjects, query); + ASSERT(q); + delete_query_object(q); + _mesa_HashRemove(ctx->Occlusion.QueryObjects, query); + } + else { + break; + } + } + _mesa_DeleteHashTable(ctx->Occlusion.QueryObjects); +} diff --git a/src/mesa/main/occlude.h b/src/mesa/main/occlude.h index 5696463aecf..acf19101f14 100644 --- a/src/mesa/main/occlude.h +++ b/src/mesa/main/occlude.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.0.2 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -30,6 +30,9 @@ extern void _mesa_init_occlude(GLcontext *ctx); +extern void +_mesa_free_occlude_data(GLcontext *ctx); + extern void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids); |