Detect fragile GL driver by Metal GPU family instead of device model

This commit is contained in:
Arkadiusz Fal
2026-07-23 23:02:21 +02:00
parent 6994b9353a
commit faf0964746

View File

@@ -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