Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp

Issue 1604993005: Add ability to wire up sharelist in glcontext creation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp ('k') | src/gpu/gl/iOS/SkCreatePlatformGLContext_iOS.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
diff --git a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
index 8c58a53702b44dd4dfd05be8790afe344d4aedab..51b8ce9e6039a1ca0824bef8d8e723a863ffceaa 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;
« no previous file with comments | « src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp ('k') | src/gpu/gl/iOS/SkCreatePlatformGLContext_iOS.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698