From 087c11c20709f074ae278d8d3d5f00609776f40b Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 28 Jul 2018 15:56:16 +0200 Subject: [PATCH] Stop leaking texture views (and by extension, textures). --- flow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flow.cpp b/flow.cpp index c4c7b8f..4d520eb 100644 --- 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 -- 2.39.2