summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa-cb
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-06-06 16:57:31 +0200
committerJan Ekström <jeebjp@gmail.com>2018-11-13 20:43:29 +0200
commite5c41640885bafb11513f1cada7a462ee79b0aee (patch)
tree60661a0fb648e28d501a146563c7806070ba97ae /video/out/cocoa-cb
parente72093581bdf07784d6889035c3751cbc7fb8ca0 (diff)
downloadmpv-e5c41640885bafb11513f1cada7a462ee79b0aee.tar.bz2
mpv-e5c41640885bafb11513f1cada7a462ee79b0aee.tar.xz
cocoa-cb: add logging for CGL pixel format attributes
depending on the capabilities of the system and testing of various attributes the resulting CGL pixel format can change. due to that probing it can be helpful to know which pixel format is used to create the CGL context. added some verbose logging that outputs final pixel format.
Diffstat (limited to 'video/out/cocoa-cb')
-rw-r--r--video/out/cocoa-cb/video_layer.swift19
1 files changed, 19 insertions, 0 deletions
diff --git a/video/out/cocoa-cb/video_layer.swift b/video/out/cocoa-cb/video_layer.swift
index 0e14e45dc3..ccc84f8fa8 100644
--- a/video/out/cocoa-cb/video_layer.swift
+++ b/video/out/cocoa-cb/video_layer.swift
@@ -148,6 +148,18 @@ class VideoLayer: CAOpenGLLayer {
override func copyCGLPixelFormat(forDisplayMask mask: UInt32) -> CGLPixelFormatObj {
if cglPixelFormat != nil { return cglPixelFormat! }
+ let attributeLookUp: [UInt32:String] = [
+ kCGLOGLPVersion_3_2_Core.rawValue: "kCGLOGLPVersion_3_2_Core",
+ kCGLOGLPVersion_Legacy.rawValue: "kCGLOGLPVersion_Legacy",
+ kCGLPFAOpenGLProfile.rawValue: "kCGLPFAOpenGLProfile",
+ kCGLPFAAccelerated.rawValue: "kCGLPFAAccelerated",
+ kCGLPFADoubleBuffer.rawValue: "kCGLPFADoubleBuffer",
+ kCGLPFABackingStore.rawValue: "kCGLPFABackingStore",
+ kCGLPFAAllowOfflineRenderers.rawValue: "kCGLPFAAllowOfflineRenderers",
+ kCGLPFASupportsAutomaticGraphicsSwitching.rawValue: "kCGLPFASupportsAutomaticGraphicsSwitching",
+ 0: ""
+ ]
+
let glVersions: [CGLOpenGLProfile] = [
kCGLOGLPVersion_3_2_Core,
kCGLOGLPVersion_Legacy
@@ -175,6 +187,13 @@ class VideoLayer: CAOpenGLLayer {
if err == kCGLBadAttribute || err == kCGLBadPixelFormat || pix == nil {
glAttributes.remove(at: index)
} else {
+ var attArray = glAttributes.map({ (value: _CGLPixelFormatAttribute) -> String in
+ return attributeLookUp[value.rawValue]!
+ })
+ attArray.removeLast()
+
+ mpv.sendVerbose("Created CGL pixel format with attributes: " +
+ "\(attArray.joined(separator: ", "))")
break verLoop
}
}