diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_context.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_context.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc index 943a6151ced..98714269402 100644 --- a/source/blender/gpu/intern/gpu_context.cc +++ b/source/blender/gpu/intern/gpu_context.cc @@ -109,7 +109,6 @@ GPUContext *GPU_context_create(void *ghost_window) return wrap(ctx); } -/* to be called after GPU_context_active_set(ctx_to_destroy) */ void GPU_context_discard(GPUContext *ctx_) { Context *ctx = unwrap(ctx_); @@ -117,7 +116,6 @@ void GPU_context_discard(GPUContext *ctx_) active_ctx = nullptr; } -/* ctx can be NULL */ void GPU_context_active_set(GPUContext *ctx_) { Context *ctx = unwrap(ctx_); @@ -133,7 +131,7 @@ void GPU_context_active_set(GPUContext *ctx_) } } -GPUContext *GPU_context_active_get(void) +GPUContext *GPU_context_active_get() { return wrap(Context::get()); } @@ -146,12 +144,12 @@ GPUContext *GPU_context_active_get(void) static std::mutex main_context_mutex; -void GPU_context_main_lock(void) +void GPU_context_main_lock() { main_context_mutex.lock(); } -void GPU_context_main_unlock(void) +void GPU_context_main_unlock() { main_context_mutex.unlock(); } @@ -180,7 +178,7 @@ void GPU_backend_init(eGPUBackendType backend_type) } } -void GPU_backend_exit(void) +void GPU_backend_exit() { /* TODO: assert no resource left. Currently UI textures are still not freed in their context * correctly. */ @@ -188,6 +186,15 @@ void GPU_backend_exit(void) g_backend = nullptr; } +eGPUBackendType GPU_backend_get_type() +{ + if (g_backend && dynamic_cast<GLBackend *>(g_backend) != nullptr) { + return GPU_BACKEND_OPENGL; + } + + return GPU_BACKEND_NONE; +} + GPUBackend *GPUBackend::get() { return g_backend; |