Skip to content

Instantly share code, notes, and snippets.

@coderespawn
Last active September 26, 2023 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderespawn/16e761a006fedf2e341cc9f17a10971d to your computer and use it in GitHub Desktop.
Save coderespawn/16e761a006fedf2e341cc9f17a10971d to your computer and use it in GitHub Desktop.
Upgrades and builds the DLSS Unreal Engine Plugin from 5.2 to 5.3
import os
import shutil
import subprocess
# Step 0: Delete 'Plugins_Temp' and 'Plugins_5.3' directories if they exist
if os.path.exists('Plugins_Temp'):
shutil.rmtree('Plugins_Temp')
print('Deleted existing Plugins_Temp directory.')
if os.path.exists('Plugins_5.3'):
shutil.rmtree('Plugins_5.3')
print('Deleted existing Plugins_5.3 directory.')
# Step 1: Copy the 'Plugins' folder to 'Plugins_Temp'
source_folder = 'Plugins'
destination_folder = 'Plugins_Temp'
try:
shutil.copytree(source_folder, destination_folder)
print(f'Copied {source_folder} to {destination_folder}')
except FileExistsError:
print(f'{destination_folder} already exists. Skipping copy.')
# Step 2: Install the 'patch' package using pip
try:
subprocess.run(['pip', 'install', 'patch'], check=True)
print('Successfully installed the "patch" package')
except subprocess.CalledProcessError as e:
print(f'Error installing "patch" package: {e}')
exit(1)
# Step 3: Apply the patch inside the 'Plugins_Temp' folder
patch_file = 'upgrade53.patch'
if not os.path.exists(patch_file):
print(f'Patch file "{patch_file}" not found.')
exit(1)
# Step 4: Move into the 'Plugins_Temp' folder
os.chdir(destination_folder)
try:
subprocess.run(['python', '-m', 'patch', '../' + patch_file], check=True)
print(f'Applied patch from "{patch_file}" inside "{destination_folder}"')
except subprocess.CalledProcessError as e:
print(f'Error applying patch: {e}')
exit(1)
# Step 5: Move back out of the 'Plugins_Temp' folder
os.chdir('..')
# Step 6: Ask the user for the Unreal Engine 5.3 installation location
while True:
unreal_engine_path = input('Enter the Unreal Engine 5.3 installation path: ')
runuat_path = os.path.join(unreal_engine_path, 'Engine', 'Build', 'BatchFiles', 'RunUAT.bat')
if os.path.exists(runuat_path):
break
else:
print('Invalid Unreal Engine 5.3 installation path. Please try again.')
# Step 7: Iterate through the plugins and build them (excluding DLSSMoviePipelineSupport)
plugins_to_build = ['DLSS', 'NIS', 'Streamline']
target_package_path = os.path.abspath('Plugins_5.3')
for plugin in plugins_to_build:
plugin_path = os.path.abspath(os.path.join(destination_folder, plugin, plugin + ".uplugin"))
runuat_command = [
runuat_path,
'BuildPlugin',
f'-Plugin={plugin_path}',
f'-Package={target_package_path}/{plugin}',
'-Rocket',
'-TargetPlatforms=Win64'
]
print(f'Running: {" ".join(runuat_command)}')
try:
subprocess.run(runuat_command, cwd=unreal_engine_path, check=True, shell=True)
print(f'Successfully built {plugin}')
except subprocess.CalledProcessError as e:
print(f'Error building {plugin}: {e}')
# Step 8: Delete the 'Plugins_Temp' folder
shutil.rmtree(destination_folder)
print(f'Deleted {destination_folder}')
print('Script completed successfully.')
import os
import shutil
import subprocess
# Step 0: Delete 'Plugins_Temp' and 'Plugins_5.3' directories if they exist
if os.path.exists('Plugins_Temp'):
shutil.rmtree('Plugins_Temp')
print('Deleted existing Plugins_Temp directory.')
# Step 1: Copy the 'Plugins' folder to 'Plugins_Temp'
source_folder = 'Plugins'
destination_folder = 'Plugins_Temp'
try:
shutil.copytree(source_folder, destination_folder)
print(f'Copied {source_folder} to {destination_folder}')
except FileExistsError:
print(f'{destination_folder} already exists. Skipping copy.')
# Step 2: Install the 'patch' package using pip
try:
subprocess.run(['pip', 'install', 'patch'], check=True)
print('Successfully installed the "patch" package')
except subprocess.CalledProcessError as e:
print(f'Error installing "patch" package: {e}')
exit(1)
# Step 3: Apply the patch inside the 'Plugins_Temp' folder
patch_file = 'upgrade53.patch'
if not os.path.exists(patch_file):
print(f'Patch file "{patch_file}" not found.')
exit(1)
# Step 4: Move into the 'Plugins_Temp' folder
os.chdir(destination_folder)
try:
subprocess.run(['python', '-m', 'patch', '../' + patch_file], check=True)
print(f'Applied patch from "{patch_file}" inside "{destination_folder}"')
except subprocess.CalledProcessError as e:
print(f'Error applying patch: {e}')
exit(1)
# Step 5: Move back out of the 'Plugins_Temp' folder
os.chdir('..')
# Step 6: Ask the user for the Unreal Engine 5.3 installation location
while True:
unreal_engine_path = input('Enter the Unreal Engine 5.3 installation path: ')
runuat_path = os.path.join(unreal_engine_path, 'Engine', 'Build', 'BatchFiles', 'RunUAT.bat')
if os.path.exists(runuat_path):
break
else:
print('Invalid Unreal Engine 5.3 installation path. Please try again.')
# Step 7: Iterate through the plugins and build them
plugins_to_build = ['DLSSMoviePipelineSupport']
target_package_path = os.path.abspath('Plugins_5.3')
for plugin in plugins_to_build:
plugin_path = os.path.abspath(os.path.join(destination_folder, plugin, plugin + ".uplugin"))
runuat_command = [
runuat_path,
'BuildPlugin',
f'-Plugin={plugin_path}',
f'-Package={target_package_path}/{plugin}',
'-Rocket',
'-TargetPlatforms=Win64'
]
print(f'Running: {" ".join(runuat_command)}')
try:
subprocess.run(runuat_command, cwd=unreal_engine_path, check=True, shell=True)
print(f'Successfully built {plugin}')
except subprocess.CalledProcessError as e:
print(f'Error building {plugin}: {e}')
# Step 8: Delete the 'Plugins_Temp' folder
shutil.rmtree(destination_folder)
print(f'Deleted {destination_folder}')
print('Script completed successfully.')
diff --git a/DLSS/DLSS.uplugin b/DLSS/DLSS.uplugin
index d5b958e..a052a49 100644
--- a/DLSS/DLSS.uplugin
+++ b/DLSS/DLSS.uplugin
@@ -10,7 +10,7 @@
"DocsURL": "",
"MarketplaceURL": "https://www.unrealengine.com/marketplace/en-US/product/nvidia-dlss",
"SupportURL": "mailto:DLSS-Support@nvidia.com",
- "EngineVersion": "5.2.0",
+ "EngineVersion": "5.3.0",
"CanContainContent": true,
"Installed": true,
"Modules": [
diff --git a/DLSSMoviePipelineSupport/DLSSMoviePipelineSupport.uplugin b/DLSSMoviePipelineSupport/DLSSMoviePipelineSupport.uplugin
index abf072a..180712c 100644
--- a/DLSSMoviePipelineSupport/DLSSMoviePipelineSupport.uplugin
+++ b/DLSSMoviePipelineSupport/DLSSMoviePipelineSupport.uplugin
@@ -10,7 +10,7 @@
"DocsURL": "",
"MarketplaceURL": "https://www.unrealengine.com/marketplace/en-US/product/nvidia-dlss",
"SupportURL": "mailto:DLSS-Support@nvidia.com",
- "EngineVersion": "5.2.0",
+ "EngineVersion": "5.3.0",
"CanContainContent": true,
"Installed": true,
"Modules": [
diff --git a/NIS/NIS.uplugin b/NIS/NIS.uplugin
index be1f224..a5d452c 100644
--- a/NIS/NIS.uplugin
+++ b/NIS/NIS.uplugin
@@ -10,7 +10,7 @@
"DocsURL": "",
"MarketplaceURL": "https://www.unrealengine.com/marketplace/en-US/product/nvidia-dlss",
"SupportURL": "mailto:DLSS-Support@nvidia.com",
- "EngineVersion": "5.2.0",
+ "EngineVersion": "5.3.0",
"CanContainContent": false,
"Installed": true,
"Modules": [
diff --git a/NIS/Source/NISBlueprint/Private/NISLibrary.cpp b/NIS/Source/NISBlueprint/Private/NISLibrary.cpp
index 18d66ef..f0ec4c4 100644
--- a/NIS/Source/NISBlueprint/Private/NISLibrary.cpp
+++ b/NIS/Source/NISBlueprint/Private/NISLibrary.cpp
@@ -58,8 +58,13 @@ void UNISLibrary::GetNISScreenPercentageRange(float& MinScreenPercentage, float&
}
else
{
+ /*
+ using namespace UE::Renderer::Private;
MinScreenPercentage = 100.0f * ITemporalUpscaler::GetDefaultTemporalUpscaler()->GetMinUpsampleResolutionFraction();
MaxScreenPercentage = 100.0f * ITemporalUpscaler::GetDefaultTemporalUpscaler()->GetMaxUpsampleResolutionFraction();
+ */
+ MinScreenPercentage = 100.0f * 0.5f;
+ MaxScreenPercentage = 100.0f * 1.0f;
}
}
diff --git a/NIS/Source/NISShaders/Private/NISShaders.cpp b/NIS/Source/NISShaders/Private/NISShaders.cpp
index 3e44475..83166c4 100644
--- a/NIS/Source/NISShaders/Private/NISShaders.cpp
+++ b/NIS/Source/NISShaders/Private/NISShaders.cpp
@@ -27,6 +27,7 @@
// however we also have static_asserts that make sure that FNISConfigParameters matches NISConfig
#define NIS_ALIGNED(x)
#include "NIS_Config.h"
+#include "SceneRendering.h"
#define LOCTEXT_NAMESPACE "FNISImageScalingShadersModule"
@@ -298,7 +299,7 @@ struct FNISCoefficients : public FRenderResource
* Called when entering the state where both the resource and the RHI have been initialized.
* This is only called by the rendering thread.
*/
- virtual void InitRHI()
+ virtual void InitRHI(FRHICommandListBase& RHICmdList)
{
// FP32
{
diff --git a/Streamline/Source/StreamlineD3D11RHI/Private/StreamlineD3D11RHI.cpp b/Streamline/Source/StreamlineD3D11RHI/Private/StreamlineD3D11RHI.cpp
index dacfd2f..4b433d3 100644
--- a/Streamline/Source/StreamlineD3D11RHI/Private/StreamlineD3D11RHI.cpp
+++ b/Streamline/Source/StreamlineD3D11RHI/Private/StreamlineD3D11RHI.cpp
@@ -60,6 +60,11 @@ public:
return Name;
}
+ virtual const TCHAR* GetProviderName() const override {
+ static const TCHAR* ProviderName = TEXT("StreamlineD3D11DXGISwapchainProvider");
+ return ProviderName;
+ }
+
HRESULT CreateSwapChainForHwnd(IDXGIFactory2* pFactory, IUnknown* pDevice, HWND hWnd, const DXGI_SWAP_CHAIN_DESC1* pDesc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullScreenDesc, IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain) override final
{
if (!StreamlineRHI->IsSwapchainHookingAllowed())
diff --git a/Streamline/Source/StreamlineD3D12RHI/Private/StreamlineD3D12RHI.cpp b/Streamline/Source/StreamlineD3D12RHI/Private/StreamlineD3D12RHI.cpp
index 9a30bc6..23ce2ea 100644
--- a/Streamline/Source/StreamlineD3D12RHI/Private/StreamlineD3D12RHI.cpp
+++ b/Streamline/Source/StreamlineD3D12RHI/Private/StreamlineD3D12RHI.cpp
@@ -73,6 +73,11 @@ public:
bool SupportsRHI(const TCHAR* RHIName) const override final { return FString(RHIName) == FString("D3D12"); }
#endif
+ virtual const TCHAR* GetProviderName() const override {
+ static TCHAR Name[] = TEXT("FStreamlineD3D12DXGISwapchainProvider");
+ return Name;
+ }
+
TCHAR* GetName() const override final
{
static TCHAR Name[] = TEXT("FStreamlineD3D12DXGISwapchainProvider");
diff --git a/Streamline/Streamline.uplugin b/Streamline/Streamline.uplugin
index 84b6da6..e9abd87 100644
--- a/Streamline/Streamline.uplugin
+++ b/Streamline/Streamline.uplugin
@@ -10,7 +10,7 @@
"DocsURL": "",
"MarketplaceURL": "https://www.unrealengine.com/marketplace/en-US/product/nvidia-dlss",
"SupportURL": "mailto:DLSS-Support@nvidia.com",
- "EngineVersion": "5.2.0",
+ "EngineVersion": "5.3.0",
"CanContainContent": false,
"Installed": true,
"Modules": [
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment