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
83e3d25bca
commit
47c6f41b89
Notes:
blender-bot
2023-02-14 00:57:33 +01:00
Referenced by commit40edb84dcf
, Revert "Fix T77564: VSE (and compositor background) lost stereoscopy preview" Referenced by commitd5b5b228e4
, UI: Fix protential stray GPU state preventing correct drawing Referenced by issue #79940, VSE Editor crash when opening a different scene as a strip Referenced by issue #79934, Protruding curves on RGB Curves node Referenced by issue #77564, Video Sequence Editor lost stereoscopic preview
|
@ -47,11 +47,13 @@
|
|||
|
||||
#include "BIF_glutil.h"
|
||||
|
||||
#include "GPU_batch_presets.h"
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "GPU_immediate.h"
|
||||
#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"
|
||||
|
@ -1771,11 +1773,18 @@ void drawnodespace(const bContext *C, ARegion *region)
|
|||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
View2D *v2d = ®ion->v2d;
|
||||
|
||||
UI_view2d_view_ortho(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);
|
||||
GPU_batch_presets_reset();
|
||||
|
||||
UI_ThemeClearColor(TH_BACK);
|
||||
GPU_clear(GPU_COLOR_BIT);
|
||||
|
||||
UI_view2d_view_ortho(v2d);
|
||||
|
||||
/* XXX snode->cursor set in coordspace for placing new nodes, used for drawing noodles too */
|
||||
UI_view2d_region_to_view(®ion->v2d,
|
||||
win->eventstate->x - region->winrct.xmin,
|
||||
|
|
|
@ -50,12 +50,14 @@
|
|||
#include "IMB_colormanagement.h"
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
#include "GPU_batch_presets.h"
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "GPU_immediate.h"
|
||||
#include "GPU_immediate_util.h"
|
||||
#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 +1539,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.0);
|
||||
GPU_clear(GPU_COLOR_BIT);
|
||||
}
|
||||
|
||||
|
@ -1775,6 +1777,13 @@ 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);
|
||||
GPU_batch_presets_reset();
|
||||
|
||||
if (sseq->render_size == SEQ_PROXY_RENDER_SIZE_NONE) {
|
||||
sequencer_preview_clear();
|
||||
return;
|
||||
|
@ -1798,6 +1807,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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -308,7 +308,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