[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58521] branches/soc-2013-viewport_fx: Blender now runs when compiled with ANGLE and draws to the screen without triggering a GPU_SAFETY abort .

Jason Wilkins Jason.A.Wilkins at gmail.com
Tue Jul 23 01:55:44 CEST 2013


Revision: 58521
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58521
Author:   jwilkins
Date:     2013-07-22 23:55:44 +0000 (Mon, 22 Jul 2013)
Log Message:
-----------
Blender now runs when compiled with ANGLE and draws to the screen without triggering a GPU_SAFETY abort.

This is a big f***ing deal.  I feel like I've gotten a really nice present for my birthday today :-)

Modified Paths:
--------------
    branches/soc-2013-viewport_fx/CMakeLists.txt
    branches/soc-2013-viewport_fx/extern/glew-es/include/GL/glesew.h
    branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c
    branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp
    branches/soc-2013-viewport_fx/source/blender/blenfont/intern/blf.c
    branches/soc-2013-viewport_fx/source/blender/editors/animation/keyframes_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c
    branches/soc-2013-viewport_fx/source/blender/editors/gpencil/gpencil_paint.c
    branches/soc-2013-viewport_fx/source/blender/editors/interface/interface.c
    branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_icons.c
    branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_panel.c
    branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_widgets.c
    branches/soc-2013-viewport_fx/source/blender/editors/mask/mask_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/physics/particle_edit.c
    branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c
    branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c
    branches/soc-2013-viewport_fx/source/blender/editors/screen/screendump.c
    branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_cursor.c
    branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_stroke.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_clip/clip_dopesheet_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_graph/graph_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_nla/nla_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_node/drawnode.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_node/node_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_sequencer/sequencer_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawmesh.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_ruler.c
    branches/soc-2013-viewport_fx/source/blender/editors/uvedit/uvedit_draw.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_draw.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_internal.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_lighting.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_lighting_glsl.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_lighting_inline.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_matrix.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_safety.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_simple_shader.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_state_latch.c
    branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_draw.c
    branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_operators.c
    branches/soc-2013-viewport_fx/source/creator/CMakeLists.txt

Modified: branches/soc-2013-viewport_fx/CMakeLists.txt
===================================================================
--- branches/soc-2013-viewport_fx/CMakeLists.txt	2013-07-22 23:44:46 UTC (rev 58520)
+++ branches/soc-2013-viewport_fx/CMakeLists.txt	2013-07-22 23:55:44 UTC (rev 58521)
@@ -1964,14 +1964,20 @@
 	set(ANGLE_GLESv2_LIBRARY "" CACHE FILEPATH "ANGLE OpenGL ES 2.0 library file")
 	set(ANGLE_EGL_LIBRARY    "" CACHE FILEPATH "ANGLE EGL library file")
 	set(ANGLE_GLESv2_DLL     "" CACHE FILEPATH "ANGLE OpenGL ES 2.0 dynamic link library file")
-	set(ANGLE_EGL_DLL        "" CACHE FILEPATH "ANGLE EGL library dynamic link file")
+	set(ANGLE_EGL_DLL        "" CACHE FILEPATH "ANGLE EGL library dynamic link library file")
+	set(D3DCOMPILER_DLL      "" CACHE FILEPATH "Direct3D Compiler dynamic link library file")
 
+	get_filename_component(D3DCOMPILER "${D3DCOMPILER_DLL}" NAME)
+
+	set(GL_DEFINITIONS "${GL_DEFINITIONS} -DD3DCOMPILER=\"\\\"${D3DCOMPILER}\\\"\"")
+
 	mark_as_advanced(
 		ANGLE_INCLUDE_PATH
 		ANGLE_GLESv2_LIBRARY
 		ANGLE_EGL_LIBRARY
 		ANGLE_GLESv2_DLL
 		ANGLE_EGL_DLL
+		D3DCOMPILER_DLL
 	)
 endif()
 

Modified: branches/soc-2013-viewport_fx/extern/glew-es/include/GL/glesew.h
===================================================================
--- branches/soc-2013-viewport_fx/extern/glew-es/include/GL/glesew.h	2013-07-22 23:44:46 UTC (rev 58520)
+++ branches/soc-2013-viewport_fx/extern/glew-es/include/GL/glesew.h	2013-07-22 23:55:44 UTC (rev 58521)
@@ -1082,6 +1082,7 @@
 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 // XXX missing enum
 #define GL_STATIC_DRAW 0x88E4 // XXX missing enum
 #define GL_DYNAMIC_DRAW 0x88E8 // XXX missing enum
+#define GL_SAMPLE_BUFFERS 0x80A8 // XXX missing enum
 
 typedef char             GLchar; // XXX jwilkins: this typedef is missing when ES 1.1 is not enabled
 typedef khronos_intptr_t GLintptr; // XXX

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-22 23:44:46 UTC (rev 58520)
+++ branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c	2013-07-22 23:55:44 UTC (rev 58521)
@@ -245,12 +245,34 @@
 #if linux
 #  define glewGetProcAddress(name) esGetProcAddress(name)
 #else
