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

#include <root_signature.h>

Public Member Functions

 RootSignature ()
 
 ~RootSignature ()
 
void Create (UINT num_root_parameters, UINT num_static_samplers)
 
void Finalize (const WString &name, D3D12_ROOT_SIGNATURE_FLAGS flags=D3D12_ROOT_SIGNATURE_FLAG_NONE)
 
RootParameteroperator[] (UINT i)
 
const RootParameteroperator[] (UINT i) const
 
ID3D12RootSignature * Get () const
 
 operator ID3D12RootSignature * () const
 
ID3D12RootSignature * operator-> () const
 
void InitStaticSampler (const D3D12_STATIC_SAMPLER_DESC &static_sampler_desc, D3D12_SHADER_VISIBILITY visibility=D3D12_SHADER_VISIBILITY_ALL)
 
void InitStaticSampler (UINT shader_register, const D3D12_SAMPLER_DESC &sampler_desc, D3D12_SHADER_VISIBILITY visibility=D3D12_SHADER_VISIBILITY_ALL)
 

Protected Member Functions

void ConfirmInitializedParameter ()
 

Private Attributes

bool finalized_
 
UINT num_root_parameters_
 
UINT num_initialized_root_parameters_
 
UINT num_static_samplers_
 
UINT num_initialized_static_samplers_
 
ID3D12RootSignature * root_signature_
 
RootParameter root_parameters_ [ROOT_SIGNATURE_MAX_PARAMETERS]
 
D3D12_STATIC_SAMPLER_DESC static_samplers_ [ROOT_SIGNATURE_MAX_STATIC_SAMPLERS]
 

Friends

class RootParameter
 

Detailed Description

Wraps the ID3D12RootSignature object.

This class makes it easy for you to create RootSignatures by cutting out a lot of the fuss from setting up all the different root parameters and also wrapping the logic for finalizing the root signature. When you want to create a RootSignature, start by calling RootSignature::Create() with the number of root parameters and static samplers that you want. Then continue to initialize all the root parameters by using the [] operator to access each RootParameter. After that, continue to initialize the static samplers that you want to use by calling RootSignature::InitStaticSampler(). After all that is set and done, finalize the RootSignature by calling RootSignature::Finalize(). Your RootSignature is now ready for use.

Constructor & Destructor Documentation

blowbox::RootSignature::RootSignature ( )

Constructs the RootSignature.

blowbox::RootSignature::~RootSignature ( )

Destructs the RootSignature.

Member Function Documentation

void blowbox::RootSignature::ConfirmInitializedParameter ( )
protected

Confirms to the RootSignature that a RootParameter has been successfully initialized.

Remarks
This function is only called from the RootParameter itself after it was successfully initialized.
void blowbox::RootSignature::Create ( UINT  num_root_parameters,
UINT  num_static_samplers 
)

Creates all the underlying root parameters and static samplers, so that you can access them with the [] operator.

Parameters
[in]num_root_parametersThe number of root parameters that should be in this RootSignature.
[in]num_static_samplersThe number of static samplers that should be in this RootSignature.
void blowbox::RootSignature::Finalize ( const WString name,
D3D12_ROOT_SIGNATURE_FLAGS  flags = D3D12_ROOT_SIGNATURE_FLAG_NONE 
)

Finalizes the RootSignature. It will validate all RootParameters and construct the final ID3D12RootSignature.

Parameters
[in]nameThe name of this RootSignature.
[in]flagsAny flags that this RootSignature should be created with.
ID3D12RootSignature* blowbox::RootSignature::Get ( ) const
inline
Returns
The underlying ID3D12RootSignature.
void blowbox::RootSignature::InitStaticSampler ( const D3D12_STATIC_SAMPLER_DESC &  static_sampler_desc,
D3D12_SHADER_VISIBILITY  visibility = D3D12_SHADER_VISIBILITY_ALL 
)

Init a static sampler with a given static sampler desc.

Parameters
[in]static_sampler_descThe static sampler desc
[in]visibilityThe shader stages in which this sampler is visible.
Remarks
It is preferred to use the other overload of this function to make it simpler for you to initialize static samplers.
void blowbox::RootSignature::InitStaticSampler ( UINT  shader_register,
const D3D12_SAMPLER_DESC &  sampler_desc,
D3D12_SHADER_VISIBILITY  visibility = D3D12_SHADER_VISIBILITY_ALL 
)

Init a static sampler with a given NON-static sampler desc.

Parameters
[in]shader_registerThe shader register where this sampler should appear in the shaders.
[in]sampler_descThe NON-static sampler desc
[in]visibilityThe shader stages in which this sampler is visible.
blowbox::RootSignature::operator ID3D12RootSignature * ( ) const
inline

Implicit casting to ID3D12RootSignature.

ID3D12RootSignature* blowbox::RootSignature::operator-> ( ) const
inline

Overload the pointer operator to access the underlying ID3D12RootSignature.

RootParameter & blowbox::RootSignature::operator[] ( UINT  i)
Returns
The ith RootParameter.
const RootParameter & blowbox::RootSignature::operator[] ( UINT  i) const
Returns
The ith RootParameter.

Member Data Documentation

bool blowbox::RootSignature::finalized_
private

Whether the RootSignature has been finalized.

UINT blowbox::RootSignature::num_initialized_root_parameters_
private

The number of currently initialized RootParameters.

UINT blowbox::RootSignature::num_initialized_static_samplers_
private

The number of currently initialized static samplers.

UINT blowbox::RootSignature::num_root_parameters_
private

The number of RootParameters in this RootSignature.

UINT blowbox::RootSignature::num_static_samplers_
private

The number of static samplers in this RootSignature.

RootParameter blowbox::RootSignature::root_parameters_[ROOT_SIGNATURE_MAX_PARAMETERS]
private

All the RootParameters in this RootSignature.

ID3D12RootSignature* blowbox::RootSignature::root_signature_
private

The underlying ID3D12RootSignature.

D3D12_STATIC_SAMPLER_DESC blowbox::RootSignature::static_samplers_[ROOT_SIGNATURE_MAX_STATIC_SAMPLERS]
private

All the static sampllers in this RootSignature.


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