[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58568] branches/soc-2013-viewport_fx/ intern/ghost/intern/GHOST_WindowWin32.cpp: eglChooseConfig can return EGL_TRUE even if it doesn' t find a suitable configuration, so you have to check the value of num_configs.

Jason Wilkins Jason.A.Wilkins at gmail.com
Wed Jul 24 11:54:52 CEST 2013


Revision: 58568
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58568
Author:   jwilkins
Date:     2013-07-24 09:54:52 +0000 (Wed, 24 Jul 2013)
Log Message:
-----------
eglChooseConfig can return EGL_TRUE even if it doesn't find a suitable configuration, so you have to check the value of num_configs.  Removed unused query for the total number of EGL configs.  Now using a std::vector to hold the attrib_list.  Put variable declarations close to their use sites.

Modified Paths:
--------------
    branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp

Modified: branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
--- branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp	2013-07-24 09:22:10 UTC (rev 58567)
+++ branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp	2013-07-24 09:54:52 UTC (rev 58568)
@@ -986,15 +986,6 @@
 		break;
 #elif defined(WITH_GL_SYSTEM_EMBEDDED)
 		{
-			EGLint major, minor;
-			EGLint num_config;
-			EGLConfig config;
-			std::vector<EGLint> attrib_list(20);
-
-#if defined(WITH_GL_PROFILE_ES20)
-			EGLint attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };
-#endif
-
 			success = GHOST_kFailure;
 
 #if defined(WITH_ANGLE)
@@ -1018,12 +1009,15 @@
 			if (m_egl_display == EGL_NO_DISPLAY)
 				break;
 
+			EGLint major, minor;
+
 			if (!::eglInitialize(m_egl_display, &major, &minor))
 				break;
 
-			if (!::eglGetConfigs(m_egl_display, NULL, 0, &num_config))
-				break;
+			printf("EGL v%d.%d\n", major, minor);
 
+			std::vector<EGLint> attrib_list(20);
+
 			attrib_list.push_back(EGL_RED_SIZE);
 			attrib_list.push_back(8);
 
@@ -1054,14 +1048,25 @@
 
 			attrib_list.push_back(EGL_NONE);
 
+			EGLConfig config;
+			EGLint    num_config;
+
 			if (!::eglChooseConfig(m_egl_display, &(attrib_list[0]), &config, 1, &num_config))
 				break;
 
+			/* ChooseConfig can "succeed" without finding any suitable configurations */
+			if (num_config != 1)
+				break;
+
 			m_egl_surface = ::eglCreateWindowSurface(m_egl_display, config, m_hWnd, NULL);
 
 			if (m_egl_surface == EGL_NO_SURFACE)
 				break;
 
+#if defined(WITH_GL_PROFILE_ES20)
+			EGLint attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
+#endif
+
 			m_egl_context = ::eglCreateContext(m_egl_display, config, s_egl_first_context, attribs);
 
 			if (m_egl_context == EGL_NO_CONTEXT)




More information about the Bf-blender-cvs mailing list