MayaFlux 0.1.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 211 of file ShaderFoundry.cpp.

215{
216 if (!is_initialized()) {
218 "ShaderFoundry not initialized");
219 return nullptr;
220 }
221
222 auto it = m_shader_cache.find(spirv_path);
223 if (it != m_shader_cache.end()) {
225 "Using cached SPIR-V shader: {}", spirv_path);
226 return it->second;
227 }
228
229 auto shader = create_shader_module();
230 auto vk_stage = to_vulkan_stage(stage);
231
232 if (!shader->create_from_spirv_file(
233 get_device(), spirv_path, vk_stage, entry_point,
236 "Failed to load SPIR-V shader: {}", spirv_path);
237 return nullptr;
238 }
239
240 m_shader_cache[spirv_path] = shader;
242 "Loaded SPIR-V shader: {}", spirv_path);
243 return shader;
244}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
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: