Like gpu/vk/fsr2/fsr2.h, the interface knows nothing of the renderer, the settings or the log. The caller gives the
device, the images in the layouts said and the command buffer, and each backend records plain vkCmd* calls into it.
What can't run comes back as a reason in words, which the caller logs. It is the library snx_upscaler, which
tests/vk_hook_upscale.c links without the renderer.
Each backend has a SnxUpscalerCaps (snx_upscaler_caps):
| Field | Says |
|---|---|
kind | temporal (it keeps a history), spatial (one frame) or the copy |
needs | the inputs it can't run without: depth, motion vectors |
takes | the inputs it uses when given: jitter, exposure, a reactive mask |
range | the color it takes: display-referred (LDR), linear and unbounded (HDR), or both |
scale_min, scale_max | the output's size over the render size, on each axis |
sharpens | whether the sharpness does something |
filtered | whether it samples the color with a linear filter, so that the color's format must filter (every backend stores its output, whose format must be one the device stores) |
snx_upscaler_available says whether a backend is built in and the device can run it, and why not.
snx_upscaler_choose takes the preferred backend, the device and what the call has (SnxUpscaleNeeds: the inputs
given, the kinds the caller takes, the color's range, both sizes, and the color's and the output's formats). It tries the preferred one, then Best's order:
DLSS, newer FSR, XeSS, FSR 2, the spatial upscaler, the copy. The first that passes every test runs:
When the preferred one is passed over, the reason comes back with the one that stands in, for the log. When none
passes, the call gets no backend and the reason of the first one it would take that is built in, and runs its own
fallback. So a DLSS evaluation with render_upscaler set to the spatial upscaler still gets FSR 2: it takes temporal
upscalers only. A module that gives no motion vectors gets the spatial upscaler under Best, when it takes one, and the
filtered copy when it doesn't, unless it gives depth and a reprojection matrix (hook ABI 1.2,
Hooks): then gpu/vk/upscaler/reproject.c makes the camera's motion vectors
from the depth before the upscaler runs, and a temporal one takes the frame.
snx_upscaler_create makes a context of one backend for the largest render size it will be given, the output size,
the color's and the output's formats and the conventions (SNX_UP_FLAG_*, the bits of fsr2.h: HDR color, motion vectors at the
output's size, motion vectors that include the jitter, inverted depth, the backend's own exposure).
snx_upscaler_evaluate records one evaluation (SnxUpscaleEval):
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL. The output is in VK_IMAGE_LAYOUT_GENERAL with a storage view, and is
written whole at the context's output sizeA context goes round its descriptors over SNX_UPSCALER_IN_FLIGHT (4) evaluations whose commands haven't finished.
snx_upscaler_destroy needs the device done with them.
Made from docs/layers/gpu/upscalers.md at 69237645142c. GPL-3.0-or-later.