HelloD3D12 is a small, introductory Direct3D 12 sample, which shows how to set up a window and render a textured quad complete with proper uploading handling, multiple frames queued and constant buffers.
There are three samples with increasing complexity.
Common functionality, like window creation, present handling is part of
The rest is scaffolding of very minor interest;
ImageIO has some helper classes to load an image from disk using WIC,
Window contains a class to create a Win32 Window.
The samples are:
D3D12Quad: Renders a quad. This is the most basic sample.
D3D12AnimatedQuad: Animates the quad by using a constant buffer.
D3D12TexturedQuad: Adds a texture to the animated quad sample.
| POINTS OF INTEREST
- The application queues multiple frames. To protect the per-frame command lists and other resources, fences are created. After the command list for a frame is submitted, the fence is signaled and the next command list is used.
- The texture and mesh data is uploaded using an upload heap. This happens during the initialization and shows how to transfer data to the GPU. Ideally, this should be running on the copy queue but for the sake of simplicity it is run on the general graphics queue.
- Constant buffers are placed in an
uploadheap. Placing them in the upload heap is best if the buffers are read once.
- Barriers are as specific as possible and grouped. Transitioning many resources in one barrier is faster than using multiple barriers as the GPU have to flush caches, and if multiple barriers are grouped, the caches are only flushed once.
- The application uses a root signature slot for the most frequently changing constant buffer.
DEBUGconfiguration will automatically enable the debug layers to validate the API usage. Check the source code for details, as this requires the graphics tools to be installed.
- A graphics card with Direct3D 12 support.
- For instance, any GCN-based AMD GPU.
- Windows 10 (64-bit recommended).
- Visual Studio 2015 with Visual C++ and the Windows 10 SDK installed.
| YOU MAY ALSO LIKE
This sample demonstrates how to use most of Cauldron’s features. It is also a useful reference for getting started with developing your own samples and prototypes.
This sample demonstrates how to enable Freesync Premium Pro (HDR) with the DirectX® 12 and Vulkan® APIs.
The Barycentrics12 sample shows how to enable new intrinsic instructions in your DirectX 12 HLSL code.
This is a slightly modified version of the Microsoft D3D12nBodyGravity sample, This sample demonstrates the use of asynchronous compute shaders (multi-engine) to simulate an n-body gravity system.