Provides the interface for a shader compiler that prepares the GLSL shader source code so that it conforms to the Vulkan GLSL extension (https://github.com/KhronosGroup/GLSL/blob/master/extensions/khr/GL_KHR_vulkan_glsl.txt) for use with the KzGFx library. More...
#include <kanzi/shadercompiler/shadercompiler.hpp>
Classes | |
| struct | CompileResult |
| Result type of the compile operation. More... | |
| struct | ShaderErrors |
| Shader compilation error messages. More... | |
| struct | ShaderIncludeResult |
| When providing custom shader include logic, communicates the result of a shader include operation. More... | |
| struct | ShaderSource |
| Shader input data for a shader stage. More... | |
| struct | StageResult |
| Shader compiler results for a single stage. More... | |
Public Types | |
| using | CustomIncluderFunction |
| The callback function that resolves custom includes. | |
| enum struct | OptionFlags { None , Optimize , EmitReflection , EmitBlob , EmitHumanReadable , ConvertLegacyShader , Default } |
| Configuration options for the shader compiler. More... | |
| using | ProgramResults |
| Map of stages to stage results. | |
Public Member Functions | |
| virtual CompileResult | compile (span< ShaderSource > sources, OptionFlags options, span< const gfx::ShaderFormat > formats, string_view defines="", CustomIncluderFunction systemIncluder={}, CustomIncluderFunction localIncluder={})=0 |
| Invokes the shader compiler for a given set of shader sources. | |
| virtual | ~ShaderCompiler ()=default |
| Destructor. | |
Provides the interface for a shader compiler that prepares the GLSL shader source code so that it conforms to the Vulkan GLSL extension (https://github.com/KhronosGroup/GLSL/blob/master/extensions/khr/GL_KHR_vulkan_glsl.txt) for use with the KzGFx library.
To provide syntax checking for the provided source code, the shader compiler internally uses the OpenGL ES reference compiler (https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/). The shader compiler returns errors to the caller.
The shader compiler can output reflection information about the resulting shader program, such as input attributes, uniform buffer definitions, and image and sampler definitions.
Map of stages to stage results.
The callback function that resolves custom includes.
The first parameter is the requested source file. The second parameter is the source file that contains the include directive. The third parameter is the inclusion depth.
Configuration options for the shader compiler.
|
virtualdefault |
Destructor.
|
pure virtual |
Invokes the shader compiler for a given set of shader sources.
| sources | The list of ShaderSource objects to compile. A vertex shader is required, other stages are optional. The shader compiler will assemble all stages into a single program. |
| options | The set of options to use for the compilation. |
| formats | The list of shader formats to create. |
| defines | A list of preprocessor definitions that are prepended to all shader compilations. |
| systemIncluder | A system level includer function to use when the parser encounters an include operation in the shader. |
| localIncluder | A local level includer function to use when the parser encounters an include operation in the shader. |