src/render/opengles2/SDL_render_gles2.c
changeset 6052 263ef1203b76
parent 6044 35448a5ea044
child 6060 59d398ac031e
equal deleted inserted replaced
6051:cb1f941ce38e 6052:263ef1203b76
   188 
   188 
   189 static void
   189 static void
   190 GLES2_DestroyRenderer(SDL_Renderer *renderer)
   190 GLES2_DestroyRenderer(SDL_Renderer *renderer)
   191 {
   191 {
   192     GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
   192     GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
   193     GLES2_ProgramCacheEntry *entry;
       
   194     GLES2_ProgramCacheEntry *next;
       
   195 
   193 
   196     /* Deallocate everything */
   194     /* Deallocate everything */
   197     if (rdata) {
   195     if (rdata) {
   198         GLES2_ActivateRenderer(renderer);
   196         GLES2_ActivateRenderer(renderer);
   199 
   197 
   200         entry = rdata->program_cache.head;
   198 	{
   201         while (entry) {
   199 	    GLES2_ShaderCacheEntry *entry;
   202             glDeleteShader(entry->vertex_shader->id);
   200 	    GLES2_ShaderCacheEntry *next;
   203             glDeleteShader(entry->fragment_shader->id);
   201 	    entry = rdata->shader_cache.head;
   204             SDL_free(entry->vertex_shader);
   202 	    while (entry)
   205             SDL_free(entry->fragment_shader);
   203 	    {
   206             glDeleteProgram(entry->id);
   204                 glDeleteShader(entry->id);
   207             next = entry->next;
   205                 next = entry->next;
   208             SDL_free(entry);
   206                 SDL_free(entry);
   209             entry = next;
   207                 entry = next;
   210         }
   208 	    }
       
   209 	}
       
   210 	{
       
   211 	    GLES2_ProgramCacheEntry *entry;
       
   212 	    GLES2_ProgramCacheEntry *next;
       
   213             entry = rdata->program_cache.head;
       
   214             while (entry) {
       
   215                 glDeleteProgram(entry->id);
       
   216                 next = entry->next;
       
   217                 SDL_free(entry);
       
   218                 entry = next;
       
   219             }
       
   220 	}
   211         if (rdata->context) {
   221         if (rdata->context) {
   212             SDL_GL_DeleteContext(rdata->context);
   222             SDL_GL_DeleteContext(rdata->context);
   213         }
   223         }
   214         if (rdata->shader_formats) {
   224         if (rdata->shader_formats) {
   215             SDL_free(rdata->shader_formats);
   225             SDL_free(rdata->shader_formats);