[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58418] branches/soc-2013-viewport_fx: Fixes to get WITH_GL_PROFILE_COMPAT/ WITH_GL_SYSTEM_LEGACY working with WITH_GLEW_ES

Jason Wilkins Jason.A.Wilkins at gmail.com
Fri Jul 19 22:55:52 CEST 2013


Revision: 58418
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58418
Author:   jwilkins
Date:     2013-07-19 20:55:51 +0000 (Fri, 19 Jul 2013)
Log Message:
-----------
Fixes to get WITH_GL_PROFILE_COMPAT/WITH_GL_SYSTEM_LEGACY working with WITH_GLEW_ES

Also, added comments to the "shims" in gpu_glew.h

Modified Paths:
--------------
    branches/soc-2013-viewport_fx/CMakeLists.txt
    branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_glew.h

Modified: branches/soc-2013-viewport_fx/CMakeLists.txt
===================================================================
--- branches/soc-2013-viewport_fx/CMakeLists.txt	2013-07-19 20:28:46 UTC (rev 58417)
+++ branches/soc-2013-viewport_fx/CMakeLists.txt	2013-07-19 20:55:51 UTC (rev 58418)
@@ -2060,9 +2060,6 @@
 		set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew-es/include")
 
 		set(GL_DEFINITIONS "${GL_DEFINITIONS} -DWITH_GLEW_ES")
-		set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGL_ES_VERSION_1_0=0")
-		set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGL_ES_VERSION_CL_1_1=0")
-		set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGL_ES_VERSION_CM_1_1=0")
 
 		# this isn't strictly required, but potentally makes GLEW smaller and helps catch unguarded API usage
 		if(NOT WITH_GL_PROFILE_ES20)
@@ -2075,6 +2072,14 @@
 
 		if (WITH_GL_PROFILE_ES20)
 			set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGLEW_USE_LIB_ES20")
+			
+			# XXX jwilkins: this is just an experiment to eliminate ES 1 symbols,
+			# GLEW doesn't really properly provide this level of control (it eliminates too many symbols, for example),
+			# so there are lots of modifications to GLEW to make this work,
+			# and no attempt to make it work beyond Blender at this point
+			set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGL_ES_VERSION_1_0=0")
+			set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGL_ES_VERSION_CL_1_1=0")
+			set(GL_DEFINITIONS "${GL_DEFINITIONS} -DGL_ES_VERSION_CM_1_1=0")
 		endif()
 
 		if(WITH_GL_SYSTEM_EMBEDDED)

Modified: branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c
===================================================================
--- branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c	2013-07-19 20:28:46 UTC (rev 58417)
+++ branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c	2013-07-19 20:55:51 UTC (rev 58418)
@@ -8243,16 +8243,18 @@
 
 #ifdef GL_EXT_separate_shader_objects
 
