diff options
| author | Brian Osman <brianosman@google.com> | 2017-02-21 16:58:08 -0500 |
|---|---|---|
| committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-22 13:32:56 +0000 |
| commit | 60c774db3ec46f3eb85f6390ba31e38c8d29e2d4 (patch) | |
| tree | 0fd26132415dc9843b98b4db2e90ba1f44b3c32c /tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp | |
| parent | 22eb2f1aa09b0fb27c199c2cc96cd74b2098d502 (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/command_buffer/GLTestContext_command_buffer.cpp')
| -rw-r--r-- | tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp b/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp index 888270e41b..56bc5da3d6 100644 --- a/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp +++ b/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp @@ -138,7 +138,7 @@ static const GrGLInterface* create_command_buffer_interface() { namespace sk_gpu_test { -CommandBufferGLTestContext::CommandBufferGLTestContext() +CommandBufferGLTestContext::CommandBufferGLTestContext(CommandBufferGLTestContext* shareContext) : fContext(EGL_NO_CONTEXT), fDisplay(EGL_NO_DISPLAY), fSurface(EGL_NO_SURFACE) { static const EGLint configAttribs[] = { @@ -157,32 +157,6 @@ CommandBufferGLTestContext::CommandBufferGLTestContext() EGL_NONE }; - initializeGLContext(nullptr, configAttribs, surfaceAttribs); -} - -CommandBufferGLTestContext::CommandBufferGLTestContext(void *nativeWindow, int msaaSampleCount) { - static const EGLint surfaceAttribs[] = {EGL_NONE}; - - EGLint configAttribs[] = { - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 8, - EGL_STENCIL_SIZE, 8, - EGL_SAMPLE_BUFFERS, 1, - EGL_SAMPLES, msaaSampleCount, - EGL_NONE - }; - if (msaaSampleCount == 0) { - configAttribs[12] = EGL_NONE; - } - - initializeGLContext(nativeWindow, configAttribs, surfaceAttribs); -} - -void CommandBufferGLTestContext::initializeGLContext(void *nativeWindow, const int *configAttribs, - const int *surfaceAttribs) { load_command_buffer_once(); if (!gfFunctionsLoadedSuccessfully) { static SkOnce once; @@ -208,16 +182,10 @@ void CommandBufferGLTestContext::initializeGLContext(void *nativeWindow, const i return; } - if (nativeWindow) { - fSurface = gfCreateWindowSurface(fDisplay, - static_cast<EGLConfig>(fConfig), - (EGLNativeWindowType) nativeWindow, - surfaceAttribs); - } else { - fSurface = gfCreatePbufferSurface(fDisplay, - static_cast<EGLConfig>(fConfig), - surfaceAttribs); - } + fSurface = gfCreatePbufferSurface(fDisplay, + static_cast<EGLConfig>(fConfig), + surfaceAttribs); + if (EGL_NO_SURFACE == fSurface) { SkDebugf("Command Buffer: Could not create EGL surface.\n"); this->destroyGLContext(); @@ -228,7 +196,10 @@ void CommandBufferGLTestContext::initializeGLContext(void *nativeWindow, const i EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; - fContext = gfCreateContext(fDisplay, static_cast<EGLConfig>(fConfig), nullptr, contextAttribs); + EGLContext eglShareContext = shareContext + ? reinterpret_cast<EGLContext>(shareContext->fContext) : nullptr; + fContext = gfCreateContext(fDisplay, static_cast<EGLConfig>(fConfig), eglShareContext, + contextAttribs); if (EGL_NO_CONTEXT == fContext) { SkDebugf("Command Buffer: Could not create EGL context.\n"); this->destroyGLContext(); |
