From a02413d2f6862d5ea49081501035ff69343ea66d Mon Sep 17 00:00:00 2001 From: ipavlin98 Date: Fri, 13 Nov 2026 06:59:14 +0300 Subject: [PATCH] Keep DLSS on frames where the game draws a half-size mip chain of the scene before the light target: the bloom chain's start now needs level 0, as the chain's level 1 ended the scene before anything was armed, DLAA skipped those frames and the picture flickered between anti-aliased and plain ones --- runtime/vk_dlaa.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c index 18643d82..3fc25ab6 100644 --- a/runtime/vk_dlaa.c +++ b/runtime/vk_dlaa.c @@ -1085,6 +1085,16 @@ static int scene_color(VkFormat f) { return f == VK_FORMAT_B10G11R11_UFLOAT_PACK32 || f == VK_FORMAT_R16G16B16A16_SFLOAT; } +// The bloom chain's first pass: at most a quarter of the scene's width, into level 0 of a scene colour target. At some +// views (seen in the yard of Lookout Landing) the game draws a full-screen pass without depth into the light target, +// then a half-size scene colour target and its mips, and only then the light target with the scene depth. Level 1 of +// those mips is a quarter of the scene's width; taken for the bloom it ended the scene before anything was armed, DLSS +// skipped those frames, and the picture flickered between anti-aliased frames and plain ones as the view changed. +static int bloom_start(const VkExec *ex, uint32_t scene_w) { + const VkExecTarget *c = &ex->color[0]; + return ex->pass_w && ex->pass_w * 4 <= scene_w && c->image && scene_color(c->format) && !c->level; +} + int vk_dlaa_plan(const VkExec *ex, VkExecJob *j) { const VkExecTarget *c = &ex->color[0], *z = &ex->depth; if (!dl_active() || D.done) return 0; @@ -1116,8 +1126,7 @@ int vk_dlaa_plan(const VkExec *ex, VkExecJob *j) { if (D.gbuf && !D.armed && !D.ended && !z->image && ex->pass_ncolor == 1 && c->image && scene_color(c->format) && c->width >= D.gbuf_w && !c->level) D.nodepth = c->image; - if (D.nodepth && !D.armed && !D.ended && ex->pass_w && ex->pass_w * 4 <= D.gbuf_w && c->image && - scene_color(c->format)) { + if (D.nodepth && !D.armed && !D.ended && bloom_start(ex, D.gbuf_w)) { D.end_fence = ex->fence, D.end_pos = ex->pos; __atomic_store_n(&D.ended, 1, __ATOMIC_RELEASE); } @@ -1141,11 +1150,11 @@ int vk_dlaa_plan(const VkExec *ex, VkExecJob *j) { } if (!D.armed) return 0; if (!D.ended) { - // The bloom chain's first pass ends the scene: a pass at most a quarter of the scene's width into a scene - // colour target. With the camera rune or the scope open the game draws a 160-wide depth-only pass and 160x90 - // RG16F and RGBA8 passes right after the lighting, then more geometry and the transparents; DLSS ended the - // scene at those, the next G-buffer pass disarmed it and the scaling pass found nothing to evaluate. - if (!ex->pass_w || ex->pass_w * 4 > D.color.width || !c->image || !scene_color(c->format)) return 0; + // The bloom chain's first pass ends the scene (bloom_start). With the camera rune or the scope open the game + // draws a 160-wide depth-only pass and 160x90 RG16F and RGBA8 passes right after the lighting, then more + // geometry and the transparents; DLSS ended the scene at those, the next G-buffer pass disarmed it and the + // scaling pass found nothing to evaluate. + if (!bloom_start(ex, D.color.width)) return 0; D.end_fence = ex->fence, D.end_pos = ex->pos; __atomic_store_n(&D.ended, 1, __ATOMIC_RELEASE); unsigned o[2], s[2];