From 21abf0738abf8947df6085a8ed6f3bb493507e9a Mon Sep 17 00:00:00 2001 From: CompulsiveComputing Date: Sat, 1 Jul 2023 08:38:38 -0700 Subject: [PATCH] Integrate FSR2 automatic building to the project Integrate FSR2 automatic building to the project Better automated FSR2 building Forgot part of the call structure, update the bat to be more verbose --- BuildFSR2.bat | 74 ++++++++++++++ Build_FSR2/Build_FSR2.vcxproj | 140 ++++++++++++++++++++++++++ Build_FSR2/Build_FSR2.vcxproj.filters | 17 ++++ CyberFSR.sln | 33 ++++++ CyberFSR/CyberFSR.vcxproj | 6 ++ README.md | 4 +- 6 files changed, 271 insertions(+), 3 deletions(-) create mode 100644 BuildFSR2.bat create mode 100644 Build_FSR2/Build_FSR2.vcxproj create mode 100644 Build_FSR2/Build_FSR2.vcxproj.filters diff --git a/BuildFSR2.bat b/BuildFSR2.bat new file mode 100644 index 0000000..bc892a4 --- /dev/null +++ b/BuildFSR2.bat @@ -0,0 +1,74 @@ ++@echo off +setlocal +set "origin=%cd%\" +set "buildPath=..\external\FidelityFX-FSR2\build" +set "slnDX12=FSR2_Sample_DX12.sln" +set "slnVK=FSR2_Sample_VK.sln" + +echo Script started on %date% %time% +echo Current working directory: %origin% + +REM Clear old artifacts +echo Clearing old artifacts... +cd /d "%origin%%buildPath%" +if exist "DX12" ( + echo Removing old DX12 artifacts... + rd /s /q "DX12" > nul 2>&1 + if errorlevel 1 ( + echo Failed to remove old DX12 artifacts. + ) else ( + echo Successfully removed old DX12 artifacts. + ) +) +if exist "VK" ( + echo Removing old VK artifacts... + rd /s /q "VK" > nul 2>&1 + if errorlevel 1 ( + echo Failed to remove old VK artifacts. + ) else ( + echo Successfully removed old VK artifacts. + ) +) + +REM Regenerate artifacts +echo Regenerating artifacts... +cd /d "%origin%%buildPath%" +call GenerateSolutions.bat > nul 2>&1 +if errorlevel 1 ( + echo Failed to regenerate artifacts. +) else ( + echo Successfully regenerated artifacts. +) + +REM Build FSR2_Sample_DX12.sln +call :BuildSolution "%origin%%buildPath%\DX12\%slnDX12%" "Debug" "DX12" +call :BuildSolution "%origin%%buildPath%\DX12\%slnDX12%" "RelWithDebInfo" "DX12" + +REM Build FSR2_Sample_VK.sln +call :BuildSolution "%origin%%buildPath%\VK\%slnVK%" "Debug" "VK" +call :BuildSolution "%origin%%buildPath%\VK\%slnVK%" "RelWithDebInfo" "VK" + +cd /d "%origin%" +goto :endofBuildFSR2 + +REM Function to build a solution file +:BuildSolution +set "solutionPath=%~1" +set "configuration=%~2" +if exist "%solutionPath%" ( + echo Building %solutionPath%... + cd /d "%origin%%buildPath%\%~3" + MSBUILD.exe "%solutionPath%" /t:Build /p:Configuration=%configuration% + if errorlevel 1 ( + echo Failed to build %solutionPath%. + ) else ( + echo Successfully built %solutionPath%. + ) +) else ( + echo %solutionPath% not found. Skipping build. +) +exit /b + +:endofBuildFSR2 +echo FSR2 build-script finished on %date% %time% +endlocal diff --git a/Build_FSR2/Build_FSR2.vcxproj b/Build_FSR2/Build_FSR2.vcxproj new file mode 100644 index 0000000..edc3640 --- /dev/null +++ b/Build_FSR2/Build_FSR2.vcxproj @@ -0,0 +1,140 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {e61bcfc0-bc33-46d1-a144-9021fef7f6bc} + BuildFSR2 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + call "..\BuildFSR2.bat" + + + Build / rebuild FSR2 artifacts + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + \ No newline at end of file diff --git a/Build_FSR2/Build_FSR2.vcxproj.filters b/Build_FSR2/Build_FSR2.vcxproj.filters new file mode 100644 index 0000000..a8a6563 --- /dev/null +++ b/Build_FSR2/Build_FSR2.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + \ No newline at end of file diff --git a/CyberFSR.sln b/CyberFSR.sln index 0194284..f592ad2 100644 --- a/CyberFSR.sln +++ b/CyberFSR.sln @@ -4,23 +4,56 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 17.2.32602.215 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CyberFSR", "CyberFSR\CyberFSR.vcxproj", "{8D2B73FB-EECD-45CE-B8E5-335610462F58}" + ProjectSection(ProjectDependencies) = postProject + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC} = {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Build_FSR2", "Build_FSR2\Build_FSR2.vcxproj", "{E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + MinSizeRel|x64 = MinSizeRel|x64 + MinSizeRel|x86 = MinSizeRel|x86 Release|x64 = Release|x64 Release|x86 = Release|x86 + RelWithDebInfo|x64 = RelWithDebInfo|x64 + RelWithDebInfo|x86 = RelWithDebInfo|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {8D2B73FB-EECD-45CE-B8E5-335610462F58}.Debug|x64.ActiveCfg = Debug|x64 {8D2B73FB-EECD-45CE-B8E5-335610462F58}.Debug|x64.Build.0 = Debug|x64 {8D2B73FB-EECD-45CE-B8E5-335610462F58}.Debug|x86.ActiveCfg = Debug|Win32 {8D2B73FB-EECD-45CE-B8E5-335610462F58}.Debug|x86.Build.0 = Debug|Win32 + {8D2B73FB-EECD-45CE-B8E5-335610462F58}.MinSizeRel|x64.ActiveCfg = Release|x64 + {8D2B73FB-EECD-45CE-B8E5-335610462F58}.MinSizeRel|x64.Build.0 = Release|x64 + {8D2B73FB-EECD-45CE-B8E5-335610462F58}.MinSizeRel|x86.ActiveCfg = Release|Win32 + {8D2B73FB-EECD-45CE-B8E5-335610462F58}.MinSizeRel|x86.Build.0 = Release|Win32 {8D2B73FB-EECD-45CE-B8E5-335610462F58}.Release|x64.ActiveCfg = Release|x64 {8D2B73FB-EECD-45CE-B8E5-335610462F58}.Release|x64.Build.0 = Release|x64 {8D2B73FB-EECD-45CE-B8E5-335610462F58}.Release|x86.ActiveCfg = Release|Win32 {8D2B73FB-EECD-45CE-B8E5-335610462F58}.Release|x86.Build.0 = Release|Win32 + {8D2B73FB-EECD-45CE-B8E5-335610462F58}.RelWithDebInfo|x64.ActiveCfg = Release|x64 + {8D2B73FB-EECD-45CE-B8E5-335610462F58}.RelWithDebInfo|x64.Build.0 = Release|x64 + {8D2B73FB-EECD-45CE-B8E5-335610462F58}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 + {8D2B73FB-EECD-45CE-B8E5-335610462F58}.RelWithDebInfo|x86.Build.0 = Release|Win32 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.Debug|x64.ActiveCfg = Debug|x64 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.Debug|x64.Build.0 = Debug|x64 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.Debug|x86.ActiveCfg = Debug|Win32 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.Debug|x86.Build.0 = Debug|Win32 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.MinSizeRel|x64.ActiveCfg = Debug|x64 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.MinSizeRel|x64.Build.0 = Debug|x64 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.MinSizeRel|x86.ActiveCfg = Debug|Win32 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.MinSizeRel|x86.Build.0 = Debug|Win32 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.Release|x64.ActiveCfg = Release|x64 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.Release|x64.Build.0 = Release|x64 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.Release|x86.ActiveCfg = Release|Win32 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.Release|x86.Build.0 = Release|Win32 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.RelWithDebInfo|x64.ActiveCfg = Release|x64 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.RelWithDebInfo|x64.Build.0 = Release|x64 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 + {E61BCFC0-BC33-46D1-A144-9021FEF7F6BC}.RelWithDebInfo|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CyberFSR/CyberFSR.vcxproj b/CyberFSR/CyberFSR.vcxproj index 5e25c4e..25a61f1 100644 --- a/CyberFSR/CyberFSR.vcxproj +++ b/CyberFSR/CyberFSR.vcxproj @@ -162,6 +162,12 @@ vulkan-1.lib;ffx_fsr2_api_x64.lib;ffx_fsr2_api_dx12_x64.lib;ffx_fsr2_api_vk_x64.lib;%(AdditionalDependencies) UseLinkTimeCodeGeneration + + call "..\BuildFSR2.bat" + + + Clear and rebuildall FSR2 artifacts + diff --git a/README.md b/README.md index 3b81112..6789452 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,8 @@ WINEPREFIX=/path/where/the/steam/library/is/steamapps/compatdata/1091500/pfx /bi ### Instructions * Clone this repo with all of its submodules. -* Compile the FSR 2.0 submodule in external/FidelityFX-FSR2 as instructed in [official documentation](https://github.com/GPUOpen-Effects/FidelityFX-FSR2#quick-start-checklist). Note: I used the GenerateSolutionsDLL.bat but I am sure static libraries will work fine too. * Open the CyberFSR.sln with Visual Studio 2022. -* Hit Compile in VS2022, if you compiled the FSR2 in Debug mode, compile CyberFSR in Debug mode, and if you compiled the FSR2 DLLs in Release mode, do the same in CyberFSR. This will result in a DLL in either `[root]/x64/Debug/CyberFSR.dll` or `[root]/x64/Release/nvngx.dll`. -* Copy the compiled `ffx_fsr2_api_dx12_x64.dll` and `ffx_fsr2_api_x64.dll` from the FidelityFX Directory to your Cyberpunk 2077 executable directory. +* Hit Compile in VS2022. This will result in a DLL in either `[root]/x64/Debug/CyberFSR.dll` or `[root]/x64/Release/nvngx.dll`. * Rename the compiled DLL from two steps ago to `nvngx.dll` if it is `CyberFSR.dll`. * Copy `nvngx.dll` to your Cyberpunk 2077 executable directory. * Run the `EnableSignatureOverride.reg` to allow Cyberpunks DLSS implementation to load unsigned DLSS versions