mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add AMD FSR2 SDK detection and backend integration scaffolding
This commit is contained in:
parent
e2a2316038
commit
a24ff375fb
5 changed files with 83 additions and 0 deletions
|
|
@ -22,6 +22,25 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||||
option(WOWEE_BUILD_TESTS "Build tests" OFF)
|
option(WOWEE_BUILD_TESTS "Build tests" OFF)
|
||||||
option(WOWEE_ENABLE_ASAN "Enable AddressSanitizer (Debug builds)" OFF)
|
option(WOWEE_ENABLE_ASAN "Enable AddressSanitizer (Debug builds)" OFF)
|
||||||
|
option(WOWEE_ENABLE_AMD_FSR2 "Enable AMD FidelityFX FSR2 backend when SDK is present" ON)
|
||||||
|
|
||||||
|
# AMD FidelityFX FSR2 SDK detection (drop-in under extern/FidelityFX-FSR2)
|
||||||
|
set(WOWEE_AMD_FSR2_DIR ${CMAKE_SOURCE_DIR}/extern/FidelityFX-FSR2)
|
||||||
|
set(WOWEE_AMD_FSR2_HEADER ${WOWEE_AMD_FSR2_DIR}/src/ffx-fsr2-api/ffx_fsr2.h)
|
||||||
|
if(WOWEE_ENABLE_AMD_FSR2 AND EXISTS ${WOWEE_AMD_FSR2_HEADER})
|
||||||
|
message(STATUS "AMD FSR2 SDK detected at ${WOWEE_AMD_FSR2_DIR}")
|
||||||
|
add_compile_definitions(WOWEE_HAS_AMD_FSR2=1)
|
||||||
|
include_directories(
|
||||||
|
${WOWEE_AMD_FSR2_DIR}/src
|
||||||
|
${WOWEE_AMD_FSR2_DIR}/src/ffx-fsr2-api
|
||||||
|
${WOWEE_AMD_FSR2_DIR}/src/ffx-fsr2-api/vk
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_compile_definitions(WOWEE_HAS_AMD_FSR2=0)
|
||||||
|
if(WOWEE_ENABLE_AMD_FSR2)
|
||||||
|
message(WARNING "AMD FSR2 SDK not found at ${WOWEE_AMD_FSR2_DIR}; using internal fallback implementation.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Opcode registry generation/validation
|
# Opcode registry generation/validation
|
||||||
find_package(Python3 COMPONENTS Interpreter QUIET)
|
find_package(Python3 COMPONENTS Interpreter QUIET)
|
||||||
|
|
|
||||||
50
docs/AMD_FSR2_INTEGRATION.md
Normal file
50
docs/AMD_FSR2_INTEGRATION.md
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
# AMD FSR2 Integration Notes
|
||||||
|
|
||||||
|
This project currently has two FSR2 states:
|
||||||
|
|
||||||
|
- `AMD FidelityFX SDK` backend (preferred): enabled when SDK sources are present.
|
||||||
|
- `Internal fallback` backend: used when SDK is missing.
|
||||||
|
|
||||||
|
## SDK Location
|
||||||
|
|
||||||
|
Drop AMD's official FSR2 repo at:
|
||||||
|
|
||||||
|
`extern/FidelityFX-FSR2`
|
||||||
|
|
||||||
|
Expected header for detection:
|
||||||
|
|
||||||
|
`extern/FidelityFX-FSR2/src/ffx-fsr2-api/ffx_fsr2.h`
|
||||||
|
|
||||||
|
## Build Flags
|
||||||
|
|
||||||
|
- `WOWEE_ENABLE_AMD_FSR2=ON` (default): try to use AMD SDK if detected.
|
||||||
|
- `WOWEE_HAS_AMD_FSR2` compile define:
|
||||||
|
- `1` when SDK header is found.
|
||||||
|
- `0` otherwise (fallback path).
|
||||||
|
|
||||||
|
## Current Status
|
||||||
|
|
||||||
|
- CMake detects the SDK and defines `WOWEE_HAS_AMD_FSR2`.
|
||||||
|
- UI shows active FSR2 backend label in settings.
|
||||||
|
- Runtime logs clearly indicate whether AMD SDK is available.
|
||||||
|
|
||||||
|
## Remaining Work (to finish official AMD path)
|
||||||
|
|
||||||
|
1. Add backend wrapper around `FfxFsr2Context` and Vulkan backend helpers.
|
||||||
|
2. Feed required inputs each frame:
|
||||||
|
- Color, depth, motion vectors
|
||||||
|
- Jitter offsets
|
||||||
|
- Delta time and render/display resolution
|
||||||
|
- Exposure / reactive mask as needed
|
||||||
|
3. Replace custom compute accumulation path with `ffxFsr2ContextDispatch`.
|
||||||
|
4. Keep current fallback path behind a runtime switch for safety.
|
||||||
|
5. Add a debug overlay:
|
||||||
|
- Backend in use
|
||||||
|
- Internal resolution
|
||||||
|
- Jitter values
|
||||||
|
- Motion vector validity stats
|
||||||
|
6. Validate with fixed camera + movement sweeps:
|
||||||
|
- Static shimmer
|
||||||
|
- Moving blur/ghosting
|
||||||
|
- Fine geometry stability
|
||||||
|
|
||||||
|
|
@ -270,6 +270,11 @@ public:
|
||||||
float getFSRSharpness() const { return fsr_.sharpness; }
|
float getFSRSharpness() const { return fsr_.sharpness; }
|
||||||
void setFSR2Enabled(bool enabled);
|
void setFSR2Enabled(bool enabled);
|
||||||
bool isFSR2Enabled() const { return fsr2_.enabled; }
|
bool isFSR2Enabled() const { return fsr2_.enabled; }
|
||||||
|
#if WOWEE_HAS_AMD_FSR2
|
||||||
|
bool isAmdFsr2SdkAvailable() const { return true; }
|
||||||
|
#else
|
||||||
|
bool isAmdFsr2SdkAvailable() const { return false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
void setWaterRefractionEnabled(bool enabled);
|
void setWaterRefractionEnabled(bool enabled);
|
||||||
bool isWaterRefractionEnabled() const;
|
bool isWaterRefractionEnabled() const;
|
||||||
|
|
|
||||||
|
|
@ -3739,6 +3739,11 @@ bool Renderer::initFSR2Resources() {
|
||||||
LOG_INFO("FSR2: initializing at ", fsr2_.internalWidth, "x", fsr2_.internalHeight,
|
LOG_INFO("FSR2: initializing at ", fsr2_.internalWidth, "x", fsr2_.internalHeight,
|
||||||
" -> ", swapExtent.width, "x", swapExtent.height,
|
" -> ", swapExtent.width, "x", swapExtent.height,
|
||||||
" (scale=", fsr2_.scaleFactor, ")");
|
" (scale=", fsr2_.scaleFactor, ")");
|
||||||
|
#if WOWEE_HAS_AMD_FSR2
|
||||||
|
LOG_INFO("FSR2: AMD FidelityFX SDK detected at build time.");
|
||||||
|
#else
|
||||||
|
LOG_WARNING("FSR2: AMD FidelityFX SDK not detected; using internal fallback path.");
|
||||||
|
#endif
|
||||||
|
|
||||||
VkFormat colorFmt = vkCtx->getSwapchainFormat();
|
VkFormat colorFmt = vkCtx->getSwapchainFormat();
|
||||||
VkFormat depthFmt = vkCtx->getDepthFormat();
|
VkFormat depthFmt = vkCtx->getDepthFormat();
|
||||||
|
|
|
||||||
|
|
@ -6311,6 +6311,10 @@ void GameScreen::renderSettingsWindow() {
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
if (fsrMode > 0) {
|
if (fsrMode > 0) {
|
||||||
|
if (fsrMode == 2 && renderer) {
|
||||||
|
ImGui::TextDisabled("FSR2 backend: %s",
|
||||||
|
renderer->isAmdFsr2SdkAvailable() ? "AMD FidelityFX SDK" : "Internal fallback");
|
||||||
|
}
|
||||||
const char* fsrQualityLabels[] = { "Ultra Quality (77%)", "Quality (67%)", "Balanced (59%)", "Performance (50%)" };
|
const char* fsrQualityLabels[] = { "Ultra Quality (77%)", "Quality (67%)", "Balanced (59%)", "Performance (50%)" };
|
||||||
static const float fsrScaleFactors[] = { 0.77f, 0.67f, 0.59f, 0.50f };
|
static const float fsrScaleFactors[] = { 0.77f, 0.67f, 0.59f, 0.50f };
|
||||||
if (ImGui::Combo("FSR Quality", &pendingFSRQuality, fsrQualityLabels, 4)) {
|
if (ImGui::Combo("FSR Quality", &pendingFSRQuality, fsrQualityLabels, 4)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue