Multi-View: rolls back to a non quadbuffer friendly window if displaymode changes from pageflip to something else

In some cases the graphic card supports quadbuffer, but not the display.
In this case it is nice to go back to a window that does not have
quadbuffer if you change back to anaglyph, interlace, ...

Otherwise you may be stuck with a flickering window
This commit is contained in:
Dalai Felinto 2015-04-24 12:51:20 -03:00
parent fb17a3fb76
commit 27ac96dbae
1 changed files with 22 additions and 11 deletions

View File

@ -450,18 +450,28 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
const bool is_fullscreen = WM_window_is_fullscreen(win);
char display_mode = win->stereo3d_format->display_mode;
char prev_display_mode = win->stereo3d_format->display_mode;
Stereo3dData *s3dd = op->customdata;
if (G.background)
if (G.background || s3dd == NULL)
return OPERATOR_CANCELLED;
if (op->customdata) {
Stereo3dData *s3dd = op->customdata;
*win->stereo3d_format = s3dd->stereo3d_format;
}
*win->stereo3d_format = s3dd->stereo3d_format;
/* pageflip requires a new window to be created with the proper OS flags */
if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
if (prev_display_mode == S3D_DISPLAY_PAGEFLIP &&
prev_display_mode != win->stereo3d_format->display_mode)
{
/* in case the hardward supports pageflip but not the display */
if (wm_window_duplicate_exec(C, op) == OPERATOR_FINISHED) {
wm_window_close(C, wm, win);
}
else {
BKE_report(op->reports, RPT_ERROR,
"Fail to create a window without quadbuffer support, you may experience flickering");
}
}
else if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
/* pageflip requires a new window to be created with the proper OS flags */
if (wm_window_duplicate_exec(C, op) == OPERATOR_FINISHED) {
if (wm_stereo3d_quadbuffer_supported()) {
wm_window_close(C, wm, win);
@ -470,17 +480,18 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
else {
wmWindow *win_new = wm->windows.last;
wm_window_close(C, wm, win_new);
win->stereo3d_format->display_mode = display_mode;
win->stereo3d_format->display_mode = prev_display_mode;
BKE_report(op->reports, RPT_ERROR, "Quad-buffer not supported by the system");
}
}
else {
BKE_report(op->reports, RPT_ERROR,
"Fail to create a window compatible with the time sequential display method");
win->stereo3d_format->display_mode = display_mode;
win->stereo3d_format->display_mode = prev_display_mode;
}
}
else if (wm_stereo3d_is_fullscreen_required(win->stereo3d_format->display_mode)) {
if (wm_stereo3d_is_fullscreen_required(s3dd->stereo3d_format.display_mode)) {
if (!is_fullscreen) {
BKE_report(op->reports, RPT_INFO, "Stereo 3D Mode requires the window to be fullscreen");
}