From 2495391dd710f2b718d94532c9eb3d7a6dedbfdb Mon Sep 17 00:00:00 2001 From: epicmeme546 <178368684+epicmeme546@users.noreply.github.com> Date: Thu, 12 Nov 2026 10:22:00 -0500 Subject: [PATCH] Fill the scene's outer rows and columns in every jittered frame, and take only turns of 30 degrees a frame for camera cuts. A player's clip at Ultra Performance still showed the sky's colour in the last row of about half the frames. In those frames the fill, done only after a jitter to the left or up, had not run. The outermost row and column on each side of the light target and the depth are now filled from their neighbours whenever the frame was jittered, whatever the jitter's direction. A copied border pixel is nothing anyone sees. A quick swing of the camera around Link turns it 11 to 18 degrees and moves it 0.9 to 1.4 m a frame. That was taken for a cut, and nine frames in a row started a new history, which showed the scene at its render size, blocky at the smaller modes. A cut now needs a move of 5 m or a turn of 30 degrees with a move. Hyrule Field, FSR 4 Ultra Performance, present screenshots: standing still and on grass while running, the bottom edge matched the rows above it. Over water a bright bottom edge remains in a fifth of the moving shots, and none with the jitter off: the water reads the scene before the fill. The 0.9.2 notes list it as a known issue, with the frame rates and FSR's GPU times measured for the Ultra Performance question. Co-Authored-By: Claude Opus 5.5 --- docs/releases/v0.9.2.md | 25 +++++++++++++++ runtime/vk_dlaa.c | 68 +++++++++++++++++++++++++---------------- 2 files changed, 66 insertions(+), 27 deletions(-) create mode 100644 docs/releases/v0.9.2.md diff --git a/docs/releases/v0.9.2.md b/docs/releases/v0.9.2.md new file mode 100644 index 00000000..db2c82ea --- /dev/null +++ b/docs/releases/v0.9.2.md @@ -0,0 +1,25 @@ +## Fixed + +- **A crash after switching FSR modes.** One FSR context served every mode, with another render size at each switch, + and the first frame after a switch from Quality to Native AA could end the game inside AMD's driver. Each render size + now gets a context of its own, as AMD's own sample makes them, and the one before goes a few frames later (a mode + switch takes about 50 ms more); with dynamic resolution on, one context made for changing sizes takes every step. +- **The light line at the bottom or right edge with FSR or DLSS, still seen in some frames.** The scene's outermost + rows and columns are now filled from the ones next to them in every frame the upscaler gets, not only after the + scene moved up or to the left. +- **A blocky picture for a moment whenever the camera swung quickly with FSR or DLSS.** A fast swing of the camera + around Link (11 to 18 degrees a frame) was taken for a cut to a new view, and the upscaler threw away what it had + built up at every frame of the swing; at Ultra Performance that showed the scene at a third of the picture's size. + Only a jump of the camera or a turn of 30 degrees or more in one frame counts as a cut now. + +## Known issues + +- At FSR's and DLSS's smaller modes, Link and other characters look coarser while they move: the upscaler gets only + the camera's motion for them, not their own, so it can keep less of what it built up there. +- Over water, a bright line can still show at the very bottom of the picture now and then with FSR or DLSS: the water + reads the scene before its last row is filled. +- Ultra Performance gains little frame rate over Quality with FSR 4. Most of a frame is the replay of the game's draws + on the CPU, which does not shrink with the render size, and FSR 4 itself takes 3.1 ms of the GPU's time at Ultra + Performance and 3.9 ms at Native AA on a Radeon RX 7900 XT (FSR 3.1: 0.5 ms). Measured standing in Hyrule Field at + 3416x1440: FSR 4 Native AA 52 fps, Quality 53, Ultra Performance 55; FSR 3.1 Native AA 55, Ultra Performance 66; + without an upscaler 70. diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c index 3d58bd67..040db9be 100644 --- a/runtime/vk_dlaa.c +++ b/runtime/vk_dlaa.c @@ -1070,9 +1070,13 @@ static void cam_note(int view, int kept) { // that jumped: an area load or a spawn moves it 5 to 180 m in one frame. Such a frame now starts a new history, as // NVIDIA's DLSS guide asks for a camera cut: a move over 5 m, or a turn over 10 degrees together with a move over 0.5 m, // both per 60 Hz frame and scaled by the time since the last camera. Camera traces of play in the Fire Temple -// (NX2NAVI_MOUSE_TRACE) had a median of 0.05 m and 0.08 degrees a frame; the second test took only the area loads and a -// swing of the camera through a doorway at 12 to 18 degrees and 0.7 to 1.4 m a frame. A turn alone (the mouse camera, -// which orbits about 3 m from Link) does not count. Each cut is logged, up to 24. +// (NX2NAVI_MOUSE_TRACE) had a median of 0.05 m and 0.08 degrees a frame. A turn alone (the mouse camera, which orbits +// about 3 m from Link) does not count, and the turn with a move counts only from CUT_TURN degrees: a quick swing of the +// orbiting camera turns 11 to 18 degrees and moves 0.9 to 1.4 m a frame, and taken for a cut at 10 degrees it started a +// new history at every frame of the swing (nine in a row in Hyrule Field), which at FSR's or DLSS's smaller modes showed +// the scene at its render size for those frames, blocky and flickering. Its motion vectors carry it as well as any other +// turn. Each cut is logged, up to 24. +#define CUT_TURN 30.0 // v: the Ocarina scene context's rows 0-2, the view (fg_camera). static void cam_cut(const float *v) { static int on = -1; @@ -1091,7 +1095,7 @@ static void cam_cut(const float *v) { double k = (now - D.cut_ns) / 1e6 / (1000.0 / 60); // 60 Hz frames since the last camera if (k < 0.25) k = 0.25; if (k > 4) k = 4; - if (move > 5.0 * k || (turn > 10.0 * k && move > 0.5 * k)) { + if (move > 5.0 * k || (turn > CUT_TURN * k && move > 0.5 * k)) { D.reset = 1, D.cuts++; if (D.cut_logged < 24) D.cut_logged++, rt_log("dlaa: frame %llu: camera cut (moved %.2f m, turned %.1f degrees in %.1f ms): new " @@ -1816,35 +1820,45 @@ static void release_kept(const struct Size *making, int all) { making->w, making->h, all ? "after a release" : "larger inputs"); } -// The scene's last column and row after a jitter to the left or up. The jitter moves the scene's viewport by under half a -// pixel (vk_dlaa_viewport), which keeps every pixel centre inside it, yet on an RX 7900 XT (AMD's Windows driver) the -// draws of a viewport moved left left the last column out, and of one moved up the last row: the driver evidently limits -// drawing to the whole pixels inside the viewport. In a frame dump (NX2NAVI_DUMP, Hyrule Field, 3416x1440, FSR 4 Native -// AA) the depth's last row kept its clear value through every scene pass and the light target held the fog's colour -// there, which the upscaler blended into a grey line along the bottom and right edges of the picture that flickered with -// the jitter; with NX2NAVI_DLAA_JITTER=0, and without DLSS or FSR, there was no line. Before DLSS or FSR reads the scene, -// such a column or row of the light target and of the depth (which the motion vectors are made from) is filled from the -// one next to it. NX2NAVI_DLAA_EDGE_FILL=0 (test): not filled. -static void edge_fill(VkCommandBuffer cb, const VkExecTarget *t, const VkExecTarget *z, float jx, float jy) { +// The scene's outer columns and rows in a jittered frame. The jitter moves the scene's viewport by under half a pixel +// (vk_dlaa_viewport), which keeps every pixel centre inside it, yet on an RX 7900 XT (AMD's Windows driver) the draws of +// a viewport moved left left the last column out, and of one moved up the last row: the driver evidently limits drawing +// to the whole pixels inside the viewport. In a frame dump (NX2NAVI_DUMP, Hyrule Field, 3416x1440, FSR 4 Native AA) the +// depth's last row kept its clear value through every scene pass and the light target held the fog's colour there, +// which the upscaler blended into a light line along the bottom and right edges of the picture that flickered with the +// jitter; with NX2NAVI_DLAA_JITTER=0, and without DLSS or FSR, there was no line. Before DLSS or FSR reads the scene, the +// outermost column and row on each side of the light target and of the depth (which the motion vectors are made from) +// are filled from the ones next to them, in every jittered frame: filled only after a jitter to the left or up, the line +// stayed gone in every test run, yet a player's clip at Ultra Performance with HDR still showed the sky's colour in the +// last row of about half the frames, and another driver may round the near edge instead. A copied edge costs nothing +// visible: one render pixel at the picture's border, which the upscaler blends with its history. +// NX2NAVI_DLAA_EDGE_FILL=0 (test): not filled. +static void edge_fill(VkCommandBuffer cb, const VkExecTarget *t, const VkExecTarget *z, int jittered) { static int on = -1; if (on < 0) on = rt_knob("DLAA_EDGE_FILL", "1"); uint32_t w = t->width, h = t->height; - if (!on || w < 2 || h < 2 || (jx >= 0 && jy >= 0)) return; + if (!on || !jittered || w < 3 || h < 3) return; static int told; - if (!told++) rt_log("dlaa: the scene's last column or row after a jitter to the left or up is filled from the one before it"); - // the column first, then the row over the whole width, so the corner comes from the filled column + if (!told++) rt_log("dlaa: the scene's outer columns and rows are filled from the ones next to them in each jittered frame"); + // the columns first, then the rows over the whole width, so the corners come from the filled columns for (int pass = 0; pass < 2; pass++) { - if (pass ? jy >= 0 : jx >= 0) continue; - VkOffset3D from = pass ? (VkOffset3D){0, (int32_t)h - 2, 0} : (VkOffset3D){(int32_t)w - 2, 0, 0}; - VkOffset3D to = pass ? (VkOffset3D){0, (int32_t)h - 1, 0} : (VkOffset3D){(int32_t)w - 1, 0, 0}; - VkExtent3D ext = pass ? (VkExtent3D){w, 1, 1} : (VkExtent3D){1, h, 1}; + VkImageCopy r[2][2]; // [image][side] + for (int side = 0; side < 2; side++) { + int32_t end = pass ? (int32_t)h - 1 : (int32_t)w - 1, at = side ? end : 0, next = side ? end - 1 : 1; + VkOffset3D from = pass ? (VkOffset3D){0, next, 0} : (VkOffset3D){next, 0, 0}; + VkOffset3D to = pass ? (VkOffset3D){0, at, 0} : (VkOffset3D){at, 0, 0}; + VkExtent3D ext = pass ? (VkExtent3D){w, 1, 1} : (VkExtent3D){1, h, 1}; + for (int i = 0; i < 2; i++) { + const VkExecTarget *g = i ? z : t; + VkImageAspectFlags a = i ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT; + r[i][side] = (VkImageCopy){.srcSubresource = {a, g->level, g->base_layer, 1}, .srcOffset = from, + .dstSubresource = {a, g->level, g->base_layer, 1}, .dstOffset = to, .extent = ext}; + } + } for (int i = 0; i < 2; i++) { const VkExecTarget *g = i ? z : t; - if (!g->image || g->width != w || g->height != h) continue; - VkImageAspectFlags a = i ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT; - VkImageCopy r = {.srcSubresource = {a, g->level, g->base_layer, 1}, .srcOffset = from, - .dstSubresource = {a, g->level, g->base_layer, 1}, .dstOffset = to, .extent = ext}; - vkCmdCopyImage(cb, g->image, VK_IMAGE_LAYOUT_GENERAL, g->image, VK_IMAGE_LAYOUT_GENERAL, 1, &r); + if (g->image && g->width == w && g->height == h) + vkCmdCopyImage(cb, g->image, VK_IMAGE_LAYOUT_GENERAL, g->image, VK_IMAGE_LAYOUT_GENERAL, 2, r[i]); } full_barrier(cb); } @@ -1880,7 +1894,7 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) { VkImageView zv = vk_exec_target_view(z->img, z->format, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_DEPTH_BIT, z->level, z->base_layer, 1, 0); float jx = D.jit_used ? D.ux : 0.0f, jy = D.jit_used ? D.uy : 0.0f; - edge_fill(cb, t, z, jx, jy); // before the motion vectors read the depth + edge_fill(cb, t, z, D.jit_used); // before the motion vectors read the depth static int no_mv = -1; if (no_mv < 0) no_mv = !rt_knob("DLAA_MV", "1"); // NX2NAVI_DLAA_MV=0: zero motion (test) int masked = 0, mv = no_mv ? 0 : mv_pass(ex, e, zv, jx, jy, char_bias(), &masked);