dx11 changes

This commit is contained in:
Cetin Ozdil
2024-03-02 16:23:45 +03:00
parent 09206eb36d
commit 009df144af
4 changed files with 49 additions and 40 deletions
+1 -1
View File
@@ -82,7 +82,7 @@
<IncludePath>$(SolutionDir)external\simpleini;$(SolutionDir)external\nvngx_dlss_sdk;$(SolutionDir)external\unordered_dense\include;$(SolutionDir)external\xess\inc\xess;$(SolutionDir)external\vulkan\include;$(SolutionDir)external\ffx-sdk\sdk\include;$(SolutionDir)external\fmt\include;$(SolutionDir)external\spdlog\include;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)external\xess\lib;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath)</LibraryPath>
<TargetName>nvngx</TargetName>
<OutDir>E:\Games\God of War</OutDir>
<OutDir>D:\Folders\Games\Deep Rock Galactic\FSD\Binaries\Win64\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(SolutionDir)external\simpleini;$(SolutionDir)external\nvngx_dlss_sdk;$(SolutionDir)external\unordered_dense\include;$(SolutionDir)external\xess\inc\xess;$(SolutionDir)external\vulkan\include;$(SolutionDir)external\ffx-sdk\sdk\include;$(SolutionDir)external\fmt\include;$(SolutionDir)external\spdlog\include;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath)</IncludePath>
+9 -9
View File
@@ -268,16 +268,16 @@ NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceContext* InDevCtx,
}
}
if (!deviceContext->IsInited())
{
deviceContext->Init(D3D11Device, InDevCtx, InParameters);
//if (!deviceContext->IsInited())
//{
// deviceContext->Init(D3D11Device, InDevCtx, InParameters);
if (!deviceContext->IsInited())
{
spdlog::error("NVSDK_NGX_D3D11_EvaluateFeature deviceContext.XessInit is false, init failed!");
return NVSDK_NGX_Result_Fail;
}
}
// if (!deviceContext->IsInited())
// {
// spdlog::error("NVSDK_NGX_D3D11_EvaluateFeature deviceContext.XessInit is false, init failed!");
// return NVSDK_NGX_Result_Fail;
// }
//}
NVSDK_NGX_Result evResult = NVSDK_NGX_Result_Success;
if (!deviceContext->Evaluate(InDevCtx, InParameters))
+17 -17
View File
@@ -262,26 +262,26 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom
}
}
if (!deviceContext->IsInited())
{
ID3D12Device* device;
spdlog::debug("NVSDK_NGX_D3D12_EvaluateFeature Get D3d12 device from InCmdList!");
auto deviceResult = InCmdList->GetDevice(IID_PPV_ARGS(&device));
//if (!deviceContext->IsInited())
//{
// ID3D12Device* device;
// spdlog::debug("NVSDK_NGX_D3D12_EvaluateFeature Get D3d12 device from InCmdList!");
// auto deviceResult = InCmdList->GetDevice(IID_PPV_ARGS(&device));
if (deviceResult != S_OK || device == nullptr)
{
spdlog::error("NVSDK_NGX_D3D12_EvaluateFeature Can't get Dx12Device from InCmdList!");
return NVSDK_NGX_Result_Fail;
}
// if (deviceResult != S_OK || device == nullptr)
// {
// spdlog::error("NVSDK_NGX_D3D12_EvaluateFeature Can't get Dx12Device from InCmdList!");
// return NVSDK_NGX_Result_Fail;
// }
deviceContext->Init(device, InParameters);
// deviceContext->Init(device, InParameters);
if (!deviceContext->IsInited())
{
spdlog::error("NVSDK_NGX_D3D12_EvaluateFeature deviceContext.XessInit is false, init failed!");
return NVSDK_NGX_Result_Fail;
}
}
// if (!deviceContext->IsInited())
// {
// spdlog::error("NVSDK_NGX_D3D12_EvaluateFeature deviceContext.XessInit is false, init failed!");
// return NVSDK_NGX_Result_Fail;
// }
//}
//dumpParams.frame_count = 1;
//dumpParams.frame_idx = cnt++;
+22 -13
View File
@@ -298,7 +298,7 @@ bool XeSSFeatureDx11::Init(ID3D11Device* device, ID3D11DeviceContext* context, c
spdlog::debug("XeSSFeatureDx11::Init calling InitXeSS");
if (!InitXeSS(Dx12on11Device, initParams))
if (Dx12on11Device && !InitXeSS(Dx12on11Device, initParams))
{
spdlog::error("XeSSFeatureDx11::Init InitXeSS fail!");
return false;
@@ -309,13 +309,10 @@ bool XeSSFeatureDx11::Init(ID3D11Device* device, ID3D11DeviceContext* context, c
bool XeSSFeatureDx11::Evaluate(ID3D11DeviceContext* InDeviceContext, const NVSDK_NGX_Parameter* InParameters)
{
if (!IsInited() || !_xessContext)
return false;
ID3D11DeviceContext4* dc;
auto result = InDeviceContext->QueryInterface(IID_PPV_ARGS(&dc));
if (result!= S_OK)
if (result != S_OK)
{
spdlog::error("XeSSFeatureDx11::Evaluate CreateFence d3d12fence error: {0:x}", result);
return false;
@@ -328,18 +325,30 @@ bool XeSSFeatureDx11::Evaluate(ID3D11DeviceContext* InDeviceContext, const NVSDK
Dx11DeviceContext = dc;
}
if (!Dx12on11Device)
if (!IsInited() || !_xessContext)
{
auto fl = Dx11Device->GetFeatureLevel();
auto result = CreateDx12Device(fl);
if (result != S_OK || !Dx12on11Device)
if (!Dx12on11Device)
{
spdlog::error("XeSSFeatureDx11::Init QueryInterface Dx12Device result: {0:x}", result);
return false;
auto fl = Dx11Device->GetFeatureLevel();
result = CreateDx12Device(fl);
if (result != S_OK || !Dx12on11Device)
{
spdlog::error("XeSSFeatureDx11::Init QueryInterface Dx12Device result: {0:x}", result);
return false;
}
if (!IsInited() && Dx12on11Device && !InitXeSS(Dx12on11Device, InParameters))
{
spdlog::error("XeSSFeatureDx11::Init InitXeSS fail!");
return false;
}
}
else
return false;
}
// Fence for syncing
ID3D12Fence* d3d12Fence;
result = Dx12on11Device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&d3d12Fence));
@@ -694,7 +703,7 @@ XeSSFeatureDx11::~XeSSFeatureDx11()
ReleaseSharedResources();
}
void IFeature_Dx11::Shutdown()
void IFeature_Dx11::Shutdown()
{
SAFE_RELEASE(Dx12CommandList);
SAFE_RELEASE(Dx12CommandQueue);