+#if defined(GLEW_NO_ES) // XXX jwilkins: there is an inconsistency between the ES and None-ES versions of this extension??
 static GLboolean _glewInit_GL_EXT_separate_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT)
 {
   GLboolean r = GL_FALSE;
 
-  r = ((glActiveShaderProgramEXT = (PFNGLACTIVESHADERPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveShaderProgramEXT")) == NULL) || r; // XXX jwilkins: incorrect function name??
-  r = ((glCreateShaderProgramvEXT = (PFNGLCREATESHADERPROGRAMVEXTPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderProgramvEXT")) == NULL) || r; // XXX jwilkins: incorrect function name??
-  r = ((glUseProgramStagesEXT = (PFNGLUSEPROGRAMSTAGESEXTPROC)glewGetProcAddress((const GLubyte*)"glUseProgramStagesEXT")) == NULL) || r; // XXX jwilkins: incorrect function name??
+  r = ((glActiveProgramEXT = (PFNGLACTIVEPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveProgramEXT")) == NULL) || r; // XXX jwilkins: may be modified
+  r = ((glCreateShaderProgramEXT = (PFNGLCREATESHADERPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderProgramEXT")) == NULL) || r; // XXX jwilkins: may be modified
+  r = ((glUseShaderProgramEXT = (PFNGLUSESHADERPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glUseShaderProgramEXT")) == NULL) || r; // XXX jwilkins: may be modified
 
   return r;
 }
+#endif // XXX
 
 #endif /* GL_EXT_separate_shader_objects */
 

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_glew.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_glew.h	2013-07-19 20:28:46 UTC (rev 58417)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_glew.h	2013-07-19 20:55:51 UTC (rev 58418)
@@ -38,10 +38,36 @@
 
 
 
+/*
+The following section is for any simple stuff that is missing from GLEW when
+compiled with either the GLEW_ES_ONLY or the GLEW_NO_ES flag.
+
+Should limit this to simple things.
+More complex version shims should be placed elsewhere.
+
+Also, only put in stuff as it is needed.
+*/
+
+
+
 #if defined(GLEW_ES_ONLY)
 
-// XXX jwilkins: need to check ALL of these to make sure you didn't cover an unguarded use of an extension/version
 
+
+/* ES does not support the GLdouble type. */
+// XXX jwilkins: Beyond the scope of this would be making it possible to compile Blender with configurable precision.
+
+#ifndef GLdouble
+#define GLdouble double
+#endif
+
+
+
+/*
+Need stubs for these version checks if compiling with only ES support.
+Rely on compiler to eliminate unreachable code when version checks become constants
+*/
+
 #ifndef GLEW_VERSION_1_1
 #define GLEW_VERSION_1_1 0
 #endif
@@ -134,6 +160,19 @@
 #define GLEW_ARB_texture_query_lod 0
 #endif
 
+
+
+/*
+The following symbolic constants are missing from an ES only header,
+so alias them to their (same valued) extension versions which are available in the header.
+
+Be careful that this does not lead to unguarded use of what are extensions in ES!
+
+Some of these may be here simply to patch inconsistencies in the header files.
+*/
+
+// XXX jwilkins: need to check ALL of these to make sure you didn't cover an unguarded use of an extension/version
+
 #ifndef GL_TEXTURE_3D
 #define GL_TEXTURE_3D GL_TEXTURE_3D_OES
 #endif
@@ -187,19 +226,21 @@
 #endif
 
 #ifndef GL_WRITE_ONLY
-#define GL_WRITE_ONLY GL_WRITE_ONLY_OES // XXX jwilkins: similar to GLdouble
+#define GL_WRITE_ONLY GL_WRITE_ONLY_OES
 #endif
 
-#ifndef GLdouble
-#define GLdouble double // XXX jwilkins: what to do about this?
-#endif
 
-#endif /* GLEW_ES_ONLY */
 
+/* end of defined(GLEW_ES_ONLY) */
+#elif defined(GLEW_NO_ES)
 
 
-#if defined(GLEW_NO_ES)
 
+/*
+Need stubs for these version checks if compiling without any support.
+Rely on compiler to eliminate unreachable code when version checks become constants
+*/
+
 #ifndef GLEW_ES_VERSION_2_0
 #define GLEW_ES_VERSION_2_0 0
 #endif
@@ -240,14 +281,22 @@
 #define GLEW_OES_texture_3D 0
 #endif
 
-#ifndef GLEW_ARB_texture_rg
-#define GLEW_ARB_texture_rg 0
-#endif
-
 #ifndef GLEW_EXT_texture_rg
 #define GLEW_EXT_texture_rg 0
 #endif
 
+
+
+/*
+The following symbolic constants are missing when there is no ES support,
+so alias them to their (same valued) extension versions which are available in the header.
+
+Desktop GL typically does not have any extensions that originated from ES,
+unlike ES which has many extensions to replace what was taken out.
+
+For that reason these aliases are more likely just patching inconsistencies in the header files.
+*/
+
 #ifndef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS
 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
 #endif




More information about the Bf-blender-cvs mailing list