diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp index d41adff4bb..e5939f4a79 100644 --- a/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp +++ b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp @@ -10,7 +10,6 @@ #define GL_GLEXT_PROTOTYPES #include <GLES2/gl2.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/egl.h> #include <EGL/eglext.h> @@ -29,7 +28,11 @@ public: void deleteFence(sk_gpu_test::PlatformFence fence) const override; private: - EGLFenceSync(EGLDisplay display) : fDisplay(display) {} + EGLFenceSync(EGLDisplay display); + + PFNEGLCREATESYNCKHRPROC fEGLCreateSyncKHR; + PFNEGLCLIENTWAITSYNCKHRPROC fEGLClientWaitSyncKHR; + PFNEGLDESTROYSYNCKHRPROC fEGLDestroySyncKHR; EGLDisplay fDisplay; @@ -306,23 +309,31 @@ std::unique_ptr<EGLFenceSync> EGLFenceSync::MakeIfSupported(EGLDisplay display) return std::unique_ptr<EGLFenceSync>(new EGLFenceSync(display)); } +EGLFenceSync::EGLFenceSync(EGLDisplay display) + : fDisplay(display) { + fEGLCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC) eglGetProcAddress("eglCreateSyncKHR"); + fEGLClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC) eglGetProcAddress("eglClientWaitSyncKHR"); + fEGLDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC) eglGetProcAddress("eglDestroySyncKHR"); + SkASSERT(fEGLCreateSyncKHR && fEGLClientWaitSyncKHR && fEGLDestroySyncKHR); +} + sk_gpu_test::PlatformFence EGLFenceSync::insertFence() const { - EGLSyncKHR eglsync = eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, nullptr); + EGLSyncKHR eglsync = fEGLCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, nullptr); return reinterpret_cast<sk_gpu_test::PlatformFence>(eglsync); } bool EGLFenceSync::waitFence(sk_gpu_test::PlatformFence platformFence) const { EGLSyncKHR eglsync = reinterpret_cast<EGLSyncKHR>(platformFence); return EGL_CONDITION_SATISFIED_KHR == - eglClientWaitSyncKHR(fDisplay, - eglsync, - EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, - EGL_FOREVER_KHR); + fEGLClientWaitSyncKHR(fDisplay, + eglsync, + EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, + EGL_FOREVER_KHR); } void EGLFenceSync::deleteFence(sk_gpu_test::PlatformFence platformFence) const { EGLSyncKHR eglsync = reinterpret_cast<EGLSyncKHR>(platformFence); - eglDestroySyncKHR(fDisplay, eglsync); + fEGLDestroySyncKHR(fDisplay, eglsync); } GR_STATIC_ASSERT(sizeof(EGLSyncKHR) <= sizeof(sk_gpu_test::PlatformFence)); |