Plasma Engine  2.0
Loading...
Searching...
No Matches
ShaderCompilerDXC.h
1#pragma once
2
3#include <RendererCore/ShaderCompiler/ShaderCompiler.h>
4#include <ShaderCompilerDXC/ShaderCompilerDXCDLL.h>
5
6struct SpvReflectDescriptorBinding;
7struct SpvReflectBlockVariable;
8
9class PL_SHADERCOMPILERDXC_DLL plShaderCompilerDXC : public plShaderProgramCompiler
10{
11 PL_ADD_DYNAMIC_REFLECTION(plShaderCompilerDXC, plShaderProgramCompiler);
12
13public:
14 virtual void GetSupportedPlatforms(plHybridArray<plString, 4>& out_platforms) override { out_platforms.PushBack("VULKAN"); }
15
16 virtual plResult ModifyShaderSource(plShaderProgramData& inout_data, plLogInterface* pLog) override;
17 virtual plResult Compile(plShaderProgramData& inout_Data, plLogInterface* pLog) override;
18
19private:
25 plResult DefineShaderResourceBindings(const plShaderProgramData& data, plHashTable<plHashedString, plShaderResourceBinding>& inout_resourceBinding, plLogInterface* pLog);
26
27 void CreateNewShaderResourceDeclaration(plStringView sPlatform, plStringView sDeclaration, const plShaderResourceBinding& binding, plStringBuilder& out_sDeclaration);
28
29 plResult ReflectShaderStage(plShaderProgramData& inout_Data, plGALShaderStage::Enum Stage);
30 plShaderConstantBufferLayout* ReflectConstantBufferLayout(plGALShaderByteCode& pStageBinary, const char* szName, const SpvReflectBlockVariable& block);
31 plResult FillResourceBinding(plGALShaderByteCode& shaderBinary, plShaderResourceBinding& binding, const SpvReflectDescriptorBinding& info);
32 plResult FillSRVResourceBinding(plGALShaderByteCode& shaderBinary, plShaderResourceBinding& binding, const SpvReflectDescriptorBinding& info);
33 plResult FillUAVResourceBinding(plGALShaderByteCode& shaderBinary, plShaderResourceBinding& binding, const SpvReflectDescriptorBinding& info);
34 static plGALShaderTextureType::Enum GetTextureType(const SpvReflectDescriptorBinding& info);
35 plResult Initialize();
36
37private:
39};
void PushBack(const T &value)
Pushes value at the end of the array.
Definition ArrayBase_inl.h:333
This class wraps shader byte code storage. Since byte code can have different requirements for alignm...
Definition ShaderByteCode.h:96
Definition HashTable.h:333
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
Definition Map.h:408
Definition ShaderCompilerDXC.h:10
virtual void GetSupportedPlatforms(plHybridArray< plString, 4 > &out_platforms) override
Returns the platforms that this shader compiler supports.
Definition ShaderCompilerDXC.h:14
Reflection data of a shader constant buffer.
Definition ShaderByteCode.h:56
Shader compiler interface. Custom shader compiles need to derive from this class and implement the pu...
Definition ShaderCompiler.h:17
virtual plResult ModifyShaderSource(plShaderProgramData &inout_data, plLogInterface *pLog)=0
virtual plResult Compile(plShaderProgramData &inout_data, plLogInterface *pLog)=0
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
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
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