Skip to content

shaders/shader_compiler.hpp

Namespaces

Name
sgns
sgns::sgprocessing
Artifact and manifest binary serialization.

Classes

Name
struct sgns::sgprocessing::CompiledShaderStage
class sgns::sgprocessing::ShaderCompiler

Functions

Name
OUTCOME_HPP_DECLARE_ERROR_2(sgns::sgprocessing , ShaderCompiler::Error )

Functions Documentation

function OUTCOME_HPP_DECLARE_ERROR_2

OUTCOME_HPP_DECLARE_ERROR_2(
    sgns::sgprocessing ,
    ShaderCompiler::Error 
)

Source code

#ifndef SGPROCESSINGMANAGER_SHADER_COMPILER_HPP
#define SGPROCESSINGMANAGER_SHADER_COMPILER_HPP

#include <outcome/sgprocmgr-outcome.hpp>
#include <util/sgprocmgr-logger.hpp>
#include <Stage.hpp>
#include <ShaderSourceType.hpp>

#include <cstdint>
#include <string>
#include <vector>

namespace sgns::sgprocessing
{
    struct CompiledShaderStage
    {
        std::vector<uint32_t> spirv;
        sgns::Stage            stage;
    };

    class ShaderCompiler
    {
    public:
        enum class Error
        {
            COMPILE_FAILED    = 1,
            VALIDATION_FAILED = 2
        };

        outcome::result<CompiledShaderStage> CompileAndValidate( const std::vector<char> &source_bytes,
                                                                   sgns::Stage              stage,
                                                                   sgns::ShaderSourceType   type,
                                                                   const std::string       &entry_point );

    private:
        sgns::sgprocmanager::Logger m_logger = sgns::sgprocmanager::createLogger( "ShaderCompiler" );
    };
}

OUTCOME_HPP_DECLARE_ERROR_2( sgns::sgprocessing, ShaderCompiler::Error );

#endif // SGPROCESSINGMANAGER_SHADER_COMPILER_HPP

Updated on 2026-09-17 at 06:29:15 +0000