diff options
author | der richter <der.richter@gmx.de> | 2019-05-25 19:29:34 +0200 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2019-09-26 00:02:02 +0200 |
commit | 41f290f54e385f28257bd24e8f399bcb7f3727b7 (patch) | |
tree | 582575468126b095b5dcb435b7b93bf283bf4716 /osdep | |
parent | ff2aed2b56e43665e2b10acf06fa107877799bec (diff) | |
download | mpv-41f290f54e385f28257bd24e8f399bcb7f3727b7.tar.bz2 mpv-41f290f54e385f28257bd24e8f399bcb7f3727b7.tar.xz |
cocoa-cb: add support for 10bit opengl rendering
this will request a 16bit half-float framebuffer instead if a 8bit
integer framebuffer.
Fixes #3613
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/macOS_mpv_helper.swift | 4 | ||||
-rw-r--r-- | osdep/macOS_swift_compat.swift | 14 | ||||
-rw-r--r-- | osdep/macosx_application.h | 1 | ||||
-rw-r--r-- | osdep/macosx_application.m | 2 |
4 files changed, 20 insertions, 1 deletions
diff --git a/osdep/macOS_mpv_helper.swift b/osdep/macOS_mpv_helper.swift index fdc458e834..3494c60cfd 100644 --- a/osdep/macOS_mpv_helper.swift +++ b/osdep/macOS_mpv_helper.swift @@ -139,12 +139,13 @@ class MPVHelper: NSObject { return flags & UInt64(MPV_RENDER_UPDATE_FRAME.rawValue) > 0 } - func drawRender(_ surface: NSSize, _ ctx: CGLContextObj, skip: Bool = false) { + func drawRender(_ surface: NSSize, _ depth: GLint, _ ctx: CGLContextObj, skip: Bool = false) { deinitLock.lock() if mpvRenderContext != nil { var i: GLint = 0 var flip: CInt = 1 var skip: CInt = skip ? 1 : 0 + var ditherDepth = depth glGetIntegerv(GLenum(GL_DRAW_FRAMEBUFFER_BINDING), &i) // CAOpenGLLayer has ownership of FBO zero yet can return it to us, // so only utilize a newly received FBO ID if it is nonzero. @@ -157,6 +158,7 @@ class MPVHelper: NSObject { var params: [mpv_render_param] = [ mpv_render_param(type: MPV_RENDER_PARAM_OPENGL_FBO, data: &data), mpv_render_param(type: MPV_RENDER_PARAM_FLIP_Y, data: &flip), + mpv_render_param(type: MPV_RENDER_PARAM_DEPTH, data: &ditherDepth), mpv_render_param(type: MPV_RENDER_PARAM_SKIP_RENDERING, data: &skip), mpv_render_param() ] diff --git a/osdep/macOS_swift_compat.swift b/osdep/macOS_swift_compat.swift index 381398e1bf..c14aa08282 100644 --- a/osdep/macOS_swift_compat.swift +++ b/osdep/macOS_swift_compat.swift @@ -23,6 +23,13 @@ extension NSAppearance.Name { static let accessibilityHighContrastVibrantLight: NSAppearance.Name = NSAppearance.Name(rawValue: "NSAppearanceNameAccessibilityVibrantLight") static let accessibilityHighContrastVibrantDark: NSAppearance.Name = NSAppearance.Name(rawValue: "NSAppearanceNameAccessibilityVibrantDark") } + +@available(OSX 10.12, *) +extension String { + static let RGBA16Float: String = kCAContentsFormatRGBA16Float + static let RGBA8Uint: String = kCAContentsFormatRGBA8Uint + static let gray8Uint: String = kCAContentsFormatGray8Uint +} #endif extension NSPasteboard.PasteboardType { @@ -73,6 +80,13 @@ extension Array { } } +extension Array where Element == [CGLPixelFormatAttribute] { + + func contains(_ obj: [CGLPixelFormatAttribute]) -> Bool { + return self.contains(where:{ $0 == obj }) + } +} + extension NSWindow.Level { static func +(left: NSWindow.Level, right: Int) -> NSWindow.Level { diff --git a/osdep/macosx_application.h b/osdep/macosx_application.h index 7c22abaf84..7e233987fd 100644 --- a/osdep/macosx_application.h +++ b/osdep/macosx_application.h @@ -28,6 +28,7 @@ struct macos_opts { struct m_color macos_title_bar_color; int macos_fs_animation_duration; int cocoa_cb_sw_renderer; + int cocoa_cb_10bit_context; }; // multithreaded wrapper for mpv_main diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index 08b3fce901..a07f4f5db9 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -63,6 +63,7 @@ const struct m_sub_options macos_conf = { ({"default", -1})), OPT_CHOICE("cocoa-cb-sw-renderer", cocoa_cb_sw_renderer, 0, ({"auto", -1}, {"no", 0}, {"yes", 1})), + OPT_FLAG("cocoa-cb-10bit-context", cocoa_cb_10bit_context, 0), OPT_REMOVED("macos-title-bar-style", "Split into --macos-title-bar-appearance " "and --macos-title-bar-material"), {0} @@ -72,6 +73,7 @@ const struct m_sub_options macos_conf = { .macos_title_bar_color = {0, 0, 0, 0}, .macos_fs_animation_duration = -1, .cocoa_cb_sw_renderer = -1, + .cocoa_cb_10bit_context = 1 }, }; |