114{
117 "ShaderFoundry not initialized");
118 return nullptr;
119 }
120
124 "Using cached shader: {}", filepath);
125 return it->second;
126 }
127
128 std::optional<vk::ShaderStageFlagBits> vk_stage;
129 if (stage.has_value()) {
131 }
132
134
135 if (filepath.ends_with(".spv")) {
136 if (!shader->create_from_spirv_file(
138 vk_stage.value_or(vk::ShaderStageFlagBits::eCompute),
141 "Failed to compile SPIR-V shader: {}", filepath);
142 return nullptr;
143 }
144 } else {
145 if (!shader->create_from_glsl_file(
146 get_device(), filepath, vk_stage, entry_point,
150 "Failed to compile GLSL shader: {}", filepath);
151 return nullptr;
152 }
153 }
154
157 "Compiled shader: {} ({})", filepath, vk::to_string(shader->get_stage()));
158 return shader;
159}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
vk::Device get_device() const
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.