From 327107412032d075c63427d86e5154a5e37b8d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 14 Oct 2020 18:15:50 +0200 Subject: GL: FrameBuffer: Set GL_FRAMEBUFFER_SRGB if needed This makes possible to rebind the same GPUFrameBuffer to enable or disable sRGB encoding transform. --- source/blender/gpu/opengl/gl_framebuffer.cc | 14 ++++++++------ 1 file changed, 8 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 4270ba544b5..cd87fc88144 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -286,20 +286,22 @@ void GLFrameBuffer::bind(bool enabled_srgb) this->scissor_reset(); } - if (context_->active_fb != this) { - context_->active_fb = this; - state_manager_->active_fb = this; - dirty_state_ = true; - + if (context_->active_fb != this || enabled_srgb_ != enabled_srgb) { + enabled_srgb_ = enabled_srgb; if (enabled_srgb) { glEnable(GL_FRAMEBUFFER_SRGB); } else { glDisable(GL_FRAMEBUFFER_SRGB); } - GPU_shader_set_framebuffer_srgb_target(enabled_srgb && srgb_); } + + if (context_->active_fb != this) { + context_->active_fb = this; + state_manager_->active_fb = this; + dirty_state_ = true; + } } /** \} */ -- cgit v1.2.3