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

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

Issue 1194783003: Implement SkGLContext swapBuffers with fence syncs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: windows build Created 5 years, 6 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 8006d498aa670fbe77e5c927d1f2dbe437f1b4fa..7933757186d3eedcd7137706b70a41bb5898c3ff 100644
--- a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
+++ b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
@@ -48,12 +48,14 @@ class GLXGLContext : public SkGLContext {
public:
GLXGLContext(GrGLStandard forcedGpuAPI);
~GLXGLContext() override;
- void makeCurrent() const override;
- void swapBuffers() const override;
private:
void destroyGLContext();
+ void onPlatformMakeCurrent() const override;
+ void onPlatformSwapBuffers() const override;
+ GrGLFuncPtr onPlatformGetProcAddress(const char*) const override;
+
GLXContext fContext;
Display* fDisplay;
Pixmap fPixmap;
@@ -267,27 +269,29 @@ GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI)
return;
}
- fGL.reset(GrGLCreateNativeInterface());
- if (NULL == fGL.get()) {
+ SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface());
+ if (NULL == gl.get()) {
SkDebugf("Failed to create gl interface");
this->destroyGLContext();
return;
}
- if (!fGL->validate()) {
+ if (!gl->validate()) {
SkDebugf("Failed to validate gl interface");
this->destroyGLContext();
return;
}
+
+ this->init(gl.detach());
}
GLXGLContext::~GLXGLContext() {
+ this->teardown();
this->destroyGLContext();
}
void GLXGLContext::destroyGLContext() {
- fGL.reset(NULL);
if (fDisplay) {
glXMakeCurrent(fDisplay, 0, 0);
@@ -311,16 +315,20 @@ void GLXGLContext::destroyGLContext() {
}
}
-void GLXGLContext::makeCurrent() const {
+void GLXGLContext::onPlatformMakeCurrent() const {
if (!glXMakeCurrent(fDisplay, fGlxPixmap, fContext)) {
SkDebugf("Could not set the context.\n");
}
}
-void GLXGLContext::swapBuffers() const {
+void GLXGLContext::onPlatformSwapBuffers() const {
glXSwapBuffers(fDisplay, fGlxPixmap);
}
+GrGLFuncPtr GLXGLContext::onPlatformGetProcAddress(const char* procName) const {
+ return glXGetProcAddress(reinterpret_cast<const GLubyte*>(procName));
+}
+
} // anonymous namespace
SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) {
« 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