Home » Samples »

HelloD3D12 DirectX® 12 Sample

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 hellod3d12\src\D3D12Sample.cpp

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 upload heap. 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.
  • The DEBUG configuration 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.

Requirements

  • 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:

Hybrid Shadows

Hybrid Shadows Sample

This sample demonstrates how to combine ray traced shadows and rasterized shadow maps together to achieve higher quality and performance.

glTFSample Cauldron Sample Project

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.

You may also be interested in...

If slide decks are what you’re after, you’ll find 100+ of our finest presentations here. Plus there’s a handy list of our product manuals!

Developer guides

Browse our developer guides, and find valuable advice on developing with AMD hardware, ray tracing, Vulkan, DirectX, UE4, and lots more.

Words not enough? How about pictures? How about moving pictures? We have some amazing videos to share with you!

The home of great performance and optimization advice for AMD RDNA™ 2 GPUs, AMD Ryzen™ CPUs, and so much more.

Product Blogs

Our handy product blogs will help you make good use of our tools, SDKs, and effects, as well as sharing the latest features with new releases.

Publications

Discover our published publications.