From 1096eae18d1c871f33f46d0d34e5a894354c3c44 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 16 Jan 2006 16:35:13 +0000 Subject: [PATCH] properly free ATI fragment shaders (Tilman Sauerbeck) --- src/mesa/main/context.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4101c9f1ed2..8d42c2168e1 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -845,8 +845,8 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) } _mesa_DeleteHashTable(ss->TexObjects); -#if FEATURE_NV_vertex_program - /* Free vertex programs */ +#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_NV_fragment_program) + /* Free vertex/fragment programs */ while (1) { GLuint prog = _mesa_HashFirstEntry(ss->Programs); if (prog) { @@ -868,15 +868,33 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) #if FEATURE_ARB_fragment_program _mesa_delete_program(ctx, ss->DefaultFragmentProgram); #endif + #if FEATURE_ATI_fragment_shader - _mesa_free(ss->DefaultFragmentShader); + /* Free ATI fragment shaders */ + while (1) { + GLuint prog = _mesa_HashFirstEntry(ss->ATIShaders); + if (prog) { + struct ati_fragment_shader *s = (struct ati_fragment_shader *) + _mesa_HashLookup(ss->ATIShaders, prog); + ASSERT(s); + _mesa_delete_ati_fragment_shader(ctx, s); + _mesa_HashRemove(ss->ATIShaders, prog); + } + else { + break; + } + } + _mesa_DeleteHashTable(ss->ATIShaders); + _mesa_delete_ati_fragment_shader(ctx, ss->DefaultFragmentShader); #endif #if FEATURE_ARB_vertex_buffer_object _mesa_DeleteHashTable(ss->BufferObjects); #endif +#if FEATURE_ARB_shader_objects _mesa_DeleteHashTable (ss->GL2Objects); +#endif #if FEATURE_EXT_framebuffer_object _mesa_DeleteHashTable(ss->FrameBuffers); -- 2.30.2