summaryrefslogtreecommitdiffstats
path: root/video/out/mac/gl_layer.swift
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/mac/gl_layer.swift')
-rw-r--r--video/out/mac/gl_layer.swift10
1 files changed, 10 insertions, 0 deletions
diff --git a/video/out/mac/gl_layer.swift b/video/out/mac/gl_layer.swift
index dd96af7265..d0d3a6de16 100644
--- a/video/out/mac/gl_layer.swift
+++ b/video/out/mac/gl_layer.swift
@@ -199,6 +199,14 @@ class GLLayer: CAOpenGLLayer {
}
}
+ func lockCglContext() {
+ CGLLockContext(cglContext)
+ }
+
+ func unlockCglContext() {
+ CGLUnlockContext(cglContext)
+ }
+
override func copyCGLPixelFormat(forDisplayMask mask: UInt32) -> CGLPixelFormatObj {
return cglPixelFormat
}
@@ -219,10 +227,12 @@ class GLLayer: CAOpenGLLayer {
super.display()
CATransaction.flush()
if isUpdate && needsFlip {
+ lockCglContext()
CGLSetCurrentContext(cglContext)
if libmpv.isRenderUpdateFrame() {
libmpv.drawRender(NSZeroSize, bufferDepth, cglContext, skip: true)
}
+ unlockCglContext()
}
displayLock.unlock()
}