Fix T77564: VSE (and compositor background) lost stereoscopy preview
Issue introduced on fe045b2b77
.
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
This commit is contained in:
parent
63998d3522
commit
2e908156d0
Notes:
blender-bot
2023-02-14 02:27:56 +01:00
Referenced by commit d6d2897ef0
, Sequencer: Fix crash caused by stereo rendering fix
Referenced by issue #77564, Video Sequence Editor lost stereoscopic preview
Referenced by issue #76876, Anaglyph 3D not showing in backdrop of compositor.
|
@ -52,6 +52,7 @@
|
|||
#include "GPU_immediate_util.h"
|
||||
#include "GPU_matrix.h"
|
||||
#include "GPU_state.h"
|
||||
#include "GPU_viewport.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
@ -1755,6 +1756,12 @@ void drawnodespace(const bContext *C, ARegion *region)
|
|||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
View2D *v2d = ®ion->v2d;
|
||||
|
||||
/* Setup offscreen buffers. */
|
||||
GPUViewport *viewport = WM_draw_region_get_viewport(region);
|
||||
|
||||
GPUFrameBuffer *framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport);
|
||||
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
|
||||
|
||||
UI_ThemeClearColor(TH_BACK);
|
||||
GPU_clear(GPU_COLOR_BIT);
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "GPU_matrix.h"
|
||||
#include "GPU_state.h"
|
||||
#include "GPU_vertex_buffer.h"
|
||||
#include "GPU_viewport.h"
|
||||
|
||||
#include "ED_anim_api.h"
|
||||
#include "ED_gpencil.h"
|
||||
|
@ -1537,7 +1538,7 @@ static void sequencer_preview_clear(void)
|
|||
float col[3];
|
||||
|
||||
UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
|
||||
GPU_clear_color(col[0], col[1], col[2], 0.0);
|
||||
GPU_clear_color(col[0], col[1], col[2], 1.0f);
|
||||
GPU_clear(GPU_COLOR_BIT);
|
||||
}
|
||||
|
||||
|
@ -1780,6 +1781,12 @@ void sequencer_draw_preview(const bContext *C,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Setup offscreen buffers. */
|
||||
GPUViewport *viewport = WM_draw_region_get_viewport(region);
|
||||
|
||||
GPUFrameBuffer *framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport);
|
||||
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
|
||||
|
||||
/* Setup view. */
|
||||
sequencer_display_size(scene, viewrect);
|
||||
UI_view2d_totRect_set(v2d, viewrect[0] + 0.5f, viewrect[1] + 0.5f);
|
||||
|
@ -1798,6 +1805,9 @@ void sequencer_draw_preview(const bContext *C,
|
|||
ibuf = sequencer_ibuf_get(
|
||||
bmain, depsgraph, scene, sseq, cfra, frame_ofs, names[sseq->multiview_eye]);
|
||||
|
||||
/* sequencer_ibuf_get can call GPU_framebuffer_bind. So disable srgb framebuffer again. */
|
||||
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
|
||||
|
||||
if (ibuf) {
|
||||
scope = sequencer_get_scope(scene, sseq, ibuf, draw_backdrop);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -307,7 +307,9 @@ static void wm_region_test_xr_do_draw(const wmWindowManager *wm,
|
|||
|
||||
static bool wm_region_use_viewport_by_type(short space_type, short region_type)
|
||||
{
|
||||
return (ELEM(space_type, SPACE_VIEW3D, SPACE_IMAGE) && region_type == RGN_TYPE_WINDOW);
|
||||
return (ELEM(space_type, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE) &&
|
||||
region_type == RGN_TYPE_WINDOW) ||
|
||||
((space_type == SPACE_SEQ) && region_type == RGN_TYPE_PREVIEW);
|
||||
}
|
||||
|
||||
bool WM_region_use_viewport(ScrArea *area, ARegion *region)
|
||||
|
|
Loading…
Reference in New Issue