MayaFlux 0.4.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 250 of file ShaderFoundry.cpp.

251{
252 switch (shader_source.type) {
254 return compile_from_file(shader_source.content, shader_source.stage, shader_source.entry_point);
255
257 return compile_from_source(shader_source.content, shader_source.stage, shader_source.entry_point);
258
260 return compile_from_spirv(shader_source.content, shader_source.stage, shader_source.entry_point);
261
262 default:
264 "Unknown shader source type");
265 return nullptr;
266 }
267}
#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: