aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-04-12 15:32:53 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-13 13:28:03 +0000
commit59163ba06c42e2bb2e7c87c8f3564f0bfd9df327 (patch)
tree71033e1af9ca0a70199bd4d1b354678693ee91eb
parentea0f845bf6525b41898899b3f33f3cc960443881 (diff)
Access EGL_KHR_fence_sync via eglGetProcAddress
Bug: skia:6497 Change-Id: Icf04de6b1facc94e8c45085575cb45189c6c649c Reviewed-on: https://skia-review.googlesource.com/13306 Reviewed-by: Kevin Lubick <kjlubick@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
-rw-r--r--tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp27
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));