mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 13:05:57 +00:00
Skip the game's scaling draw over DLSS's picture again
With a DLSS mode (a scene smaller than the output) DLSS writes the scaled picture into the scaling pass's target and vk_dlaa_skip_draw skips the game's own scaling draw, known by its fragment shader's SPIR-V hash. Translator patch 0011 (the shadow filter spread) changed that hash, so the draw ran again and covered DLSS's picture with the scaled jittered scene: the whole picture shook by a fraction of a pixel each frame, most visible on lit flat surfaces in shrines. The FXAA switch (fxaa = 0) stopped working for the same reason. Add the hash of the current translator, and log once when DLSS scaled a frame whose scaling draw was not found, so the next translator change that moves the hash shows in the log. Measured on 1.4.3, Ukouh Shrine, output 3200x1800, dlss = quality, mean absolute change between consecutive frames with a still camera: 1.40 before, 0.07 after (0.054 with dlaa = 0). Outdoors on stone: 4.29 before, 1.08 after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
438aa41747
commit
9263989625
1 file changed
+14
-5
+14
-5
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user