aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpu/gl/mac
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-02-21 16:58:08 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-22 13:32:56 +0000
commit60c774db3ec46f3eb85f6390ba31e38c8d29e2d4 (patch)
tree0fd26132415dc9843b98b4db2e90ba1f44b3c32c /tools/gpu/gl/mac
parent22eb2f1aa09b0fb27c199c2cc96cd74b2098d502 (diff)
Support shared GL contexts in GrContextFactory
Mostly plumbing, plus some minimal testing to make sure that the platform APIs don't explode. I plan to add testing of SkCrossContextImageData using this, which should verify that textures are actually shared. Also found a factory and some related code in the CommandBuffer test context that was totally unused. BUG=skia: Change-Id: I05bbc22c4d1ef946b702a5cc7f67788785219c62 Reviewed-on: https://skia-review.googlesource.com/8808 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tools/gpu/gl/mac')
-rw-r--r--tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp b/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp
index 2a908f8625..8ce687d00d 100644
--- a/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp
+++ b/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp
@@ -16,7 +16,7 @@
namespace {
class MacGLTestContext : public sk_gpu_test::GLTestContext {
public:
- MacGLTestContext();
+ MacGLTestContext(MacGLTestContext* shareContext);
~MacGLTestContext() override;
private:
@@ -30,7 +30,7 @@ private:
void* fGLLibrary;
};
-MacGLTestContext::MacGLTestContext()
+MacGLTestContext::MacGLTestContext(MacGLTestContext* shareContext)
: fContext(nullptr)
, fGLLibrary(RTLD_DEFAULT) {
CGLPixelFormatAttribute attributes[] = {
@@ -50,7 +50,7 @@ MacGLTestContext::MacGLTestContext()
return;
}
- CGLCreateContext(pixFormat, nullptr, &fContext);
+ CGLCreateContext(pixFormat, shareContext ? shareContext->fContext : nullptr, &fContext);
CGLReleasePixelFormat(pixFormat);
if (nullptr == fContext) {
@@ -111,15 +111,11 @@ GrGLFuncPtr MacGLTestContext::onPlatformGetProcAddress(const char* procName) con
namespace sk_gpu_test {
GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI,
GLTestContext* shareContext) {
- SkASSERT(!shareContext);
- if (shareContext) {
- return nullptr;
- }
-
if (kGLES_GrGLStandard == forcedGpuAPI) {
return nullptr;
}
- MacGLTestContext* ctx = new MacGLTestContext;
+ MacGLTestContext* macShareContext = reinterpret_cast<MacGLTestContext*>(shareContext);
+ MacGLTestContext* ctx = new MacGLTestContext(macShareContext);
if (!ctx->isValid()) {
delete ctx;
return nullptr;