1
+ # This file is part of the AMD Work Graph Ivy Generation Sample.
2
+ #
3
+ # Copyright (C) 2023 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 CAULDRON)
46
+
47
+ # FFX uses CMAKE_HOME_DIRECTORY as root directory for all internal paths
48
+ # since FFX is not the top-level repository here, we need to change CMAKE_HOME_DIRECTORY such that all the paths still match up
49
+ set (CMAKE_HOME_DIRECTORY ${ffxsdk_SOURCE_DIR} )
50
+ add_subdirectory (${ffxsdk_SOURCE_DIR} ${ffxsdk_BINARY_DIR} )
51
+
52
+ message (STATUS "Downloading FidelityFX SDK media" )
53
+ # Download FFX media
54
+ execute_process (
55
+ COMMAND ${FFX_ROOT} /UpdateMedia.bat
56
+ WORKING_DIRECTORY ${FFX_ROOT} )
57
+
58
+
59
+ # Copy Media to repository root directory
60
+ message (STATUS "Copying FidelityFX SDK media" )
61
+ # Copy Sponza scene
62
+ file (COPY ${FFX_ROOT} /media/SponzaNew DESTINATION ${CMAKE_SOURCE_DIR} /media)
63
+ # Create Textures folder
64
+ file (MAKE_DIRECTORY ${CMAKE_SOURCE_DIR} /media/Textures)
65
+ # Copy BRDF lookup folder
66
+ file (COPY ${FFX_ROOT} /media/Textures/BRDF DESTINATION ${CMAKE_SOURCE_DIR} /media/Textures)
67
+ # Create IBL folder
68
+ file (MAKE_DIRECTORY ${CMAKE_SOURCE_DIR} /media/IBL)
69
+ # Copy IBL folder for procedural skydome
70
+ file (COPY
71
+ ${FFX_ROOT} /media/IBL/mud_road_puresky_Diffuse.dds
72
+ ${FFX_ROOT} /media/IBL/mud_road_puresky_Specular.dds
73
+ ${FFX_ROOT} /media/IBL/LICENSE.md
74
+ DESTINATION
75
+ ${CMAKE_SOURCE_DIR} /media/IBL)
76
+
77
+ endif ()
78
+
79
+ # set root directory of FidelityFX SDK
80
+ set (FFX_ROOT ${ffxsdk_SOURCE_DIR} PARENT_SCOPE)
81
+
82
+ # propagate configurations to top level; only DX12 is supported for this sample
83
+ set (CMAKE_CONFIGURATION_TYPES "DebugDX12;ReleaseDX12;RelWithDebInfoDX12" PARENT_SCOPE)
0 commit comments