Cleanup: GLBackend: Move buf_free and tex_free to GLContext

This makes it easier to follow.

Also removes the GL related functions inside gpu_context.cc.
This commit is contained in:
2020-09-07 20:08:25 +02:00
parent 58353834f4
commit 19f56cfe6c
10 changed files with 25 additions and 92 deletions

View File

@@ -230,25 +230,27 @@ void GLContext::fbo_free(GLuint fbo_id)
}
}
void GLBackend::buf_free(GLuint buf_id)
void GLContext::buf_free(GLuint buf_id)
{
/* Any context can free. */
if (GPU_context_active_get()) {
glDeleteBuffers(1, &buf_id);
}
else {
orphans_add(shared_orphan_list_.buffers, shared_orphan_list_.lists_mutex, buf_id);
GLSharedOrphanLists &orphan_list = GLBackend::get()->shared_orphan_list_get();
orphans_add(orphan_list.buffers, orphan_list.lists_mutex, buf_id);
}
}
void GLBackend::tex_free(GLuint tex_id)
void GLContext::tex_free(GLuint tex_id)
{
/* Any context can free. */
if (GPU_context_active_get()) {
glDeleteTextures(1, &tex_id);
}
else {
orphans_add(shared_orphan_list_.textures, shared_orphan_list_.lists_mutex, tex_id);
GLSharedOrphanLists &orphan_list = GLBackend::get()->shared_orphan_list_get();
orphans_add(orphan_list.textures, orphan_list.lists_mutex, tex_id);
}
}