Engine: native presets K and M in the D3D12 shim, wider game coverage
A standalone Vulkan inference engine (engine/) for DLSS presets K and M that runs from weights extracted from the user's own nvngx_dlss.dll, with d4r's own input, network and reconstruction shaders or the native HIP network layers, recorded into the game's command list by the shim. Opt-in ([Engine] Enabled / D4R_ENGINE=1); anything uncovered falls back to the CUDA/ZLUDA path with the reason logged. Byte-identical to NGX's CUDA backend under the phase-capable reference (1706x960 -> 2560x1440, native HIP network, eleven frames, RX 9070 XT): - K render- and display-resolution motion vectors, HDR and LDR - K game-supplied exposure and automatic exposure with any pre-exposure and exposure scale (one residual: effective exposure exactly 2 or 4) - K and M with the DLSS indicator's inverted-axis parameters - M with any exposure settings (NGX ignores them for M) K packages need the current compile_k.py (marker D4RO0003). Also: HIP shared buffers are pooled across feature recreation (ROCm leaks destroyed imports), hipnet.bin must match the preset, M-only games do not load the K model, install_d4r_runtime.sh stages k, k-ldr, m, m-ldr with hip/, the activation table has a generator (gen_activation_m.py), and package_release.sh can bundle the engine's shaders (never its weights). Signed-off-by: woutermans <[email protected]>
This commit is contained in:
1 parent
16cfc1f063
commit
e0d1549a21
82 files changed
+13335
-96
No files matched your search
@@ -0,0 +1,33 @@
|
||||
// Adapter between a game's own textures and the preset M engine: input conversion, the frame and the copy into
|
||||
// the game's output texture, all recorded into the game's command buffer. Separate from GameUpscaler (preset K).
|
||||
#pragma once
|
||||
#include "game.h"
|
||||
|
||||
namespace d4r {
|
||||
struct GameFrameM {
|
||||
GameImage color, depth, motion, output; // as for GameUpscaler; views are not used (inputs are always copied)
|
||||
float jitter[2] = {0, 0};
|
||||
float motionToRender[2] = {1, 1}; // (motion texel + motionOffset) * this = render pixels
|
||||
float motionOffset[2] = {0, 0}; // jittered motion vectors: jitter - previous jitter, motion texel units
|
||||
bool reset = false;
|
||||
bool depthInverted = true;
|
||||
};
|
||||
class GameUpscalerM {
|
||||
public:
|
||||
// The model must outlive this object. The render size is fixed and at most half the output size.
|
||||
GameUpscalerM(MModel& model, VkPhysicalDevice physical, VkDevice device, uint32_t outputWidth, uint32_t outputHeight,
|
||||
uint32_t renderWidth, uint32_t renderHeight, const ExternalNetwork* external = nullptr);
|
||||
~GameUpscalerM(); // only once every recorded frame has completed on the GPU
|
||||
GameUpscalerM(const GameUpscalerM&) = delete;
|
||||
GameUpscalerM& operator=(const GameUpscalerM&) = delete;
|
||||
void record(VkCommandBuffer command, const GameFrameM& frame);
|
||||
// With an external network (ExternalNetwork): the part before it (input copies, exposure, input stage) and the
|
||||
// part after it (expansion, reconstruction, downsample, the copy into the game's output). The network must run
|
||||
// between the two on the GPU; the caller orders them (the shim splits the game's command list there).
|
||||
void recordFront(VkCommandBuffer command, const GameFrameM& frame);
|
||||
void recordBack(VkCommandBuffer command, const GameFrameM& frame);
|
||||
private:
|
||||
struct Impl;
|
||||
std::unique_ptr<Impl> impl;
|
||||
};
|
||||
} // namespace d4r
|
||||
Reference in new issue
Block a user