Lecture 12: DX12 initialization

Computer graphics in Game development

Ivan Belyavtsev


Validation layer

To engage API validation:

  1. Call D3D12GetDebugInterface function to get debug controller
  2. Call EnableDebugLayer method of the debug controller
  3. Use DXGI_CREATE_FACTORY_DEBUG flag in further DXGI factory creation [1]

Hardware adapter

  • Use CreateDXGIFactory* function to create a DXGI factory (don’t forget about flags)
  • Call EnumAdapters* method to find HW
  • EnumAdapters for adapter #0 gives us a pointer to the primary display adapter [1]

Device and command queue

  • Call D3D12CreateDevice function to create a DX12 device
  • Make sure that minimum future level is D3D_FEATURE_LEVEL_11_0
  • Call CreateCommandQueue method of DX12 device to create a direct queue [1]

Swap chain

  • Call CreateSwapChainForHwnd method of the DXGI factory with Direct queue, window handler and swap chain descriptor
  • Call MakeWindowAssociation method of the DXGI factory with window handler and DXGI_MWA_NO_ALT_ENTER
  • Cast the swap chain pointer to required COM interface [1]

Lab: load_pipeline: init DX12 and swap chain


Satran M. et al. Direct3D 12 programming guide [Electronic resource]. 2019. URL: https://docs.microsoft.com/en-us/windows/win32/direct3d12/directx-12-programming-guide.
// reveal.js plugins