Skip to content

Commit

Permalink
DXR Support Toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Oct 24, 2024
1 parent c500441 commit 3587bb2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
22 changes: 22 additions & 0 deletions Whisky/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -3558,6 +3558,28 @@
}
}
},
"config.dxr" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "DirectX Raytracing"
}
}
}
},
"config.dxr.info" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Enables raytracing support in DirectX 12 titles "
}
}
}
},
"config.dxvk" : {
"localizations" : {
"ar" : {
Expand Down
9 changes: 9 additions & 0 deletions Whisky/Views/Bottle/ConfigView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ struct ConfigView: View {
Text("config.metalTrace")
Text("config.metalTrace.info")
}
if let device = MTLCreateSystemDefaultDevice() {
// Represents the Apple family 9 GPU features that correspond to the Apple A17, M3, and M4 GPUs.
if device.supportsFamily(.apple9) {
Toggle(isOn: $bottle.settings.dxrEnabled) {
Text("config.dxr")
Text("config.dxr.info")
}
}
}
}
}
.formStyle(.grouped)
Expand Down
21 changes: 16 additions & 5 deletions WhiskyKit/Sources/WhiskyKit/Whisky/BottleSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ public struct BottleWineConfig: Codable, Equatable {
public struct BottleMetalConfig: Codable, Equatable {
var metalHud: Bool = false
var metalTrace: Bool = false
var dxrEnabled: Bool = false

public init() {}

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.metalHud = try container.decodeIfPresent(Bool.self, forKey: .metalHud) ?? false
self.metalTrace = try container.decodeIfPresent(Bool.self, forKey: .metalTrace) ?? false
self.dxrEnabled = try container.decodeIfPresent(Bool.self, forKey: .dxrEnabled) ?? false
}
}

Expand Down Expand Up @@ -178,6 +180,11 @@ public struct BottleSettings: Codable, Equatable {
set { wineConfig.windowsVersion = newValue }
}

public var avxEnabled: Bool {
get { return wineConfig.avxEnabled }
set { wineConfig.avxEnabled = newValue }
}

/// The pinned programs on this bottle
public var pins: [PinnedProgram] {
get { return info.pins }
Expand Down Expand Up @@ -205,6 +212,11 @@ public struct BottleSettings: Codable, Equatable {
set { metalConfig.metalTrace = newValue }
}

public var dxrEnabled: Bool {
get { return metalConfig.dxrEnabled }
set { metalConfig.dxrEnabled = newValue }
}

public var dxvk: Bool {
get { return dxvkConfig.dxvk }
set { dxvkConfig.dxvk = newValue }
Expand All @@ -220,11 +232,6 @@ public struct BottleSettings: Codable, Equatable {
set { dxvkConfig.dxvkHud = newValue }
}

public var avxEnabled: Bool {
get { return wineConfig.avxEnabled }
set { wineConfig.avxEnabled = newValue }
}

@discardableResult
public static func decode(from metadataURL: URL) throws -> BottleSettings {
guard FileManager.default.fileExists(atPath: metadataURL.path(percentEncoded: false)) else {
Expand Down Expand Up @@ -306,5 +313,9 @@ public struct BottleSettings: Codable, Equatable {
if avxEnabled {
wineEnv.updateValue("1", forKey: "ROSETTA_ADVERTISE_AVX")
}

if dxrEnabled {
wineEnv.updateValue("1", forKey: "D3DM_SUPPORT_DXR")
}
}
}

0 comments on commit 3587bb2

Please sign in to comment.