mirror of
https://github.com/yattee/yattee.git
synced 2026-07-31 04:12:03 +00:00
Detect fragile GL driver by Metal GPU family instead of device model
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import Libmpv
|
import Libmpv
|
||||||
|
import Metal
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
import OpenGL.GL
|
import OpenGL.GL
|
||||||
@@ -191,16 +192,14 @@ final class MPVClient: @unchecked Sendable {
|
|||||||
// MARK: - Device Detection
|
// MARK: - Device Detection
|
||||||
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
/// Apple TV HD (AppleTV5,3, A8): its GL driver deadlocks on the float
|
/// A8-class (PowerVR Series6XT) and older GPUs: their GL driver deadlocks on
|
||||||
/// texture uploads mpv's renderer defaults to (issue #956).
|
/// the float texture uploads mpv's renderer defaults to (issue #956).
|
||||||
|
/// Keyed on the Metal GPU family rather than the device model so every device
|
||||||
|
/// with this GPU generation is covered, e.g. Apple TV HD (AppleTV5,3, A8).
|
||||||
|
/// If an A10-class device ever shows the same hang, bump the check to .apple4.
|
||||||
static let hasFragileGLDriver: Bool = {
|
static let hasFragileGLDriver: Bool = {
|
||||||
var systemInfo = utsname()
|
guard let device = MTLCreateSystemDefaultDevice() else { return true }
|
||||||
uname(&systemInfo)
|
return !device.supportsFamily(.apple3) // .apple2 = A8/A8X, .apple1 = A7
|
||||||
let machine = withUnsafeBytes(of: systemInfo.machine) { rawPtr -> String in
|
|
||||||
guard let base = rawPtr.baseAddress else { return "" }
|
|
||||||
return String(cString: base.assumingMemoryBound(to: CChar.self))
|
|
||||||
}
|
|
||||||
return machine == "AppleTV5,3"
|
|
||||||
}()
|
}()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user