Skip to content

Commit c357467

Browse files
committed
Fix texture pool problem with NVIDIA threaded optimizations.
1 parent 0c10b32 commit c357467

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/modules/opengl/filter_glsl_manager.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ extern "C" {
4343
#include <GL/glx.h>
4444
#endif
4545

46+
// Texture pool may cause frames to appear out-of-order with NVIDIA
47+
// threaded optimizations.
48+
#define USE_TEXTURE_POOL 0
49+
4650
using namespace movit;
4751

4852
void dec_ref_and_delete(GlslManager *p)
@@ -107,6 +111,7 @@ GlslManager* GlslManager::get_instance()
107111

108112
glsl_texture GlslManager::get_texture(int width, int height, GLint internal_format)
109113
{
114+
#if USE_TEXTURE_POOL
110115
lock();
111116
for (int i = 0; i < texture_list.count(); ++i) {
112117
glsl_texture tex = (glsl_texture) texture_list.peek(i);
@@ -121,6 +126,7 @@ glsl_texture GlslManager::get_texture(int width, int height, GLint internal_form
121126
}
122127
}
123128
unlock();
129+
#endif
124130

125131
GLuint tex = 0;
126132
glGenTextures(1, &tex);
@@ -147,15 +153,22 @@ glsl_texture GlslManager::get_texture(int width, int height, GLint internal_form
147153
gtex->height = height;
148154
gtex->internal_format = internal_format;
149155
gtex->used = 1;
156+
#if USE_TEXTURE_POOL
150157
lock();
151158
texture_list.push_back(gtex);
152159
unlock();
160+
#endif
153161
return gtex;
154162
}
155163

156164
void GlslManager::release_texture(glsl_texture texture)
157165
{
166+
#if USE_TEXTURE_POOL
158167
texture->used = 0;
168+
#else
169+
glDeleteTextures(1, &texture->texture);
170+
delete texture;
171+
#endif
159172
}
160173

161174
void GlslManager::delete_sync(GLsync sync)

0 commit comments

Comments
 (0)