From 2e908156d0c744e526e165b386c61a0a4d0e8ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 18 Aug 2020 14:43:18 +0200 Subject: 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 --- source/blender/gpu/GPU_framebuffer.h | 1 + source/blender/gpu/intern/gpu_framebuffer.cc | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h index 9dc07fefd4e..7103317e4d6 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.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index 5f3089b2ffb..627f417e0c3 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -555,6 +555,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) { -- cgit v1.2.3