Skip to content

Commit 3587bb2

Browse files
committed
DXR Support Toggle
1 parent c500441 commit 3587bb2

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

Whisky/Localizable.xcstrings

+22
Original file line numberDiff line numberDiff line change
@@ -3558,6 +3558,28 @@
35583558
}
35593559
}
35603560
},
3561+
"config.dxr" : {
3562+
"extractionState" : "manual",
3563+
"localizations" : {
3564+
"en" : {
3565+
"stringUnit" : {
3566+
"state" : "translated",
3567+
"value" : "DirectX Raytracing"
3568+
}
3569+
}
3570+
}
3571+
},
3572+
"config.dxr.info" : {
3573+
"extractionState" : "manual",
3574+
"localizations" : {
3575+
"en" : {
3576+
"stringUnit" : {
3577+
"state" : "translated",
3578+
"value" : "Enables raytracing support in DirectX 12 titles "
3579+
}
3580+
}
3581+
}
3582+
},
35613583
"config.dxvk" : {
35623584
"localizations" : {
35633585
"ar" : {

Whisky/Views/Bottle/ConfigView.swift

+9
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ struct ConfigView: View {
141141
Text("config.metalTrace")
142142
Text("config.metalTrace.info")
143143
}
144+
if let device = MTLCreateSystemDefaultDevice() {
145+
// Represents the Apple family 9 GPU features that correspond to the Apple A17, M3, and M4 GPUs.
146+
if device.supportsFamily(.apple9) {
147+
Toggle(isOn: $bottle.settings.dxrEnabled) {
148+
Text("config.dxr")
149+
Text("config.dxr.info")
150+
}
151+
}
152+
}
144153
}
145154
}
146155
.formStyle(.grouped)

WhiskyKit/Sources/WhiskyKit/Whisky/BottleSettings.swift

+16-5
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,15 @@ public struct BottleWineConfig: Codable, Equatable {
104104
public struct BottleMetalConfig: Codable, Equatable {
105105
var metalHud: Bool = false
106106
var metalTrace: Bool = false
107+
var dxrEnabled: Bool = false
107108

108109
public init() {}
109110

110111
public init(from decoder: Decoder) throws {
111112
let container = try decoder.container(keyedBy: CodingKeys.self)
112113
self.metalHud = try container.decodeIfPresent(Bool.self, forKey: .metalHud) ?? false
113114
self.metalTrace = try container.decodeIfPresent(Bool.self, forKey: .metalTrace) ?? false
115+
self.dxrEnabled = try container.decodeIfPresent(Bool.self, forKey: .dxrEnabled) ?? false
114116
}
115117
}
116118

@@ -178,6 +180,11 @@ public struct BottleSettings: Codable, Equatable {
178180
set { wineConfig.windowsVersion = newValue }
179181
}
180182

183+
public var avxEnabled: Bool {
184+
get { return wineConfig.avxEnabled }
185+
set { wineConfig.avxEnabled = newValue }
186+
}
187+
181188
/// The pinned programs on this bottle
182189
public var pins: [PinnedProgram] {
183190
get { return info.pins }
@@ -205,6 +212,11 @@ public struct BottleSettings: Codable, Equatable {
205212
set { metalConfig.metalTrace = newValue }
206213
}
207214

215+
public var dxrEnabled: Bool {
216+
get { return metalConfig.dxrEnabled }
217+
set { metalConfig.dxrEnabled = newValue }
218+
}
219+
208220
public var dxvk: Bool {
209221
get { return dxvkConfig.dxvk }
210222
set { dxvkConfig.dxvk = newValue }
@@ -220,11 +232,6 @@ public struct BottleSettings: Codable, Equatable {
220232
set { dxvkConfig.dxvkHud = newValue }
221233
}
222234

223-
public var avxEnabled: Bool {
224-
get { return wineConfig.avxEnabled }
225-
set { wineConfig.avxEnabled = newValue }
226-
}
227-
228235
@discardableResult
229236
public static func decode(from metadataURL: URL) throws -> BottleSettings {
230237
guard FileManager.default.fileExists(atPath: metadataURL.path(percentEncoded: false)) else {
@@ -306,5 +313,9 @@ public struct BottleSettings: Codable, Equatable {
306313
if avxEnabled {
307314
wineEnv.updateValue("1", forKey: "ROSETTA_ADVERTISE_AVX")
308315
}
316+
317+
if dxrEnabled {
318+
wineEnv.updateValue("1", forKey: "D3DM_SUPPORT_DXR")
319+
}
309320
}
310321
}

0 commit comments

Comments
 (0)