diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-08 05:12:12 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-08 05:15:50 +0300 |
commit | 48690d967a7731367cda01ab8dca64e7f4c3f6b5 (patch) | |
tree | 9295cc0ef083fd50eaab2c62785d54545eb004c6 /source/blender/gpu/opengl/gl_context.hh | |
parent | d2e9de93b8d1d6cd45abce8164d0f92af8f636d0 (diff) |
GPUContext: Move GPUContext to gpu::Context for more consistency
This makes the GPUContext follow the same naming convention as the rest
of the module.
Also add a static getter for extra bonus style (no need for casts):
- Context::get()
- GLContext::get()
Diffstat (limited to 'source/blender/gpu/opengl/gl_context.hh')
-rw-r--r-- | source/blender/gpu/opengl/gl_context.hh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/gpu/opengl/gl_context.hh b/source/blender/gpu/opengl/gl_context.hh index ef0c13719e2..63014903e0a 100644 --- a/source/blender/gpu/opengl/gl_context.hh +++ b/source/blender/gpu/opengl/gl_context.hh @@ -53,7 +53,7 @@ class GLSharedOrphanLists { void orphans_clear(void); }; -class GLContext : public GPUContext { +class GLContext : public Context { public: /** Capabilities. */ static GLint max_texture_3d_size; @@ -103,9 +103,14 @@ class GLContext : public GPUContext { void memory_statistics_get(int *total_mem, int *free_mem) override; - static inline GLStateManager *state_manager_active_get() + static GLContext *get() { - GLContext *ctx = static_cast<GLContext *>(GPU_context_active_get()); + return static_cast<GLContext *>(Context::get()); + } + + static GLStateManager *state_manager_active_get() + { + GLContext *ctx = GLContext::get(); return static_cast<GLStateManager *>(ctx->state_manager); }; @@ -122,6 +127,8 @@ class GLContext : public GPUContext { private: static void orphans_add(Vector<GLuint> &orphan_list, std::mutex &list_mutex, GLuint id); void orphans_clear(void); + + MEM_CXX_CLASS_ALLOC_FUNCS("GLContext") }; } // namespace gpu |