mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
The default was off only on AMD's driver branch for RDNA 1 and 2, on the grounds that builds with the default on had been measured on an RX 7900 XT. Those measurements were standing in Hyrule Field and walking through a village; the report this is about is of a game that ended in fights, on an AMD card the player did not name, and fights are where the lazy path is busiest. Nobody has played one on an AMD card under our eyes on either branch, so the exception is now AMD's own driver as a whole (wb_lazy_choice.h, by VkDriverId), until a card of each branch has played fights with wb_lazy = 1 and a log to show. The cost is the open-area frame rate of 0.7.0 on every AMD card under Windows; the RX 7900 XT figures in the draft notes come from builds that had it on by default, which the notes now say. wb_lazy = 1 still turns it on. --probe-vkdevice prints the line a fatal error or a crash adds to the log, so its wording can be read without a failing run. On an RTX 5090: "fatal: gpu NVIDIA GeForce RTX 5090, driver NVIDIA "621.01" version 621.1.0.0; memory mode mirror, lazy write-back on (the default on Windows (wb_lazy = 0 turns it off)); texture detail not chosen yet (no texture made)", and with the reporting player's nx2navi.ini beside the exe "lazy write-back off (wb_lazy = 0 is set)", after a start whose log names async_compute, vram_safe_mode and exception_handler as no settings of this version. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
73 lines
4.1 KiB
C
73 lines
4.1 KiB
C
// runtime/wb_lazy_choice.h: whether the lazy write-back runs, by the player's setting, the platform and the GPU driver
|
|
// (runtime/vk_memory.c vk_mem_lazy_decide). Built and run by tests/wb_lazy_check.py; prints each failed check and
|
|
// exits 1 on any.
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include "wb_lazy_choice.h"
|
|
|
|
static int fails;
|
|
#define CHECK(c, ...) do { if (!(c)) { fails++; printf("FAIL line %d: ", __LINE__); printf(__VA_ARGS__); printf("\n"); } } while (0)
|
|
|
|
// VkDriverId values (vulkan_core.h)
|
|
enum { AMD_PROPRIETARY = 1, AMD_OPEN_SOURCE = 2, MESA_RADV = 3, NVIDIA_PROPRIETARY = 4, INTEL_WINDOWS = 5, MESA_NVK = 24 };
|
|
enum { LINUX = 0, WINDOWS = 1 };
|
|
|
|
static int has(const char *s, const char *part) { return s && strstr(s, part) != NULL; }
|
|
|
|
int main(void) {
|
|
static const unsigned drivers[] = {AMD_PROPRIETARY, AMD_OPEN_SOURCE, MESA_RADV, NVIDIA_PROPRIETARY, INTEL_WINDOWS,
|
|
MESA_NVK, 0};
|
|
enum { ND = sizeof drivers / sizeof *drivers };
|
|
|
|
// Nothing set, Windows: on, except on AMD's own driver (both of its branches report this id).
|
|
WblChoice nv = wb_lazy_choice(NULL, WINDOWS, NVIDIA_PROPRIETARY);
|
|
CHECK(nv.on == 1, "Windows, NVIDIA's driver, nothing set: on");
|
|
CHECK(has(nv.why, "default") && has(nv.why, "wb_lazy = 0"), "it says it is the default and how to turn it off: %s", nv.why);
|
|
CHECK(wb_lazy_choice(NULL, WINDOWS, INTEL_WINDOWS).on == 1, "Windows, Intel's driver, nothing set: on");
|
|
CHECK(wb_lazy_choice(NULL, WINDOWS, 0).on == 1, "Windows, a driver that reports no id: on, as 0.7.1 had it");
|
|
WblChoice amd = wb_lazy_choice(NULL, WINDOWS, AMD_PROPRIETARY);
|
|
CHECK(amd.on == 0, "Windows, AMD's driver, nothing set: off");
|
|
CHECK(has(amd.why, "AMD") && has(amd.why, "wb_lazy = 1"), "it names the driver and how to turn it on: %s", amd.why);
|
|
CHECK(has(amd.why, "frame rate"), "it says what off costs: %s", amd.why);
|
|
CHECK(has(amd.why, "default"), "it says it is a default: %s", amd.why);
|
|
|
|
// An empty value is no value (cfg.c add: "key =" leaves the setting at its default).
|
|
CHECK(wb_lazy_choice("", WINDOWS, AMD_PROPRIETARY).on == 0, "an empty value on AMD: the default, off");
|
|
CHECK(wb_lazy_choice("", WINDOWS, NVIDIA_PROPRIETARY).on == 1, "an empty value on NVIDIA: the default, on");
|
|
|
|
// Nothing set, elsewhere: off on every driver.
|
|
for (int i = 0; i < ND; i++) {
|
|
WblChoice c = wb_lazy_choice(NULL, LINUX, drivers[i]);
|
|
CHECK(c.on == 0 && has(c.why, "wb_lazy = 1"), "Linux, driver %u, nothing set: off, and how to turn it on: %s",
|
|
drivers[i], c.why);
|
|
}
|
|
|
|
// What the player sets wins on every platform and driver, and the reason says it was set.
|
|
for (int os = LINUX; os <= WINDOWS; os++)
|
|
for (int i = 0; i < ND; i++) {
|
|
WblChoice on = wb_lazy_choice("1", os, drivers[i]), off = wb_lazy_choice("0", os, drivers[i]);
|
|
CHECK(on.on == 1 && has(on.why, "set"), "os %d driver %u, wb_lazy = 1: on (%s)", os, drivers[i], on.why);
|
|
CHECK(off.on == 0 && has(off.why, "set"), "os %d driver %u, wb_lazy = 0: off (%s)", os, drivers[i], off.why);
|
|
CHECK(!has(on.why, "default") && !has(off.why, "default"), "os %d driver %u: a set value is not a default", os,
|
|
drivers[i]);
|
|
}
|
|
// Any value but 0 counts as on, as cfg_bool reads it for memory.c mem_init.
|
|
CHECK(wb_lazy_choice("on", WINDOWS, AMD_PROPRIETARY).on == 1, "wb_lazy = on: on");
|
|
|
|
// The exception is the driver, not the vendor: another driver for AMD cards follows its platform's default.
|
|
CHECK(wb_lazy_choice(NULL, WINDOWS, AMD_OPEN_SOURCE).on == 1 && wb_lazy_choice(NULL, WINDOWS, MESA_RADV).on == 1,
|
|
"the exception is AMD's own driver");
|
|
CHECK(WBL_DRIVER_AMD == AMD_PROPRIETARY, "WBL_DRIVER_AMD is VK_DRIVER_ID_AMD_PROPRIETARY");
|
|
|
|
// The game passes the platform it was built for.
|
|
#ifdef _WIN32
|
|
CHECK(WBL_ON_WINDOWS == 1, "a Windows build says so");
|
|
#else
|
|
CHECK(WBL_ON_WINDOWS == 0, "a build elsewhere says so");
|
|
#endif
|
|
|
|
if (!fails) printf("wb lazy choice: all checks passed\n");
|
|
return fails != 0;
|
|
}
|