Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Public Member Functions | Private Attributes | List of all members
blowbox::DescriptorHeap Class Reference

#include <descriptor_heap.h>

Public Member Functions

 DescriptorHeap ()
 
 ~DescriptorHeap ()
 
void Create (const WString &name, D3D12_DESCRIPTOR_HEAP_TYPE heap_type, D3D12_DESCRIPTOR_HEAP_FLAGS flags=D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, UINT descriptor_count=4096U)
 
UINT CreateDepthStencilView (ID3D12Resource *dsv_buffer, D3D12_DEPTH_STENCIL_VIEW_DESC *desc)
 
UINT CreateRenderTargetView (ID3D12Resource *rtv_buffer, D3D12_RENDER_TARGET_VIEW_DESC *desc)
 
UINT CreateConstantBufferView (D3D12_CONSTANT_BUFFER_VIEW_DESC *desc)
 
UINT CreateShaderResourceView (ID3D12Resource *srv_buffer, D3D12_SHADER_RESOURCE_VIEW_DESC *desc)
 
UINT CreateUnorderedAccessView (ID3D12Resource *buffer, ID3D12Resource *counter_buffer, D3D12_UNORDERED_ACCESS_VIEW_DESC *desc)
 
UINT CreateSampler (D3D12_SAMPLER_DESC *desc)
 
D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorById (UINT id)
 
D3D12_GPU_DESCRIPTOR_HANDLE GetGPUDescriptorById (UINT id)
 
ID3D12DescriptorHeap * Get ()
 
const D3D12_DESCRIPTOR_HEAP_DESC & GetDesc ()
 
void Clear ()
 
UINT GetDescriptorSize () const
 
UINT GetDescriptorsAllocated () const
 
UINT GetDescriptorHeapMaxAllocations () const
 

Private Attributes

ID3D12DescriptorHeap * heap_
 
D3D12_DESCRIPTOR_HEAP_DESC heap_desc_
 
UINT current_allocations_
 
UINT descriptor_size_
 

Detailed Description

Manages a ID3D12DescriptorHeap of a certain type.

Helps managing ID3D12DescriptorHeaps. It makes it easy to create and access descriptors for resources.

Constructor & Destructor Documentation

blowbox::DescriptorHeap::DescriptorHeap ( )

Constructs a DescriptorHeap.

blowbox::DescriptorHeap::~DescriptorHeap ( )

Destructs the DescriptorHeap.

Member Function Documentation

void blowbox::DescriptorHeap::Clear ( )

Essentially resets the DescriptorHeap.

void blowbox::DescriptorHeap::Create ( const WString name,
D3D12_DESCRIPTOR_HEAP_TYPE  heap_type,
D3D12_DESCRIPTOR_HEAP_FLAGS  flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE,
UINT  descriptor_count = 4096U 
)

Creates the DescriptorHeap.

Parameters
[in]nameThe name of the DescriptorHeap.
[in]heap_typeThe type of DescriptorHeap.
[in]flagsAny flags that should be set on the DescriptorHeap.
[in]descriptor_countThe number of descriptors this DescriptorHeap should be able to hold.
UINT blowbox::DescriptorHeap::CreateConstantBufferView ( D3D12_CONSTANT_BUFFER_VIEW_DESC *  desc)

Creates a ConstantBufferView (descriptor)

Parameters
[in]descThe description of this descriptor used to describe the resource with
UINT blowbox::DescriptorHeap::CreateDepthStencilView ( ID3D12Resource *  dsv_buffer,
D3D12_DEPTH_STENCIL_VIEW_DESC *  desc 
)

Creates a DepthStencilView (descriptor)

Parameters
[in]dsv_bufferThe buffer this descriptor should describe
[in]descThe description of this descriptor used to describe the resource with
UINT blowbox::DescriptorHeap::CreateRenderTargetView ( ID3D12Resource *  rtv_buffer,
D3D12_RENDER_TARGET_VIEW_DESC *  desc 
)

Creates a RenderTargetView (descriptor)

Parameters
[in]rtv_bufferThe buffer this descriptor should describe
[in]descThe description of this descriptor used to describe the resource with
UINT blowbox::DescriptorHeap::CreateSampler ( D3D12_SAMPLER_DESC *  desc)

Creates a sampler state (descriptor)

Parameters
[in]descThe description of this descriptor used to describe the resource with
UINT blowbox::DescriptorHeap::CreateShaderResourceView ( ID3D12Resource *  srv_buffer,
D3D12_SHADER_RESOURCE_VIEW_DESC *  desc 
)

Creates a ShaderResourceView (descriptor)

Parameters
[in]srv_bufferThe buffer the descriptor is describing
[in]descThe description of this descriptor used to describe the resource with
UINT blowbox::DescriptorHeap::CreateUnorderedAccessView ( ID3D12Resource *  buffer,
ID3D12Resource *  counter_buffer,
D3D12_UNORDERED_ACCESS_VIEW_DESC *  desc 
)

Creates a UnorderedAccessView (descriptor)

Parameters
[in]bufferThe buffer this descriptor should describe
[in]counter_bufferThe counter buffer this descriptor should describe
[in]descThe description of this descriptor used to describe the resource with
ID3D12DescriptorHeap* blowbox::DescriptorHeap::Get ( )
inline
Returns
The underlying ID3D12DescriptorHeap.
D3D12_CPU_DESCRIPTOR_HANDLE blowbox::DescriptorHeap::GetCPUDescriptorById ( UINT  id)

Get a cpu handle to a descriptor by its id.

Parameters
[in]idThe id of the desired descriptor
const D3D12_DESCRIPTOR_HEAP_DESC& blowbox::DescriptorHeap::GetDesc ( )
inline
Returns
The underlying ID3D12DescriptorHeap.
UINT blowbox::DescriptorHeap::GetDescriptorHeapMaxAllocations ( ) const
inline
Returns
The maximum amount of descriptors that will fit in this descriptor heap.
UINT blowbox::DescriptorHeap::GetDescriptorsAllocated ( ) const
inline
Returns
The amount of descriptors that is currently allocated.
UINT blowbox::DescriptorHeap::GetDescriptorSize ( ) const
inline
Returns
The size of a descriptor of this heap size.
D3D12_GPU_DESCRIPTOR_HANDLE blowbox::DescriptorHeap::GetGPUDescriptorById ( UINT  id)

Get a gpu handle to a descriptor by its id.

Parameters
[in]idThe id of the desired descriptor

Member Data Documentation

UINT blowbox::DescriptorHeap::current_allocations_
private

The number of descriptors in the descriptor heap in active use.

UINT blowbox::DescriptorHeap::descriptor_size_
private

The size of a single descriptor.

ID3D12DescriptorHeap* blowbox::DescriptorHeap::heap_
private

The underlying descriptor heap.

D3D12_DESCRIPTOR_HEAP_DESC blowbox::DescriptorHeap::heap_desc_
private

The description for the descriptor heap.


The documentation for this class was generated from the following files: