Skip to content
Open
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
31 changes: 30 additions & 1 deletion Samples/Desktop/D3D12Multithreading/src/D3D12Multithreading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
D3D12Multithreading* D3D12Multithreading::s_app = nullptr;
bool D3D12Multithreading::s_bIsEnhancedBarriersEnabled = false;

extern "C" { __declspec(dllexport) extern const UINT D3D12SDKVersion = 618; }
extern "C" { __declspec(dllexport) extern const UINT D3D12SDKVersion = 619; }
extern "C" { __declspec(dllexport) extern const char* D3D12SDKPath = u8".\\D3D12\\"; }

D3D12Multithreading::D3D12Multithreading(UINT width, UINT height, std::wstring name) :
Expand All @@ -37,13 +37,41 @@ D3D12Multithreading::D3D12Multithreading(UINT width, UINT height, std::wstring n
m_keyboardInput.animate = true;

ThrowIfFailed(DXGIDeclareAdapterRemovalSupport());

SetApplicationIdentity();
}

D3D12Multithreading::~D3D12Multithreading()
{
s_app = nullptr;
}

void D3D12Multithreading::SetApplicationIdentity()
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its not super clear from the PR what Application Identify is, and how would devs would benefit from this. Perhaps here you can add some comments and context for the developers.

ComPtr<ID3D12ApplicationIdentity> pApplicationIdentity;
HRESULT hr = D3D12GetInterface(CLSID_D3D12ApplicationIdentity, IID_PPV_ARGS(&pApplicationIdentity));
if (E_NOINTERFACE == hr)
{
return;
}

D3D12_APPLICATION_DESC appDesc;
appDesc.pExeFilename = L"D3D12Multithreading.exe";
appDesc.pName = L"D3D12 Multithreading";
appDesc.Version.Version = 0x0001000000000000;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily asking for a change, but we should consider if there's something we should do to make this nicer to read.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that's the main reason why I was looking for comments/suggestions.
I was thinking of using something along the lines of:

appDesc.pEngineName = L"D3D12 Multithreading Engine";
appDesc.EngineVersion.Version = 0x0001000000000000; // 1.0.0.0

And name it based on the sample.

appDesc.pEngineName = nullptr;
appDesc.EngineVersion.Version = 0x0000000000000000;

GUID D3D12MultithreadingAppID = { /* 8367fc8a-d739-485a-a473-12dfaa190567 */
0x8367fc8a,
0xd739,
0x485a,
{ 0xa4, 0x73, 0x12, 0xdf, 0xaa, 0x19, 0x05, 0x67 }
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably explain how you came up with this GUID as well, might help developers understand what is within the range of "Yes this is ok" vs "no this ID won't work".


pApplicationIdentity->SetApplicationIdentity(&appDesc, D3D12MultithreadingAppID);
}

