[Bf-blender-cvs] [b5b359b] master: Warning messagebox for windows when an unsupported implementation of OpenGL is detected:

Antony Riakiotakis noreply at git.blender.org
Wed Feb 25 13:52:09 CET 2015


Commit: b5b359b48f7f35a79b3eec8534f363952485212d
Author: Antony Riakiotakis
Date:   Wed Feb 25 13:51:53 2015 +0100
Branches: master
https://developer.blender.org/rBb5b359b48f7f35a79b3eec8534f363952485212d

Warning messagebox for windows when an unsupported implementation of
OpenGL is detected:

Hoping to decrease the frequency of by far one of the most frequent bug
reports by windows users.

There is some reorganization of the GHOST API to allow easy addition of
further OpenGL options in the future. The change is not propagated too
deep to keep the size of the patch managable. We might reorganize things
here later.

For OpenGL we do two checks here:
One is a combination of GDI generic renderer or vendor microsoft
corporation and OpenGL version 1.1. This means the system does not
use GPU acceleration at all. We warn user to install a graphics
driver and of cases where this might happen (remote connection, using
blender through virtual machine)

The other one just checks if OpenGL version is less than 1.4 (we can
easily change that in the future of course) and warns that it is
deprecated.

Both cases will still let blender startup correctly but users should now
have a clear idea of the system being unsupported.

A user preference flag is provided to turn the warning off.

Now stop posting those bug reports without installing a driver first -
please?

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

M	intern/ghost/GHOST_C-api.h
M	intern/ghost/GHOST_ISystem.h
M	intern/ghost/GHOST_Types.h
M	intern/ghost/intern/GHOST_C-api.cpp
M	intern/ghost/intern/GHOST_ContextWGL.cpp
M	intern/ghost/intern/GHOST_ContextWGL.h
M	intern/ghost/intern/GHOST_System.cpp
M	intern/ghost/intern/GHOST_SystemCocoa.h
M	intern/ghost/intern/GHOST_SystemCocoa.mm
M	intern/ghost/intern/GHOST_SystemNULL.h
M	intern/ghost/intern/GHOST_SystemSDL.cpp
M	intern/ghost/intern/GHOST_SystemSDL.h
M	intern/ghost/intern/GHOST_SystemWin32.cpp
M	intern/ghost/intern/GHOST_SystemWin32.h
M	intern/ghost/intern/GHOST_SystemX11.cpp
M	intern/ghost/intern/GHOST_SystemX11.h
M	intern/ghost/intern/GHOST_WindowWin32.cpp
M	intern/ghost/intern/GHOST_WindowWin32.h
M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/windowmanager/intern/wm_playanim.c
M	source/blender/windowmanager/intern/wm_window.c
M	source/gameengine/GamePlayer/ghost/GPG_Application.cpp

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

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index c0f2651..5f01a13 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -186,8 +186,7 @@ extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
                                              GHOST_TUns32 height,
                                              GHOST_TWindowState state,
                                              GHOST_TDrawingContextType type,
