[Bf-blender-cvs] [9d876960e89] blender2.8: This option limits visibility of the glew.h header to just bf_gpu and intern_gawain this is to highlight areas in the code that still directly do opengl calls or use opengl types.

Ray Molenkamp noreply at git.blender.org
Sat Jun 16 04:17:26 CEST 2018


Commit: 9d876960e8914bfa11bc3be1e500832711c20350
Author: Ray Molenkamp
Date:   Fri Jun 15 20:17:16 2018 -0600
Branches: blender2.8
https://developer.blender.org/rB9d876960e8914bfa11bc3be1e500832711c20350

This option limits visibility of the glew.h header to just bf_gpu and intern_gawain
this is to highlight areas in the code that still directly do opengl calls or use
opengl types.

This is in preparation for supporting alternative rendering back-ends.

Reviewers: brecht, fclem

Differential Revision: https://developer.blender.org/D3304

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

M	CMakeLists.txt
M	intern/gawain/CMakeLists.txt
M	intern/gawain/gawain/gwn_common.h
M	source/blender/gpu/CMakeLists.txt
M	source/blender/gpu/GPU_glew.h

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4a537a01545..4da0f70884a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -458,11 +458,13 @@ endif()
 
 # OpenGL
 
+option(WITH_OPENGL              "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
 option(WITH_GLEW_ES             "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
 option(WITH_GL_EGL              "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)"       OFF)
 option(WITH_GL_PROFILE_ES20     "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)"                                  OFF)
 
 mark_as_advanced(
+	WITH_OPENGL
 	WITH_GLEW_ES
 	WITH_GL_EGL
 	WITH_GL_PROFILE_ES20
@@ -1003,6 +1005,10 @@ endif()
 find_package(OpenGL)
 blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
 
+if(WITH_OPENGL)
+	add_definitions(-DWITH_OPENGL)
+endif()
+
 if(WITH_SYSTEM_GLES)
 	find_package_wrapper(OpenGLES)
 endif()
diff --git a/intern/gawain/CMakeLists.txt b/intern/gawain/CMakeLists.txt
index 177c76327aa..ced52b22e2c 100644
--- a/intern/gawain/CMakeLists.txt
+++ b/intern/gawain/CMakeLists.txt
@@ -1,3 +1,10 @@
+# WITH_OPENGL limits the visibility of the opengl headers to just gawain and bg_gpu,
+# to more easily highlight codepadths in other libraries that need to be refactored, 
+# bf_intern_gawain is allowed to have opengl regardless of this option.
+
+if(NOT WITH_OPENGL)
+	add_definitions(-DWITH_OPENGL)
+endif()
 
 set(INC
 	gawain
diff --git a/intern/gawain/gawain/gwn_common.h b/intern/gawain/gawain/gwn_common.h
index f1512bf4466..6a56543da40 100644
--- a/intern/gawain/gawain/gwn_common.h
+++ b/intern/gawain/gawain/gwn_common.h
@@ -20,7 +20,10 @@
   #define TRUST_NO_ONE 1
 #endif
 
-#include <GL/glew.h>
+#if defined(WITH_OPENGL)
+  #include <GL/glew.h>
+#endif
+
 #include <stdbool.h>
 #include <stdint.h>
 
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 481133ba984..fe6d438924f 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -23,6 +23,14 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
+# WITH_OPENGL limits the visibility of the opengl headers to just gawain and bg_gpu,
+# to more easily highlight codepadths in other libraries that need to be refactored, 
+# bf_gpu is allowed to have opengl regardless of this option.
+
+if(NOT WITH_OPENGL)
+	add_definitions(-DWITH_OPENGL)
+endif()
+
 set(INC
 	.
 	../blenkernel
diff --git a/source/blender/gpu/GPU_glew.h b/source/blender/gpu/GPU_glew.h
index afe1c9763ad..b3e2a9fcfa5 100644
--- a/source/blender/gpu/GPU_glew.h
+++ b/source/blender/gpu/GPU_glew.h
@@ -32,10 +32,12 @@
 #ifndef __GPU_GLEW_H__
 #define __GPU_GLEW_H__
 
-#include "glew-mx.h"
+#if defined(WITH_OPENGL)
+	#include "glew-mx.h"
 
-#ifndef WITH_LEGACY_OPENGL
-#include "GPU_legacy_stubs.h"
+	#ifndef WITH_LEGACY_OPENGL
+		#include "GPU_legacy_stubs.h"
+	#endif
 #endif
 
 #endif /* __GPU_GLEW_H__ */



More information about the Bf-blender-cvs mailing list