Skip to content

Commit

Permalink
Fix bugs with fence sync API on iOS devices
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
Commit-Queue: Brian Osman <[email protected]>
  • Loading branch information
brianosman authored and Skia Commit-Bot committed Oct 10, 2017
1 parent 1700baf commit e6984a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tools/gpu/gl/GLTestContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
}
fEAGLContext = nil;
}
if (RTLD_DEFAULT != fGLLibrary) {
if (nullptr != fGLLibrary) {
dlclose(fGLLibrary);
}
}
Expand All @@ -89,7 +89,8 @@
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
Expand Down
5 changes: 3 additions & 2 deletions tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void MacGLTestContext::destroyGLContext() {
CGLReleaseContext(fContext);
fContext = nullptr;
}
if (RTLD_DEFAULT != fGLLibrary) {
if (nullptr != fGLLibrary) {
dlclose(fGLLibrary);
}
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/ios_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit e6984a0

Please sign in to comment.