Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp

Issue 1974913003: Implement vulkan fence syncs for nanobench (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: -Address comments and fix compilation of non-vulkan build Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gpu/gl/GLTestContext.cpp ('k') | tools/gpu/vk/VkTestContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/GLTestContext.h" 8 #include "gl/GLTestContext.h"
9 9
10 #define GL_GLEXT_PROTOTYPES 10 #define GL_GLEXT_PROTOTYPES
11 #include <GLES2/gl2.h> 11 #include <GLES2/gl2.h>
12 12
13 #define EGL_EGLEXT_PROTOTYPES 13 #define EGL_EGLEXT_PROTOTYPES
14 #include <EGL/egl.h> 14 #include <EGL/egl.h>
15 #include <EGL/eglext.h> 15 #include <EGL/eglext.h>
16 16
17 #include "gl/GrGLDefines.h" 17 #include "gl/GrGLDefines.h"
18 #include "gl/GrGLUtil.h" 18 #include "gl/GrGLUtil.h"
19 19
20 namespace { 20 namespace {
21 21
22 // TODO: Share this class with ANGLE if/when it gets support for EGL_KHR_fence_s ync. 22 // TODO: Share this class with ANGLE if/when it gets support for EGL_KHR_fence_s ync.
23 class EGLFenceSync : public SkGpuFenceSync { 23 class EGLFenceSync : public SkGpuFenceSync {
24 public: 24 public:
25 static EGLFenceSync* CreateIfSupported(EGLDisplay); 25 static EGLFenceSync* CreateIfSupported(EGLDisplay);
26 26
27 SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const override; 27 SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const override;
28 bool waitFence(SkPlatformGpuFence fence, bool flush) const override; 28 bool waitFence(SkPlatformGpuFence fence) const override;
29 void deleteFence(SkPlatformGpuFence fence) const override; 29 void deleteFence(SkPlatformGpuFence fence) const override;
30 30
31 private: 31 private:
32 EGLFenceSync(EGLDisplay display) : fDisplay(display) {} 32 EGLFenceSync(EGLDisplay display) : fDisplay(display) {}
33 33
34 EGLDisplay fDisplay; 34 EGLDisplay fDisplay;
35 35
36 typedef SkGpuFenceSync INHERITED; 36 typedef SkGpuFenceSync INHERITED;
37 }; 37 };
38 38
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) { 298 if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) {
299 return nullptr; 299 return nullptr;
300 } 300 }
301 return new EGLFenceSync(display); 301 return new EGLFenceSync(display);
302 } 302 }
303 303
304 SkPlatformGpuFence EGLFenceSync::insertFence() const { 304 SkPlatformGpuFence EGLFenceSync::insertFence() const {
305 return eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, nullptr); 305 return eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, nullptr);
306 } 306 }
307 307
308 bool EGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) const { 308 bool EGLFenceSync::waitFence(SkPlatformGpuFence platformFence) const {
309 EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); 309 EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence);
310 return EGL_CONDITION_SATISFIED_KHR == 310 return EGL_CONDITION_SATISFIED_KHR ==
311 eglClientWaitSyncKHR(fDisplay, 311 eglClientWaitSyncKHR(fDisplay,
312 eglsync, 312 eglsync,
313 flush ? EGL_SYNC_FLUSH_COMMANDS_BIT_KHR : 0, 313 EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,
314 EGL_FOREVER_KHR); 314 EGL_FOREVER_KHR);
315 } 315 }
316 316
317 void EGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { 317 void EGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const {
318 EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); 318 EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence);
319 eglDestroySyncKHR(fDisplay, eglsync); 319 eglDestroySyncKHR(fDisplay, eglsync);
320 } 320 }
321 321
322 } // anonymous namespace 322 } // anonymous namespace
323 323
324 namespace sk_gpu_test { 324 namespace sk_gpu_test {
325 GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, 325 GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI,
326 GLTestContext *shareContext) { 326 GLTestContext *shareContext) {
327 SkASSERT(!shareContext); 327 SkASSERT(!shareContext);
328 if (shareContext) { 328 if (shareContext) {
329 return nullptr; 329 return nullptr;
330 } 330 }
331 EGLGLTestContext *ctx = new EGLGLTestContext(forcedGpuAPI); 331 EGLGLTestContext *ctx = new EGLGLTestContext(forcedGpuAPI);
332 if (!ctx->isValid()) { 332 if (!ctx->isValid()) {
333 delete ctx; 333 delete ctx;
334 return nullptr; 334 return nullptr;
335 } 335 }
336 return ctx; 336 return ctx;
337 } 337 }
338 } // namespace sk_gpu_test 338 } // namespace sk_gpu_test
339 339
OLDNEW
« no previous file with comments | « tools/gpu/gl/GLTestContext.cpp ('k') | tools/gpu/vk/VkTestContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698