Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: avx feature switch #1034

Merged
merged 7 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Whisky/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -3130,6 +3130,26 @@
}
}
},
"config.avx" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Advertise AVX Support"
}
}
}
},
"config.avx.warning" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "May negatively impact performance"
}
}
}
},
"config.buildVersion" : {
"localizations" : {
"ar" : {
Expand Down
17 changes: 17 additions & 0 deletions Whisky/Views/Bottle/ConfigView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ struct ConfigView: View {
)
}
}
if #available(macOS 15, *) {
Toggle(isOn: $bottle.settings.avxEnabled) {
VStack(alignment: .leading) {
Text("config.avx")
if bottle.settings.avxEnabled {
HStack(alignment: .firstTextBaseline) {
Image(systemName: "exclamationmark.triangle.fill")
.symbolRenderingMode(.multicolor)
.font(.subheadline)
Text("config.avx.warning")
.fontWeight(.light)
.font(.subheadline)
}
}
}
}
}
}
Section("config.title.dxvk", isExpanded: $dxvkSectionExpanded) {
Toggle(isOn: $bottle.settings.dxvk) {
Expand Down
11 changes: 11 additions & 0 deletions WhiskyKit/Sources/WhiskyKit/Whisky/BottleSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public struct BottleWineConfig: Codable, Equatable {
var wineVersion: SemanticVersion = Self.defaultWineVersion
var windowsVersion: WinVersion = .win10
var enhancedSync: EnhancedSync = .msync
var avxEnabled: Bool = false

public init() {}

Expand All @@ -95,6 +96,7 @@ public struct BottleWineConfig: Codable, Equatable {
self.wineVersion = try container.decodeIfPresent(SemanticVersion.self, forKey: .wineVersion) ?? Self.defaultWineVersion
self.windowsVersion = try container.decodeIfPresent(WinVersion.self, forKey: .windowsVersion) ?? .win10
self.enhancedSync = try container.decodeIfPresent(EnhancedSync.self, forKey: .enhancedSync) ?? .msync
self.avxEnabled = try container.decodeIfPresent(Bool.self, forKey: .avxEnabled) ?? false
}
// swiftlint:enable line_length
}
Expand Down Expand Up @@ -218,6 +220,11 @@ 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 @@ -295,5 +302,9 @@ public struct BottleSettings: Codable, Equatable {
if metalTrace {
wineEnv.updateValue("1", forKey: "METAL_CAPTURE_ENABLED")
}

if avxEnabled {
wineEnv.updateValue("1", forKey: "ROSETTA_ADVERTISE_AVX")
}
}
}
Loading