137{
140 "ShaderFoundry not initialized");
141 return nullptr;
142 }
143
147 "Using cached shader: {}", filepath);
148 return it->second;
149 }
150
151 std::optional<vk::ShaderStageFlagBits> vk_stage;
152 if (stage.has_value()) {
154 }
155
157
158 if (filepath.ends_with(".spv")) {
159 if (!shader->create_from_spirv_file(
161 vk_stage.value_or(vk::ShaderStageFlagBits::eCompute),
164 "Failed to compile SPIR-V shader: {}", filepath);
165 return nullptr;
166 }
167 } else {
168 if (!shader->create_from_glsl_file(
169 get_device(), filepath, vk_stage, entry_point,
173 "Failed to compile GLSL shader: {}", filepath);
174 return nullptr;
175 }
176 }
177
180 "Compiled shader: {} ({})", filepath, vk::to_string(shader->get_stage()));
181 return shader;
182}
#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.
ShaderCompilerConfig m_config
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.
std::vector< std::string > include_directories
Paths for #include resolution.
std::unordered_map< std::string, std::string > defines
Preprocessor macros.