Nameless Engine
|
#include <RootSignatureGenerator.h>
Classes | |
struct | CollectedInfo |
struct | Generated |
class | RootParameter |
Public Member Functions | |
RootSignatureGenerator (const RootSignatureGenerator &)=delete | |
RootSignatureGenerator & | operator= (const RootSignatureGenerator &)=delete |
Static Public Member Functions | |
static std::variant< CollectedInfo, Error > | collectInfoFromReflection (ID3D12Device *pDevice, const ComPtr< ID3D12ShaderReflection > &pShaderReflection) |
static std::variant< Generated, Error > | generateGraphics (DirectXRenderer *pRenderer, HlslShader *pVertexShader, HlslShader *pPixelShader) |
static std::variant< Generated, Error > | generateCompute (DirectXRenderer *pRenderer, HlslShader *pComputeShader) |
Static Private Member Functions | |
static std::variant< SamplerType, Error > | findStaticSamplerForSamplerResource (const D3D12_SHADER_INPUT_BIND_DESC &samplerResourceDescription) |
static void | addSpecialResourceRootParametersIfUsed (std::unordered_map< std::string, std::pair< UINT, RootSignatureGenerator::RootParameter > > &shaderRootParameterIndices, std::vector< CD3DX12_ROOT_PARAMETER > &vRootParameters, std::vector< CD3DX12_DESCRIPTOR_RANGE > &vTableRanges, std::set< std::string > &addedRootParameterNames, std::unordered_map< std::string, UINT > &rootParameterIndices, std::array< UINT, static_cast< unsigned int >(SpecialRootParameterSlot::SIZE)> &vSpecialRootParameterIndices) |
static std::optional< Error > | addUniquePairResourceNameRootParameterIndex (std::unordered_map< std::string, std::pair< UINT, RootParameter > > &mapToAddTo, const std::string &sResourceName, UINT iRootParameterIndex, const RootParameter ¶meter) |
static std::optional< Error > | addCbufferRootParameter (std::vector< RootParameter > &vRootParameters, std::unordered_map< std::string, std::pair< UINT, RootParameter > > &rootParameterIndices, const D3D12_SHADER_INPUT_BIND_DESC &resourceDescription) |
static std::optional< Error > | addTexture2DRootParameter (std::vector< RootParameter > &vRootParameters, std::unordered_map< std::string, std::pair< UINT, RootParameter > > &rootParameterIndices, const D3D12_SHADER_INPUT_BIND_DESC &resourceDescription, bool bIsReadWrite) |
static std::optional< Error > | addStructuredBufferRootParameter (std::vector< RootParameter > &vRootParameters, std::unordered_map< std::string, std::pair< UINT, RootParameter > > &rootParameterIndices, const D3D12_SHADER_INPUT_BIND_DESC &resourceDescription, bool bIsReadWrite) |
static std::variant< bool, Error > | processRootConstantsIfFound (const ComPtr< ID3D12ShaderReflection > &pShaderReflection, const D3D12_SHADER_INPUT_BIND_DESC &resourceDescription, std::unordered_map< std::string, size_t > &rootConstantOffsets, std::vector< RootParameter > &vRootParameters, std::unordered_map< std::string, std::pair< UINT, RootParameter > > &rootParameterIndices) |
Static Private Attributes | |
static const std::string | sRootConstantsVariableName = "constants" |
static const std::string | sRootConstantsTypeName = "RootConstants" |
Generates Root Signature based on HLSL code.
|
staticprivate |
|
staticprivate |
Adds special root signature resources (if they are actually used).
shaderRootParameterIndices | Used resources of shaders. |
vRootParameters | Single root parameters of the root signature that will be generated. |
vTableRanges | Range root parameters of the root signature that will be generated. |
addedRootParameterNames | Names of the root parameters that were added. |
rootParameterIndices | Pairs of "resource name" - "root parameter index" that were added. |
vSpecialRootParameterIndices | Indices of special root parameters. |
|
staticprivate |
Adds a (RW)StructuredBuffer
shader resource to root parameters.
vRootParameters | Parameters to add the new resource to. |
rootParameterIndices | Map to add new parameter to. |
resourceDescription | Shader resource description. |
bIsReadWrite | true if buffer is read/write, false if only read. |
|
staticprivate |
Adds a (RW)Texture2D
shader resource to root parameters.
vRootParameters | Parameters to add the new resource to. |
rootParameterIndices | Map to add new parameter to. |
resourceDescription | Shader resource description. |
bIsReadWrite | true if buffer is read/write, false if only read. |
|
staticprivate |
Adds a new pair of resource name
- root parameter index
to the specified map, additionally checks if a resource with this name already exists in the map and returns error in this case.
mapToAddTo | Map to add new pair to. |
sResourceName | Resource name. |
iRootParameterIndex | Root parameter index of the resource. |
parameter | Parameter to add. |
|
static |
Generates root signature based on HLSL code reflection.
pDevice | DirectX device. |
pShaderReflection | Reflection from compiled HLSL shader. |
|
staticprivate |
Finds static sampler for the specified sampler resource.
samplerResourceDescription | HLSL resource description. |
|
static |
Generates a new root signature using the compute shader info.
pRenderer | DirectX renderer. |
pComputeShader | Compute shader. |
|
static |
Generates a new root signature using the vertex and pixel shader info.
pRenderer | DirectX renderer. |
pVertexShader | Vertex shader. |
pPixelShader | Pixel shader. Specify nullptr to generate root signature only for vertex shader. |
|
staticprivate |
Looks if the specified cbuffer resource description stores root constants (sRootConstantsTypeName) and if it does adds root constant offsets to the specified map.
pShaderReflection | Shader reflection. |
resourceDescription | Cbuffer description. |
rootConstantOffsets | If found root constants, their offsets will be added here. |
vRootParameters | Parameters to add the new resource to (if root constants are found). |
rootParameterIndices | Map to add new parameter to (if root constants are found). |
false
if no root constants were found and true
if root constants were found and variable offsets were added.
|
inlinestaticprivate |
Name of the shader struct that stores root constants.
|
inlinestaticprivate |
Name of the shader cbuffer
that will be considered as buffer that stores root constants.