#1544: FSR 3.1 frame generation, a generator choice, one graphics queue and AMD Anti-Lag #1555
No reviewers
Labels
No labels
amd
avatars
bug
builder
cannot-reproduce
crash
epic
feature
from-viewer
gl-removal
known-limitation
monitoring
parity
perf
platform
priority
critical
priority
high
priority
low
priority
medium
provenance
rendering
rt
status
in-progress
status
testing
status
up-next
triage
ui
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sky_line/Slipstream!1555
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "TheSlowly/Slipstream:fsr-framegen"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #1544 (part of #1114, follow-up of #1517 and #1536): frame generation for GPUs that cannot run DLSS frame generation, through AMD's FSR 3.1 frame interpolation and optical flow. AMD's GLSL is vendored next to the FSR upscaler's; the host code is ours, so there is no AMD runtime or DLL and it runs on Windows and Linux.
RenderVKFrameGenSharedQueueforces it for testing.VK_AMD_anti_lag) where the driver offers it, with or without frame generation;RenderVKAntiLag0 turns it off. Nothing changes on other GPUs.RenderVKFrameGenFsrDebug(AMD's generated-frame and reset markers).framegen-generator,framegen-fsr,framegen-queue; docs updated, test plandoc/testplans/1544-frame-generation-fsr.md.Tested in world on Windows (RTX 5070 Ti, exclusive fullscreen): FSR 2x in HDR10 and SDR (colours right on a BGRA8 chain), generated-only view, live DLSS <-> FSR switching, quality-mode change while running, teleport, DLSS unchanged (old-conventions A/B), Preferences lists, debug markers, shared-queue mode with DLSS and FSR (same frame rate as separate queues; alt-tab, minimise, resize, fullscreen, teleport, snapshot, torn-off floater, quit).
Not tested: Linux, AMD and Intel GPUs (FSR on them, the real single-queue drivers, Anti-Lag), older NVIDIA GPUs picking FSR automatically. The last two fixes (a live switch to FSR admits its images again; a quit no longer waits on a present thread left behind holding the shared queue) pass their checks but were not run in world.
Known: on a shared queue the renderer's submits wait for the present thread's IMMEDIATE present. If a driver ever holds such a present, the viewer stalls until it returns (logged); a bounded design (the main thread presenting in shared mode) would be a follow-up.
Rules (llvkframegenpolicy.h, tested): llfg::chooseGenerator picks DLSS where it runs, else FSR, unless RenderVKFrameGenGenerator (new, hidden: 0 automatic, 1 DLSS, 2 FSR) names one; when neither runs the reason shown is DLSS's if the player can act on it, else FSR's. FSR's caps are one generated frame per rendered frame and never driver pacing; a stored multiplier above 2x says "2x (FSR generates one frame per rendered frame)". The add-on's blocks are DLSS's only. The scratch image's format per generator (FSR: RGBA8 on a BGRA8 chain), the generator's own images in the one-set admission, the status prefix ("FSR 2x"). Availability: "needs DLSS upscaling" becomes "needs DLSS or FSR upscaling" (Context::inputsOn, Block::NeedsUpscaler). The FSR upscaler hands frame generation its depth and motion vectors (the same inputs pass as DLSS's) and the main view's camera, and the frame generation chain is built for RenderVKUpscaler 1-11. So DLSS frame generation now also runs with FSR upscaling. LLVKFrameGen asks both generators at startup and keeps each one's answer. The FSR generator (llvkframegenfsr.*) is a placeholder that reports it cannot run, so the choice is DLSS or none, as before; the setting is read at startup. Checks: framegen-policy (new cases, rule GENERATOR), framegen-generator (both upscalers as camera producers, rule INPUTS), framegen-direct and framegen-linux follow the moved code.- The generator's depth / motion copies and its feature are made after one drain, copies first: the feature is given the render size and every present slot's images (fillGenSize), counted by imagesSerial whenever they are made again. Another quality mode makes FSR's feature again; DLSS ignores the render size. No feature is made before the upscaler's inputs exist. - The scratch image is in the generator's format (llfg::scratchFormat: RGBA8 for FSR on a BGRA8 chain); the storage check tests it, and a generated frame that could not be composed is blitted instead of copied when the formats differ. - The generator's own images join the present slots' memory admission (generatorBytes). - fillGenInputs (was fillFrameGenEval) also hands the display's peak, the time since the frame before and the frame's counter. - RenderVKFrameGenGenerator is live: a change asks for a swapchain rebuild, where applyGenerator releases the old feature (present thread drained, device idle), adopts the new generator's caps and asks about driver pacing again. - The 5 s log line starts with the generator and multiplier ("FSR 2x", "DLSS 3x").- The Frame generation tooltip and RenderVKFrameGen's comment: DLSS frame generation needs a GeForce RTX 40 or 50 and the DLSS add-on, FSR frame generation runs on other GPUs at 2x; both need DLSS or FSR upscaling. - The tooltip's status starts with the generator in use and its multiplier ("FSR 2x", "DLSS 3x"). - Check framegen-fsr gains rule TEXT.Frame generation's present thread needed a second queue of the graphics family, and was refused ("cannot present generated frames") where the family has only one: Mesa's RADV and ANV state exactly one in their source, and the same is reported for current Radeon drivers on Windows. FSR frame generation is meant for those GPUs. Where the family has no queue to spare the present thread now shares the renderer's queue (llfg::presentQueueFor, VkDeviceContext:: presentQueueShared): - Every driver call on that queue goes through one lock, VkDeviceContext::QueueLock: the submit and queue-wait wrappers take it for every caller, the two vkQueuePresentKHR sites take it themselves, and the instant replay encoder submits through the viewer's wrapper (a hook) instead of its own entry point. On a device whose present thread has its own queue the lock takes nothing. - The lock holds one driver call and nothing else. It raises nothing; a wait for it is logged after 5 s and ends without the lock only on a device lost meanwhile (no driver call is made then). - A shared queue presents generated frames in IMMEDIATE mode only, so no present sits in the compositor with the lock. A display that offers no IMMEDIATE mode gets a normal chain and the reason Block::NeedsImmediate; the bounded slot wait stays the main thread's only wait for the present thread. - No submit waits for the pacer on a shared queue (the renderer's submits would sit behind it): the present thread waits each gate itself, at most llfg::kGateWaitBoundMs, then presents. - A device wait made while the present thread exists waits the shared queue too, inside the lock. - Reflex stays off on a shared queue (it cannot be marked out of band). - Block::NoPresentQueue is left for a device with no usable queue; a missing pacer clock is Block::Unsupported. RenderVKFrameGenSharedQueue (hidden, read at startup) forces the shared queue on a GPU that has a spare one, for testing. New check framegen-queue (HOOK, LOCK, OWN, DEVICE, BLOCK, CHAIN, GATE, SETTING); policy and swapchain mock tests for the queue choice, the present mode, the gate wait and the lock scopes.08c37c29dfto571f8ee8cb571f8ee8cbtoa2d80e0d14Rebased onto main
b282ecfff1(GPU-loss recovery). The conflicts were the queue / present calls #1546 wraps in VkDriverCallScope: both kept (the queue lock, then the driver-call scope). New commita2d80e0d14: #1547 boundedIdleProof submits on the shared present queue under its lock (framegen-queue). After a recovery FSR frame generation stays off like DLSS (shutdownDirect, no initDirect), as #1550 says. Source checks pass (76).Merged to main in
2834e00bf5; closing.Pull request closed