Fix FSR3 permutation script failures on arm64 Linux and Windows

Linux arm64 (Exec format error):
- The script was downloading the x86_64 DXC release on all Linux hosts;
  on aarch64 runners the x86_64 ELF fails with EXEC_FORMAT_ERROR at
  shader compilation time. Add uname -m guard: when running on aarch64/
  arm64 Linux without a DXC in PATH, exit 0 with an advisory message
  rather than downloading an incompatible binary. The FSR3 SDK build
  proceeds as it did before the permutation script was introduced
  (permutation headers are expected to be pre-built in the SDK checkout).

Windows (bash: command not found, exit 127):
- cmake custom-target COMMANDs run via cmd.exe on Windows even when
  cmake is configured from a MSYS2 shell, so bare 'bash' is not resolved.
- Use find_program(BASH_EXECUTABLE bash) at configure time (which runs
  under shell: msys2 in CI and thus finds the MSYS2 bash at its native
  Windows-absolute path). When bash is found, embed the full path in the
  COMMAND; when not found (unusual non-MSYS2 Windows setups), skip the
  permutation step and emit a STATUS message.
This commit is contained in:
Kelsi 2026-03-09 13:11:03 -07:00
parent 6a7287bde3
commit e2b89c9b42
2 changed files with 53 additions and 16 deletions

View file

@ -156,23 +156,53 @@ if(WOWEE_ENABLE_AMD_FSR3_FRAMEGEN AND WOWEE_AMD_FFX_SDK_KITS_READY)
set(WOWEE_AMD_FSR3_RUNTIME_BUILD_TYPE Release)
endif()
add_custom_target(wowee_fsr3_official_runtime_build
COMMAND ${CMAKE_COMMAND}
-S ${WOWEE_AMD_FFX_SDK_KITS_DIR}
-B ${WOWEE_AMD_FSR3_RUNTIME_BUILD_DIR}
-DCMAKE_BUILD_TYPE=${WOWEE_AMD_FSR3_RUNTIME_BUILD_TYPE}
-DFFX_BUILD_VK=ON
-DFFX_BUILD_FRAMEGENERATION=ON
-DFFX_BUILD_UPSCALER=ON
COMMAND bash ${CMAKE_SOURCE_DIR}/tools/generate_ffx_sdk_vk_permutations.sh
${CMAKE_SOURCE_DIR}/extern/FidelityFX-SDK
COMMAND ${CMAKE_COMMAND}
--build ${WOWEE_AMD_FSR3_RUNTIME_BUILD_DIR}
--config $<CONFIG>
--parallel
COMMENT "Building native AMD FSR3 runtime (Path A) from FidelityFX-SDK Kits"
VERBATIM
# Locate bash at configure time so the build-time COMMAND works on Windows
# (cmake custom commands run via cmd.exe on Windows, so bare 'bash' is not found).
find_program(BASH_EXECUTABLE bash
HINTS
/usr/bin
/bin
"${MSYS2_PATH}/usr/bin"
"$ENV{MSYS2_PATH}/usr/bin"
"C:/msys64/usr/bin"
"D:/msys64/usr/bin"
)
if(BASH_EXECUTABLE)
add_custom_target(wowee_fsr3_official_runtime_build
COMMAND ${CMAKE_COMMAND}
-S ${WOWEE_AMD_FFX_SDK_KITS_DIR}
-B ${WOWEE_AMD_FSR3_RUNTIME_BUILD_DIR}
-DCMAKE_BUILD_TYPE=${WOWEE_AMD_FSR3_RUNTIME_BUILD_TYPE}
-DFFX_BUILD_VK=ON
-DFFX_BUILD_FRAMEGENERATION=ON
-DFFX_BUILD_UPSCALER=ON
COMMAND ${BASH_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/generate_ffx_sdk_vk_permutations.sh
${CMAKE_SOURCE_DIR}/extern/FidelityFX-SDK
COMMAND ${CMAKE_COMMAND}
--build ${WOWEE_AMD_FSR3_RUNTIME_BUILD_DIR}
--config $<CONFIG>
--parallel
COMMENT "Building native AMD FSR3 runtime (Path A) from FidelityFX-SDK Kits"
VERBATIM
)
else()
message(STATUS "bash not found; VK permutation headers will not be auto-generated")
add_custom_target(wowee_fsr3_official_runtime_build
COMMAND ${CMAKE_COMMAND}
-S ${WOWEE_AMD_FFX_SDK_KITS_DIR}
-B ${WOWEE_AMD_FSR3_RUNTIME_BUILD_DIR}
-DCMAKE_BUILD_TYPE=${WOWEE_AMD_FSR3_RUNTIME_BUILD_TYPE}
-DFFX_BUILD_VK=ON
-DFFX_BUILD_FRAMEGENERATION=ON
-DFFX_BUILD_UPSCALER=ON
COMMAND ${CMAKE_COMMAND}
--build ${WOWEE_AMD_FSR3_RUNTIME_BUILD_DIR}
--config $<CONFIG>
--parallel
COMMENT "Building native AMD FSR3 runtime (Path A) from FidelityFX-SDK Kits (no permutation bootstrap)"
VERBATIM
)
endif()
add_custom_target(wowee_fsr3_official_runtime_copy
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}

View file

@ -35,6 +35,13 @@ if [[ -z "${DXC:-}" ]]; then
elif command -v dxc >/dev/null 2>&1; then
export DXC="$(command -v dxc)"
elif [[ "$(uname -s)" == "Linux" ]]; then
_arch="$(uname -m)"
if [[ "$_arch" == "aarch64" || "$_arch" == "arm64" ]]; then
echo "Linux aarch64: no official arm64 DXC release available." >&2
echo "Install 'directx-shader-compiler' via apt or set DXC=/path/to/dxc to regenerate." >&2
echo "Skipping VK permutation codegen (permutations may be pre-built in the SDK checkout)."
exit 0
fi
echo "DXC not found; downloading Linux DXC release to /tmp/dxc ..."
tmp_json="$(mktemp)"
curl -sS https://api.github.com/repos/microsoft/DirectXShaderCompiler/releases/latest > "$tmp_json"