Skip to content

Play your Steam library's Windows games on a jailbroken PS5.

C++

Run Stray's pixel shaders in wave32

Leonardo Lobato42932bfbc426
diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md
index afe99f7..eccc8d0 100644
--- a/COMPATIBILITY.md
+++ b/COMPATIBILITY.md
@@ -123,7 +123,7 @@ uses: Direct3D 8–11 goes through DXVK to Vulkan, and Direct3D 12 through vkd3d
| [STAR WARS Knights of the Old Republic II: The Sith Lords](https://store.steampowered.com/app/208580) | ✅ Works | 0.10 | Odyssey · OpenGL · 32-bit | New game, cutscenes and the prologue with the controller. |
| [Star Wars: Battlefront II (Classic, 2005)](https://store.steampowered.com/app/6060) | ✅ Works | 0.10 | — · D3D9 · 32-bit | Use Controller preset = **Mouse**: the left stick moves the pointer, Cross clicks, Options is Enter. Menus and the first mission load. |
| [STAR WARS: The Force Unleashed Ultimate Sith Edition](https://store.steampowered.com/app/32430) | ✅ Works | 0.10 | D3D9 · DXVK · 32-bit | In the game's own launcher, set Input Device to Xbox360 Controller (`IsKBAndMouse=FALSE`), then start `SWTFU.exe`. Loading a save and walking as Darth Vader with the controller work. Full campaign not tested. |
-| [Stray](https://store.steampowered.com/app/1332010) | ✅ Works | 0.11 | Unreal 4 · D3D11 · DXVK · 64-bit | Default settings. Brightness screen, menus, a new game and walking as the cat in the opening area with the controller. |
+| [Stray](https://store.steampowered.com/app/1332010) | ✅ Works | 0.12 | Unreal 4 · D3D11 · DXVK · 64-bit | Game settings › Pixel shaders = **Wave32** (Automatic picks it for Stray); with Wave64 loading a save freezes the console. Brightness screen, menus, a new game, loading a save and walking as the cat in the opening area with the controller. |
| [Super Hexagon](https://store.steampowered.com/app/221640) | ✅ Works | 0.10 | — · D3D11 · 32-bit | Menu and game at about 60 fps; the D-pad steers. |
| [Super Meat Boy](https://store.steampowered.com/app/40800) | ✅ Works | 0.10 | Tommunism · D3D9 · 32-bit | Intro, menus and play with the D-pad. |
| [Team Fortress 2](https://store.steampowered.com/app/440) | ✅ Works | 0.10 | Source · D3D9 · DXVK · 64-bit | Plays with a USB mouse and keyboard. Online play does not work: the game shows it is disconnected. The menu does not react to the DualSense, even with Controller preset = **Mouse**. Keep Game settings › Steam features on **Offline emulation**: with the game's own files it quits after about 18 seconds. On Steam accounts from before about 2010, Playden installed only the game's executables until the fix for [#58](https://github.com/leolobato/playden-ps5/issues/58). |
diff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cpp
index 742ca13..095ba37 100644
--- a/src/runtime/game_settings.cpp
+++ b/src/runtime/game_settings.cpp
@@ -193,6 +193,14 @@ std::vector<SettingDefinition> BuildCatalogue() {
{{"wine", "Wine", "Wine's own Direct3D 12."},
{"vkd3d-proton", "vkd3d-proton", "Direct3D 12 on Vulkan, as in Proton. Experimental."}},
"wine"));
+ // RADV runs pixel shaders in wave64 on the PS5's GPU; some never finish there and the console freezes.
+ list.push_back(Choice("pixel_shader_waves", "Pixel shaders",
+ "How the GPU runs pixel shaders. Wave32 stops some games from freezing the console while loading.",
+ "RADV_PERFTEST=pswave32", T::kCompatibility,
+ {{"auto", "Automatic", "Wave32 for games known to freeze in wave64, wave64 for the rest."},
+ {"wave64", "Wave64", "The driver's default."},
+ {"wave32", "Wave32", "Fixes GPU freezes in some games; may be a little slower."}},
+ "auto"));
list.push_back(Choice("steam_features", "Steam features", "How the game reaches Steam without the Steam client.",
"steam_api.dll · steam_api64.dll", T::kCompatibility,
{{"emulate", "Offline emulation", "Playden's Steam emulator answers the game."},
@@ -280,6 +288,100 @@ std::vector<SettingDefinition> BuildCatalogue() {
return list;
}
+// Steam games whose pixel shaders hang the PS5's GPU in wave64, RADV's default there: Pixel shaders "Automatic" runs
+// them in wave32 (RADV_PERFTEST=pswave32). The driver-side cause is not known yet. Matched by the recipe's Steam app
+// ID only: an imported copy of one of these games (another store) needs Wave32 chosen by hand.
+constexpr std::uint32_t kPixelShaderWave32Games[] = {
+ 1332010, // Stray: the GPU hangs while the first save loads; with wave32 it loads and plays.
+};
+
+bool NeedsPixelShaderWave32(const GameRecipe& recipe) {
+ const auto app = RecipeGame(recipe).steam_app();
+ return app && std::find(std::begin(kPixelShaderWave32Games), std::end(kPixelShaderWave32Games), *app) !=
+ std::end(kPixelShaderWave32Games);
+}
+
+std::string TrimSpaces(std::string text) {
+ while (!text.empty() && text.front() == ' ') text.erase(0, 1);
+ while (!text.empty() && text.back() == ' ') text.pop_back();
+ return text;
+}
+
+// The Environment variables with the one Pixel shaders sets, which wins over the player's own:
+// - wave32: RADV_PERFTEST gets pswave32 (added to the player's value when there is one) and goes first, so the entry
+// limits never drop it; a RADV_PS5_PS_WAVE64 of the player's is left out.
+// - wave64: RADV_PS5_PS_WAVE64=1 goes first; pswave32 is taken out of the player's RADV_PERFTEST, which stays where it
+// was (or is left out when nothing else is in it). A RADV_PERFTEST with "all" fails: it turns pswave32 on.
+// - empty (the driver's default): the player's text, unchanged.
+// debug_env: the variables go to [debug] env lines, whose values are shorter than [environment]'s. Fails with a reason
+// when RADV_PERFTEST with pswave32 no longer fits there: the game must not start without it.
+// Options are read as PS5_Mesa's parse_debug_string (src/util/u_debug.c) reads them.
+bool WithPixelShaderEnvironment(const std::string& entries, const std::string& waves, bool debug_env, std::string* out,
+ std::string* reason) {
+ if (waves != "wave32" && waves != "wave64") {
+ *out = entries;
+ return true;
+ }
+ const bool wave32 = waves == "wave32";
+ std::string perftest; // wave32: the player's RADV_PERFTEST options, pswave32 added
+ bool listed = false;
+ std::string rest;
+ std::size_t start = 0;
+ while (!entries.empty() && start <= entries.size()) {
+ const auto end = std::min(entries.find(';', start), entries.size());
+ const std::string entry = entries.substr(start, end - start);
+ start = end + 1;
+ const auto equals = entry.find('=');
+ const auto name = TrimSpaces(equals == std::string::npos ? entry : entry.substr(0, equals));
+ if (equals != std::string::npos && name == "RADV_PS5_PS_WAVE64") continue;
+ if (equals != std::string::npos && name == "RADV_PERFTEST") {
+ // Options split as RADV's parse_debug_string splits them: at commas, spaces and newlines. Written back with
+ // commas.
+ const auto item = entry.substr(equals + 1);
+ std::string kept;
+ std::size_t at = 0;
+ while (at <= item.size()) {
+ const auto separator = std::min(item.find_first_of(", \n", at), item.size());
+ const auto option = item.substr(at, separator - at);
+ at = separator + 1;
+ if (option.empty()) continue;
+ // parse_debug_string turns on every option for "all", and for any option that "all" starts with ("a", "al").
+ if (!wave32 && std::string_view("all").substr(0, option.size()) == option) {
+ if (reason)
+ *reason = "RADV_PERFTEST=" + option +
+ " in Environment variables turns on wave32 pixel shaders. Remove it, or set Pixel shaders to "
+ "Wave32 or Automatic.";
+ return false;
+ }
+ if (option == "pswave32") {
+ if (!wave32 || listed) continue;
+ listed = true;
+ }
+ kept += (kept.empty() ? "" : ",") + option;
+ }
+ if (wave32) perftest = kept;
+ else if (!kept.empty()) rest += (rest.empty() ? "" : ";") + std::string("RADV_PERFTEST=") + kept;
+ continue;
+ }
+ if (!TrimSpaces(entry).empty()) rest += (rest.empty() ? "" : ";") + entry;
+ }
+ std::string first;
+ if (wave32) {
+ if (!listed) perftest += (perftest.empty() ? "" : ",") + std::string("pswave32");
+ if (debug_env ? !IsProsperoDebugEnvEntry("RADV_PERFTEST", perftest)
+ : !IsProsperoEnvironmentEntry("RADV_PERFTEST", perftest)) {
+ if (reason)
+ *reason = "RADV_PERFTEST in Environment variables is too long to add pswave32 for Pixel shaders. Shorten it.";
+ return false;
+ }
+ first = "RADV_PERFTEST=" + perftest;
+ } else {
+ first = "RADV_PS5_PS_WAVE64=1";
+ }
+ *out = rest.empty() ? first : first + ";" + rest;
+ return true;
+}
+
constexpr const char* kVerboseWinedebug = "err+all,warn+all,fixme-all,+loaddll,+process,+seh";
// Raw Input, DirectInput, the winmm joystick API and the HID drivers the game hosts: what a game asks for and
// what it finds.
@@ -388,7 +490,9 @@ std::string Unavailable(const SettingDefinition& definition, const std::string&
if ((id == "windows_version" || id == "text_scale") && !kit.registry)
return "Needs a verified runtime kit with access to the game's bottle.";
// A Zink kit's runtime (upstream prospero-win) reads MESA_, DXVK_, RADV_ and the like as [debug] env.
- if (id == "environment" && !kit.environment && !kit.opengl_zink) return "Needs a prospero-win update that reads [environment].";
+ // Pixel shaders is an environment variable for the driver, so it goes where Environment variables go.
+ if ((id == "environment" || id == "pixel_shader_waves") && !kit.environment && !kit.opengl_zink)
+ return "Needs a prospero-win update that reads [environment].";
if (id == "wheel_stick" && !kit.input_wheel) return "Needs a prospero-win update that turns the mouse wheel.";
if (id == "volume" && !kit.audio_volume) return "Needs a prospero-win update with per-game volume.";
if (id == "stick_deadzone" || id == "rumble" || id == "trigger_deadzone") {
@@ -693,6 +797,12 @@ bool BuildEffectiveSettings(const GameRecipe& recipe, const SettingsPreset* pres
}
}
+ // Pixel shaders: Automatic is wave32 for the games known to hang in wave64, and the driver's default otherwise.
+ if (const auto& waves = out.values["pixel_shader_waves"]; waves.available) {
+ if (waves.value == "auto") out.pixel_shader_waves = NeedsPixelShaderWave32(recipe) ? "wave32" : "";
+ else out.pixel_shader_waves = waves.value;
+ }
+
// The program: the chosen launch entry, or a program the player picked in the game folder.
// The player's folder and arguments apply to either.
std::optional<LaunchEntry> launch;
@@ -967,13 +1077,21 @@ bool RenderProsperoProfile(const GameRecipe& recipe, const EffectiveSettings& se
if (value("logging") == "input") text += std::string("\n[debug]\nwinedebug = ") + kInputWinedebug + "\n";
const auto& environment = settings.values.at("environment");
+ // The player's variables, with the one Pixel shaders sets (none for the driver's default).
+ std::string environment_entries;
+ if (environment.available) {
+ std::string why;
+ if (!WithPixelShaderEnvironment(environment.value, settings.pixel_shader_waves, settings.environment_as_debug_env,
+ &environment_entries, &why))
+ return fail(why);
+ }
bool debug_env = false;
- if (environment.available && !environment.value.empty() && settings.debug_env_lines) {
+ if (environment.available && !environment_entries.empty() && settings.debug_env_lines) {
// [debug] env = NAME=value, one line per variable; names the runtime does not take are left out, and so are
// names that go to [environment] on a kit that reads it.
std::string lines;
std::size_t start = 0, count = 0;
- const auto& entries = environment.value;
+ const auto& entries = environment_entries;
while (start <= entries.size()) {
const auto end = std::min(entries.find(';', start), entries.size());
std::string entry = entries.substr(start, end - start);
@@ -1015,7 +1133,7 @@ bool RenderProsperoProfile(const GameRecipe& recipe, const EffectiveSettings& se
}
if (environment.available && !settings.environment_as_debug_env) {
std::size_t start = 0;
- const auto& entries = environment.value;
+ const auto& entries = environment_entries;
while (!entries.empty() && start <= entries.size()) {
const auto end = std::min(entries.find(';', start), entries.size());
std::string entry = entries.substr(start, end - start);
diff --git a/src/runtime/game_settings.h b/src/runtime/game_settings.h
index 2113a2f..f86b52f 100644
--- a/src/runtime/game_settings.h
+++ b/src/runtime/game_settings.h
@@ -205,6 +205,9 @@ struct EffectiveSettings {
bool debug_env_lines = false;
// Direct3D 12 through vkd3d-proton: ApplyD3D12Library puts its DLLs in the bottle before the game starts.
bool vkd3d_proton = false;
+ // Pixel shaders as the driver gets them: "wave32" or "wave64" adds a variable to the environment; empty (Automatic
+ // for a game not known to hang, or a kit without environment variables) leaves the driver's default.
+ std::string pixel_shader_waves;
// The title's runtime honors [display] refresh on every graphics path and paces [display] frame_rate itself
// (KitCapabilities::display_120hz); without it Frame limit is DXVK's maxFrameRate, as before.
bool display_120hz = false;
diff --git a/tests/game_settings_test.cpp b/tests/game_settings_test.cpp
index 97d7f50..ee69abf 100644
--- a/tests/game_settings_test.cpp
+++ b/tests/game_settings_test.cpp
@@ -559,6 +559,160 @@ int main(int argc, char** argv) {
CHECK(profile.text.find("env = DXVK_") == std::string::npos && profile.text.find("env = MESA_") == std::string::npos);
CHECK(CheckProsperoProfile(profile.text, &reason, {.environment_section = true, .debug_env = true}));
}
+ // Pixel shaders: Automatic runs a game known to hang the GPU in wave64 (Stray) in wave32, through the same
+ // environment the Environment variables row writes; every other game's profile stays as it was.
+ {
+ auto stray = hl2;
+ stray.app_id = 1332010;
+ KitCapabilities debug_kit = zink; // a Zink kit without [environment]: [debug] env lines
+ const auto render = [&](const GameRecipe& recipe, const std::map<std::string, std::string>& overrides,
+ const KitCapabilities& kit) {
+ CHECK(BuildEffectiveSettings(recipe, nullptr, overrides, kit, &settings, &error));
+ reason.clear();
+ if (!RenderProsperoProfile(recipe, settings, target, &profile, &reason)) profile.text.clear();
+ return profile.text;
+ };
+ const auto count = [](const std::string& text, const std::string& what) {
+ std::size_t found = 0;
+ for (auto at = text.find(what); at != std::string::npos; at = text.find(what, at + 1)) ++found;
+ return found;
+ };
+ CHECK(FindSetting("pixel_shader_waves") && FindSetting("pixel_shader_waves")->playden_default == "auto" &&
+ FindSetting("pixel_shader_waves")->tier == SettingTier::kCompatibility);
+ CHECK(!ValidateSettingValue(hl2, "pixel_shader_waves", "wave16", &reason));
+ // The Stray profile; it ends in its [environment] section.
+ const std::string base = render(hl2, {}, environment_kit);
+ CHECK(settings.pixel_shader_waves.empty() && base.find("[environment]") == std::string::npos);
+ CHECK(render(stray, {}, environment_kit) == base + "\n[environment]\nRADV_PERFTEST = pswave32\n");
+ CHECK(settings.values.at("pixel_shader_waves").available && settings.pixel_shader_waves == "wave32");
+ CHECK(CheckProsperoProfile(profile.text, &reason, {.environment_section = true}));
+ if (std::getenv("PLAYDEN_PRINT_PROFILES")) std::printf("--- stray auto ---\n%s", profile.text.c_str());
+ // Another game on Automatic: byte for byte the profile this build wrote before the row, conflicting variables of
+ // the player's included (checked against the earlier build's output).
+ const std::map<std::string, std::string> conflicting = {
+ {"environment", " ; RADV_PERFTEST = pswave32 , sam ;; RADV_PS5_PS_WAVE64=0;DXVK_FRAME_RATE = 45"},
+ {"cpu_topology", "4"}};
+ const std::string hl2_expected =
+ "; Generated by Playden from recipe steam-220-hl2-v1 v1. Edit settings in Playden.\n"
+ "[application]\n"
+ "id = playden-steam-220\n"
+ "name = Half-Life 2\n"
+ "executable = Z:\\data\\homebrew\\FAKE77031\\games\\220\\hl2.exe\n"
+ "working_directory = Z:\\data\\homebrew\\FAKE77031\\games\\220\n"
+ "arguments = -game hl2 -steam -w 1920 -h 1080 -novid +exec 360controller.cfg +joystick 1\n"
+ "dll_overrides = d3d9=n\n"
+ "prefix = game\n"
+ "runtime = wine-wow64\n"
+ "architecture = pe32\n"
+ "graphics = dxvk\n"
+ "\n[display]\n"
+ "desktop = 1920x1080\n"
+ "view = window\n"
+ "show_fps = false\n"
+ "\n[input]\n"
+ "mode = xinput\n"
+ "mouse = none\n"
+ "options = escape\n"
+ "\n[environment]\n"
+ "WINE_CPU_TOPOLOGY = 4:0,1,2,3\n"
+ "RADV_PERFTEST = pswave32 , sam\n"
+ "RADV_PS5_PS_WAVE64 = 0\n"
+ "DXVK_FRAME_RATE = 45\n";
+ CHECK(render(hl2, conflicting, environment_kit) == hl2_expected);
+ CHECK(settings.pixel_shader_waves.empty());
+ if (std::getenv("PLAYDEN_PRINT_PROFILES")) std::printf("--- hl2 auto ---\n%s", profile.text.c_str());
+ // Wave32 wins: pswave32 once (spaces and empty options dropped), the player's RADV_PS5_PS_WAVE64 left out.
+ auto wave32 = conflicting;
+ wave32["pixel_shader_waves"] = "wave32";
+ CHECK(render(hl2, wave32, environment_kit).find("\n[environment]\nWINE_CPU_TOPOLOGY = 4:0,1,2,3\n"
+ "RADV_PERFTEST = pswave32,sam\nDXVK_FRAME_RATE = 45\n") !=
+ std::string::npos);
+ CHECK(count(profile.text, "RADV_PERFTEST") == 1 && profile.text.find("RADV_PS5_PS_WAVE64") == std::string::npos);
+ CHECK(render(stray, {{"environment", "DXVK_FRAME_RATE=45;RADV_PERFTEST= sam,,nggc "}}, environment_kit)
+ .find("\n[environment]\nRADV_PERFTEST = sam,nggc,pswave32\nDXVK_FRAME_RATE = 45\n") != std::string::npos);
+ // Wave64 wins, for Stray too: RADV_PS5_PS_WAVE64=1, pswave32 taken out of the player's RADV_PERFTEST.
+ auto wave64 = conflicting;
+ wave64["pixel_shader_waves"] = "wave64";
+ CHECK(render(stray, wave64, environment_kit).find("\n[environment]\nWINE_CPU_TOPOLOGY = 4:0,1,2,3\n"
+ "RADV_PS5_PS_WAVE64 = 1\nRADV_PERFTEST = sam\n"
+ "DXVK_FRAME_RATE = 45\n") != std::string::npos);
+ CHECK(count(profile.text, "RADV_PS5_PS_WAVE64") == 1 && profile.text.find("pswave32") == std::string::npos);
+ CHECK(render(stray, {{"pixel_shader_waves", "wave64"}, {"environment", "RADV_PERFTEST=pswave32"}}, environment_kit) ==
+ base + "\n[environment]\nRADV_PS5_PS_WAVE64 = 1\n");
+ // Options are split as RADV splits them, at spaces as well as commas, and written back with commas; on either
+ // destination. "all" (or "a", "al": RADV takes any start of it) turns pswave32 on, so Wave64 refuses it.
+ for (const auto* kit : {&environment_kit, &debug_kit}) {
+ const std::string line = kit == &environment_kit ? "\nRADV_PERFTEST = " : "\nenv = RADV_PERFTEST=";
+ CHECK(render(stray, {{"environment", "RADV_PERFTEST=sam nggc"}}, *kit).find(line + "sam,nggc,pswave32\n") !=
+ std::string::npos);
+ CHECK(render(hl2, {{"environment", "RADV_PERFTEST=sam pswave32,nggc"}, {"pixel_shader_waves", "wave64"}}, *kit)
+ .find(line + "sam,nggc\n") != std::string::npos);
+ CHECK(profile.text.find("pswave32") == std::string::npos);
+ CHECK(render(stray, {{"environment", "RADV_PERFTEST=all"}}, *kit).find(line + "all,pswave32\n") != std::string::npos);
+ for (const auto* all : {"all", "sam all", "sam,al", "a"}) {
+ CHECK(render(stray, {{"environment", std::string("RADV_PERFTEST=") + all}, {"pixel_shader_waves", "wave64"}}, *kit)
+ .empty());
+ CHECK(reason.find("turns on wave32 pixel shaders") != std::string::npos);
+ }
+ // A word that only starts with "all" is not "all".
+ CHECK(render(stray, {{"environment", "RADV_PERFTEST=allx"}, {"pixel_shader_waves", "wave64"}}, *kit)
+ .find(line + "allx\n") != std::string::npos);
+ }
+ // The entry limits never drop it: eight variables of the player's after CPU cores in [environment]...
+ const std::string eight = "DXVK_A=1;DXVK_B=2;DXVK_C=3;DXVK_D=4;DXVK_E=5;DXVK_F=6;DXVK_G=7;DXVK_H=8";
+ CHECK(render(stray, {{"environment", eight}, {"cpu_topology", "4"}}, environment_kit)
+ .find("\n[environment]\nWINE_CPU_TOPOLOGY = 4:0,1,2,3\nRADV_PERFTEST = pswave32\nDXVK_A = 1\n") !=
+ std::string::npos);
+ CHECK(count(profile.text, "DXVK_") == 6 && profile.text.find("DXVK_G") == std::string::npos);
+ // ...and five [debug] env lines on a Zink kit.
+ CHECK(render(stray, {{"environment", "DXVK_A=1;DXVK_B=2;DXVK_C=3;DXVK_D=4;DXVK_E=5"}}, debug_kit)
+ .find("\n[debug]\nenv = RADV_PERFTEST=pswave32\nenv = DXVK_A=1\n") != std::string::npos);
+ CHECK(count(profile.text, "env = ") == 5 && profile.text.find("DXVK_E") == std::string::npos);
+ CHECK(profile.text.find("[environment]") == std::string::npos);
+ CHECK(CheckProsperoProfile(profile.text, &reason, {.debug_env = true}));
+ // A player's RADV_PERFTEST too long to take pswave32 stops the launch with a reason, never starts without it:
+ // [environment] values are under 128 bytes, [debug] env values under 96.
+ const auto perftest = [](std::size_t bytes) { return "RADV_PERFTEST=" + std::string(bytes, 'x'); };
+ CHECK(render(stray, {{"environment", perftest(118)}}, environment_kit)
+ .find("\nRADV_PERFTEST = " + std::string(118, 'x') + ",pswave32\n") != std::string::npos);
+ CHECK(render(stray, {{"environment", perftest(119)}}, environment_kit).empty());
+ CHECK(reason.find("RADV_PERFTEST") != std::string::npos && reason.find("pswave32") != std::string::npos);
+ CHECK(render(stray, {{"environment", perftest(86)}}, debug_kit)
+ .find("\nenv = RADV_PERFTEST=" + std::string(86, 'x') + ",pswave32\n") != std::string::npos);
+ CHECK(render(stray, {{"environment", perftest(87)}}, debug_kit).empty() && reason.find("pswave32") != std::string::npos);
+ SettingsLaunchInput too_long;
+ too_long.recipe = &stray;
+ too_long.kit = environment_kit;
+ too_long.target = target;
+ too_long.record.overrides = {{"environment", perftest(119)}};
+ SettingsLaunchPlan refused;
+ CHECK(!BuildSettingsLaunchPlan(too_long, &refused, &reason) && reason.find("pswave32") != std::string::npos);
+ // On Automatic for another game, or Wave64, the same long value is the player's to keep.
+ CHECK(render(hl2, {{"environment", perftest(119)}}, environment_kit).find(std::string(119, 'x') + "\n") !=
+ std::string::npos);
+ CHECK(!render(stray, {{"environment", perftest(119)}, {"pixel_shader_waves", "wave64"}}, environment_kit).empty());
+ // A kit without either: the row is unavailable for the same reason, and nothing is written.
+ CHECK(render(stray, {{"pixel_shader_waves", "wave32"}}, KitCapabilities{}).find("RADV_") == std::string::npos);
+ CHECK(!settings.values.at("pixel_shader_waves").available &&
+ settings.values.at("pixel_shader_waves").reason == settings.values.at("environment").reason &&
+ settings.pixel_shader_waves.empty());
+ CHECK(render(stray, {}, KitCapabilities{}).find("RADV_") == std::string::npos);
+ // Presets and recipes may set it; a recipe keeps it through a save.
+ std::vector<SettingsPreset> wave_presets;
+ CHECK(ParseSettingsPresets(R"({"presets":[{"id":"wave32","name":"Wave32","settings":{"pixel_shader_waves":"wave32"}}]})",
+ &wave_presets, &reason));
+ CHECK(BuildEffectiveSettings(hl2, &wave_presets.front(), {}, environment_kit, &settings, &error));
+ CHECK(settings.values.at("pixel_shader_waves").source == ValueSource::kPreset && settings.pixel_shader_waves == "wave32");
+ auto recipe_wave64 = stray;
+ recipe_wave64.defaults["pixel_shader_waves"] = "wave64";
+ GameRecipe reread_wave;
+ CHECK(ParseGameRecipe(SerializeGameRecipe(recipe_wave64), &reread_wave, &reason));
+ CHECK(reread_wave.defaults.at("pixel_shader_waves") == "wave64");
+ CHECK(render(reread_wave, {}, environment_kit) == base + "\n[environment]\nRADV_PS5_PS_WAVE64 = 1\n");
+ CHECK(settings.values.at("pixel_shader_waves").source == ValueSource::kRecipe);
+ reread_wave.defaults["pixel_shader_waves"] = "wave16";
+ CHECK(!BuildEffectiveSettings(reread_wave, nullptr, {}, environment_kit, &settings, &error));
+ }
// Stick dead zone and rumble need a runtime with controller tuning and the Xbox controller;
// only values that differ from the runtime's defaults are written.
const std::map<std::string, std::string> tuning = {{"stick_deadzone", "15"}, {"rumble", "50"}};