118{
121 "ShaderFoundry not initialized");
122 return nullptr;
123 }
124
128 "Using cached shader: {}", filepath);
129 return it->second;
130 }
131
132 std::optional<vk::ShaderStageFlagBits> vk_stage;
133 if (stage.has_value()) {
135 }
136
138
139 if (filepath.ends_with(".spv")) {
140 if (!shader->create_from_spirv_file(
142 vk_stage.value_or(vk::ShaderStageFlagBits::eCompute),
145 "Failed to compile SPIR-V shader: {}", filepath);
146 return nullptr;
147 }
148 } else {
149 if (!shader->create_from_glsl_file(
150 get_device(), filepath, vk_stage, entry_point,
154 "Failed to compile GLSL shader: {}", filepath);
155 return nullptr;
156 }
157 }
158
161 "Compiled shader: {} ({})", filepath, vk::to_string(shader->get_stage()));
162 return shader;
163}
#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.