Files
DroidDeck/tools/upscale/layer/fsr412_lite.h
T
The412Banner 74ece6c854 upscale: port Winlator-NeuralScale r5 (non-root parts)
Layer and bridges updated from Winlator-NeuralScale 71c140d9 (michaelisomer-cyber, GPL-3.0):
- full FSR 4.1 on the NPU (S8 graph, U8 fallback), compiled on the device per HTP arch
- ghosting fix: blank far depth when a game sends none, binding 11 bound with 62
- FSR 4.1.2 Lite S8/U8 zero-copy graphs
- Snapdragon GSR 2 on the GPU (new engine sgsr2_gpu)
- D3D11 DLSS through DXVK's interop (nvngx D3D11 entry points)

Left out on purpose: upstream's root-only performance/thermal manager, GPU clock floor and
bypass charging. Kept from DroidDeck: NPU detection by the app (DROIDDECK_UPSCALE_NPU, any HTP
generation incl. the phone's own QNN libraries) instead of upstream's SoC list, DD env names and
log tags, Intel XeSS 3 (runtime still fetched from a0ab6b0f, upstream dropped it in cb3ae04e).

FSR 4.0 on the NPU is gone upstream; the engine id becomes fsr4_1_full_npu and saved
fsr4_0_npu choices map to it. The full-FSR-4-on-Turnip guard is now opt-in
(DROIDDECK_UPSCALE_FULL_OFF_ON_TURNIP=1), since upstream's binding-11 fix targets that black frame.
Data files re-pinned to 71c140d9 (81 core + 8 NPU, sha256 checked).
2026-12-04 18:52:36 -05:00

54 lines
2.5 KiB
C

// Winlator Ludashi AMD FSR 4.1.2 Lite INT8 Pipeline (GPU DP4a + Hexagon HTP v81 NPU)
//
// Uses genuine AMD FidelityFX SDK v2.4.0 FSR 4.1.2 Lite SPIR-V compute shaders (12 passes,
// classic Vulkan descriptor sets, packed 4x8-bit DP4a + FP16 — NO VK_EXT_descriptor_buffer
// and NO shaderInt8 required!) and genuine 27,392-byte weights.bin.
//
// Supports two execution targets on the exact same prepass/postpass contract:
// - GPU mode (use_npu = 0): runs all 12 compute passes directly on Adreno 840 GPU
// - NPU mode (use_npu = 1): runs prepass (0000/0001) + pack -> Hexagon HTP v81 (Sync or Async)
// -> unpack + K1 (0009) + K2 RCAS (0013)
#pragma once
#include <vulkan/vulkan.h>
#include "fsr4_pipeline.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct WlFsr412Lite WlFsr412Lite;
WlFsr412Lite *wl_fsr412_lite_create(const WlVkDispatch *vk, const char *fsr4_dir, const char *power_mode);
void wl_fsr412_lite_destroy(WlFsr412Lite *ctx);
void wl_fsr412_lite_reset(WlFsr412Lite *ctx);
void wl_fsr412_lite_release_sync_events(WlFsr412Lite *ctx);
int wl_fsr412_lite_is_gpu_ready(const WlFsr412Lite *ctx);
int wl_fsr412_lite_is_npu_ready(const WlFsr412Lite *ctx);
const char *wl_fsr412_lite_npu_state(const WlFsr412Lite *ctx);
const char *wl_fsr412_lite_fail_reason(const WlFsr412Lite *ctx);
// Record one FSR 4.1.2 Lite frame (GPU DP4a or Hexagon HTP v81 NPU).
// Returns:
// 2 = Active FSR 4.1.2 Lite frame recorded
// 1 = Warmup/fallback (caller may fall back to FSR 3.1 GPU or blit)
// 0 = Unsupported resolution or missing features/assets (caller should fall back to FSR 3.1 GPU)
int wl_fsr412_lite_dispatch(WlFsr412Lite *ctx, VkCommandBuffer cb,
const WlFsr4FrameDesc *frame,
VkImage color_img, VkFormat color_fmt, uint32_t cw, uint32_t ch,
VkImage depth_img, VkFormat depth_fmt,
VkImage motion_img, VkFormat motion_fmt,
VkImage exp_img, VkFormat exp_fmt,
VkImage out_img, VkFormat out_fmt, VkImageUsageFlags out_usage,
uint32_t ow, uint32_t oh,
int use_npu, int npu_sync, float sharpness,
int *out_used_npu,
uint32_t *out_gpu_us,
uint32_t *out_htp_us,
uint64_t *out_dispatches,
const char **out_reason);
#ifdef __cplusplus
}
#endif