MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ compile()

std::shared_ptr< Core::VKShaderModule > MayaFlux::Portal::Graphics::ShaderFoundry::compile ( const ShaderSource shader_source)

Compile shader from ShaderSource descriptor.

Parameters
shader_sourceShader descriptor (path or source + type + stage)
Returns
Compiled shader module, or nullptr on failure

Unified interface that dispatches to appropriate compile method. Useful for abstracted shader loading pipelines.

Definition at line 246 of file ShaderFoundry.cpp.

247{
248 switch (shader_source.type) {
250 return compile_from_file(shader_source.content, shader_source.stage, shader_source.entry_point);
251
253 return compile_from_source(shader_source.content, shader_source.stage, shader_source.entry_point);
254
256 return compile_from_spirv(shader_source.content, shader_source.stage, shader_source.entry_point);
257
258 default:
260 "Unknown shader source type");
261 return nullptr;
262 }
263}
#define MF_ERROR(comp, ctx,...)
std::shared_ptr< Core::VKShaderModule > compile_from_source(const std::string &source, ShaderStage stage, const std::string &entry_point="main")
std::shared_ptr< Core::VKShaderModule > compile_from_file(const std::string &filepath, std::optional< ShaderStage > stage=std::nullopt, const std::string &entry_point="main")
std::shared_ptr< Core::VKShaderModule > compile_from_spirv(const std::string &spirv_path, ShaderStage stage, const std::string &entry_point="main")
@ ShaderCompilation
Shader compilation tasks (Portal::Graphics::ShaderCompiler)
@ Portal
High-level user-facing API layer.

References compile_from_file(), compile_from_source(), compile_from_spirv(), MayaFlux::Portal::Graphics::ShaderSource::content, MayaFlux::Portal::Graphics::ShaderSource::entry_point, MayaFlux::Portal::Graphics::ShaderSource::GLSL_FILE, MayaFlux::Portal::Graphics::ShaderSource::GLSL_STRING, MF_ERROR, MayaFlux::Journal::Portal, MayaFlux::Journal::ShaderCompilation, MayaFlux::Portal::Graphics::ShaderSource::SPIRV_FILE, MayaFlux::Portal::Graphics::ShaderSource::stage, and MayaFlux::Portal::Graphics::ShaderSource::type.

+ Here is the call graph for this function: