Category Archives: DirectX 12

DirectX 12 Hello World Sample

Purpose of the Sample:

This sample demonstrates serves as a DirectX 12 “Hello World” sample. It is based heavily on Frank Luna’s implementation from his book “3D Game Programming with DirectX 12”.
This sample contains the bare essentials to render content with DirectX 12. The sample simply renders a quad using a vertex and index buffer. The CPU and GPU are synchronized each frame and there is only ever one frame being processed by the CPU at a time. In a future article, I will demonstrate how to improve performance by keeping both the CPU and GPU busy by generating more frames on the CPU for the GPU to process. One interesting note about this sample is that I use bundles to execute the draw call.

“The purpose of bundles is to allow apps to group a small number of API commands together for later execution. At bundle creation time, the driver will perform as much pre-processing as is possible to make these cheap to execute later. Bundles are designed to be used and re-used any number of times.”
https://docs.microsoft.com/en-us/windows/desktop/direct3d12/recording-command-lists-and-bundles

NVidia suggests that you limit the number of commands you include in a bundle to increase its reusability.
https://developer.nvidia.com/dx12-dos-and-donts#worksubmit

CGame.h

CGame.cpp

UploadBuffer.h

VertexShader.hlsl

PixelShader.hlsl

Download Sample App