mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 06:09:58 -04:00
Give frame generation and FSR the scene's own near and far planes, field of view and units.
DLSS frame generation (Streamline and the NGX path) and FSR 3.1 and 4 upscaling and frame generation were told the depth came from a camera with near 0.1 and no far plane. Ocarina's projection has a finite far plane that changes with the camera: in Hyrule Field its z row is (-1.00001, -0.200001), near 0.1 and far about 25,000; the camera before it had far about 1,000. With the far plane taken as missing, a surface 10,000 units away was read as 16,650. The planes, and whether the depth is inverted, now come from the frame's projection and the device's depth mode every frame (vk_dlaa.c proj_planes), with one log line when they change. The stored depth is already 0 near and 1 far: the -w..w clip depth the pipelines keep maps to exactly what a 0..w projection with the same planes stores, and a frame dump's scene depth spans 0.975 to 1.0. FSR's contexts lose their infinite-depth flag and take the far plane from each dispatch. FSR frame generation now gets the camera's field of view instead of a fixed 1 radian, and the upscaler gets it too (its caller passed 0). The view's units are metres, not the centimetres FSR was told: the camera orbits Link about 4 units behind him at about 3 units a second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,12 @@ typedef struct {
|
||||
int storage; // created with VK_IMAGE_USAGE_STORAGE_BIT (FSR writes it)
|
||||
} VkFfxImage;
|
||||
|
||||
// The scene camera FSR takes, from the frame's projection (vk_dlaa.c proj_planes): the vertical field of view in
|
||||
// radians, the near and far planes' view distances (far: VK_DLAA_FAR_INFINITE, 1e8, for a projection without a far
|
||||
// plane) and the metres in one unit of view space. A field of 0 is not known, and FSR then gets 1 radian, 0.1, 1e8 and
|
||||
// 1.
|
||||
typedef struct { float fov_y, znear, zfar, meters; } VkFfxCamera;
|
||||
|
||||
int vk_ffx_load(void); // 1 when the library is there with its entry points (loaded once)
|
||||
// Whether FSR 3.1 upscaling can run in this build, for the settings menu: after vk_ffx_load ran, what it found; before,
|
||||
// whether the library file is there, asked once without loading it. 0 where the build has no FSR 3.1 to load.
|
||||
@@ -17,10 +23,10 @@ int vk_ffx_available(void);
|
||||
// rest below), not only an upscaler.
|
||||
int vk_ffx_framegen_available(void);
|
||||
// Records FSR 3.1 into cb: color (the scene light, render size), depth (D32F), mv (R16G16F, render pixels, current to
|
||||
// previous), out (the output size, RGBA16F, storage). jx, jy: the jitter the scene took, render pixels. fov_y in
|
||||
// radians (0: unknown). 0 on failure (the caller falls back as it does when DLSS fails).
|
||||
// previous), out (the output size, RGBA16F, storage). jx, jy: the jitter the scene took, render pixels. cam: the
|
||||
// frame's camera. 0 on failure (the caller falls back as it does when DLSS fails).
|
||||
int vk_ffx_upscale(VkCommandBuffer cb, const VkFfxImage *color, const VkFfxImage *depth, const VkFfxImage *mv,
|
||||
const VkFfxImage *out, float jx, float jy, int reset, float dt_ms, float fov_y);
|
||||
const VkFfxImage *out, float jx, float jy, int reset, float dt_ms, const VkFfxCamera *cam);
|
||||
void vk_ffx_release(void); // before the device goes away
|
||||
// FSR 3.1's contexts that no upscale used in the last `recent` calls, destroyed with the device idle (the caller waited
|
||||
// for it): room for an FSR 4 context whose creation failed. Their count.
|
||||
@@ -36,7 +42,8 @@ int vk_ffx4_available(void); // the libraries are there and list a 4.x vers
|
||||
// device, from any thread (0 before the device exists)
|
||||
const char *vk_ffx4_name(void); // "AMD FSR 4.1.2" once vk_ffx4_available found it
|
||||
int vk_ffx4_upscale(VkCommandBuffer cb, const VkFfxImage *color, const VkFfxImage *depth, const VkFfxImage *mv,
|
||||
const VkFfxImage *out, float jx, float jy, int reset, float dt_ms, float fov_y); // as vk_ffx_upscale
|
||||
const VkFfxImage *out, float jx, float jy, int reset, float dt_ms,
|
||||
const VkFfxCamera *cam); // as vk_ffx_upscale
|
||||
void vk_ffx4_release(void);
|
||||
int vk_ffx4_failed(void); // it failed three times in a row: FSR 3.1 serves until vk_ffx4_retry
|
||||
void vk_ffx4_retry(void); // the menu chose FSR 4 again: try it anew after such failures
|
||||
|
||||
Reference in New Issue
Block a user