Plasma Engine  2.0
Loading...
Searching...
No Matches
ShaderParser.h
1#pragma once
2
3#include <Foundation/Strings/String.h>
4#include <RendererCore/ShaderCompiler/Declarations.h>
5#include <RendererFoundation/Shader/ShaderByteCode.h>
6
8
9class PL_RENDERERCORE_DLL plShaderParser
10{
11public:
13 {
14 plString m_sType;
16 };
17
19 {
20 const plRTTI* m_pType = nullptr;
21 plString m_sType;
22 plString m_sName;
23
25 };
26
27 struct EnumValue
28 {
29 plHashedString m_sValueName;
30 plInt32 m_iValueValue = 0;
31 };
32
34 {
35 plString m_sName;
36 plUInt32 m_uiDefaultValue = 0;
38 };
39
40 static void ParseMaterialParameterSection(
41 plStreamReader& inout_stream, plHybridArray<ParameterDefinition, 16>& out_parameter, plHybridArray<EnumDefinition, 4>& out_enumDefinitions);
42
43 static void ParsePermutationSection(
44 plStreamReader& inout_stream, plHybridArray<plHashedString, 16>& out_permVars, plHybridArray<plPermutationVar, 16>& out_fixedPermVars);
45 static void ParsePermutationSection(
46 plStringView sPermutationSection, plHybridArray<plHashedString, 16>& out_permVars, plHybridArray<plPermutationVar, 16>& out_fixedPermVars);
47
48 static void ParsePermutationVarConfig(plStringView sPermutationVarConfig, plVariant& out_defaultValue, EnumDefinition& out_enumDefinition);
49
50
51
57 static void ParseShaderResources(plStringView sShaderStageSource, plDynamicArray<plShaderResourceDefinition>& out_resources);
58
65
73 static plResult MergeShaderResourceBindings(const plShaderProgramData& spd, plHashTable<plHashedString, plShaderResourceBinding>& out_bindings, plLogInterface* pLog);
74
76 static plResult SanityCheckShaderResourceBindings(const plHashTable<plHashedString, plShaderResourceBinding>& bindings, plLogInterface* pLog);
77
85 static void ApplyShaderResourceBindings(plStringView sPlatform, plStringView sShaderStageSource, const plDynamicArray<plShaderResourceDefinition>& resources, const plHashTable<plHashedString, plShaderResourceBinding>& bindings, const CreateResourceDeclaration& createDeclaration, plStringBuilder& out_sShaderStageSource);
86};
Definition DynamicArray.h:81
Definition HashTable.h:333
This class is optimized to take nearly no memory (sizeof(void*)) and to allow very fast checks whethe...
Definition HashedString.h:25
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Base class for all logging classes.
Definition Log.h:77
Base class of all attributes can be used to decorate a RTTI property.
Definition PropertyAttributes.h:11
This class holds information about reflected types. Each instance represents one type that is known t...
Definition RTTI.h:30
Definition ShaderParser.h:10
Interface for binary in (read) streams.
Definition Stream.h:22
plStringBuilder is a class that is meant for creating and modifying strings.
Definition StringBuilder.h:35
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
plVariant is a class that can store different types of variables, which is useful in situations where...
Definition Variant.h:44
A generic delegate class which supports static functions and member functions.
Definition Delegate.h:76
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Definition ShaderParser.h:13
Definition ShaderParser.h:34
Definition ShaderParser.h:28
Definition ShaderParser.h:19
Storage used during the shader compilation process.
Definition Declarations.h:38
Shader reflection of a single shader resource (texture, constant buffer, etc.).
Definition ShaderByteCode.h:77