diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-18 16:49:48 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-18 16:50:49 +0300 |
commit | 47c6f41b8926befcf1ffe8b0dcccb90922c4b9be (patch) | |
tree | ce9a350a9c9b50b4f68bfae523bd6e498cc060ed /source/blender/gpu | |
parent | 83e3d25bcae37df0139bb93b85d7ae5bf3da553b (diff) |
Fix T77564: VSE (and compositor background) lost stereoscopy preview
Issue introduced on fe045b2b77dc6d7f0b552619fe824b496d34db6c.
Since the stereoscopy compositing (anaglyph, ...) is only done for
viewports the VSE preview and compositor need to use viewports.
Reviewed by: dfelinto
Differential Revision: https://developer.blender.org/D8472
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_framebuffer.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h index 4958d1eaac8..ee99f1f68c8 100644 --- a/source/blender/gpu/GPU_framebuffer.h +++ b/source/blender/gpu/GPU_framebuffer.h @@ -61,6 +61,7 @@ typedef struct GPUOffScreen GPUOffScreen; GPUFrameBuffer *GPU_framebuffer_create(void); void GPU_framebuffer_free(GPUFrameBuffer *fb); void GPU_framebuffer_bind(GPUFrameBuffer *fb); +void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *fb); void GPU_framebuffer_restore(void); bool GPU_framebuffer_bound(GPUFrameBuffer *fb); diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index 77abb786117..838450e6528 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -544,6 +544,18 @@ void GPU_framebuffer_bind(GPUFrameBuffer *fb) glViewport(0, 0, fb->width, fb->height); } +/* Workaround for binding a srgb framebuffer without doing the srgb transform. */ +void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *fb) +{ + GPU_framebuffer_bind(fb); + + glDisable(GL_FRAMEBUFFER_SRGB); + + GPUTexture *first_target = fb->attachments[GPU_FB_COLOR_ATTACHMENT0].tex; + const bool is_srgb_target = (first_target && (GPU_texture_format(first_target) == GPU_SRGB8_A8)); + GPU_shader_set_framebuffer_srgb_target(!is_srgb_target); +} + void GPU_framebuffer_restore(void) { if (GPU_framebuffer_active_get() != NULL) { |