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

◆ compile_from_spirv()

std::shared_ptr< Core::VKShaderModule > MayaFlux::Portal::Graphics::ShaderFoundry::compile_from_spirv ( const std::string &  spirv_path,
ShaderStage  stage,
const std::string &  entry_point = "main" 
)
private

Definition at line 215 of file ShaderFoundry.cpp.

219{
220 if (!is_initialized()) {
222 "ShaderFoundry not initialized");
223 return nullptr;
224 }
225
226 auto it = m_shader_cache.find(spirv_path);
227 if (it != m_shader_cache.end()) {
229 "Using cached SPIR-V shader: {}", spirv_path);
230 return it->second;
231 }
232
233 auto shader = create_shader_module();
234 auto vk_stage = to_vulkan_stage(stage);
235
236 if (!shader->create_from_spirv_file(
237 get_device(), spirv_path, vk_stage, entry_point,
240 "Failed to load SPIR-V shader: {}", spirv_path);
241 return nullptr;
242 }
243
244 m_shader_cache[spirv_path] = shader;
246 "Loaded SPIR-V shader: {}", spirv_path);
247 return shader;
248}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
vk::Device get_device() const
Get logical device handle.
std::shared_ptr< Core::VKShaderModule > create_shader_module()
std::unordered_map< std::string, std::shared_ptr< Core::VKShaderModule > > m_shader_cache
static vk::ShaderStageFlagBits to_vulkan_stage(ShaderStage stage)
Convert Portal ShaderStage to Vulkan ShaderStageFlagBits.
bool is_initialized() const
Check if compiler is initialized.
@ ShaderCompilation
Shader compilation tasks (Portal::Graphics::ShaderCompiler)
@ Portal
High-level user-facing API layer.
bool enable_reflection
Extract descriptor bindings and metadata.

References create_shader_module(), MayaFlux::Portal::Graphics::ShaderCompilerConfig::enable_reflection, get_device(), is_initialized(), m_config, m_shader_cache, MF_DEBUG, MF_ERROR, MF_INFO, MayaFlux::Journal::Portal, MayaFlux::Journal::ShaderCompilation, and to_vulkan_stage().

Referenced by compile(), and load_shader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: