mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Attempts to add an early exit for non-Metal Macs.
This will be necessary only prior to 10.14.
This commit is contained in:
parent
6f4ccebfa1
commit
572be48f38
@ -11,12 +11,24 @@ import Cocoa
|
|||||||
@NSApplicationMain
|
@NSApplicationMain
|
||||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
|
|
||||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
private var failedMetalCheck = false
|
||||||
|
func applicationDidFinishLaunching(_ notification: Notification) {
|
||||||
// Insert code here to initialize your application.
|
// Insert code here to initialize your application.
|
||||||
}
|
|
||||||
|
|
||||||
func applicationWillTerminate(_ aNotification: Notification) {
|
// Check for at least one Metal-capable GPU; this check
|
||||||
// Insert code here to tear down your application.
|
// will become unnecessary if/when the minimum OS version
|
||||||
|
// that this project supports reascends to 10.14.
|
||||||
|
if (MTLCopyAllDevices().count == 0) {
|
||||||
|
self.failedMetalCheck = true
|
||||||
|
|
||||||
|
let alert = NSAlert()
|
||||||
|
alert.messageText = "This application requires a Metal-capable GPU"
|
||||||
|
alert.addButton(withTitle: "Exit")
|
||||||
|
alert.runModal()
|
||||||
|
|
||||||
|
let application = notification.object as! NSApplication
|
||||||
|
application.terminate(self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var hasShownOpenDocument = false
|
private var hasShownOpenDocument = false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user