-                                             const int stereoVisual,
-                                             const GHOST_TUns16 numOfAASamples);
+                                             GHOST_GLSettings glSettings);
 
 /**
  * Returns the window user data.
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 19f3631..93ccc0f 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -250,9 +250,8 @@ public:
 	        const STR_String& title,
 	        GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
 	        GHOST_TWindowState state, GHOST_TDrawingContextType type,
-	        const bool stereoVisual = false,
+	        GHOST_GLSettings glSettings,
 	        const bool exclusive = false,
-	        const GHOST_TUns16 numOfAASamples = 0,
 	        const GHOST_TEmbedderWindowID parentWindow = 0) = 0;
 
 	/**
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index c4a7490..6dd92e5 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -50,6 +50,17 @@ typedef unsigned short GHOST_TUns16;
 typedef int GHOST_TInt32;
 typedef unsigned int GHOST_TUns32;
 
+typedef struct {
+	GHOST_TUns16 numOfAASamples;
+	int flags;
+} GHOST_GLSettings;
+
+typedef enum {
+	GHOST_glStereoVisual = 0,
+	GHOST_glWarnSupport
+} GHOST_GLFlags;
+
+
 #ifdef _MSC_VER
 typedef __int64 GHOST_TInt64;
 typedef unsigned __int64 GHOST_TUns64;
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 0da77ac..8d01e8a 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -140,14 +140,12 @@ GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
                                       GHOST_TUns32 height,
                                       GHOST_TWindowState state,
                                       GHOST_TDrawingContextType type,
-                                      const int stereoVisual,
-                                      const GHOST_TUns16 numOfAASamples)
+                                      GHOST_GLSettings glSettings)
 {
 	GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
 
 	return (GHOST_WindowHandle) system->createWindow(title, left, top, width, height,
-	                                                 state, type, stereoVisual != 0, false,
-	                                                 numOfAASamples);
+	                                                 state, type, glSettings, false);
 }
 
 GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 312600c..31b5863 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -48,6 +48,7 @@ HGLRC GHOST_ContextWGL::s_sharedHGLRC = NULL;
 int   GHOST_ContextWGL::s_sharedCount = 0;
 
 bool GHOST_ContextWGL::s_singleContextMode = false;
+bool GHOST_ContextWGL::s_warn_old = false;
 
 
 /* Intel video-cards don't work fine with multiple contexts and
@@ -863,12 +864,39 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
 	initClearGL();
 	::SwapBuffers(m_hDC);
 
+	const char *vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
+	const char *renderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
+	const char *version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
+
 #ifndef NDEBUG
-	reportContextString("Vendor",   m_dummyVendor,   reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
-	reportContextString("Renderer", m_dummyRenderer, reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
-	reportContextString("Version",  m_dummyVersion,  reinterpret_cast<const char*>(glGetString(GL_VERSION)));
+	reportContextString("Vendor",   m_dummyVendor,   vendor);
+	reportContextString("Renderer", m_dummyRenderer, renderer);
+	reportContextString("Version",  m_dummyVersion,  version);
 #endif
 
+	if (!s_warn_old) {
+		if ((strcmp(vendor, "Microsoft Corporation") == 0 ||
+		    strcmp(renderer, "GDI Generic") == 0) && version[0] == '1' && version[0] == '1')
+		{
+			MessageBox(m_hWnd, "Your system does not use GPU acceleration.\n"
+			                   "Such systems can cause stability problems in blender and they are unsupported.\n\n"
+			                   "This may is caused by:\n"
+			                   "* A missing or faulty graphics driver installation.\n"
+			                   "  Blender needs a graphics card driver to work correctly.\n"
+			                   "* Accessing blender through a remote connection.\n"
+			                   "* Using blender through a virtual machine.\n\n"
+			                   "Disable this message in <User Preferences - Interface - Warn On Deprecated OpenGL>",
+			                   "Blender - Can't detect GPU accelerated Driver!", MB_OK | MB_ICONWARNING);
+		}
+		else if (version[0] == '1' && version[2] < '4') {
+			MessageBox(m_hWnd, "The OpenGL version provided by your graphics driver version is too low\n"
+			                   "Blender requires version 1.4 and may not work correctly\n\n"
+			                   "Disable this message in <User Preferences - Interface - Warn On Deprecated OpenGL>",
+			                   "Blender - Unsupported Graphics Driver!", MB_OK | MB_ICONWARNING);
+		}
+		s_warn_old = true;
+	}
+
 	return GHOST_kSuccess;
 
 error:
diff --git a/intern/ghost/intern/GHOST_ContextWGL.h b/intern/ghost/intern/GHOST_ContextWGL.h
index 98a8059..63496d2 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.h
+++ b/intern/ghost/intern/GHOST_ContextWGL.h
@@ -118,6 +118,8 @@ public:
 	 */
 	GHOST_TSuccess getSwapInterval(int &intervalOut);
 
