Fix FG disable state reset and FSR3 context compatibility for SDK variants

This commit is contained in:
Kelsi 2026-03-08 23:32:02 -07:00
parent aa43aa6fc8
commit e600f003ca
2 changed files with 34 additions and 3 deletions

View file

@ -3,6 +3,8 @@
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <type_traits>
#include <utility>
#include <vector>
#include "core/logger.hpp"
@ -48,6 +50,24 @@ FfxErrorCode vkSwapchainConfigureNoop(const FfxFrameGenerationConfig*) {
return FFX_OK;
}
template <typename T, typename = void>
struct HasUpscaleOutputSize : std::false_type {};
template <typename T>
struct HasUpscaleOutputSize<T, std::void_t<decltype(std::declval<T&>().upscaleOutputSize)>> : std::true_type {};
template <typename T>
inline void setUpscaleOutputSizeIfPresent(T& ctxDesc, uint32_t width, uint32_t height) {
if constexpr (HasUpscaleOutputSize<T>::value) {
ctxDesc.upscaleOutputSize.width = width;
ctxDesc.upscaleOutputSize.height = height;
} else {
(void)ctxDesc;
(void)width;
(void)height;
}
}
FfxSurfaceFormat mapVkFormatToFfxSurfaceFormat(VkFormat format, bool isDepth) {
if (isDepth) {
switch (format) {
@ -233,8 +253,7 @@ bool AmdFsr3Runtime::initialize(const AmdFsr3RuntimeInitDesc& desc) {
if (desc.depthInverted) ctxDesc.flags |= FFX_FSR3_ENABLE_DEPTH_INVERTED;
ctxDesc.maxRenderSize.width = desc.maxRenderWidth;
ctxDesc.maxRenderSize.height = desc.maxRenderHeight;
ctxDesc.upscaleOutputSize.width = desc.displayWidth;
ctxDesc.upscaleOutputSize.height = desc.displayHeight;
setUpscaleOutputSizeIfPresent(ctxDesc, desc.displayWidth, desc.displayHeight);
ctxDesc.displaySize.width = desc.displayWidth;
ctxDesc.displaySize.height = desc.displayHeight;
if (!backendShared.fpSwapChainConfigureFrameGeneration) {