From cb7ea2ccfbb5d81083313c21d6b85a9c85db67d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 8 Aug 2020 01:18:18 +0200 Subject: GPUBackend: Add new GPUBackend object to manage GL object allocations This just set a global object responsible for allocating new objects in a thread safe way without needing any GPUContext bound to this thread. This also introduce the GLContext which will contain all the GL related functions for the current context. # Conflicts: # source/blender/gpu/intern/gpu_context.cc --- source/blender/gpu/opengl/gl_backend.hh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'source/blender/gpu/opengl/gl_backend.hh') diff --git a/source/blender/gpu/opengl/gl_backend.hh b/source/blender/gpu/opengl/gl_backend.hh index 25400a55394..f7c01b2f184 100644 --- a/source/blender/gpu/opengl/gl_backend.hh +++ b/source/blender/gpu/opengl/gl_backend.hh @@ -25,12 +25,33 @@ #include "gpu_backend.hh" +#include "BLI_vector.hh" + #include "gl_context.hh" +namespace blender { +namespace gpu { + class GLBackend : public GPUBackend { + private: + GLSharedOrphanLists shared_orphan_list_; + public: GPUContext *context_alloc(void *ghost_window) { - return new GLContext(ghost_window); + return new GLContext(ghost_window, shared_orphan_list_); }; + + /* TODO remove */ + void buf_free(GLuint buf_id); + void tex_free(GLuint tex_id); + void orphans_add(Vector &orphan_list, std::mutex &list_mutex, unsigned int id) + { + list_mutex.lock(); + orphan_list.append(id); + list_mutex.unlock(); + } }; + +} // namespace gpu +} // namespace blender -- cgit v1.2.3