mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 15:59:59 -04:00
Crashes: the render-target heap (HeapDef DynamicTextureAllocatorMem and its parent) grows with the widescreen picture, so the pause menu no longer reads a null block at 5120x2160; texture uploads keep the game's memory mapped while they copy it, so UnmapPhysicalMemory no longer pulls it away mid-copy; DLSS Frame Generation no longer crashes in Streamline's set-up (physical devices and the window surface go through its proxies, its swapchain images are counted first, resources are tagged per frame); a stale core-wait target is cleared before its thread is freed. Freezes and races: a resize during a swapchain rebuild is kept, a failed frame generation swapchain is retried instead of replaced by a plain one, three acquire timeouts in a row rebuild the swapchain, device waits take the queue lock, a translator child that stops answering times out, an in-flight compute pipeline builds at normal priority, a save Commit started before the window closes finishes and none starts after, a settings change just before closing is saved, and a movie sample taken before a flush is dropped. HDR: Enhanced HDR extends the game's own tonemap so highlights go above the picture's white (the hue slider, which no longer applies, is gone from the menu); frame generation gets a HUD-less picture, the HDR flag and the HDR10 metadata under HDR too. Memory: ASTC textures are encoded to BC3 unless the PC has 20 GiB of VRAM and 48 GiB of RAM, as Windows charges video memory to the commit charge (a long session held 17 GiB of RGBA8 textures and 45.7 GiB of commit on a 32 GiB PC). Shaders: the translator lowers spill-mode programs with more than eight uniform register groups in a wider spill layout, and local loads and stores with a uniform-register address (36029 of the game's 36031 variants translate, 20 failed before). The launcher release ships the shader tools and AMD's FidelityFX library (make_launcher.py --ffx); windres there gets the toolchain on PATH. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
4.9 KiB
C
69 lines
4.9 KiB
C
// DLAA (vk_dlaa.c): NVIDIA DLSS at the scene's own size, behind NX2NAVI_DLAA (nx2navi.ini dlaa = 1).
|
|
#pragma once
|
|
#include "vk.h"
|
|
#include "vk_ffx.h"
|
|
|
|
// The narrowest scene the DLSS pass and the motion passes recognise by its D32F depth: Ultra Performance at a 1080p
|
|
// output renders 640 wide, smaller windows less.
|
|
#define DLAA_SCENE_MIN_W 320u
|
|
|
|
int vk_dlaa_wanted(void); // the setting is on (the device may still lack DLSS)
|
|
int vk_dlaa_fsr3(void);
|
|
// Frame generation (vk_fg.cpp): the depth and motion vectors of the frame DLSS or FSR 3.1 last ran on, with its jitter
|
|
// and whether its history reset; 1 once per evaluation (0: none since the last call). The images stay valid until the
|
|
// next frame's scene draws over them, after this present.
|
|
int vk_dlaa_fg_inputs(VkFfxImage *depth, VkFfxImage *mv, float *jx, float *jy, int *reset);
|
|
// ... their views, and this frame's camera for DLSS Frame Generation (vk_dlssg.c): matrices for row vectors (v * M, the
|
|
// rows stored in order), as Streamline takes them; 0 without a camera that frame.
|
|
typedef struct {
|
|
float view_to_clip[16], clip_to_view[16], clip_to_prev_clip[16], prev_clip_to_clip[16];
|
|
float pos[3], up[3], right[3], fwd[3];
|
|
float fov_y, aspect;
|
|
} VkDlaaCamera;
|
|
int vk_dlaa_fg_views(VkImageView *depth, VkImageView *mv);
|
|
// The picture without the HUD at the size of the game's picture, in *fmt: RGBA8 UNORM bytes like it (sRGB-encoded), or
|
|
// RGBA16F linear with HDR on; made at each evaluation while vk_dlaa_hudless_wanted (frame generation sets it); 1 once per
|
|
// evaluation.
|
|
extern int vk_dlaa_hudless_wanted;
|
|
int vk_dlaa_fg_hudless(VkImage *img, VkImageView *view, uint32_t *w, uint32_t *h, VkFormat *fmt);
|
|
int vk_dlaa_fg_camera(VkDlaaCamera *c); // ... and its temporal upscaler is AMD FSR 3.1 (NX2NAVI_TAA = fsr3) instead of DLSS
|
|
// vk_device.c: NGX's instance and device extensions join the lists (room for max names); vk_dlaa_init after the
|
|
// device exists brings NGX up and checks that DLSS is available.
|
|
void vk_dlaa_instance_exts(const char **ext, uint32_t *n, uint32_t max);
|
|
void vk_dlaa_device_exts(const VkExtensionProperties *have, uint32_t nhave, const char **ext, uint32_t *n, uint32_t max);
|
|
void vk_dlaa_init(void);
|
|
// 1 when dlaa is on and NGX came up with DLSS (after vk_dlaa_init): a DLSS mode's smaller scene is scaled up by DLSS.
|
|
int vk_dlaa_available(void);
|
|
// vk_exec.c vk_exec_pass_begin, once the pass's targets are resolved and before its barrier: arms the frame on the
|
|
// scene's light target or, at the first quarter-width pass after it, runs DLAA on that target. Each present ends the
|
|
// frame (vk_dlaa_frame).
|
|
typedef struct VkExec VkExec;
|
|
void vk_dlaa_pass(VkExec *ex);
|
|
void vk_dlaa_frame(void);
|
|
// vk_exec_draw.c, each draw before its fixed state is recorded: notes the scene camera block (vk_dlaa_draw), and moves
|
|
// the viewport of the scene's draws by the frame's jitter (vk_dlaa_viewport, when the viewport is recorded).
|
|
void vk_dlaa_draw(VkExec *ex);
|
|
void vk_dlaa_viewport(VkExec *ex, VkViewport *v);
|
|
// vk_mvsurvey.c (NX2NAVI_MV_SURVEY): notes the uniform blocks of each scene draw, beside vk_dlaa_draw; each present
|
|
// compares them with the previous frames' and logs a summary now and then.
|
|
void vk_mvsurvey_draw(VkExec *ex);
|
|
void vk_mvsurvey_frame(void);
|
|
void vk_mvprev_draw(VkExec *ex); // vk_mvprev.c: notes the scene draw's object and bone blocks
|
|
// Per-object motion (vk_exec_draw.c): the moving scene draws are listed again during the replay with
|
|
// their vertex shader's last-frame variant; vk_dlaa.c mv_pass records them over the camera motion into ex->cb (and
|
|
// leaves every binding of the replay to be set again; draws whose camera block is not cam are left out).
|
|
// vk_dlaa_prev_camera: last frame's camera block and this frame's jitter, 0 when there is no history.
|
|
int vk_mvobj_execute(VkExec *ex, uint64_t cam, VkImageView mv, VkImageView depth, VkFormat depth_fmt, uint32_t w,
|
|
uint32_t h);
|
|
int vk_dlaa_prev_camera(VkDescriptorBufferInfo *out, float jitter[2]);
|
|
// vk_mvcheck.c (NX2NAVI_MV_CHECK, test): mv_pass hands it the motion image after the camera pass and, after the object
|
|
// pass, the motion image again and the scene light target it ran on; it measures how well the vectors fit the picture.
|
|
void vk_mvcheck_camera(VkCommandBuffer cb, VkImage mv, uint32_t w, uint32_t h, float jx, float jy);
|
|
void vk_mvcheck_final(VkCommandBuffer cb, uint64_t fence, VkImage mv, VkImage cimg, VkFormat cfmt, uint32_t level,
|
|
uint32_t layer, uint32_t w, uint32_t h, float jx, float jy);
|
|
const char *vk_mvobj_frame_masks(void); // vk_exec_draw.c: the last motion list, per position and changed banks
|
|
void vk_mvcheck_output(VkCommandBuffer cb, VkImage out, uint32_t ow, uint32_t oh); // after DLSS on a check frame
|
|
// vk_exec_draw.c, once a draw's fragment shader is known: 1 skips the draw (the game's FXAA while NX2NAVI_FXAA is 0, its
|
|
// scaling draw when DLSS wrote the scaled picture).
|
|
int vk_dlaa_skip_draw(VkExec *ex, const GfxShader *fs);
|