Fix FSR3 runtime wrapper for local SDK API and real Vulkan resource dispatch

This commit is contained in:
Kelsi 2026-03-08 23:13:08 -07:00
parent f1099f5940
commit 538a1db866
5 changed files with 486 additions and 90 deletions

View file

@ -0,0 +1,72 @@
#pragma once
#include <cstdint>
#include <string>
#include <vulkan/vulkan.h>
namespace wowee::rendering {
struct AmdFsr3RuntimeInitDesc {
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
VkDevice device = VK_NULL_HANDLE;
PFN_vkGetDeviceProcAddr getDeviceProcAddr = nullptr;
uint32_t maxRenderWidth = 0;
uint32_t maxRenderHeight = 0;
uint32_t displayWidth = 0;
uint32_t displayHeight = 0;
VkFormat colorFormat = VK_FORMAT_UNDEFINED;
bool hdrInput = false;
bool depthInverted = false;
};
struct AmdFsr3RuntimeDispatchDesc {
VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
VkImage colorImage = VK_NULL_HANDLE;
VkImage depthImage = VK_NULL_HANDLE;
VkImage motionVectorImage = VK_NULL_HANDLE;
VkImage outputImage = VK_NULL_HANDLE;
uint32_t renderWidth = 0;
uint32_t renderHeight = 0;
uint32_t outputWidth = 0;
uint32_t outputHeight = 0;
VkFormat colorFormat = VK_FORMAT_UNDEFINED;
VkFormat depthFormat = VK_FORMAT_UNDEFINED;
VkFormat motionVectorFormat = VK_FORMAT_R16G16_SFLOAT;
VkFormat outputFormat = VK_FORMAT_UNDEFINED;
float jitterX = 0.0f;
float jitterY = 0.0f;
float motionScaleX = 1.0f;
float motionScaleY = 1.0f;
float frameTimeDeltaMs = 16.67f;
float cameraNear = 0.1f;
float cameraFar = 1000.0f;
float cameraFovYRadians = 1.0f;
bool reset = false;
};
class AmdFsr3Runtime {
public:
AmdFsr3Runtime();
~AmdFsr3Runtime();
bool initialize(const AmdFsr3RuntimeInitDesc& desc);
bool dispatchUpscale(const AmdFsr3RuntimeDispatchDesc& desc);
void shutdown();
bool isReady() const { return ready_; }
const std::string& loadedLibraryPath() const { return loadedLibraryPath_; }
private:
void* libHandle_ = nullptr;
std::string loadedLibraryPath_;
void* scratchBuffer_ = nullptr;
size_t scratchBufferSize_ = 0;
bool ready_ = false;
struct RuntimeFns;
RuntimeFns* fns_ = nullptr;
void* contextStorage_ = nullptr;
};
} // namespace wowee::rendering

View file

@ -51,6 +51,7 @@ class WorldMap;
class QuestMarkerRenderer;
class CharacterPreview;
class Shader;
class AmdFsr3Runtime;
class Renderer {
public:
@ -450,6 +451,7 @@ private:
void* amdScratchBuffer = nullptr;
size_t amdScratchBufferSize = 0;
#endif
std::unique_ptr<AmdFsr3Runtime> amdFsr3Runtime;
// Convergent accumulation: jitter for N frames then freeze
int convergenceFrame = 0;