To create a very
basic starting point DX12 Visual Studio based on the D3D12 Samples SDK codebase
(branching from friendly developer license code as starting point):
Update for Visual Studio 2019:
- create an x64 project, unicode looks like default
- didn't need the win32 preprocessor defn below.
- did need the libs
- did need to change the subystem to windows
- did need to disable shaders.hlsl compilation
Visual Studio 2017
Create a console
application (File->New Project->Empty Project)
Pull in .cpp, .c,
and .hlsl files from D3DFramebuffer (my feeling is this is the best base case due to correct render loop that does not block on previous frames Present call before starting to build command list for next frame).
Changed to an x64
build environment
On the project,
walked the 'full compiler options' and the 'full linker options'
Compiler:
- Change character set to unicode from multibyte
- Add 'WIN32' to preprocessor definitions
Linker:
- Add d3d12.lib, d3dcompiler.lib, and dxgi.lib to the set of files to link to
- Change subsystem to 'Windows'
- Disabled compilation of shaders.hlsl by Visual studio
Change the lines
that compile the shaders from this:
ThrowIfFailed(D3DCompileFromFile(GetAssetFullPath(L"shaders.hlsl").c_str(),
nullptr, nullptr, "VSMain", "vs_5_0", compileFlags, 0,
&vertexShader, nullptr));
ThrowIfFailed(D3DCompileFromFile(GetAssetFullPath(L"shaders.hlsl").c_str(),
nullptr, nullptr, "PSMain", "ps_5_0", compileFlags, 0,
&pixelShader, nullptr));
To this:
ThrowIfFailed(D3DCompileFromFile(L"shaders.hlsl",
nullptr, nullptr, "VSMain", "vs_5_0", compileFlags, 0,
&vertexShader, nullptr));
ThrowIfFailed(D3DCompileFromFile(L"shaders.hlsl",
nullptr, nullptr, "PSMain", "ps_5_0", compileFlags, 0,
&pixelShader, nullptr));
Note: I am sure GetAssetFullPath is useful, probably esp. in remote debug cases. Will circle back to this later.
No comments:
Post a Comment