X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fopengl%2Ffilter_glsl_manager.cpp;h=cf71a211434073678a9135cc8e5721b903b0eeff;hb=96fc85b6fe773d2b1ac1199fe51051efa4717237;hp=9b01337301f5636717dc18637278c3a56caf6f45;hpb=1efe96041e015b55eb70f300cac5a1083decc868;p=mlt diff --git a/src/modules/opengl/filter_glsl_manager.cpp b/src/modules/opengl/filter_glsl_manager.cpp index 9b013373..cf71a211 100644 --- a/src/modules/opengl/filter_glsl_manager.cpp +++ b/src/modules/opengl/filter_glsl_manager.cpp @@ -117,29 +117,18 @@ glsl_texture GlslManager::get_texture(int width, int height, GLint internal_form return tex; } } - - // Recycle a glsl_texture with deleted glTexture. - glsl_texture gtex = 0; - for (int i = 0; i < texture_list.count(); ++i) { - glsl_texture tex = (glsl_texture) texture_list.peek(i); - if (!tex->used && !tex->width && !tex->height) { - gtex = tex; - break; - } - } unlock(); GLuint tex = 0; glGenTextures(1, &tex); if (!tex) { - glDeleteTextures(1, &tex); return NULL; } + glsl_texture gtex = new glsl_texture_s; if (!gtex) { - gtex = new glsl_texture_s; - if (!gtex) - return NULL; + glDeleteTextures(1, &tex); + return NULL; } glBindTexture( GL_TEXTURE_2D, tex ); @@ -210,12 +199,11 @@ glsl_pbo GlslManager::get_pbo(int size) void GlslManager::cleanupContext() { lock(); - for (int i = 0; i < texture_list.count(); ++i) { - glsl_texture texture = (glsl_texture) texture_list.peek(i); + while (texture_list.peek_back()) { + glsl_texture texture = (glsl_texture) texture_list.peek_back(); glDeleteTextures(1, &texture->texture); - texture->used = 0; - texture->width = 0; - texture->height = 0; + delete texture; + texture_list.pop_back(); } if (pbo) { glDeleteBuffers(1, &pbo->pbo);