1+ # This file is part of the AMD Work Graph Mesh Node Sample.
2+ #
3+ # Copyright (C) 2024 Advanced Micro Devices, Inc.
4+ #
5+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6+ # of this software and associated documentation files(the "Software"), to deal
7+ # in the Software without restriction, including without limitation the rights
8+ # to use, copy, modify, merge, publish, distribute, sublicense, and /or sell
9+ # copies of the Software, and to permit persons to whom the Software is
10+ # furnished to do so, subject to the following conditions :
11+ #
12+ # The above copyright notice and this permission notice shall be included in
13+ # all copies or substantial portions of the Software.
14+ #
15+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
18+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+ # THE SOFTWARE.
22+
23+ include (FetchContent)
24+
25+ FetchContent_Declare(
26+ ffxsdk
27+ GIT_REPOSITORY https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK
28+ GIT_TAG 55ff22bb6981a9b9c087b9465101769fc0acd447 # fsr3-v3.0.4
29+ )
30+
31+ FetchContent_GetProperties(ffxsdk)
32+
33+ # manually import FidelityFX SDK
34+ if (NOT ffxsdk_POPULATED)
35+ message (STATUS "Downloading FidelityFX SDK" )
36+ FetchContent_Populate(ffxsdk)
37+ message (STATUS "Downloaded FidelityFX SDK to ${ffxsdk_SOURCE_DIR} " )
38+
39+ # set root directory of FidelityFX SDK for patches
40+ set (FFX_ROOT ${ffxsdk_SOURCE_DIR} )
41+ # Apply patches to FidelityFX SDK
42+ include (patch-ffx.cmake)
43+
44+ # don't build any FFX samples
45+ set (BUILD_TYPE FFX_NONE)
46+ # build FFX SDK with Cauldron backend
47+ set (FFX_API CAULDRON)
48+ # enable FSR2 in FFX SDK.
49+ set (FFX_FSR2 ON )
50+ # FFX_FSR is required for FFX_FSR2, but also enables FFX sample, which also requires FFX_FSR1
51+ set (FFX_FSR ON )
52+ set (FFX_FSR1 ON )
53+
54+ # FFX uses CMAKE_HOME_DIRECTORY as root directory for all internal paths
55+ # since FFX is not the top-level repository here, we need to change CMAKE_HOME_DIRECTORY such that all the paths still match up
56+ set (CMAKE_HOME_DIRECTORY ${ffxsdk_SOURCE_DIR} )
57+ add_subdirectory (${ffxsdk_SOURCE_DIR} ${ffxsdk_BINARY_DIR} )
58+
59+ # Move FFX_FSR sample to folder in solution
60+ set_target_properties (FFX_FSR PROPERTIES FOLDER "FFX Samples" )
61+ endif ()
62+
63+ # set root directory of FidelityFX SDK
64+ set (FFX_ROOT ${ffxsdk_SOURCE_DIR} PARENT_SCOPE)
65+
66+ # propagate configurations to top level; only DX12 is supported for this sample
67+ set (CMAKE_CONFIGURATION_TYPES "DebugDX12;ReleaseDX12;RelWithDebInfoDX12" PARENT_SCOPE)
0 commit comments