+	static void unSetWarningOld(){s_warn_old = true;}
+
 protected:
 	inline void activateWGLEW() const {
 #ifdef WITH_GLEW_MX 
@@ -183,6 +185,7 @@ private:
 	static int   s_sharedCount;
 
 	static bool s_singleContextMode;
+	static bool s_warn_old;
 };
 
 #endif  // __GHOST_CONTEXTWGL_H__
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index d1f2d5d..fef8fda 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -350,6 +350,12 @@ GHOST_TSuccess GHOST_System::exit()
 GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window, const GHOST_DisplaySetting &settings,
                                                     const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
 {
+	GHOST_GLSettings glSettings = {0};
+
+	if (stereoVisual)
+		glSettings.flags |= GHOST_glStereoVisual;
+	glSettings.numOfAASamples = numOfAASamples;
+
 	/* note: don't use getCurrentDisplaySetting() because on X11 we may
 	 * be zoomed in and the desktop may be bigger then the viewport. */
 	GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager");
@@ -359,9 +365,8 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window, const
 	    0, 0, settings.xPixels, settings.yPixels,
 	    GHOST_kWindowStateNormal,
 	    GHOST_kDrawingContextTypeOpenGL,
-	    stereoVisual,
-	    true,  /* exclusive */
-	    numOfAASamples);
+	    glSettings,
+	    true  /* exclusive */);
 	return (*window == NULL) ? GHOST_kFailure : GHOST_kSuccess;
 }
 
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 72a4d7d..a86575a 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -118,9 +118,8 @@ public:
 	    GHOST_TUns32 height,
 	    GHOST_TWindowState state,
 	    GHOST_TDrawingContextType type,
-	    const bool stereoVisual = false,
-		const bool exclusive = false,
-	    const GHOST_TUns16 numOfAASamples = 0,
+	    GHOST_GLSettings glSettings,
+	    const bool exclusive = false,
 	    const GHOST_TEmbedderWindowID parentWindow = 0
 	    );
 	
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 3ce9a4b..095c738 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -530,9 +530,8 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow(
 	GHOST_TUns32 height,
 	GHOST_TWindowState state,
 	GHOST_TDrawingContextType type,
-	bool stereoVisual,
+	GHOST_GLSettings glSettings,
 	const bool exclusive,
-	const GHOST_TUns16 numOfAASamples,
 	const GHOST_TEmbedderWindowID parentWindow
 )
 {
@@ -551,7 +550,7 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow(
 	// Add contentRect.origin.y to respect docksize
 	bottom = bottom > contentRect.origin.y ? bottom + contentRect.origin.y : contentRect.origin.y;
 
-	window = new GHOST_WindowCocoa (this, title, left, bottom, width, height, state, type, stereoVisual, numOfAASamples);
+	window = new GHOST_WindowCocoa (this, title, left, bottom, width, height, state, type, ((glSettings.flags & GHOST_glStereoVisual) != 0), glSettings.numOfAASamples);
 
 	if (window->getValid()) {
 		// Store the pointer to the window
diff --git a/intern/ghost/intern/GHOST_SystemNULL.h b/intern/ghost/intern/GHOST_SystemNULL.h
index 77a741c..868416c 100644
--- a/intern/ghost/intern/GHOST_SystemNULL.h
+++ b/intern/ghost/intern/GHOST_SystemNULL.h
@@ -75,12 +75,12 @@ public:
 			GHOST_TUns32 height,
 			GHOST_TWindowState state,
 			GHOST_TDrawingContextType type,
-			bool stereoVisual,
+			GHOST_GLSettings glSettings,
 			bool exclusive,
-			const GHOST_TUns16 numOfAASamples,
 			const GHOST_TEmbedderWindowID parentWindow)
 	{
-		return new GHOST_WindowNULL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
+		return new GHOST_WindowNULL(this, title, left, top, width, height, state, parentWindow, type,
+		                     

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list