|
static void | ParseMaterialParameterSection (plStreamReader &inout_stream, plHybridArray< ParameterDefinition, 16 > &out_parameter, plHybridArray< EnumDefinition, 4 > &out_enumDefinitions) |
|
static void | ParsePermutationSection (plStreamReader &inout_stream, plHybridArray< plHashedString, 16 > &out_permVars, plHybridArray< plPermutationVar, 16 > &out_fixedPermVars) |
|
static void | ParsePermutationSection (plStringView sPermutationSection, plHybridArray< plHashedString, 16 > &out_permVars, plHybridArray< plPermutationVar, 16 > &out_fixedPermVars) |
|
static void | ParsePermutationVarConfig (plStringView sPermutationVarConfig, plVariant &out_defaultValue, EnumDefinition &out_enumDefinition) |
|
static void | ParseShaderResources (plStringView sShaderStageSource, plDynamicArray< plShaderResourceDefinition > &out_resources) |
| Tries to find shader resource declarations inside the shader source.
|
|
static plResult | MergeShaderResourceBindings (const plShaderProgramData &spd, plHashTable< plHashedString, plShaderResourceBinding > &out_bindings, plLogInterface *pLog) |
| Merges the shader resource bindings of all used shader stages.
|
|
static plResult | SanityCheckShaderResourceBindings (const plHashTable< plHashedString, plShaderResourceBinding > &bindings, plLogInterface *pLog) |
| Makes sure that bindings fulfills the basic requirements that plEngine has for resource bindings in a shader, e.g. that each binding has a set / slot set.
|
|
static void | ApplyShaderResourceBindings (plStringView sPlatform, plStringView sShaderStageSource, const plDynamicArray< plShaderResourceDefinition > &resources, const plHashTable< plHashedString, plShaderResourceBinding > &bindings, const CreateResourceDeclaration &createDeclaration, plStringBuilder &out_sShaderStageSource) |
| Creates a new shader source code that patches all shader resources to contain fixed set / slot bindings.
|
|
◆ CreateResourceDeclaration
Delegate to creates a new declaration and register binding for a specific shader plShaderResourceDefinition.
- Parameters
-
sPlatform | The platform for which the shader is being compiled. Will be one of the values returned by GetSupportedPlatforms. |
sDeclaration | The shader resource declaration without any attributes, e.g. "Texture2D DiffuseTexture" |
binding | The binding that needs to be set on the output out_sDeclaration. |
out_sDeclaration | The new declaration that changes sDeclaration according to the provided 'binding', e.g. "Texture2D DiffuseTexture : register(t0, space5)" |
◆ ApplyShaderResourceBindings()
Creates a new shader source code that patches all shader resources to contain fixed set / slot bindings.
- Parameters
-
sPlatform | The platform for which the shader should be patched. |
sShaderStageSource | The original shader source code that should be patched. |
resources | A list of all shader resources that need to be patched within sShaderStageSource. |
bindings | The binding information that each shader resource should have after patching. These bindings must have unique set / slots combinations for each resource. |
createDeclaration | The callback to be called to generate the new shader resource declaration. |
out_shaderStageSource | The new shader source code after patching. |
◆ MergeShaderResourceBindings()
Merges the shader resource bindings of all used shader stages.
The function can fail if a shader resource of the same name has different signatures in two stages. E.g. the type, slot or set is different. Shader resources must be uniquely identified via name.
- Parameters
-
spd | The shader currently being processed. |
out_bindings | A hashmap from shader resource name to shader resource binding. If a binding is used in multiple stages, plShaderResourceBinding::m_Stages will be the combination of all used stages. |
pLog | Log interface to write errors to. |
- Returns
- Returns failure if the shader stages could not be merged.
◆ ParseShaderResources()
Tries to find shader resource declarations inside the shader source.
Used by the shader compiler implementations to generate resource mappings to sets/slots without creating conflicts across shader stages. For a list of supported resource declarations and possible pitfalls, please refer to https://plengine.net/pages/docs/graphics/shaders/shader-resources.html.
- Parameters
-
sShaderStageSource | The shader source to parse. |
out_Resources | The shader resources found inside the source. |
The documentation for this class was generated from the following files:
- Code/Engine/RendererCore/ShaderCompiler/ShaderParser.h
- Code/Engine/RendererCore/ShaderCompiler/Implementation/ShaderParser.cpp