diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-01-02 13:27:36 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-01-02 13:30:17 +0300 |
commit | 070f22c44082c1a7405795744cec667157abbfbf (patch) | |
tree | 47c0a1b2a82649740ad25947d734bc4a2c23ceab /source/blender/windowmanager/intern | |
parent | 13174df534e76c528e9d4f959eebbc6481ebf9f1 (diff) |
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.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 23 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_stereo.c | 6 |
2 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 3825db14e93..77ffa46b990 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -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 { diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c index 1c1c2ad35af..46cee907991 100644 --- a/source/blender/windowmanager/intern/wm_stereo.c +++ b/source/blender/windowmanager/intern/wm_stereo.c @@ -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); } |