@@ -6,6 +6,7 @@ project(Diligent-SuperResolution CXX)
66
77set (DILIGENT_DLSS_SUPPORTED FALSE CACHE INTERNAL "DLSS is not supported" )
88set (DILIGENT_DSR_SUPPORTED FALSE CACHE INTERNAL "DirectSR is not supported" )
9+ set (DILIGENT_FSR_SUPPORTED TRUE CACHE INTERNAL "FSR is not supported" )
910
1011if (PLATFORM_WIN32 AND NOT MINGW_BUILD AND CMAKE_SIZEOF_VOID_P EQUAL 8)
1112 if (D3D11_SUPPORTED OR D3D12_SUPPORTED OR VULKAN_SUPPORTED)
@@ -22,6 +23,9 @@ endif()
2223if (${DILIGENT_NO_DSR} )
2324 set (DILIGENT_DSR_SUPPORTED FALSE CACHE INTERNAL "DirectSR is forcibly disabled" )
2425endif ()
26+ if (${DILIGENT_NO_FSR} )
27+ set (DILIGENT_FSR_SUPPORTED FALSE CACHE INTERNAL "FSR is forcibly disabled" )
28+ endif ()
2529
2630if (DILIGENT_DSR_SUPPORTED)
2731 # Fetch DirectSR headers
@@ -61,6 +65,35 @@ set(SOURCE
6165 src/SuperResolutionFactory.cpp
6266)
6367
68+ if (DILIGENT_FSR_SUPPORTED)
69+ set (FSR_SHADERS
70+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/FSR_FullQuad.fx
71+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/FSRStructures.fxh
72+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/FSR_EdgeAdaptiveUpsampling.fx
73+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/FSR_ContrastAdaptiveSharpening.fx
74+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/fsr1/ffx_common_types.h
75+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/fsr1/ffx_core.h
76+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/fsr1/ffx_core_glsl.h
77+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/fsr1/ffx_core_gpu_common.h
78+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/fsr1/ffx_core_gpu_common_half.h
79+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/fsr1/ffx_core_hlsl.h
80+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/fsr1/ffx_core_portability.h
81+ ${CMAKE_CURRENT_SOURCE_DIR} /shaders/fsr1/ffx_fsr1.h
82+ )
83+ set_source_files_properties (${FSR_SHADERS} PROPERTIES VS_TOOL_OVERRIDE "None" )
84+
85+ # Convert shaders to headers and generate master header with the list of all files
86+ set (FSR_SHADER_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} /shaders_inc/FSR)
87+ file (MAKE_DIRECTORY ${FSR_SHADER_OUTPUT_DIR} )
88+ set (FSR_SHADERS_LIST_FILE ${FSR_SHADER_OUTPUT_DIR} /FSRShaderList.h)
89+ convert_shaders_to_headers ("${FSR_SHADERS} " ${FSR_SHADER_OUTPUT_DIR} ${FSR_SHADERS_LIST_FILE} FSR_SHADERS_INC_LIST )
90+
91+ list (APPEND SOURCE src/FSRProvider.cpp)
92+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
93+ set_source_files_properties (src/FSRProvider.cpp PROPERTIES COMPILE_OPTIONS "-Wno-unused-function" )
94+ endif ()
95+ endif ()
96+
6497if (DILIGENT_DLSS_SUPPORTED)
6598 list (APPEND INCLUDE include /SuperResolutionDLSS.hpp)
6699 list (APPEND SOURCE src/SuperResolutionDLSS.cpp)
@@ -92,9 +125,17 @@ target_include_directories(Diligent-SuperResolutionInterface INTERFACE interface
92125target_compile_definitions (Diligent-SuperResolutionInterface INTERFACE SUPER_RESOLUTION_SUPPORTED=1 )
93126
94127add_library (Diligent-SuperResolution-static STATIC
95- ${SOURCE} ${INTERFACE} ${INCLUDE}
128+ ${SOURCE}
129+ ${INTERFACE}
130+ ${INCLUDE}
131+ ${FSR_SHADERS}
132+ ${FSR_SHADERS_INC_LIST}
133+ ${FSR_SHADERS_LIST_FILE}
96134 readme.md
97135)
136+ source_group ("shaders/FSR" FILES ${FSR_SHADERS} )
137+ source_group ("generated/FSR" FILES ${FSR_SHADERS_INC_LIST} ${FSR_SHADERS_LIST_FILE} )
138+
98139add_library (Diligent-SuperResolution-shared SHARED
99140 readme.md
100141)
@@ -129,6 +170,11 @@ if(DILIGENT_DSR_SUPPORTED)
129170 endif ()
130171endif ()
131172
173+ if (DILIGENT_FSR_SUPPORTED)
174+ target_compile_definitions (Diligent-SuperResolution-static PRIVATE DILIGENT_FSR_SUPPORTED=1 )
175+ target_include_directories (Diligent-SuperResolution-static PRIVATE ${FSR_SHADER_OUTPUT_DIR} )
176+ endif ()
177+
132178target_compile_definitions (Diligent-SuperResolution-shared PUBLIC DILIGENT_SUPER_RESOLUTION_SHARED=1 )
133179
134180target_link_libraries (Diligent-SuperResolution-static
@@ -139,6 +185,7 @@ PRIVATE
139185 Diligent-Common
140186 Diligent-GraphicsAccessories
141187 Diligent-ShaderTools
188+ Diligent-GraphicsTools
142189)
143190
144191if (DILIGENT_DSR_SUPPORTED)
0 commit comments