Presets E (5) and F (6) run on d4r's own Vulkan engine without cooperative matrices: the input and reconstruction kernels translated from the user's DLL (engine/compile_sr_e.py, rr/ptx2rr.py), the network engine/sr/e_net.comp with packed v_pk_fma_f16 accumulation (engine/cnn_sr/mma_f16.glsl, the default head; --head-accumulation f32 keeps the f32 head). Runtime runtime_e.inc (EModel/EEngine), game adapter game_e.cpp, replay d4r-e; the shim serves them from engine\e and engine\f (D4R_ENGINE_MODEL_E_DIR / _F_DIR), LDR or HDR, any render size, not with AutoExposure. build-engine-models.sh builds both. Translator fixes that apply to every translated kernel: .relu on f16/f16x2 fma/add/mul was ignored; add.rz was always taken for the roundf idiom (lost the log1pf correction term); formatted image stores expand at the call site (SPIR-V image type fix); f16 mma.sync m16n8k8/k16, .const loads, shared 16-bit stores, aligned 32-bit arena words (D4R_WORD_ARENA), unified arena. Steam Deck gfx1033: 2.55 ms at 640x360 -> 1280x720, 6.20 ms at 1080p output; Rounded Quality sizes take mid_3x3 (reconstruction 2.44 -> 1.23 ms). Ray Reconstruction CNN presets A-C (compile_rr3.py, the packed RR flavor) stay out of this commit; engine/README.md already documents their tuning.
29 lines
1.4 KiB
C++
29 lines
1.4 KiB
C++
// Adapter between a game's own textures and the preset E/F engine (DLSS 3's CNN, engine/runtime_e.inc): input
|
|
// conversion, the frame and the copy into the game's output texture, all recorded into the game's command buffer.
|
|
#pragma once
|
|
#include "game.h"
|
|
|
|
namespace d4r {
|
|
struct GameFrameE {
|
|
GameImage color, depth, motion, output; // as for GameUpscaler; compatible views at origin zero may be borrowed
|
|
GameImage exposure; // HDR: the game's 1x1 float exposure (a sampled view), else 1
|
|
float jitter[2] = {0, 0};
|
|
float motionScale[2] = {1, 1}; // NGX's MV scale
|
|
bool reset = false;
|
|
};
|
|
class GameUpscalerE {
|
|
public:
|
|
// The model must outlive this object. Render size fixed for its lifetime (a new size needs a new adapter).
|
|
// lowResMotion: motion at the render size (NGX's MVLowRes), otherwise at the output size.
|
|
GameUpscalerE(EModel& model, VkPhysicalDevice physical, VkDevice device, uint32_t outputWidth, uint32_t outputHeight,
|
|
uint32_t renderWidth, uint32_t renderHeight, bool hdr, bool lowResMotion);
|
|
~GameUpscalerE(); // only once every recorded frame has completed on the GPU
|
|
GameUpscalerE(const GameUpscalerE&) = delete;
|
|
GameUpscalerE& operator=(const GameUpscalerE&) = delete;
|
|
void record(VkCommandBuffer command, const GameFrameE& frame);
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> impl;
|
|
};
|
|
} // namespace d4r
|