void D3D12Multithreading::OnInit()
{
LoadPipeline();
Expand Down Expand Up @@ -1282,3 +1310,4 @@ void D3D12Multithreading::SetCommonPipelineState(ID3D12GraphicsCommandList* pCom
// SRVs are set elsewhere because they change based on the object
// being drawn.
}

2 changes: 2 additions & 0 deletions Samples/Desktop/D3D12Multithreading/src/D3D12Multithreading.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,6 @@ class D3D12Multithreading : public DXSample
void BeginFrame();
void MidFrame();
void EndFrame();

void SetApplicationIdentity();
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\Microsoft.Direct3D.D3D12.1.619.1\build\native\Microsoft.Direct3D.D3D12.props" Condition="Exists('packages\Microsoft.Direct3D.D3D12.1.619.1\build\native\Microsoft.Direct3D.D3D12.props')" />
<Import Project="packages\Microsoft.Direct3D.DXC.1.8.2505.32\build\native\Microsoft.Direct3D.DXC.props" Condition="Exists('packages\Microsoft.Direct3D.DXC.1.8.2505.32\build\native\Microsoft.Direct3D.DXC.props')" />
<Import Project="packages\Microsoft.Direct3D.D3D12.1.618.3\build\native\Microsoft.Direct3D.D3D12.props" Condition="Exists('packages\Microsoft.Direct3D.D3D12.1.618.3\build\native\Microsoft.Direct3D.D3D12.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
Expand Down Expand Up @@ -157,18 +157,18 @@ dxc.exe -nologo -Tps_6_0 -E"PSMain" -Zi -Qembed_debug -Fo"$(OutDir)%(Filename)_P
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\Microsoft.Direct3D.D3D12.1.618.3\build\native\Microsoft.Direct3D.D3D12.targets" Condition="Exists('packages\Microsoft.Direct3D.D3D12.1.618.3\build\native\Microsoft.Direct3D.D3D12.targets')" />
<Import Project="packages\WinPixEventRuntime.1.0.240308001\build\WinPixEventRuntime.targets" Condition="Exists('packages\WinPixEventRuntime.1.0.240308001\build\WinPixEventRuntime.targets')" />
<Import Project="packages\Microsoft.Direct3D.DXC.1.8.2505.32\build\native\Microsoft.Direct3D.DXC.targets" Condition="Exists('packages\Microsoft.Direct3D.DXC.1.8.2505.32\build\native\Microsoft.Direct3D.DXC.targets')" />
<Import Project="packages\Microsoft.Direct3D.D3D12.1.619.1\build\native\Microsoft.Direct3D.D3D12.targets" Condition="Exists('packages\Microsoft.Direct3D.D3D12.1.619.1\build\native\Microsoft.Direct3D.D3D12.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Microsoft.Direct3D.D3D12.1.618.3\build\native\Microsoft.Direct3D.D3D12.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Direct3D.D3D12.1.618.3\build\native\Microsoft.Direct3D.D3D12.props'))" />
<Error Condition="!Exists('packages\Microsoft.Direct3D.D3D12.1.618.3\build\native\Microsoft.Direct3D.D3D12.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Direct3D.D3D12.1.618.3\build\native\Microsoft.Direct3D.D3D12.targets'))" />
<Error Condition="!Exists('packages\WinPixEventRuntime.1.0.240308001\build\WinPixEventRuntime.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\WinPixEventRuntime.1.0.240308001\build\WinPixEventRuntime.targets'))" />
<Error Condition="!Exists('packages\Microsoft.Direct3D.DXC.1.8.2505.32\build\native\Microsoft.Direct3D.DXC.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Direct3D.DXC.1.8.2505.32\build\native\Microsoft.Direct3D.DXC.props'))" />
<Error Condition="!Exists('packages\Microsoft.Direct3D.DXC.1.8.2505.32\build\native\Microsoft.Direct3D.DXC.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Direct3D.DXC.1.8.2505.32\build\native\Microsoft.Direct3D.DXC.targets'))" />
<Error Condition="!Exists('packages\Microsoft.Direct3D.D3D12.1.619.1\build\native\Microsoft.Direct3D.D3D12.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Direct3D.D3D12.1.619.1\build\native\Microsoft.Direct3D.D3D12.props'))" />
<Error Condition="!Exists('packages\Microsoft.Direct3D.D3D12.1.619.1\build\native\Microsoft.Direct3D.D3D12.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Direct3D.D3D12.1.619.1\build\native\Microsoft.Direct3D.D3D12.targets'))" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion Samples/Desktop/D3D12Multithreading/src/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Direct3D.D3D12" version="1.618.3" targetFramework="native" />
<package id="Microsoft.Direct3D.D3D12" version="1.619.1" targetFramework="native" />
<package id="Microsoft.Direct3D.DXC" version="1.8.2505.32" targetFramework="native" />
<package id="WinPixEventRuntime" version="1.0.240308001" targetFramework="native" />
</packages>
1 change: 1 addition & 0 deletions Samples/Desktop/D3D12Multithreading/src/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers.
#endif

#define INITGUID
#include <windows.h>

#include <d3d12.h>
Expand Down