Add a native D3D12 FSR Ray Regeneration route for gfx1200/gfx1201, using the game's device and queue with embedded HLSL guide preparation and output composition. Preserve the vkd3d compatibility route for RDNA3 and expose explicit route overrides and diagnostics. Improve Windows runtime compatibility: - Retry rejected application-ID initialization with a project identity. - Defer expensive RR backend creation until feature creation. - Recover from transient submission failures without disabling later frames. - Add shared-buffer export fallbacks through explicit heaps and a private device on the same adapter. - Safely evict old RR descriptor sets when input views change. - Treat requested RR presets as hints when a configured model is available. - Expand SR/RR input formats and handle diffuse/specular hit distances, packed normals, depth-stencil resources, and unused FSR guides. Reduce SR overhead by batching output downloads and format conversion under one completion wait. Optimize strict M enc2/tube attention with bounded FP32 accumulation and the original FP64 fallback for ambiguous rounding cases. Extend RDNA4 tooling with gfx1200/gfx1201 native FP8 RR model builds, capability checks, architecture-aware deployment, and experimental K/M kernel paths. Require matching model and runtime arithmetic families. Add optional embedded FSR shader optimizations keyed by shader hash and exact original SPIR-V contents. Preserve reflected metadata and record optimizer provenance, artifact hashes, and cache identity. Simplify Windows installation with automatic backend dependency downloads, download progress and ETA, backed-up absolute OptiScaler library paths, and recovery from interrupted RR model builds. Add build-kernels.bat and a kernels-only build matrix for all eleven registered RDNA targets, with code-object target validation and SHA256 manifests. Expand conversion probes, numerical stress tests, temporal benchmark tooling, installer/deployment tests, and setup documentation. Document synthetic regression and timing results, experimental build options, and remaining RDNA4 hardware validation requirements.
45 lines
2.5 KiB
C++
45 lines
2.5 KiB
C++
#pragma once
|
|
#include "d3d12_external.h"
|
|
#include "rr_ngx_snapshot.h"
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace d4r::win::rr {
|
|
// Where the experimental FSR Ray Regeneration backend finds its pieces. All paths are explicit: nothing is
|
|
// searched for. The compatibility route uses d4r's amdxc64 shim; native D3D12 uses AMD's real driver.
|
|
struct FsrConfig {
|
|
std::wstring vkd3dCore; // d4r's vkd3d-proton d3d12core.dll, renamed so it cannot collide with the system's
|
|
std::wstring denoiserDll; // AMD's amd_fidelityfx_denoiser_dx12.dll (FidelityFX SDK 2.3), unmodified
|
|
std::wstring amdxcShim; // d4r's amdxc64 shim (tools/windows/amdxc64_shim)
|
|
std::wstring cacheDir; // vkd3d-proton's shader cache: the denoiser's shaders are compiled once
|
|
static FsrConfig from_environment();
|
|
static bool use_native_device();
|
|
};
|
|
|
|
// FSR Ray Regeneration as the Ray Reconstruction backend on native Windows. The game's guides cross to a private
|
|
// vkd3d-proton device (D3D12 over Vulkan, dxil-spirv FP8 emulation) through the same shared packet the native
|
|
// DLSS backend uses; AMD's denoiser runs there. Evaluation is synchronous, as the native backend's is.
|
|
// That is the RDNA3 compatibility route. RDNA4 instead records all three passes on the game's
|
|
// D3D12 device and queue, with no Vulkan device or cross-API packet.
|
|
// The denoiser works at render resolution. When the output is larger (or a Super Sampling stage is wanted at all),
|
|
// the owner installs one with set_super_sampling(): the denoised colour is then copied into a texture on the game's
|
|
// device and handed to that callback together with the frame, which must record/submit the upscale into the game's
|
|
// output on `queue`. Without it an output larger than the render size is refused, never returned noisy.
|
|
class FsrBackend {
|
|
struct Impl;
|
|
std::unique_ptr<Impl> impl;
|
|
public:
|
|
FsrBackend(ID3D12Device* device, const Creation& creation, const FsrConfig& config);
|
|
~FsrBackend();
|
|
FsrBackend(const FsrBackend&) = delete;
|
|
FsrBackend& operator=(const FsrBackend&) = delete;
|
|
using SuperSampling = std::function<void(ID3D12CommandQueue*, ID3D12Resource* denoised, const Snapshot&,
|
|
const std::array<ResourceAccess, Snapshot::Count>&)>;
|
|
void set_super_sampling(SuperSampling stage, const std::array<unsigned, 4>& renderLimits);
|
|
void validate_frame(const Snapshot& frame);
|
|
void evaluate(ID3D12CommandQueue* queue, const Snapshot& frame, const std::array<ResourceAccess, Snapshot::Count>& access);
|
|
void drain();
|
|
};
|
|
}
|