diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c index 7acdd130..886d2a23 100644 --- a/runtime/vk_dlaa.c +++ b/runtime/vk_dlaa.c @@ -256,6 +256,8 @@ static struct { uint64_t mv_frames, mv_none; uint64_t why[3]; // history resets: scene size changed, no camera, scene target changed int on; // the dlaa setting, read at each present (the menu switches it live) + int scaler_skipped; // this frame: the game's scaling draw over DLSS's picture was skipped + uint64_t scaler_missed; // frames DLSS scaled whose scaling draw was not found (vk_dlaa_skip_draw) } D = {.mv_ok = -1}; static int dl_active(void) { return N.available && !D.failed && D.on; } @@ -626,7 +628,10 @@ void vk_dlaa_frame(void) { if (D.jit_used && !D.done) D.hold = 60, D.holds++; // jittered but not resolved: that frame shook else if (D.hold) D.hold--; if (!D.done) D.jit_ok = 0; - D.armed = D.done = D.jit_used = D.gbuf = D.ended = D.up = 0; + if (D.up && !D.scaler_skipped && ++D.scaler_missed == 1) + rt_log("dlaa: the game's scaling draw over DLSS's picture was not found (its fragment shader is not in FXAA_FS): " + "the jittered scene reaches the screen and shakes"); + D.armed = D.done = D.jit_used = D.gbuf = D.ended = D.up = D.scaler_skipped = 0; D.cam_addr = 0; } @@ -640,8 +645,10 @@ void vk_dlaa_frame(void) { // scaled picture into the output-sized target, in a pass without the depth attachment the in-place FXAA has: there it // is always drawn, whatever fxaa says (skipping it would leave the 3D picture out), unless DLSS already wrote that // target this frame. -// The stock translator's hash, and the one with tools/xlate patch 0010 (PCSS, PR #89) applied. -static const uint64_t FXAA_FS[] = {0xf450003ebeb3dc52ull, 0x0a12f4bc2a9a4fbeull}; +// The stock translator's hash, the one with tools/xlate patch 0010 (PCSS, PR #89) applied, and the one with patches +// 0010 and 0011 (the shadow filter spread) applied. A translator change that gives the shader another hash is reported +// by vk_dlaa_frame: the game's scaling draw then covers DLSS's picture with the jittered scene, which shakes. +static const uint64_t FXAA_FS[] = {0xf450003ebeb3dc52ull, 0x0a12f4bc2a9a4fbeull, 0x5c43ae18948d52cbull}; static uint64_t spirv_hash(const GfxShader *s) { static struct { const GfxShader *s; uint64_t h; } tab[8192]; @@ -667,8 +674,10 @@ int vk_dlaa_skip_draw(VkExec *ex, const GfxShader *fs) { if (fxaa && !D.up) return 0; // nothing to skip: no shader lookup per draw at the defaults if (!fs) return 0; uint64_t h = spirv_hash(fs); - if (h != FXAA_FS[0] && h != FXAA_FS[1]) return 0; - if (!ex->depth.image) return D.up; // the scaling pass + 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.scaler_skipped = D.up; // the scaling pass return !fxaa; }