Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions OptiScaler/inputs/NVNGX_DLSS_Dx12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "proxies/NVNGX_Proxy.h"

#include <upscalers/FeatureProvider_Dx12.h>
#include "upscalers/dlss/DLSSFeature_Dx12.h"

#include "FG/DLSSG_Mod.h"
#include "FG/FSR3_Dx12_FG.h"
Expand Down Expand Up @@ -360,6 +361,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Shutdown(void)
// Unhooking and cleaning stuff causing issues during shutdown.
// Disabled for now to check if it cause any issues
// UnhookAll();
DLSSFeatureDx12::Shutdown(D3D12Device);

// Added `&& !State::Instance().isShuttingDown` hack for crash on exit
if (Config::Instance()->DLSSEnabled.value_or_default() && NVNGXProxy::IsDx12Inited() &&
Expand Down
10 changes: 10 additions & 0 deletions OptiScaler/upscalers/dlss/DLSSFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,16 @@ DLSSFeature::DLSSFeature(unsigned int handleId, NVSDK_NGX_Parameter* InParameter

DLSSFeature::~DLSSFeature() {}

void DLSSFeature::Shutdown()
{
LOG_FUNC();

if (NVNGXProxy::NVNGXModule() != nullptr)
UnhookApis();

LOG_FUNC_RESULT(0);
}

float DLSSFeature::GetSharpness(const NVSDK_NGX_Parameter* InParameters)
{
if (Config::Instance()->OverrideSharpness.value_or_default())
Expand Down
1 change: 1 addition & 0 deletions OptiScaler/upscalers/dlss/DLSSFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DLSSFeature : public virtual IFeature
void ProcessInitParams(NVSDK_NGX_Parameter* InParameters);
void ReadVersion();

static void Shutdown();
float GetSharpness(const NVSDK_NGX_Parameter* InParameters);

public:
Expand Down
13 changes: 13 additions & 0 deletions OptiScaler/upscalers/dlss/DLSSFeature_Dx12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,19 @@ bool DLSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
return true;
}

void DLSSFeatureDx12::Shutdown(ID3D12Device* InDevice)
{
if (_dlssInited)
{
if (NVNGXProxy::D3D12_Shutdown() != nullptr)
NVNGXProxy::D3D12_Shutdown()();
else if (NVNGXProxy::D3D12_Shutdown1() != nullptr)
NVNGXProxy::D3D12_Shutdown1()(InDevice);
}

DLSSFeature::Shutdown();
}

DLSSFeatureDx12::DLSSFeatureDx12(unsigned int InHandleId, NVSDK_NGX_Parameter* InParameters)
: IFeature(InHandleId, InParameters), IFeature_Dx12(InHandleId, InParameters), DLSSFeature(InHandleId, InParameters)
{
Expand Down
2 changes: 2 additions & 0 deletions OptiScaler/upscalers/dlss/DLSSFeature_Dx12.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class DLSSFeatureDx12 : public DLSSFeature, public IFeature_Dx12
NVSDK_NGX_Parameter* InParameters) override;
bool Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_NGX_Parameter* InParameters) override;

static void Shutdown(ID3D12Device* InDevice);

feature_version Version() override { return DLSSFeature::Version(); }
std::string Name() const override { return DLSSFeature::Name(); }

Expand Down
Loading