diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2017-12-13 05:57:52 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2017-12-13 05:57:52 +0000 |
| commit | f546087cb597f4096d695e21b3a37a55dbd3c0d3 (patch) | |
| tree | 36d5fa78986d7673e247d7b1b1150e37c07c7e79 /Graphics/GraphicsEngine | |
| parent | Few more updates to cmake lists (diff) | |
| download | DiligentCore-f546087cb597f4096d695e21b3a37a55dbd3c0d3.tar.gz DiligentCore-f546087cb597f4096d695e21b3a37a55dbd3c0d3.zip | |
Added option to create shader from bytecode for D3D11 and D3D12
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/interface/Shader.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h index 06381966..ecee3825 100644 --- a/Graphics/GraphicsEngine/interface/Shader.h +++ b/Graphics/GraphicsEngine/interface/Shader.h @@ -204,12 +204,15 @@ struct ShaderMacro struct ShaderCreationAttribs { /// Source file path - const Char* FilePath; + + /// If source file path is provided, Source and ByteCode members must be null + const Char* FilePath = nullptr; /// Pointer to the shader source input stream factory. - /// The factory is used to create additional input streams for - /// shader include files - IShaderSourceInputStreamFactory *pShaderSourceStreamFactory; + + /// The factory is used to load the shader source file if FilePath is not null. + /// It is also used to create additional input streams for shader include files + IShaderSourceInputStreamFactory *pShaderSourceStreamFactory = nullptr; /// HLSL->GLSL conversion stream @@ -222,32 +225,39 @@ struct ShaderCreationAttribs /// the first time and will use it in all subsequent times. /// For all subsequent conversions, FilePath member must be the same, or /// new stream will be crated and warning message will be displayed. - class IHLSL2GLSLConversionStream **ppConversionStream; + class IHLSL2GLSLConversionStream **ppConversionStream = nullptr; /// Shader source - const Char* Source; + + /// If shader source is provided, FilePath and ByteCode members must be null + const Char* Source = nullptr; + + /// Compiled shader bytecode. + + /// If shader byte code is provided, FilePath and Source members must be null + /// \note. This option is currently only supported for D3D11 and D3D12 + const void *ByteCode = nullptr; + + /// Size of the compiled shader bytecode + + /// Byte code size must be provided if ByteCode is not null + size_t ByteCodeSize = 0; /// Shader entry point - const Char* EntryPoint; + + /// This member is ignored if ByteCode is not null + const Char* EntryPoint = "main"; /// Shader macros - const ShaderMacro *Macros; + + /// This member is ignored if ByteCode is not null + const ShaderMacro *Macros = nullptr; /// Shader description. See Diligent::ShaderDesc. ShaderDesc Desc; /// Shader source language. See Diligent::SHADER_SOURCE_LANGUAGE. - SHADER_SOURCE_LANGUAGE SourceLanguage; - - ShaderCreationAttribs() : - FilePath( nullptr ), - Source( nullptr ), - pShaderSourceStreamFactory( nullptr ), - ppConversionStream( nullptr ), - EntryPoint("main"), - Macros(nullptr), - SourceLanguage(SHADER_SOURCE_LANGUAGE_DEFAULT) - {} + SHADER_SOURCE_LANGUAGE SourceLanguage = SHADER_SOURCE_LANGUAGE_DEFAULT; }; |
