Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

DXVK: async shader compilation off by default, and migrate existing bottles

Gauthier Piarrette29fd7e19ac80
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
index 25292ac..26505bc 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -328,7 +328,7 @@ struct BottleSettingsSheet: View {
}
}
Toggle(L("Metal performance HUD"), isOn: binding(\.metalHUD))
- Toggle(L("DXVK async shader compilation (less stutter)"), isOn: binding(\.dxvkAsync))
+ Toggle(L("DXVK async shader compilation (experimental — can skip draws while a shader compiles)"), isOn: binding(\.dxvkAsync))
Picker(L("Frame rate cap"), selection: binding(\.fpsCap)) {
Text(L("Uncapped")).tag(0)
Text("30 fps").tag(30)
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index bd3abb9..2c7de72 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -183,7 +183,7 @@ enum L10n {
"Install engine": "Installer le moteur",
"Installing…": "Installation…",
- "DXVK async shader compilation (less stutter)": "Compilation asynchrone des shaders DXVK (moins de saccades)",
+ "DXVK async shader compilation (experimental — can skip draws while a shader compiles)": "Compilation asynchrone des shaders DXVK (expérimental — peut omettre des tracés pendant la compilation)",
"Frame rate cap": "Limite d’images par seconde",
"Uncapped": "Illimité",
"Games run with the bottle’s sync (msync is fastest). Opening the Steam window restarts Windows processes with sync off — its interface needs it.":
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swift
index db57005..f808ff5 100644
--- a/Sources/HighballKit/Bottle.swift
+++ b/Sources/HighballKit/Bottle.swift
@@ -177,7 +177,8 @@ public enum ArgumentLine {
/// Persisted as `<bottle>/bottle.json` (older bottles: `gin.json`, still read as a fallback).
public struct BottleSettings: Codable, Sendable {
- public var formatVersion: Int = 1
+ /// 2: dxvkAsync no longer defaults on. Bottles written at 1 are migrated off once on load.
+ public var formatVersion: Int = 2
public var name: String
public var engineID: String
public var renderer: Renderer = .dxmt
@@ -189,8 +190,20 @@ public struct BottleSettings: Codable, Sendable {
public var sync: SyncMode = .msync
public var metalHUD: Bool = false
public var advertiseAVX: Bool = false
- /// DXVK async pipeline compilation — big shader-stutter relief, minor risk of artifacts.
- public var dxvkAsync: Bool = true
+ /// DXVK async pipeline compilation. Off, and deliberately so.
+ ///
+ /// The name oversells it: on a pipeline miss it does not compile in the background and draw
+ /// later, it SKIPS THE DRAW and presents the frame without that geometry. Upstream DXVK has
+ /// refused the patch twice, naming multiplayer explicitly, and refused it even as an
+ /// off-by-default option; the fork that carries it tells users not to report bugs with it
+ /// enabled, and warns it may be risky in multiplayer. The engine's own built-in default is
+ /// off, so writing True was an active opt-in for every game, not stock behaviour.
+ ///
+ /// It was on for every game from 0.3.0, arriving as a trailing clause in a commit about sync
+ /// modes, and it has never been measured to help here: 16 alternated Unigine Heaven runs
+ /// through d9vk on an M1 Pro gave −0.1%, p = 0.43. Turn it on per game with a recipe
+ /// dxvkconfig step if a title ever demonstrates a win.
+ public var dxvkAsync: Bool = false
/// Cap the frame rate (0 = uncapped). Applied per renderer (DXVK_FRAME_RATE / DXMT_CONFIG).
public var fpsCap: Int = 0
/// Windows UI scale as a DPI value (LogPixels): 96 = 100% (1x), up to 240 = 250%. Above 96 the
@@ -230,7 +243,7 @@ public struct BottleSettings: Codable, Sendable {
sync = try c.decodeIfPresent(SyncMode.self, forKey: .sync) ?? .msync
metalHUD = try c.decodeIfPresent(Bool.self, forKey: .metalHUD) ?? false
advertiseAVX = try c.decodeIfPresent(Bool.self, forKey: .advertiseAVX) ?? false
- dxvkAsync = try c.decodeIfPresent(Bool.self, forKey: .dxvkAsync) ?? true
+ dxvkAsync = try c.decodeIfPresent(Bool.self, forKey: .dxvkAsync) ?? false
fpsCap = try c.decodeIfPresent(Int.self, forKey: .fpsCap) ?? 0
// dpiScale supersedes the old retinaMode toggle (on == 200% == LogPixels 192).
if let dpi = try c.decodeIfPresent(Int.self, forKey: .dpiScale) {
@@ -246,6 +259,15 @@ public struct BottleSettings: Codable, Sendable {
pins = try c.decodeIfPresent([Pin].self, forKey: .pins) ?? []
recipes = try c.decodeIfPresent([String].self, forKey: .recipes) ?? []
created = try c.decodeIfPresent(Date.self, forKey: .created) ?? Date()
+
+ // Every bottle written before format 2 carries dxvkAsync: true because that was the
+ // default, not because anyone chose it — there is no explicit-choice flag for it the way
+ // rendererExplicit exists for the renderer. Switch those off once and stamp the version,
+ // so a user who deliberately turns it back on keeps it.
+ if formatVersion < 2 {
+ dxvkAsync = false
+ formatVersion = 2
+ }
}
/// Legacy key for migrating pre-dpiScale bottles that stored `retinaMode`.
diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swift
index ae3b436..5d8ed07 100644
--- a/Tests/HighballKitTests/RegressionTests.swift
+++ b/Tests/HighballKitTests/RegressionTests.swift
@@ -4,6 +4,31 @@ import XCTest
/// Tripwires for bugs that shipped once and must not ship twice.
final class RegressionTests: XCTestCase {
+ /// DXVK async was on for every game from 0.3.0, not because anyone chose it but because it
+ /// was the default. It skips draws while a pipeline compiles, upstream refuses to ship it,
+ /// and it measured no benefit here, so format 2 switches existing bottles off once.
+ func testOldBottlesAreMigratedOffDxvkAsync() throws {
+ let json = #"{"name":"b","engineID":"e","dxvkAsync":true,"formatVersion":1}"#
+ let s = try JSONDecoder.highball.decode(BottleSettings.self, from: Data(json.utf8))
+ XCTAssertFalse(s.dxvkAsync, "a bottle written before format 2 must be switched off")
+ XCTAssertEqual(s.formatVersion, 2, "and stamped, so the migration never runs twice")
+ }
+
+ /// But a user who turns it back on afterwards keeps it: the stamp is what makes it one-shot.
+ func testADeliberateDxvkAsyncChoiceSurvives() throws {
+ let json = #"{"name":"b","engineID":"e","dxvkAsync":true,"formatVersion":2}"#
+ let s = try JSONDecoder.highball.decode(BottleSettings.self, from: Data(json.utf8))
+ XCTAssertTrue(s.dxvkAsync, "format 2 means the value was chosen, not inherited")
+ }
+
+ /// A fresh bottle is off, and the generated conf says so rather than staying silent — the
+ /// explicit line is what keeps DXVK printing its "Effective configuration" block, the one
+ /// artefact that survives a game started by a launcher Highball did not spawn (#21).
+ func testNewBottlesDefaultAsyncOffAndSaySo() {
+ XCTAssertFalse(BottleSettings(name: "b", engineID: "e").dxvkAsync)
+ XCTAssertTrue(Bottle.dxvkConfig(async: false).contains("dxvk.enableAsync = False"))
+ }
+
// Issue #12: Windows-invalid characters in a bottle name break wineboot (exit 53).
func testBottleNameValidation() {
XCTAssertNil(BottleStore.nameProblem("games"))
@@ -47,7 +72,8 @@ final class RegressionTests: XCTestCase {
XCTAssertEqual(s.dpiScale, 96, "no dpi field on an old bottle must default to 96 (100%)")
XCTAssertEqual(s.dllOverrides, "", "field added in 0.7.2 must default empty")
XCTAssertEqual(s.fpsCap, 0)
- XCTAssertEqual(s.dxvkAsync, true)
+ // That fixture predates formatVersion 2, so it exercises the migration below.
+ XCTAssertEqual(s.dxvkAsync, false)
XCTAssertEqual(s.pins.first?.arguments, [], "pin arguments default to empty")
XCTAssertEqual(s.pins.first?.environment, [:])
XCTAssertNil(s.pins.first?.renderer)