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-10-14 19:15:50 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-10-14 19:53:41 +0300
commit327107412032d075c63427d86e5154a5e37b8d4a (patch)
tree30d5f868cbe2a1abfb8acf57ec89ab6fe0681581 /source/blender/gpu/opengl
parent4fa4245464380cd72603377150d17f71ef3b4ab6 (diff)
GL: FrameBuffer: Set GL_FRAMEBUFFER_SRGB if needed
This makes possible to rebind the same GPUFrameBuffer to enable or disable sRGB encoding transform.
Diffstat (limited to 'source/blender/gpu/opengl')
-rw-r--r--source/blender/gpu/opengl/gl_framebuffer.cc14
-rw-r--r--source/blender/gpu/opengl/gl_framebuffer.hh2
2 files changed, 10 insertions, 6 deletions
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;
+ }
}
/** \} */
diff --git a/source/blender/gpu/opengl/gl_framebuffer.hh b/source/blender/gpu/opengl/gl_framebuffer.hh
index 755f3f97567..33c1cd0befa 100644
--- a/source/blender/gpu/opengl/gl_framebuffer.hh
+++ b/source/blender/gpu/opengl/gl_framebuffer.hh
@@ -55,6 +55,8 @@ class GLFrameBuffer : public FrameBuffer {
bool immutable_;
/** True is the framebuffer has it's first color target using the GPU_SRGB8_A8 format. */
bool srgb_;
+ /** True is the framebuffer has been bound using the GL_FRAMEBUFFER_SRGB feature. */
+ bool enabled_srgb_ = false;
public:
/**