Skip to content

Commit 3b350be

Browse files
titomatham
authored andcommittedDec 18, 2016
Windows: add support for ANGLE as an alternative for GL rendering
This can be achieve by asking a ES profile implementation to SDL2, and compile then copy ANGLE libEGL.dll and libGLESv2.dll to c:\Python27\share\sdl2\bin. Support in kivy for ANGLE must be activated at compilation: USE_ANGLE=1 make The changes intruduce a "dynamic" opengl backend, that uses SDL2 GetProcAddress to gather all the GL pointers that we need for opengl, and expose them in "cgl" context. All the graphics implementation now use cgl (either a module or the new context for dynamic gl) as a base for accessing GL functions. The GL definitions are extracted and shared in c_opengl_def. ANGLE give us: - ability to execute Kivy application with default driver (at least for Virtualbox and intel, no need to install specific vendor graphics) - works starting Direct3d 9 support (use dxdiag to find out) - works on older computer (intel drop opengl support older graphics card (< 2011, according to a customer) on Windows 10 while there where no issue on Windows 7) Known issues: - stencil doesn't work on Windows 7 on Virtual BOX, but even their samples doesn't work, while firefox and chrome that uses angle (according to http://www.browserleaks.com/webgl) - line doesn't show on Windows 10 TODO: - continue to separate fully the GL context in order to dynamically switch to another implementation at runtime - be able to use MOCK without recompilation - be able to use DEBUG opengl (check glGetError after every command) without recompilation - be able to either use DESKTOP opengl or ANGLE opengl without recompilation - stencil fixes or alternative - line fixes or alternative Suggestions: - if stencil is really an issue, there is a possibility to use scissor. It might be faster, but doesn't support stack, and have addional limitation, such as: scissor must be aligned to the windows while stencil can be rotated + position of the scissor must be in windows coordinate. They may have a possibility to make "hybrid" instructions that either use scissor or stencil depending the current matrix. On standard ui (without any scatter/rotation), only scissor would be used.
1 parent ec4961e commit 3b350be

28 files changed

+1563
-652
lines changed
 

‎Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ IOSPATH := $(PATH):/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
1111

1212
BUILD_OPTS = build_ext --inplace
1313
BUILD_OPTS_FORCE = $(BUILD_OPTS) -f
14-
BUILD_OPTS_DEBUG = $(BUILD_OPTS_FORCE)-g
14+
BUILD_OPTS_DEBUG = $(BUILD_OPTS_FORCE) -g
1515

1616
INSTALL_OPTIONS = install
1717
INSTALL_ROOT =

‎kivy/core/window/_window_sdl2.pyx

+6-1
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,19 @@ cdef class _WindowSDL2Storage:
9696

9797
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1)
9898
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16)
99-
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1)
99+
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8)
100100
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8)
101101
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8)
102102
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8)
103103
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8)
104104
SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0)
105105
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1)
106106

107+
if USE_ANGLE:
108+
Logger.info("Window: Activate GLES2/ANGLE context")
109+
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 4)
110+
SDL_SetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER, "none")
111+
107112
if x is None:
108113
x = SDL_WINDOWPOS_UNDEFINED
109114
if y is None:

‎kivy/graphics/c_opengl_debug.pyx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# This file was automatically generated with kivy/tools/stub-gl-debug.py
33
include "config.pxi"
44
include "common.pxi"
5-
IF USE_OPENGL_MOCK:
5+
IF USE_OPENGL_DYNAMIC:
6+
cimport kivy.graphics.c_opengl_dynamic as cgl
7+
ELIF USE_OPENGL_MOCK:
68
cimport kivy.graphics.c_opengl_mock as cgl
79
ELSE:
810
cimport kivy.graphics.c_opengl as cgl

0 commit comments

Comments
 (0)
Please sign in to comment.