OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "gl/SkGLContext.h" | 8 #include "gl/SkGLContext.h" |
9 | 9 |
10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 229 } |
230 extensionsStr = match + extensionLength; | 230 extensionsStr = match + extensionLength; |
231 } | 231 } |
232 return false; | 232 return false; |
233 } | 233 } |
234 | 234 |
235 SkEGLFenceSync* SkEGLFenceSync::CreateIfSupported(EGLDisplay display) { | 235 SkEGLFenceSync* SkEGLFenceSync::CreateIfSupported(EGLDisplay display) { |
236 if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) { | 236 if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) { |
237 return NULL; | 237 return NULL; |
238 } | 238 } |
239 return SkNEW_ARGS(SkEGLFenceSync, (display)); | 239 return new SkEGLFenceSync(display); |
240 } | 240 } |
241 | 241 |
242 SkPlatformGpuFence SkEGLFenceSync::insertFence() const { | 242 SkPlatformGpuFence SkEGLFenceSync::insertFence() const { |
243 return eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, NULL); | 243 return eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, NULL); |
244 } | 244 } |
245 | 245 |
246 bool SkEGLFenceSync::flushAndWaitFence(SkPlatformGpuFence platformFence) const { | 246 bool SkEGLFenceSync::flushAndWaitFence(SkPlatformGpuFence platformFence) const { |
247 EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); | 247 EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); |
248 return EGL_CONDITION_SATISFIED_KHR == eglClientWaitSyncKHR(fDisplay, | 248 return EGL_CONDITION_SATISFIED_KHR == eglClientWaitSyncKHR(fDisplay, |
249 eglsync, | 249 eglsync, |
250 EGL_SYNC_FLUSH_CO
MMANDS_BIT_KHR, | 250 EGL_SYNC_FLUSH_CO
MMANDS_BIT_KHR, |
251 EGL_FOREVER_KHR); | 251 EGL_FOREVER_KHR); |
252 } | 252 } |
253 | 253 |
254 void SkEGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { | 254 void SkEGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { |
255 EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); | 255 EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); |
256 eglDestroySyncKHR(fDisplay, eglsync); | 256 eglDestroySyncKHR(fDisplay, eglsync); |
257 } | 257 } |
258 | 258 |
259 } // anonymous namespace | 259 } // anonymous namespace |
260 | 260 |
261 SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) { | 261 SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) { |
262 EGLGLContext* ctx = SkNEW_ARGS(EGLGLContext, (forcedGpuAPI)); | 262 EGLGLContext* ctx = new EGLGLContext(forcedGpuAPI); |
263 if (!ctx->isValid()) { | 263 if (!ctx->isValid()) { |
264 SkDELETE(ctx); | 264 delete ctx; |
265 return NULL; | 265 return NULL; |
266 } | 266 } |
267 return ctx; | 267 return ctx; |
268 } | 268 } |
269 | 269 |
OLD | NEW |