Lecture 13: Resources in DX12

Computer graphics in Game development

Ivan Belyavtsev

18.02.2022

Resource

Resource is any data in memory

  • Vertex buffer
  • Index buffer
  • Constant buffer
  • Texture
  • Depth/Stencil buffer [1]

Type of resources

  • Committed
  • Placed
  • Reserved [1]

Resource heap types

  • Default - no CPU access
  • Upload - CPU can write
  • Readback - CPU can read [1]

Lab: load_assets: vertex, index and constant buffers

  1. Create committed resources for vertex, index and constant buffers on upload heap
  2. Map resources and copy suitable data to the resources

Resource descriptors

Resource descriptor is a properties of the particular resource.

  • CreateConstantBufferView
  • CreateDepthStencilView
  • CreateRenderTargetView
  • CreateShaderResourceView
  • CreateUnorderedAccessView [1]

Descriptor heaps

Descriptors heaps hold resource descriptors.

Types of descriptor heaps:

  • CBV, SRV, and UAV
  • SAMPLER
  • RTV
  • DSV [1]

Lab: load_pipeline: descriptor heaps

  1. Create a descriptor heap for render targets
  2. Create render target views
  3. Create a descriptor heap for a constant buffer
  4. Create a constant buffer view

Resource barriers

In DX12 the application is managing all resource states:

  • D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER
  • D3D12_RESOURCE_STATE_RENDER_TARGET
  • D3D12_RESOURCE_STATE_DEPTH_WRITE
  • D3D12_RESOURCE_STATE_DEPTH_READ
  • D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE
  • D3D12_RESOURCE_STATE_COPY_DEST
  • D3D12_RESOURCE_STATE_COPY_SOURCE
  • D3D12_RESOURCE_STATE_PRESENT and others [1]

References

1.
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