aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/glx
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl/glx')
-rw-r--r--src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
index 8c58a53702..51b8ce9e60 100644
--- a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
+++ b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
@@ -46,7 +46,7 @@ static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) {
class GLXGLContext : public SkGLContext {
public:
- GLXGLContext(GrGLStandard forcedGpuAPI);
+ GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareList);
~GLXGLContext() override;
private:
@@ -62,14 +62,15 @@ private:
GLXPixmap fGlxPixmap;
};
-GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI)
+GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareContext)
: fContext(nullptr)
, fDisplay(nullptr)
, fPixmap(0)
, fGlxPixmap(0) {
-
fDisplay = XOpenDisplay(0);
+ GLXContext glxShareContext = shareContext ? shareContext->fContext : nullptr;
+
if (!fDisplay) {
SkDebugf("Failed to open X display.\n");
this->destroyGLContext();
@@ -189,7 +190,7 @@ GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI)
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
None
};
- fContext = glXCreateContextAttribsARB(fDisplay, bestFbc, 0, True,
+ fContext = glXCreateContextAttribsARB(fDisplay, bestFbc, glxShareContext, True,
context_attribs_gles);
}
} else {
@@ -211,7 +212,8 @@ GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI)
None
};
fContext =
- glXCreateContextAttribsARB(fDisplay, bestFbc, 0, True, context_attribs_gl);
+ glXCreateContextAttribsARB(fDisplay, bestFbc, glxShareContext, True,
+ context_attribs_gl);
// Sync to ensure any errors generated are processed.
XSync(fDisplay, False);
@@ -237,7 +239,7 @@ GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI)
ctxErrorOccurred = false;
- fContext = glXCreateContextAttribsARB(fDisplay, bestFbc, 0, True,
+ fContext = glXCreateContextAttribsARB(fDisplay, bestFbc, glxShareContext, True,
context_attribs_gl_fallback);
}
}
@@ -331,8 +333,9 @@ GrGLFuncPtr GLXGLContext::onPlatformGetProcAddress(const char* procName) const {
} // anonymous namespace
-SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
- GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI);
+SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI, SkGLContext* shareContext) {
+ GLXGLContext* glxShareContext = reinterpret_cast<GLXGLContext*>(shareContext);
+ GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI, glxShareContext);
if (!ctx->isValid()) {
delete ctx;
return nullptr;