Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-08-08 02:18:18 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-08 02:30:33 +0300
commitcb7ea2ccfbb5d81083313c21d6b85a9c85db67d4 (patch)
treeaf7baa1dc3438da8f349bd38c2a65f9caad50bf3 /source/blender/gpu/opengl/gl_backend.hh
parent1dd737759639c63d3279be774202585de778dac5 (diff)
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
Diffstat (limited to 'source/blender/gpu/opengl/gl_backend.hh')
-rw-r--r--source/blender/gpu/opengl/gl_backend.hh23
1 files changed, 22 insertions, 1 deletions
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<GLuint> &orphan_list, std::mutex &list_mutex, unsigned int id)
+ {
+ list_mutex.lock();
+ orphan_list.append(id);
+ list_mutex.unlock();
+ }
};
+
+} // namespace gpu
+} // namespace blender