Fix T49861: Interlace stereo is broken in 2.78
This is a regression introduced in rB5bd9e832 It looks more like a hack than a proper fix, but the shader logic changed a lot for blender2.8, so I would rather do the elegant fix there, while leaving master working. If we ever do a 2.78b (or 2.79) this should get in.
This commit is contained in:
parent
13174df534
commit
070f22c440
Notes:
blender-bot
2023-02-14 08:39:23 +01:00
Referenced by commit 329879239e
, Merge remote-tracking branch 'origin/master' into blender2.8
Referenced by issue #49861, Interlace stereo is broken in 2.78
|
@ -430,7 +430,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
|
||||
void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha, bool is_interlace)
|
||||
{
|
||||
const int sizex = WM_window_pixels_x(win);
|
||||
const int sizey = WM_window_pixels_y(win);
|
||||
|
@ -451,7 +451,13 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
|
|||
halfy /= triple->y;
|
||||
}
|
||||
|
||||
GPU_basic_shader_bind((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_TEXTURE_2D : GPU_SHADER_TEXTURE_RECT);
|
||||
/* interlace stereo buffer bind the shader before calling wm_triple_draw_textures */
|
||||
if (is_interlace) {
|
||||
glEnable(triple->target);
|
||||
}
|
||||
else {
|
||||
GPU_basic_shader_bind((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_TEXTURE_2D : GPU_SHADER_TEXTURE_RECT);
|
||||
}
|
||||
|
||||
glBindTexture(triple->target, triple->bind);
|
||||
|
||||
|
@ -472,7 +478,12 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
|
|||
|
||||
glBindTexture(triple->target, 0);
|
||||
|
||||
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
|
||||
if (is_interlace) {
|
||||
glDisable(triple->target);
|
||||
}
|
||||
else {
|
||||
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
|
||||
|
@ -495,7 +506,7 @@ static void wm_draw_region_blend(wmWindow *win, ARegion *ar, wmDrawTriple *tripl
|
|||
wmSubWindowScissorSet(win, win->screen->mainwin, &ar->winrct, true);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
wm_triple_draw_textures(win, triple, 1.0f - fac);
|
||||
wm_triple_draw_textures(win, triple, 1.0f - fac, false);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
@ -516,7 +527,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
|
|||
|
||||
wmSubWindowSet(win, screen->mainwin);
|
||||
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f);
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f, false);
|
||||
}
|
||||
else {
|
||||
/* we run it when we start OR when we turn stereo on */
|
||||
|
@ -656,7 +667,7 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, StereoVi
|
|||
|
||||
wmSubWindowSet(win, screen->mainwin);
|
||||
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f);
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -77,7 +77,7 @@ static void wm_method_draw_stereo3d_pageflip(wmWindow *win)
|
|||
else //STEREO_RIGHT_ID
|
||||
glDrawBuffer(GL_BACK_RIGHT);
|
||||
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f);
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f, false);
|
||||
}
|
||||
|
||||
glDrawBuffer(GL_BACK);
|
||||
|
@ -120,7 +120,7 @@ static void wm_method_draw_stereo3d_interlace(wmWindow *win)
|
|||
break;
|
||||
}
|
||||
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f);
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f, true);
|
||||
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
|
||||
}
|
||||
interlace_prev_type = interlace_type;
|
||||
|
@ -157,7 +157,7 @@ static void wm_method_draw_stereo3d_anaglyph(wmWindow *win)
|
|||
break;
|
||||
}
|
||||
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f);
|
||||
wm_triple_draw_textures(win, drawdata->triple, 1.0f, false);
|
||||
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ void wm_draw_region_clear (struct wmWindow *win, struct ARegion *ar);
|
|||
|
||||
void wm_tag_redraw_overlay (struct wmWindow *win, struct ARegion *ar);
|
||||
|
||||
void wm_triple_draw_textures (struct wmWindow *win, struct wmDrawTriple *triple, float alpha);
|
||||
void wm_triple_draw_textures (struct wmWindow *win, struct wmDrawTriple *triple, float alpha, bool is_interlace);
|
||||
|
||||
void wm_draw_data_free (struct wmWindow *win);
|
||||
|
||||
|
|
Loading…
Reference in New Issue