+#if defined(_WIN32)
+    static HMODULE hLibGLES = NULL;
+
+    void* weGetProcAddress(const GLubyte* name) // XXX jwilkins
+    {
+        void* proc = eglGetProcAddress(name);
+
+        if(proc == NULL && hLibGLES == NULL) {
+            hLibGLES = LoadLibrary("libGLESv2.dll");
+        }
+
+        if(proc == NULL && hLibGLES != NULL) {
+            return GetProcAddress(hLibGLES, name);
+        }
+        else {
+            return proc;
+        }
+    }
+
+#  define glewGetProcAddress(name) weGetProcAddress(name)
+#else
 #  define glewGetProcAddress(name) eglGetProcAddress(name)
 #endif
+#endif
 #elif defined(_WIN32)
-    static HANDLE hOpenGL = NULL;
+    static HMODULE hOpenGL = NULL;
 
-    void* wGetProcAddress(LPCSTR name)
+    void* wGetProcAddress(const GLubyte* name) // XXX jwilkins
     {
         void* proc = wglGetProcAddress(name);
 
@@ -10694,6 +10716,17 @@
   r = ((glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fv")) == NULL) || r;
   r = ((glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointer")) == NULL) || r;
 
+  r = ((glBindBuffer = (PFNGLBINDBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindBuffer")) == NULL) || r; // XXX jwilkins: missing function
+  r = ((glBufferData = (PFNGLBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glBufferData")) == NULL) || r; // XXX jwilkins: missing function
+  r = ((glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteBuffers")) == NULL) || r; // XXX jwilkins: missing function
+  r = ((glGenBuffers = (PFNGLGENBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenBuffers")) == NULL) || r; // XXX jwilkins: missing function
+  r = ((glTexParameteri = (PFNGLTEXPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glTexParameteri")) == NULL) || r; // XXX jwilkins: missing function
+  r = ((glIsEnabled = (PFNGLISENABLEDPROC)glewGetProcAddress((const GLubyte*)"glIsEnabled")) == NULL) || r; // XXX jwilkins: missing function
+  r = ((glGetFloatv = (PFNGLGETFLOATVPROC)glewGetProcAddress((const GLubyte*)"glGetFloatv")) == NULL) || r; // XXX jwilkins: missing function
+  r = ((glDepthRangef = (PFNGLDEPTHRANGEFPROC)glewGetProcAddress((const GLubyte*)"glDepthRangef")) == NULL) || r; // XXX jwilkins: missing function
+  r = ((glActiveTexture = (PFNGLACTIVETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glActiveTexture")) == NULL) || r; // XXX jwilkins: missing function
+  r = ((glGetBooleanv = (PFNGLGETBOOLEANVPROC)glewGetProcAddress((const GLubyte*)"glGetBooleanv")) == NULL) || r; // XXX jwilkins: missing function
+
   return r;
 }
 

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-22 23:44:46 UTC (rev 58520)
+++ branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_WindowWin32.cpp	2013-07-22 23:55:44 UTC (rev 58521)
@@ -47,11 +47,6 @@
 #include <math.h>
 #include <string.h>
 
-// MSVC6 still doesn't define M_PI
-#ifndef M_PI
-#define M_PI 3.1415926536
-#endif
-
 const wchar_t *GHOST_WindowWin32::s_windowClassName = L"GHOST_WindowClass";
 const int GHOST_WindowWin32::s_maxTitleLength = 128;
 
@@ -984,6 +979,8 @@
 				break;
 			}
 
+			LoadLibrary(D3DCOMPILER);
+
 			if(!::eglInitialize(egl_display, &major, &minor)) {
 				success = GHOST_kFailure;
 				break;

Modified: branches/soc-2013-viewport_fx/source/blender/blenfont/intern/blf.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/blenfont/intern/blf.c	2013-07-22 23:44:46 UTC (rev 58520)
+++ branches/soc-2013-viewport_fx/source/blender/blenfont/intern/blf.c	2013-07-22 23:55:44 UTC (rev 58521)
@@ -510,7 +510,12 @@
 		}
 
 		/* one-time GL setup */
-		glEnable(GL_TEXTURE_2D);
+#if defined(WITH_GL_PROFILE_COMPAT)
+		if (GPU_PROFILE_COMPAT) {
+			glEnable(GL_TEXTURE_2D);
+		}
+#endif
+
 		glEnable(GL_BLEND);
 	}
 
@@ -529,8 +534,13 @@
 
 	if (font->locked == 0) {
 		glDisable(GL_BLEND);
-		glDisable(GL_TEXTURE_2D);
 
+#if defined(WITH_GL_PROFILE_COMPAT)
+		if (GPU_PROFILE_COMPAT) {
+			glDisable(GL_TEXTURE_2D);
+		}
+#endif
+
 		gpuImmediateUnformat();
 	}
 }

Modified: branches/soc-2013-viewport_fx/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/animation/keyframes_draw.c	2013-07-22 23:44:46 UTC (rev 58520)
+++ branches/soc-2013-viewport_fx/source/blender/editors/animation/keyframes_draw.c	2013-07-22 23:55:44 UTC (rev 58521)
@@ -560,7 +560,7 @@
 	gpuScale(1.0f / xscale * hsize, hsize, 1.0f);
 	
 	/* anti-aliased lines for more consistent appearance */
-	glEnable(GL_LINE_SMOOTH);
+	gpuEnableLineSmooth();
 	
 	/* draw! */
 	if (ELEM(mode, KEYFRAME_SHAPE_INSIDE, KEYFRAME_SHAPE_BOTH)) {
@@ -616,7 +616,7 @@
 		gpuEnd();
 	}
 	
-	glDisable(GL_LINE_SMOOTH);
+	gpuDisableLineSmooth();
 	
 	/* restore view transform */
 	gpuScale(xscale / hsize, 1.0f / hsize, 1.0f);

Modified: branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c	2013-07-22 23:44:46 UTC (rev 58520)
+++ branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c	2013-07-22 23:55:44 UTC (rev 58521)
@@ -549,7 +549,7 @@
 	setlinestyle(0);
 	
 	/* turn on smooth lines (i.e. anti-aliasing) */
-	glEnable(GL_LINE_SMOOTH);
+	gpuEnableLineSmooth();
 	
 	/* turn on alpha-blending */
 	glEnable(GL_BLEND);
@@ -654,7 +654,7 @@
 	
 	/* turn off alpha blending, then smooth lines */
 	glDisable(GL_BLEND); // alpha blending
-	glDisable(GL_LINE_SMOOTH); // smooth lines
+	gpuDisableLineSmooth(); // smooth lines
 		
 	/* restore initial gl conditions */
 	glLineWidth(1.0);

Modified: branches/soc-2013-viewport_fx/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/gpencil/gpencil_paint.c	2013-07-22 23:44:46 UTC (rev 58520)
+++ branches/soc-2013-viewport_fx/source/blender/editors/gpencil/gpencil_paint.c	2013-07-22 23:55:44 UTC (rev 58521)
@@ -1396,13 +1396,13 @@
 	if (p->paintmode == GP_PAINTMODE_ERASER) {
 		gpuCurrentColor4x(CPACK_WHITE, 0.500f);
 		
-		glEnable(GL_LINE_SMOOTH);
+		gpuEnableLineSmooth();
 		glEnable(GL_BLEND);
 
 		gpuSingleCircle(x, y, p->radius, 40);
 
 		glDisable(GL_BLEND);
-		glDisable(GL_LINE_SMOOTH);
+		gpuDisableLineSmooth();
 	}
 }
 

Modified: branches/soc-2013-viewport_fx/source/blender/editors/interface/interface.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/interface/interface.c	2013-07-22 23:44:46 UTC (rev 58520)
+++ branches/soc-2013-viewport_fx/source/blender/editors/interface/interface.c	2013-07-22 23:55:44 UTC (rev 58521)
@@ -1047,8 +1047,10 @@
 	ARegion *ar;
 	uiBut *but;
 	rcti rect;
+#if defined(WITH_GL_PROFILE_COMPAT) || defined(WITH_GL_PROFILE_CORE)
 	int multisample_enabled;
-	
+#endif
+
 	/* get menu region or area region */
 	ar = CTX_wm_menu(C);
 	if (!ar)
@@ -1057,10 +1059,14 @@
 	if (!block->endblock)
 		uiEndBlock(C, block);
 
+#if defined(WITH_GL_PROFILE_COMPAT) || defined(WITH_GL_PROFILE_CORE)
 	/* disable AA, makes widgets too blurry */
 	multisample_enabled = glIsEnabled(GL_MULTISAMPLE);
 	if (multisample_enabled)
 		glDisable(GL_MULTISAMPLE);
+#else
+	// XXX jwilkins: multisampling can only be controlled during context creation with ES
+#endif
 
 	/* scale fonts */
 	ui_fontscale(&style.paneltitle.points, block->aspect);
@@ -1104,9 +1110,11 @@
 	gpuMatrixMode(GL_MODELVIEW);
 	gpuPopMatrix();
 
+#if defined(WITH_GL_PROFILE_COMPAT) || defined(WITH_GL_PROFILE_CORE)
 	if (multisample_enabled)
 		glEnable(GL_MULTISAMPLE);
-	
+#endif
+
 	ui_draw_links(block);
 }
 

Modified: branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list