diff options
-rw-r--r-- | gyp/common.gypi | 4 | ||||
-rw-r--r-- | gyp/common_conditions.gypi | 11 | ||||
-rw-r--r-- | gyp/common_variables.gypi | 12 | ||||
-rw-r--r-- | include/views/SkOSWindow_Unix.h | 3 | ||||
-rw-r--r-- | src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp | 27 |
5 files changed, 47 insertions, 10 deletions
diff --git a/gyp/common.gypi b/gyp/common.gypi index a3ce66e362..46ae9f37e7 100644 --- a/gyp/common.gypi +++ b/gyp/common.gypi @@ -30,8 +30,8 @@ [ 'skia_mesa and skia_os not in ["mac", "linux"]', { 'error': '<!(skia_mesa=1 only supported with skia_os="mac" or "linux".)', }], - [ 'skia_angle and not skia_os == "win"', { - 'error': '<!(skia_angle=1 only supported with skia_os="win".)', + [ 'skia_angle and not (skia_os == "win" or skia_os == "linux")', { + 'error': '<!(skia_angle=1 only supported with skia_os="win" or skia_os="linux".)', }], [ 'skia_os == "chromeos" and OS != "linux"', { 'error': '<!(Skia ChromeOS build is only supported on Linux.)', diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi index 54fa54345e..60020ed23a 100644 --- a/gyp/common_conditions.gypi +++ b/gyp/common_conditions.gypi @@ -250,6 +250,17 @@ '-m32', ], }], + [ 'skia_angle == 1' , { + 'cflags!': [ + '-fstrict-aliasing', + ], + 'cflags_cc!': [ + '-Wnon-virtual-dtor', + ], + 'cflags_cc': [ + '-Wno-unknown-pragmas', + ], + }], ], }], [ 'skia_warnings_as_errors', { diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi index 3f122a5a78..e8a835541c 100644 --- a/gyp/common_variables.gypi +++ b/gyp/common_variables.gypi @@ -89,6 +89,11 @@ }, { 'os_posix%': 1, }], + [ 'skia_os == "linux"', { + # ANGLE on linux require these two variable be defined. + 'chromeos%': 0, + 'use_x11%': 1, + }], [ 'skia_os == "android"', { 'skia_static_initializers%': 0, 'skia_egl%': 1, @@ -164,6 +169,11 @@ }, { 'skia_release_optimization_level%': '<(skia_default_gcc_optimization_level)', }], + [ 'skia_os == "linux"', { + # ANGLE on linux require these two variable be defined. + 'chromeos%': 0, + 'use_x11%': 1, + }], [ 'skia_sanitizer', { 'skia_clang_build': 1, 'skia_keep_frame_pointer': 1, @@ -171,7 +181,7 @@ 'skia_clang_build%': 0, 'skia_keep_frame_pointer%': 0, }], - [ 'skia_shared_lib or skia_sanitizer or skia_os == "android"', { + [ 'skia_shared_lib or skia_sanitizer or skia_os == "android" or (skia_os == "linux" and skia_angle == 1)', { 'skia_pic%' : 1, }, { 'skia_pic%' : 0, diff --git a/include/views/SkOSWindow_Unix.h b/include/views/SkOSWindow_Unix.h index 62705b441e..d7fcf6e392 100644 --- a/include/views/SkOSWindow_Unix.h +++ b/include/views/SkOSWindow_Unix.h @@ -36,6 +36,9 @@ public: enum SkBackEndTypes { kNone_BackEndType, kNativeGL_BackEndType, +#if SK_ANGLE + kANGLE_BackEndType, +#endif // SK_ANGLE }; bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*); diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp index 51e461a0d8..9a4dffb4b1 100644 --- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp +++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp @@ -10,12 +10,21 @@ #include "gl/GrGLInterface.h" #include "gl/GrGLAssembleInterface.h" +#if defined _WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> +#else +#include <dlfcn.h> +#endif // defined _WIN32 + #include <EGL/egl.h> static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { +#if defined _WIN32 GrGLFuncPtr proc = (GrGLFuncPtr) GetProcAddress((HMODULE)ctx, name); +#else + GrGLFuncPtr proc = (GrGLFuncPtr) dlsym(ctx, name); +#endif // defined _WIN32 if (proc) { return proc; } @@ -23,17 +32,21 @@ static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { } const GrGLInterface* GrGLCreateANGLEInterface() { + static void* gANGLELib = nullptr; - static HMODULE ghANGLELib = nullptr; - - if (nullptr == ghANGLELib) { + if (nullptr == gANGLELib) { // We load the ANGLE library and never let it go - ghANGLELib = LoadLibrary("libGLESv2.dll"); +#if defined _WIN32 + gANGLELib = LoadLibrary("libGLESv2.dll"); +#else + gANGLELib = dlopen("libGLESv2.so", RTLD_LAZY); +#endif // defined _WIN32 } - if (nullptr == ghANGLELib) { - // We can't setup the interface correctly w/o the DLL + + if (nullptr == gANGLELib) { + // We can't setup the interface correctly w/o the so return nullptr; } - return GrGLAssembleGLESInterface(ghANGLELib, angle_get_gl_proc); + return GrGLAssembleGLESInterface(gANGLELib, angle_get_gl_proc); } |