summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa-cb/video_layer.swift
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/cocoa-cb/video_layer.swift')
-rw-r--r--video/out/cocoa-cb/video_layer.swift8
1 files changed, 5 insertions, 3 deletions
diff --git a/video/out/cocoa-cb/video_layer.swift b/video/out/cocoa-cb/video_layer.swift
index 8cdb692ae5..51d14f84a3 100644
--- a/video/out/cocoa-cb/video_layer.swift
+++ b/video/out/cocoa-cb/video_layer.swift
@@ -166,7 +166,7 @@ class VideoLayer: CAOpenGLLayer {
for index in stride(from: glAttributes.count-2, through: 4, by: -1) {
err = CGLChoosePixelFormat(glAttributes, &pix, &npix)
- if err == kCGLBadAttribute {
+ if err == kCGLBadAttribute || err == kCGLBadPixelFormat || pix == nil {
glAttributes.remove(at: index)
} else {
break verLoop
@@ -174,8 +174,10 @@ class VideoLayer: CAOpenGLLayer {
}
}
- if err != kCGLNoError {
- fatalError("Couldn't create CGL pixel format: \(CGLErrorString(err)) (\(err))")
+ if err != kCGLNoError || pix == nil {
+ let errS = String(cString: CGLErrorString(err))
+ print("Couldn't create CGL pixel format: \(errS) (\(err.rawValue))")
+ exit(1)
}
return pix!
}