aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gyp/common_variables.gypi7
-rw-r--r--gyp/gpu.gyp34
-rw-r--r--gyp/gpu.gypi7
-rw-r--r--include/core/SkPostConfig.h9
-rw-r--r--include/gpu/gl/SkNativeGLContext.h6
-rw-r--r--src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp22
-rw-r--r--src/gpu/gl/egl/SkNativeGLContext_egl.cpp (renamed from src/gpu/gl/android/SkNativeGLContext_android.cpp)0
-rw-r--r--src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp (renamed from src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp)0
-rw-r--r--src/gpu/gl/glx/SkNativeGLContext_glx.cpp (renamed from src/gpu/gl/unix/SkNativeGLContext_unix.cpp)0
9 files changed, 78 insertions, 7 deletions
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index 6d791c9152..ab25eeff43 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -50,6 +50,7 @@
'skia_arch_type%': 'x86',
'arm_version%': 0,
'arm_neon%': 0,
+ 'skia_egl%': 0,
},
# Re-define all variables defined within the level-3 'variables' dict,
@@ -59,6 +60,7 @@
'skia_arch_type%': '<(skia_arch_type)',
'arm_version%': '<(arm_version)',
'arm_neon%': '<(arm_neon)',
+ 'skia_egl%': '<(skia_egl)',
'conditions': [
[ 'skia_android_framework == 1', {
@@ -87,6 +89,7 @@
}],
[ 'skia_os == "android"', {
'skia_static_initializers%': 0,
+ 'skia_egl%': 1,
}, {
'skia_static_initializers%': 1,
}],
@@ -95,6 +98,9 @@
'arm_version%': 7,
'arm_neon%': 0, # neon asm files known not to work with the ios build
}],
+ [ 'skia_os == "nacl"', {
+ 'skia_egl%': 1,
+ }],
[ 'skia_os in ["android", "nacl"] and not skia_android_framework',
# skia_freetype_static - on OS variants that normally would
# dynamically link the system FreeType library, don't do
@@ -233,6 +239,7 @@
'skia_disable_inlining%': 0,
'skia_moz2d%': 0,
'skia_is_bot%': '<!(python -c "import os; print os.environ.get(\'CHROME_HEADLESS\', 0)")',
+ 'skia_egl%': '<(skia_egl)',
# These are referenced by our .gypi files that list files (e.g. core.gypi)
#
diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp
index 7bb61f09b6..d40afe1a95 100644
--- a/gyp/gpu.gyp
+++ b/gyp/gpu.gyp
@@ -11,7 +11,7 @@
],
}],
['skia_os != "linux" and skia_os != "chromeos"', {
- 'sources/': [ ['exclude', '_unix.(h|cpp)$'],
+ 'sources/': [ ['exclude', '_glx.(h|cpp)$'],
],
}],
['skia_os != "ios"', {
@@ -26,6 +26,18 @@
'sources/': [ ['exclude', '_nacl.(h|cpp)$'],
],
}],
+ ['skia_os == "nacl" or skia_egl == 0', {
+ 'sources/': [ ['exclude', '_egl.(h|cpp)$'],
+ ],
+ }],
+ ['skia_os == "android"', {
+ 'sources/': [ ['exclude', 'GrGLCreateNativeInterface_egl.cpp'],
+ ],
+ }],
+ ['skia_egl == 1', {
+ 'sources/': [ ['exclude', '_glx.(h|cpp)$'],
+ ],
+ }],
# nullify the targets in this gyp file if skia_gpu is 0
[ 'skia_gpu == 0', {
'sources/': [
@@ -140,6 +152,16 @@
'../src/gpu/gl/GrGLDefaultInterface_none.cpp',
'../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
],
+ }],
+ [ '(skia_os == "linux" or skia_os == "chromeos") and skia_egl == 1', {
+ 'link_settings': {
+ 'libraries': [
+ '-lEGL',
+ '-lGLESv2',
+ ],
+ },
+ }],
+ [ '(skia_os == "linux" or skia_os == "chromeos") and skia_egl == 0', {
'link_settings': {
'libraries': [
'-lGL',
@@ -155,6 +177,16 @@
],
},
}],
+ [ 'skia_egl == 1', {
+ 'defines': [
+ 'SK_EGL=1',
+ ],
+ }],
+ [ 'skia_egl == 0', {
+ 'defines': [
+ 'SK_EGL=0',
+ ],
+ }],
[ 'skia_mesa and skia_os == "linux"', {
'link_settings': {
'libraries': [
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi
index ad4a40c998..551e4a15de 100644
--- a/gyp/gpu.gypi
+++ b/gyp/gpu.gypi
@@ -296,7 +296,8 @@
'<(skia_src_path)/gpu/gl/GrGLDefaultInterface_native.cpp',
'<(skia_src_path)/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp',
'<(skia_src_path)/gpu/gl/win/GrGLCreateNativeInterface_win.cpp',
- '<(skia_src_path)/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp',
+ '<(skia_src_path)/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp',
+ '<(skia_src_path)/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp',
'<(skia_src_path)/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp',
'<(skia_src_path)/gpu/gl/android/GrGLCreateNativeInterface_android.cpp',
@@ -305,8 +306,8 @@
'<(skia_src_path)/gpu/gl/mac/SkNativeGLContext_mac.cpp',
'<(skia_src_path)/gpu/gl/nacl/SkNativeGLContext_nacl.cpp',
'<(skia_src_path)/gpu/gl/win/SkNativeGLContext_win.cpp',
- '<(skia_src_path)/gpu/gl/unix/SkNativeGLContext_unix.cpp',
- '<(skia_src_path)/gpu/gl/android/SkNativeGLContext_android.cpp',
+ '<(skia_src_path)/gpu/gl/glx/SkNativeGLContext_glx.cpp',
+ '<(skia_src_path)/gpu/gl/egl/SkNativeGLContext_egl.cpp',
'<(skia_src_path)/gpu/gl/iOS/SkNativeGLContext_iOS.mm',
],
'skgpu_mesa_gl_sources': [
diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h
index d513d20633..ec17b65353 100644
--- a/include/core/SkPostConfig.h
+++ b/include/core/SkPostConfig.h
@@ -411,6 +411,15 @@
# endif
#endif
+//////////////////////////////////////////////////////////////////////
+
+#ifndef SK_EGL
+# if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_NACL)
+# define SK_EGL 1
+# else
+# define SK_EGL 0
+# endif
+#endif
//////////////////////////////////////////////////////////////////////
diff --git a/include/gpu/gl/SkNativeGLContext.h b/include/gpu/gl/SkNativeGLContext.h
index 3bb6530c27..93b5b4183a 100644
--- a/include/gpu/gl/SkNativeGLContext.h
+++ b/include/gpu/gl/SkNativeGLContext.h
@@ -35,7 +35,7 @@ static const struct { int major, minor; } gl_versions[] = {
#if defined(SK_BUILD_FOR_MAC)
#include <OpenGL/OpenGL.h>
-#elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_NACL)
+#elif SK_EGL
#include <GLES2/gl2.h>
#include <EGL/egl.h>
#elif defined(SK_BUILD_FOR_UNIX)
@@ -64,7 +64,7 @@ public:
private:
#if defined(SK_BUILD_FOR_MAC)
CGLContextObj fOldCGLContext;
- #elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_NACL)
+ #elif SK_EGL
EGLContext fOldEGLContext;
EGLDisplay fOldDisplay;
EGLSurface fOldSurface;
@@ -88,7 +88,7 @@ protected:
private:
#if defined(SK_BUILD_FOR_MAC)
CGLContextObj fContext;
-#elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_NACL)
+#elif SK_EGL
EGLContext fContext;
EGLDisplay fDisplay;
EGLSurface fSurface;
diff --git a/src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp b/src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp
new file mode 100644
index 0000000000..ddc9e693a4
--- /dev/null
+++ b/src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp
@@ -0,0 +1,22 @@
+
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "gl/GrGLInterface.h"
+#include "gl/GrGLAssembleInterface.h"
+#include "gl/GrGLUtil.h"
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+
+static GrGLFuncPtr egl_get_gl_proc(void* ctx, const char name[]) {
+ SkASSERT(NULL == ctx);
+ return eglGetProcAddress(name);
+}
+
+const GrGLInterface* GrGLCreateNativeInterface() {
+ return GrGLAssembleInterface(NULL, egl_get_gl_proc);
+}
diff --git a/src/gpu/gl/android/SkNativeGLContext_android.cpp b/src/gpu/gl/egl/SkNativeGLContext_egl.cpp
index d4d7219b5b..d4d7219b5b 100644
--- a/src/gpu/gl/android/SkNativeGLContext_android.cpp
+++ b/src/gpu/gl/egl/SkNativeGLContext_egl.cpp
diff --git a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp b/src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp
index 19eec7e8ac..19eec7e8ac 100644
--- a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
+++ b/src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp
diff --git a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp b/src/gpu/gl/glx/SkNativeGLContext_glx.cpp
index bd130b545c..bd130b545c 100644
--- a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp
+++ b/src/gpu/gl/glx/SkNativeGLContext_glx.cpp