[Bf-blender-cvs] [27ac96d] master: Multi-View: rolls back to a non quadbuffer friendly window if displaymode changes from pageflip to something else

Dalai Felinto noreply at git.blender.org
Fri Apr 24 18:08:33 CEST 2015


Commit: 27ac96dbae9d6fb166776ff689bae171bd7f095b
Author: Dalai Felinto
Date:   Fri Apr 24 12:51:20 2015 -0300
Branches: master
https://developer.blender.org/rB27ac96dbae9d6fb166776ff689bae171bd7f095b

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

===================================================================

M	source/blender/windowmanager/intern/wm_stereo.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index b2cd1f0..4e13f6b 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -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");
 		}




More information about the Bf-blender-cvs mailing list