mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 02:39:57 -04:00
Give Streamline constants and null tags on a frame without inputs while frame generation is on.
A review of the DLSS and frame generation paths against NVIDIA's guides (the DLSS programming guide 310.6.0, the DLSS-FG guide 310.7.0, Streamline 2.14.16's guides and headers). What follows them: the texture bias (log2(render width / output width) - 1 on top of the game's own, at each change of the mode), the jitter (Halton, 8 x (output / render)^2 phases and 16 at least, in render pixels within half a pixel, the scene drawn with it and the motion vectors made without it), the creation flags (HDR, vectors at the render size, auto-exposure, depth not inverted) and the constants Streamline gets (unjittered matrices, the jitter in pixels, the vectors' scale of one over the render size). What did not: vk_dlssg.c holds a change of generation's state for FG_SETTLE_FRAMES frames, so for up to 12 frames after the depth, the motion vectors or the camera went away (a menu, a fade, a load) generation stayed on and nx2sl_frame set no constants and tagged nothing. Streamline's guide asks for the constants at every frame and for null tags where depth or motion vectors are not valid; it logged "Unable to find 'common' constants for frame" and "Failed to find global tag 'kBufferTypeDepth'" and used the frame before's (in every play log with frame generation). Such a frame now gets the last frame's constants with reset set and the three tags as null. Not run in a game yet: nx2navi_dlssg.dll builds and exports its 15 functions. What the guides leave open: the sign of the jitter offsets against the shift of the picture, which NVIDIA says to find by trying, and the bias reaches only the tiled, trilinear samplers, not every texture of the scene. For both there is a test switch now, read once: NX2NAVI_DLAA_JITTER_TEST=<x>,<y> tells the upscaler the jitter times two factors, and NX2NAVI_DLSS_LOD_BIAS_TEST=<bias> puts a bias in the rule's place. Neither was measured: the runs that would do it start the game. The line about the presents a second (the commit before) came at 59 a second under a limit of 60: it comes under 56 now. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -237,6 +237,26 @@ extern "C" NX2SL_API int nx2sl_frame(VkCommandBuffer cb, const Nx2SlImage *depth
|
||||
uint32_t max = g_max.load();
|
||||
int n = enable > 0 ? enable : 0;
|
||||
if (n > (int)(max ? max : 1)) n = (int)(max ? max : 1);
|
||||
static sl::Constants last; // the constants of the last frame that had its inputs
|
||||
static bool have_last;
|
||||
if (n && !(depth && mv && cam) && have_last) {
|
||||
// Generation is on for this present and the frame has no depth, motion vectors or camera: a menu, a fade or a
|
||||
// load, while vk_dlssg.c holds the change of state for a few frames. Streamline's guide asks for the common
|
||||
// constants at every frame and for null tags wherever depth or motion vectors are not valid
|
||||
// (ProgrammingGuideDLSS_G.md 5.2 and 7.0). This frame gave neither, and Streamline logged "Unable to find
|
||||
// 'common' constants for frame" and "Failed to find global tag 'kBufferTypeDepth'" and went on with what the
|
||||
// frame before had set. It gets the last frame's constants again, as a new start, and the three tags as null.
|
||||
sl::Constants c = last;
|
||||
c.reset = sl::Boolean::eTrue;
|
||||
p_constants(c, *t, vp);
|
||||
sl::ResourceTag none[3] = {sl::ResourceTag(nullptr, sl::kBufferTypeDepth, sl::ResourceLifecycle::eValidUntilPresent),
|
||||
sl::ResourceTag(nullptr, sl::kBufferTypeMotionVectors, sl::ResourceLifecycle::eValidUntilPresent),
|
||||
sl::ResourceTag(nullptr, sl::kBufferTypeHUDLessColor, sl::ResourceLifecycle::eValidUntilPresent)};
|
||||
if ((t = token(frame))) p_tag(*t, vp, none, 3, (sl::CommandBuffer *)cb);
|
||||
static int said;
|
||||
if (!said++) say("dlssg: a frame without depth and motion vectors while generation is on gets the last constants "
|
||||
"as a new start and null tags");
|
||||
}
|
||||
if (n && depth && mv && cam) {
|
||||
sl::Constants c{};
|
||||
matrix(c.cameraViewToClip, cam->view_to_clip);
|
||||
@@ -259,6 +279,7 @@ extern "C" NX2SL_API int nx2sl_frame(VkCommandBuffer cb, const Nx2SlImage *depth
|
||||
c.motionVectors3D = sl::Boolean::eFalse;
|
||||
c.reset = cam->reset ? sl::Boolean::eTrue : sl::Boolean::eFalse;
|
||||
p_constants(c, *t, vp);
|
||||
last = c, have_last = true;
|
||||
sl::Resource rd = resource(depth), rm = resource(mv), rh = hudless ? resource(hudless) : sl::Resource{};
|
||||
sl::Extent ed{0, 0, depth->width, depth->height}, em{0, 0, mv->width, mv->height};
|
||||
sl::Extent eh{0, 0, hudless ? hudless->width : 0, hudless ? hudless->height : 0};
|
||||
|
||||
Reference in New Issue
Block a user