[Bf-blender-cvs] [5907b59] soc-2014-viewport_context: made GLEW_CHK extern again (ContextWGL wasn't using it and for some reason I assumed the other contexts didn't need it either)

Jason Wilkins noreply at git.blender.org
Sat Aug 2 13:27:29 CEST 2014


Commit: 5907b59138c7951cf77342423e36cfce129223ba
Author: Jason Wilkins
Date:   Sat Aug 2 06:27:04 2014 -0500
Branches: soc-2014-viewport_context
https://developer.blender.org/rB5907b59138c7951cf77342423e36cfce129223ba

made GLEW_CHK extern again (ContextWGL wasn't using it and for some reason I assumed the other contexts didn't need it either)

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

M	intern/ghost/intern/GHOST_ContextEGL.cpp
M	intern/ghost/intern/GHOST_ContextGLX.cpp
M	intern/ghost/intern/GHOST_ContextWGL.cpp
M	intern/glew-mx/glew-mx.h
M	intern/glew-mx/intern/glew-mx.c

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

diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 756e9a0..6a92318 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -342,7 +342,8 @@ void GHOST_ContextEGL::initContextEGLEW()
 	m_eglewContext = eglewContext;
 #endif
 
-	eglewInit(m_display);
+	if (GLEW_CHK(eglewInit(m_display)) != GLEW_OK)
+		fprintf(stderr, "Warning! EGLEW failed to initialize properly.\n");
 }
 
 
diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index 0b82315..43c8c0c 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -140,7 +140,8 @@ void GHOST_ContextGLX::initContextGLXEW()
 	m_glxewContext = glxewContext;
 #endif
 
-	glxewInit();
+	if (GLEW_CHK(glxewInit()) != GLEW_OK)
+		fprintf(stderr, "Warning! GLXEW failed to initialize properly.\n");
 }
 
 GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 9f1381f..b752979 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -375,7 +375,7 @@ void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
 	if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC)))
 		goto finalize;
 
-	if (wglewInit() != GLEW_OK)
+	if (GLEW_CHK(wglewInit()) != GLEW_OK)
 		fprintf(stderr, "Warning! WGLEW failed to initialize properly.\n");
 
 	// the following are not technially WGLEW, but they also require a context to work
diff --git a/intern/glew-mx/glew-mx.h b/intern/glew-mx/glew-mx.h
index 4a91997..6da80fc 100644
--- a/intern/glew-mx/glew-mx.h
+++ b/intern/glew-mx/glew-mx.h
@@ -96,6 +96,14 @@ void       mxMakeCurrentContext(MXContext *ctx);
 void       mxDestroyContext    (MXContext *ctx);
 
 
+GLenum glew_chk(GLenum error, const char *file, int line, const char *text)
+
+#ifndef NDEBUG
+#  define GLEW_CHK(x) glew_chk((x), __FILE__, __LINE__, #x)
+#else
+#  define GLEW_CHK(x) glew_chk((x), NULL, 0, NULL)
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/intern/glew-mx/intern/glew-mx.c b/intern/glew-mx/intern/glew-mx.c
index e5df6fd..35f2be2 100644
--- a/intern/glew-mx/intern/glew-mx.c
+++ b/intern/glew-mx/intern/glew-mx.c
@@ -56,7 +56,7 @@ static const char *get_glew_error_enum_string(GLenum error)
 }
 
 
-static GLenum glew_chk(GLenum error, const char *file, int line, const char *text)
+GLenum glew_chk(GLenum error, const char *file, int line, const char *text)
 {
 	if (error != GLEW_OK) {
 		const char *code = get_glew_error_enum_string(error);
@@ -80,12 +80,6 @@ static GLenum glew_chk(GLenum error, const char *file, int line, const char *tex
 	return error;
 }
 
-#ifndef NDEBUG
-#  define GLEW_CHK(x) glew_chk((x), __FILE__, __LINE__, #x)
-#else
-#  define GLEW_CHK(x) glew_chk((x), NULL, 0, NULL)
-#endif
-
 
 #ifdef WITH_GLEW_MX
 MXContext *_mx_context = NULL;




More information about the Bf-blender-cvs mailing list