Fix bugs with fence sync API on iOS devices

- Actually request extension version of fence sync functions
- Fix incorrect usage of dlopen/dlsym
- Also fixed same bugs in Mac code, although we never hit that
  code path.

Should fix iOS devices, giving more accurate (and less spammy)
results from nanobench.

Bug: skia:
Change-Id: I3456b301ef9b0b6559160d1d21c77bd93139d39a
Reviewed-on: https://skia-review.googlesource.com/57740
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2017-10-10 14:45:29 -04:00 committed by Skia Commit-Bot
parent 1700bafb8a
commit e6984a0fb5
4 changed files with 10 additions and 8 deletions

View File

@ -67,9 +67,9 @@ std::unique_ptr<GLFenceSync> GLFenceSync::MakeIfSupported(const sk_gpu_test::GLT
}
GLFenceSync::GLFenceSync(const sk_gpu_test::GLTestContext* ctx, const char* ext) {
ctx->getGLProcAddress(&fGLFenceSync, "glFenceSync");
ctx->getGLProcAddress(&fGLClientWaitSync, "glClientWaitSync");
ctx->getGLProcAddress(&fGLDeleteSync, "glDeleteSync");
ctx->getGLProcAddress(&fGLFenceSync, "glFenceSync", ext);
ctx->getGLProcAddress(&fGLClientWaitSync, "glClientWaitSync", ext);
ctx->getGLProcAddress(&fGLDeleteSync, "glDeleteSync", ext);
}
sk_gpu_test::PlatformFence GLFenceSync::insertFence() const {

View File

@ -74,7 +74,7 @@ void IOSGLTestContext::destroyGLContext() {
}
fEAGLContext = nil;
}
if (RTLD_DEFAULT != fGLLibrary) {
if (nullptr != fGLLibrary) {
dlclose(fGLLibrary);
}
}
@ -89,7 +89,8 @@ void IOSGLTestContext::onPlatformMakeCurrent() const {
void IOSGLTestContext::onPlatformSwapBuffers() const { }
GrGLFuncPtr IOSGLTestContext::onPlatformGetProcAddress(const char* procName) const {
return reinterpret_cast<GrGLFuncPtr>(dlsym(fGLLibrary, procName));
void* handle = (nullptr == fGLLibrary) ? RTLD_DEFAULT : fGLLibrary;
return reinterpret_cast<GrGLFuncPtr>(dlsym(handle, procName));
}
} // anonymous namespace

View File

@ -89,7 +89,7 @@ void MacGLTestContext::destroyGLContext() {
CGLReleaseContext(fContext);
fContext = nullptr;
}
if (RTLD_DEFAULT != fGLLibrary) {
if (nullptr != fGLLibrary) {
dlclose(fGLLibrary);
}
}
@ -103,7 +103,8 @@ void MacGLTestContext::onPlatformSwapBuffers() const {
}
GrGLFuncPtr MacGLTestContext::onPlatformGetProcAddress(const char* procName) const {
return reinterpret_cast<GrGLFuncPtr>(dlsym(fGLLibrary, procName));
void* handle = (nullptr == fGLLibrary) ? RTLD_DEFAULT : fGLLibrary;
return reinterpret_cast<GrGLFuncPtr>(dlsym(handle, procName));
}
} // anonymous namespace

View File

@ -14,7 +14,7 @@ extern "C" {
// cd into the current app's Documents/ directory.
// (This is the only directory we can easily read and write.)
void cd_Documents();
void cd_Documents(void);
#if defined(__cplusplus)
}