Zero shader locals with DLSS and DLAA on too, which removes the speckled floor tiles there.

With DLAA on, function-local variables stayed undefined, and NVIDIA's driver filled the game's clustered-light reads
with other warp lanes' values: floors around Link lit in 4x8-pixel tiles. The setting was also part of every shader
cache key, so shaders prepared with DLSS off missed with it on. Zeroing is now on for every setting; DLSS still finds
the game's FXAA by its zeroed hash and keeps its camera motion. A log line now says when DLSS replaces the game's
scaling draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-07 11:54:53 -05:00
parent b48b05dacf
commit ee6fbaf0bb
3 changed files with 11 additions and 6 deletions

View File

@@ -121,10 +121,10 @@ void vk_caps_init(VkCtx *c) {
// (docs/maxwell.md 3.12). Mesa folds undefined values freely; NVIDIA's compiler gives such a read a value of another
// lane of the warp: Ocarina's clustered-light loop reads registers that only some paths write, and on an RTX 5090
// the Great Fairy Fountain floor took an extra light term in 4x8-pixel tiles (one 32-lane warp each) and Link went
// dark with green speckles. With DLAA on (vk_dlaa.c, which finds the game's FXAA by its SPIR-V hash) they stay
// undefined off Mesa, as before: zeroing moved that hash and the picture shook under DLAA (maxwell.md 3.12).
// NX2NAVI_ZERO_LOCALS=1 / 0 forces either.
uint32_t zero_locals = env_u32("NX2NAVI_ZERO_LOCALS", vk_caps.mesa || !cfg_bool("NX2NAVI_DLAA"));
// dark with green speckles. On with every setting: vk_dlaa.c knows the game's FXAA by its zeroed SPIR-V hash too,
// and the shader cache keys (which include this) stay the same whether DLSS is on or off, so shaders prepared
// with one setting serve the other. NX2NAVI_ZERO_LOCALS=0 turns it off.
uint32_t zero_locals = env_u32("NX2NAVI_ZERO_LOCALS", 1);
// bda: global accesses the translator finds no storage buffer for go through the device address table (vk_gpa.c)
gfx_shader_set_host(vk_caps.float64, vk_caps.sbuf_align, told, gather, zero_locals != 0, vk_gpa_wanted_ctx(c));
if (gather) rt_log("vk caps: gather coordinates biased for %u sub-texel bits (NX2NAVI_GATHER_BIAS)", gather);

View File

@@ -1333,7 +1333,12 @@ int vk_dlaa_skip_draw(VkExec *ex, const GfxShader *fs) {
int known = 0;
for (size_t i = 0; i < sizeof FXAA_FS / sizeof FXAA_FS[0]; i++) known |= h == FXAA_FS[i];
if (!known) return 0;
if (!ex->depth.image) return D.up; // the scaling pass, which DLSS replaced
if (!ex->depth.image) { // the scaling pass, which DLSS replaced
static int told;
if (D.up && !told++) rt_log("dlaa: the game's scaling draw left out, DLSS wrote it (fragment shader %016llx)",
(unsigned long long)h);
return D.up;
}
if (!fxaa && !fx_found) {
fx_found = 1;
rt_log("dlaa: fxaa = 0 skips the game's FXAA (fragment shader %016llx)", (unsigned long long)h);