]> git.sesse.net Git - nageru/commitdiff
Stop leaking texture views (and by extension, textures).
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 28 Jul 2018 13:56:16 +0000 (15:56 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 28 Jul 2018 13:56:16 +0000 (15:56 +0200)
flow.cpp

index c4c7b8f359cfa98acc0a013c29c385d7ace39c49..4d520eb8fc5dca1acd9a515682e5563065d1fc8e 100644 (file)
--- a/flow.cpp
+++ b/flow.cpp
@@ -1109,7 +1109,6 @@ GLuint DISComputeFlow::exec(GLuint tex0, GLuint tex1)
                // Make sure we always read from the correct level; the chosen
                // mipmapping could otherwise be rather unpredictable, especially
                // during motion search.
-               // TODO: create these beforehand, and stop leaking them.
                GLuint tex0_view, tex1_view;
                glGenTextures(1, &tex0_view);
                glTextureView(tex0_view, GL_TEXTURE_2D, tex0, GL_R8, level, 1, 0, 1);
@@ -1170,6 +1169,8 @@ GLuint DISComputeFlow::exec(GLuint tex0, GLuint tex1)
                        prewarp.exec(tex0_view, tex1_view, dense_flow_tex, I_tex, I_t_tex, base_flow_tex, level_width, level_height);
                }
                release_texture(dense_flow_tex);
+               glDeleteTextures(1, &tex0_view);
+               glDeleteTextures(1, &tex1_view);
 
                // Calculate I_x and I_y. We're only calculating first derivatives;
                // the others will be taken on-the-fly in order to sample from fewer