diff options
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r-- | src/mesa/main/context.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 67f797f96e..fd3174c0fa 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) */ |