diff options
Diffstat (limited to 'video/out/cocoa-cb/video_layer.swift')
-rw-r--r-- | video/out/cocoa-cb/video_layer.swift | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/video/out/cocoa-cb/video_layer.swift b/video/out/cocoa-cb/video_layer.swift index 90a37ae0c5..f9a195b554 100644 --- a/video/out/cocoa-cb/video_layer.swift +++ b/video/out/cocoa-cb/video_layer.swift @@ -39,8 +39,7 @@ let glFormatSoftwareBase: [CGLPixelFormatAttribute] = [ let glFormatOptional: [[CGLPixelFormatAttribute]] = [ [kCGLPFABackingStore], - [kCGLPFAAllowOfflineRenderers], - [kCGLPFASupportsAutomaticGraphicsSwitching] + [kCGLPFAAllowOfflineRenderers] ] let glFormat10Bit: [CGLPixelFormatAttribute] = [ @@ -49,6 +48,10 @@ let glFormat10Bit: [CGLPixelFormatAttribute] = [ kCGLPFAColorFloat ] +let glFormatAutoGPU: [CGLPixelFormatAttribute] = [ + kCGLPFASupportsAutomaticGraphicsSwitching +] + let attributeLookUp: [UInt32:String] = [ kCGLOGLPVersion_3_2_Core.rawValue: "kCGLOGLPVersion_3_2_Core", kCGLOGLPVersion_Legacy.rawValue: "kCGLOGLPVersion_Legacy", @@ -272,6 +275,10 @@ class VideoLayer: CAOpenGLLayer { } glFormat += glFormatOptional + if (libmpv.macOpts.macos_force_dedicated_gpu == 0) { + glFormat += [glFormatAutoGPU] + } + for index in stride(from: glFormat.count-1, through: 0, by: -1) { let format = glFormat.flatMap { $0 } + [_CGLPixelFormatAttribute(rawValue: 0)] err = CGLChoosePixelFormat(format, &pix, &npix) |