]> git.sesse.net Git - movit/blobdiff - resource_pool.cpp
Hack around FBO/VAO sharability issues.
[movit] / resource_pool.cpp
index a32247de63461a23f00e4585ded05aa5628a0de7..201b73c73b7a9ee4855149886a2ec01bc75a6469 100644 (file)
@@ -58,8 +58,9 @@ ResourcePool::~ResourcePool()
                GLuint free_fbo_num = *freelist_it;
                assert(fbo_formats.count(free_fbo_num) != 0);
                fbo_formats.erase(free_fbo_num);
-               glDeleteFramebuffers(1, &free_fbo_num);
-               check_error();
+               // TODO: We currently leak due to FBO sharability issues.
+               // glDeleteFramebuffers(1, &free_fbo_num);
+               // check_error();
        }
        assert(fbo_formats.empty());
 }
@@ -200,6 +201,12 @@ GLuint ResourcePool::create_2d_texture(GLint internal_format, GLsizei width, GLs
        case GL_SRGB8_ALPHA8:
                format = GL_RGBA;
                break;
+       case GL_RGB32F_ARB:
+       case GL_RGB16F_ARB:
+       case GL_RGB8:
+       case GL_SRGB8:
+               format = GL_RGB;
+               break;
        case GL_RG32F:
        case GL_RG16F:
                format = GL_RG;
@@ -257,7 +264,8 @@ void ResourcePool::release_2d_texture(GLuint texture_num)
                        assert(format_it != fbo_formats.end());
                        if (format_it->second.texture_num == free_texture_num) {
                                fbo_formats.erase(fbo_num);
-                               glDeleteFramebuffers(1, &fbo_num);
+                               // TODO: We currently leak due to FBO sharability issues.
+                               // glDeleteFramebuffers(1, &fbo_num);
                                fbo_freelist.erase(fbo_freelist_it++);
                        } else {
                                ++fbo_freelist_it;
@@ -324,8 +332,9 @@ void ResourcePool::release_fbo(GLuint fbo_num)
                fbo_freelist.pop_front();
                assert(fbo_formats.count(free_fbo_num) != 0);
                fbo_formats.erase(free_fbo_num);
-               glDeleteFramebuffers(1, &free_fbo_num);
-               check_error();
+               // TODO: We currently leak due to FBO sharability issues.
+               // glDeleteFramebuffers(1, &free_fbo_num);
+               // check_error();
        }
        pthread_mutex_unlock(&lock);
 }
@@ -345,6 +354,16 @@ size_t ResourcePool::estimate_texture_size(const Texture2D &texture_format)
        case GL_SRGB8_ALPHA8:
                bytes_per_pixel = 4;
                break;
+       case GL_RGB32F_ARB:
+               bytes_per_pixel = 12;
+               break;
+       case GL_RGB16F_ARB:
+               bytes_per_pixel = 6;
+               break;
+       case GL_RGB8:
+       case GL_SRGB8:
+               bytes_per_pixel = 3;
+               break;
        case GL_RG32F:
                bytes_per_pixel = 8;
                break;