From 48690d967a7731367cda01ab8dca64e7f4c3f6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 8 Sep 2020 04:12:12 +0200 Subject: 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() --- source/blender/gpu/opengl/gl_framebuffer.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/gpu/opengl/gl_framebuffer.cc') diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc index 61270fe0acc..85fa973daff 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -78,7 +78,7 @@ GLFrameBuffer::~GLFrameBuffer() return; } - if (context_ == GPU_context_active_get()) { + if (context_ == GLContext::get()) { /* Context might be partially freed. This happens when destroying the window frame-buffers. */ glDeleteFramebuffers(1, &fbo_id_); } @@ -89,14 +89,14 @@ GLFrameBuffer::~GLFrameBuffer() if (context_->active_fb == this && context_->back_left != this) { /* If this assert triggers it means the frame-buffer is being freed while in use by another * context which, by the way, is TOTALLY UNSAFE!!! */ - BLI_assert(context_ == GPU_context_active_get()); + BLI_assert(context_ == GLContext::get()); GPU_framebuffer_restore(); } } void GLFrameBuffer::init(void) { - context_ = static_cast(GPU_context_active_get()); + context_ = GLContext::get(); state_manager_ = static_cast(context_->state_manager); glGenFramebuffers(1, &fbo_id_); @@ -274,7 +274,7 @@ void GLFrameBuffer::bind(bool enabled_srgb) this->init(); } - if (context_ != GPU_context_active_get()) { + if (context_ != GLContext::get()) { BLI_assert(!"Trying to use the same frame-buffer in multiple context"); return; } @@ -320,7 +320,7 @@ void GLFrameBuffer::clear(eGPUFrameBufferBits buffers, float clear_depth, uint clear_stencil) { - BLI_assert(GPU_context_active_get() == context_); + BLI_assert(GLContext::get() == context_); BLI_assert(context_->active_fb == this); /* Save and restore the state. */ @@ -360,7 +360,7 @@ void GLFrameBuffer::clear_attachment(GPUAttachmentType type, eGPUDataFormat data_format, const void *clear_value) { - BLI_assert(GPU_context_active_get() == context_); + BLI_assert(GLContext::get() == context_); BLI_assert(context_->active_fb == this); /* Save and restore the state. */ -- cgit v1.2.3