OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "gl/angle/SkANGLEGLContext.h" | 9 #include "gl/angle/SkANGLEGLContext.h" |
10 | 10 |
11 #include <EGL/egl.h> | 11 #include <EGL/egl.h> |
| 12 #include <EGL/eglext.h> |
12 | 13 |
13 #define EGL_PLATFORM_ANGLE_ANGLE 0x3202 | 14 #define EGL_PLATFORM_ANGLE_ANGLE 0x3202 |
14 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203 | 15 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203 |
15 #define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207 | 16 #define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207 |
16 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208 | 17 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208 |
17 | 18 |
18 void* SkANGLEGLContext::GetD3DEGLDisplay(void* nativeDisplay) { | 19 void* SkANGLEGLContext::GetD3DEGLDisplay(void* nativeDisplay) { |
19 | 20 PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT; |
20 typedef EGLDisplay (*EGLGetPlatformDisplayEXT)(EGLenum platform, | |
21 void *native_display, | |
22 const EGLint *attrib_list); | |
23 EGLGetPlatformDisplayEXT eglGetPlatformDisplayEXT; | |
24 eglGetPlatformDisplayEXT = | 21 eglGetPlatformDisplayEXT = |
25 (EGLGetPlatformDisplayEXT) eglGetProcAddress("eglGetPlatformDisplayEXT")
; | 22 (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDispla
yEXT"); |
26 | 23 |
27 if (!eglGetPlatformDisplayEXT) { | 24 if (!eglGetPlatformDisplayEXT) { |
28 return eglGetDisplay(static_cast<EGLNativeDisplayType>(nativeDisplay)); | 25 return eglGetDisplay(static_cast<EGLNativeDisplayType>(nativeDisplay)); |
29 } | 26 } |
30 | 27 |
31 // Try for an ANGLE D3D11 context, fall back to D3D9. | 28 // Try for an ANGLE D3D11 context, fall back to D3D9. |
32 EGLint attribs[2][3] = { | 29 EGLint attribs[2][3] = { |
33 { | 30 { |
34 EGL_PLATFORM_ANGLE_TYPE_ANGLE, | 31 EGL_PLATFORM_ANGLE_TYPE_ANGLE, |
35 EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, | 32 EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 140 |
144 void SkANGLEGLContext::onPlatformSwapBuffers() const { | 141 void SkANGLEGLContext::onPlatformSwapBuffers() const { |
145 if (!eglSwapBuffers(fDisplay, fSurface)) { | 142 if (!eglSwapBuffers(fDisplay, fSurface)) { |
146 SkDebugf("Could not complete eglSwapBuffers.\n"); | 143 SkDebugf("Could not complete eglSwapBuffers.\n"); |
147 } | 144 } |
148 } | 145 } |
149 | 146 |
150 GrGLFuncPtr SkANGLEGLContext::onPlatformGetProcAddress(const char* name) const { | 147 GrGLFuncPtr SkANGLEGLContext::onPlatformGetProcAddress(const char* name) const { |
151 return eglGetProcAddress(name); | 148 return eglGetProcAddress(name); |
152 } | 149 } |
OLD | NEW |