Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Static Public Member Functions | Static Private Member Functions | List of all members
ShaderCompiler Class Reference

Relies on glslang to compile GLSL shaders to SPIR-V and SPIRV-Cross to generate reflection data. More...

#include <ShaderCompiler.hpp>

Static Public Member Functions

static void compile (const std::string &prog, ShaderType type, Program::Stage &stage, bool generateModule, std::string &finalLog)
 
static bool init ()
 
static void cleanup ()
 
static void clean (Program::Stage &stage)
 

Static Private Member Functions

static void reflect (const std::vector< uint32_t > &spirv, Program::Stage &stage)
 

Detailed Description

Relies on glslang to compile GLSL shaders to SPIR-V and SPIRV-Cross to generate reflection data.

Member Function Documentation

◆ clean()

void ShaderCompiler::clean ( Program::Stage stage)
static

Destroy a compiled shader

Parameters
stagethe shader to cleanup

◆ cleanup()

void ShaderCompiler::cleanup ( )
static

Close the compiler library.

◆ compile()

void ShaderCompiler::compile ( const std::string &  prog,
ShaderType  type,
Program::Stage stage,
bool  generateModule,
std::string &  finalLog 
)
static

Create a shader of a given type from a string. Extract additional informations from the shader.

Parameters
progthe content of the shader
typethe type of shader (vertex, fragment,...)
stagewill be filled with reflection information: the samplers/buffers present in the shader and their user-defined locations, along with the compiled results
generateModuleshoud a Vulkan module be generated from the SPIR-V code
finalLogwill contain the compilation log of the shader

◆ init()

bool ShaderCompiler::init ( )
static

Initialize the compiler library.

Returns
the success status

◆ reflect()

void ShaderCompiler::reflect ( const std::vector< uint32_t > &  spirv,
Program::Stage stage 
)
staticprivate

Perform reflection on a compiled program and populate our reflection structures.

Parameters
spirvthe compiled SPIR-V program
stagewill contain reflection data

The documentation for this class was generated from the following files: