16 const std::shared_ptr<Core::VulkanBackend>& backend,
21 "ShaderFoundry already initialized (static flag)");
27 "Cannot initialize ShaderFoundry with null backend");
33 "ShaderFoundry already initialized");
54 "ShaderFoundry initialized");
65 "Stopping ShaderFoundry - freeing command buffers...");
74 "ShaderFoundry stopped - command buffers freed");
88 "Shutting down ShaderFoundry...");
92 "{} command buffers still exist during shutdown - freeing now",
107 "ShaderFoundry shutdown complete");
115 const std::string& filepath,
116 std::optional<ShaderStage> stage,
117 const std::string& entry_point)
121 "ShaderFoundry not initialized");
128 "Using cached shader: {}", filepath);
132 std::optional<vk::ShaderStageFlagBits> vk_stage;
133 if (stage.has_value()) {
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);
149 if (!shader->create_from_glsl_file(
150 get_device(), filepath, vk_stage, entry_point,
154 "Failed to compile GLSL shader: {}", filepath);
161 "Compiled shader: {} ({})", filepath, vk::to_string(shader->get_stage()));
166 const std::string& source,
168 const std::string& entry_point)
172 "ShaderFoundry not initialized");
179 if (!shader->create_from_glsl(
184 "Failed to compile GLSL source");
189 "Compiled shader from source ({})", vk::to_string(vk_stage));
194 const std::string& source,
196 const std::string& cache_key,
197 const std::string& entry_point)
202 "Using cached shader: {}", cache_key);
216 const std::string& spirv_path,
218 const std::string& entry_point)
222 "ShaderFoundry not initialized");
229 "Using cached SPIR-V shader: {}", spirv_path);
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);
246 "Loaded SPIR-V shader: {}", spirv_path);
252 switch (shader_source.
type) {
264 "Unknown shader source type");
270 const std::string& content,
271 std::optional<ShaderStage> stage,
272 const std::string& entry_point)
276 "ShaderFoundry not initialized");
282 std::string cache_key;
292 "Using cached shader ID for: {}", cache_key);
293 return id_it->second;
296 if (!stage.has_value()) {
299 std::filesystem::path p(content);
300 std::string stem = p.stem().string();
307 if (!stage.has_value()) {
309 "Cannot auto-detect shader stage from '{}' - must specify explicitly",
315 std::shared_ptr<Core::VKShaderModule> shader_module;
317 switch (source_type) {
329 "Cannot determine shader source type");
333 if (!shader_module) {
340 state.module = shader_module;
342 state.
stage = *stage;
348 "Shader loaded: {} (ID: {}, stage: {})",
349 cache_key,
id,
static_cast<int>(*stage));
356 return load_shader(source.content, source.stage, source.entry_point);
361 namespace fs = std::filesystem;
363 fs::path path(filepath);
365 if (path.is_absolute() || fs::exists(filepath)) {
369 std::vector<std::string> search_paths = {
370 Core::SHADER_BUILD_OUTPUT_DIR,
371 Core::SHADER_INSTALL_DIR,
372 Core::SHADER_SOURCE_DIR,
380 if (std::string_view(Core::SHADER_EXAMPLE_DIR).length() > 0) {
381 search_paths.emplace_back(Core::SHADER_EXAMPLE_DIR);
384#ifdef MAYAFLUX_PROJECT_SHADER_DIR
385 search_paths.emplace_back(MAYAFLUX_PROJECT_SHADER_DIR);
388 for (
const auto& search_path : search_paths) {
389 fs::path full_path = fs::path(search_path) / filepath;
390 if (fs::exists(full_path)) {
402 if (resolved_path.has_value()) {
403 std::string ext = resolved_path->extension().string();
404 std::ranges::transform(ext, ext.begin(), ::tolower);
413 if (content.size() > 1024 || content.find(
'\n') != std::string::npos) {
422 std::hash<std::string> hasher;
423 size_t hash = hasher(source + std::to_string(
static_cast<int>(stage)));
424 return "source_" + std::to_string(hash);
444 if (!it->second.filepath.empty()) {
448 if (it->second.module) {
466 const auto& reflection = it->second.module->get_reflection();
469 info.
stage = it->second.stage;
473 for (
const auto& binding : reflection.bindings) {
475 .binding = binding.binding,
476 .type = binding.type,
477 .name = binding.name });
480 for (
const auto& pc : reflection.push_constants) {
482 pc_info.
offset = pc.offset;
483 pc_info.size = pc.size;
494 return it->second.
stage;
503 return it->second.entry_point;
515 std::vector<std::string> keys;
529 shader_module->cleanup(device);
538 "Cleaned up shader modules");
551 "Invalidated shader cache: {}", cache_key);
559 "Cleared shader cache");
576 "Updated shader compiler configuration");
606 vk::DescriptorType type,
616 vk::DescriptorBufferInfo buffer_info;
617 buffer_info.buffer = buffer;
618 buffer_info.offset = offset;
619 buffer_info.range = size;
621 vk::WriteDescriptorSet write;
622 write.dstSet = it->second.descriptor_set;
623 write.dstBinding = binding;
624 write.dstArrayElement = 0;
625 write.descriptorCount = 1;
626 write.descriptorType = type;
627 write.pBufferInfo = &buffer_info;
629 get_device().updateDescriptorSets(1, &write, 0,
nullptr);
635 vk::ImageView image_view,
637 vk::ImageLayout layout,
638 uint32_t array_element)
645 vk::DescriptorImageInfo image_info;
646 image_info.imageView = image_view;
647 image_info.sampler = sampler;
648 image_info.imageLayout = layout;
650 vk::WriteDescriptorSet write;
651 write.dstSet = it->second.descriptor_set;
652 write.dstBinding = binding;
653 write.dstArrayElement = array_element;
654 write.descriptorCount = 1;
655 write.descriptorType = vk::DescriptorType::eCombinedImageSampler;
656 write.pImageInfo = &image_info;
658 get_device().updateDescriptorSets(1, &write, 0,
nullptr);
664 vk::ImageView image_view,
665 vk::ImageLayout layout)
672 vk::DescriptorImageInfo image_info;
673 image_info.imageView = image_view;
674 image_info.imageLayout = layout;
676 vk::WriteDescriptorSet write;
677 write.dstSet = it->second.descriptor_set;
678 write.dstBinding = binding;
679 write.dstArrayElement = 0;
680 write.descriptorCount = 1;
681 write.descriptorType = vk::DescriptorType::eStorageImage;
682 write.pImageInfo = &image_info;
684 get_device().updateDescriptorSets(1, &write, 0,
nullptr);
691 error<std::invalid_argument>(
694 std::source_location::current(),
695 "Invalid DescriptorSetID: {}", descriptor_set_id);
697 return it->second.descriptor_set;
712 "Cleaned up descriptor resources");
721 auto& cmd_manager =
m_backend->get_command_manager();
728 ? cmd_manager.begin_single_time_commands_compute()
729 : cmd_manager.begin_single_time_commands();
738 vk::Format color_format,
739 vk::Format depth_format)
741 auto& cmd_manager =
m_backend->get_command_manager();
745 vk::CommandBuffer
cmd = cmd_manager.allocate_command_buffer(vk::CommandBufferLevel::eSecondary);
747 vk::CommandBufferInheritanceRenderingInfo inheritance_rendering;
748 inheritance_rendering.colorAttachmentCount = 1;
749 inheritance_rendering.pColorAttachmentFormats = &color_format;
750 inheritance_rendering.depthAttachmentFormat = depth_format;
751 inheritance_rendering.rasterizationSamples = vk::SampleCountFlagBits::e1;
753 vk::CommandBufferInheritanceInfo inheritance_info;
754 inheritance_info.pNext = &inheritance_rendering;
756 vk::CommandBufferBeginInfo begin_info;
757 begin_info.flags = vk::CommandBufferUsageFlagBits::eRenderPassContinue | vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
758 begin_info.pInheritanceInfo = &inheritance_info;
760 cmd.begin(begin_info);
775 return it->second.cmd;
787 it->second.cmd.end();
788 it->second.is_active =
false;
798 auto& cmd_manager =
m_backend->get_command_manager();
803 if (state.is_active) {
804 cmd_manager.free_command_buffer(state.cmd);
806 if (state.timestamp_pool) {
807 device.destroyQueryPool(state.timestamp_pool);
813 "Freed all command buffers");
827 auto& cmd_manager =
m_backend->get_command_manager();
829 it->second.cmd.end();
831 vk::SubmitInfo submit_info;
832 submit_info.commandBufferCount = 1;
833 submit_info.pCommandBuffers = &it->second.cmd;
836 switch (it->second.type) {
848 if (queue.submit(1, &submit_info,
nullptr) != vk::Result::eSuccess) {
850 "Failed to submit command buffer");
855 cmd_manager.free_command_buffer(it->second.cmd);
857 it->second.is_active =
false;
868 cmd_it->second.cmd.end();
872 vk::FenceCreateInfo fence_info;
877 vk::SubmitInfo submit_info;
878 submit_info.commandBufferCount = 1;
879 submit_info.pCommandBuffers = &cmd_it->second.cmd;
882 switch (cmd_it->second.type) {
894 if (queue.submit(1, &submit_info, fence_state.
fence) != vk::Result::eSuccess) {
896 "Failed to submit command buffer");
900 cmd_it->second.is_active =
false;
912 cmd_it->second.cmd.end();
916 vk::SemaphoreCreateInfo semaphore_info;
920 vk::SubmitInfo submit_info;
921 submit_info.commandBufferCount = 1;
922 submit_info.pCommandBuffers = &cmd_it->second.cmd;
923 submit_info.signalSemaphoreCount = 1;
924 submit_info.pSignalSemaphores = &semaphore_state.
semaphore;
927 switch (cmd_it->second.type) {
939 if (queue.submit(1, &submit_info,
nullptr) != vk::Result::eSuccess) {
941 "Failed to submit command buffer");
945 cmd_it->second.is_active =
false;
957 if (
get_device().waitForFences(1, &it->second.fence, VK_TRUE, UINT64_MAX) != vk::Result::eSuccess) {
959 "Failed to wait for fence: {}", fence_id);
962 it->second.signaled =
true;
967 std::vector<vk::Fence> fences;
968 for (
auto fence_id : fence_ids) {
971 fences.push_back(it->second.fence);
975 if (!fences.empty()) {
976 if (
get_device().waitForFences(
static_cast<uint32_t
>(fences.size()), fences.data(), VK_TRUE, UINT64_MAX) != vk::Result::eSuccess) {
978 "Failed to wait for fences");
983 for (
auto fence_id : fence_ids) {
986 it->second.signaled =
true;
998 if (it->second.signaled) {
1002 auto result =
get_device().getFenceStatus(it->second.fence);
1003 it->second.signaled = (result == vk::Result::eSuccess);
1004 return it->second.signaled;
1010 vk::PipelineStageFlags )
1024 return it->second.semaphore;
1033 for (
auto& [
id, state] :
m_fences) {
1035 device.destroyFence(state.fence);
1041 if (state.semaphore) {
1042 device.destroySemaphore(state.semaphore);
1048 "Cleaned up sync objects");
1058 vk::AccessFlags src_access,
1059 vk::AccessFlags dst_access,
1060 vk::PipelineStageFlags src_stage,
1061 vk::PipelineStageFlags dst_stage)
1068 vk::BufferMemoryBarrier barrier;
1069 barrier.srcAccessMask = src_access;
1070 barrier.dstAccessMask = dst_access;
1071 barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
1072 barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
1073 barrier.buffer = buffer;
1075 barrier.size = VK_WHOLE_SIZE;
1077 it->second.cmd.pipelineBarrier(
1080 vk::DependencyFlags {},
1089 vk::ImageLayout old_layout,
1090 vk::ImageLayout new_layout,
1091 vk::AccessFlags src_access,
1092 vk::AccessFlags dst_access,
1093 vk::PipelineStageFlags src_stage,
1094 vk::PipelineStageFlags dst_stage)
1101 vk::ImageMemoryBarrier barrier;
1102 barrier.srcAccessMask = src_access;
1103 barrier.dstAccessMask = dst_access;
1104 barrier.oldLayout = old_layout;
1105 barrier.newLayout = new_layout;
1106 barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
1107 barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
1108 barrier.image =
image;
1109 barrier.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
1110 barrier.subresourceRange.baseMipLevel = 0;
1111 barrier.subresourceRange.levelCount = 1;
1112 barrier.subresourceRange.baseArrayLayer = 0;
1113 barrier.subresourceRange.layerCount = 1;
1115 it->second.cmd.pipelineBarrier(
1118 vk::DependencyFlags {},
1143 if (!it->second.timestamp_pool) {
1144 vk::QueryPoolCreateInfo pool_info;
1145 pool_info.queryType = vk::QueryType::eTimestamp;
1146 pool_info.queryCount = 128;
1147 it->second.timestamp_pool =
get_device().createQueryPool(pool_info);
1150 auto query_index =
static_cast<uint32_t
>(it->second.timestamp_queries.size() * 2);
1151 it->second.timestamp_queries[label] = query_index;
1153 it->second.cmd.resetQueryPool(it->second.timestamp_pool, query_index, 2);
1154 it->second.cmd.writeTimestamp(vk::PipelineStageFlagBits::eTopOfPipe, it->second.timestamp_pool, query_index);
1164 auto query_it = it->second.timestamp_queries.find(label);
1165 if (query_it == it->second.timestamp_queries.end()) {
1169 uint32_t query_index = query_it->second;
1170 it->second.cmd.writeTimestamp(vk::PipelineStageFlagBits::eBottomOfPipe, it->second.timestamp_pool, query_index + 1);
1177 return { .
label = label, .duration_ns = 0, .valid =
false };
1180 auto query_it = it->second.timestamp_queries.find(label);
1181 if (query_it == it->second.timestamp_queries.end()) {
1182 return { .label = label, .duration_ns = 0, .valid =
false };
1185 if (!it->second.timestamp_pool) {
1186 return { .label = label, .duration_ns = 0, .valid =
false };
1189 uint32_t query_index = query_it->second;
1190 uint64_t timestamps[2];
1192 auto result =
get_device().getQueryPoolResults(
1193 it->second.timestamp_pool,
1199 vk::QueryResultFlagBits::e64 | vk::QueryResultFlagBits::eWait);
1201 if (result != vk::Result::eSuccess) {
1202 return { .label = label, .duration_ns = 0, .valid =
false };
1205 auto props =
m_backend->get_context().get_physical_device().getProperties();
1206 float timestamp_period = props.limits.timestampPeriod;
1208 auto duration_ns =
static_cast<uint64_t
>((timestamps[1] - timestamps[0]) * timestamp_period);
1210 return { .label = label, .duration_ns = duration_ns, .valid =
true };
1220 auto it = foundry.m_shaders.find(shader_id);
1221 if (it != foundry.m_shaders.end()) {
1222 return it->second.module;
1235 return vk::ShaderStageFlagBits::eCompute;
1237 return vk::ShaderStageFlagBits::eVertex;
1239 return vk::ShaderStageFlagBits::eFragment;
1241 return vk::ShaderStageFlagBits::eGeometry;
1243 return vk::ShaderStageFlagBits::eTessellationControl;
1245 return vk::ShaderStageFlagBits::eTessellationEvaluation;
1247 return vk::ShaderStageFlagBits::eMeshEXT;
1249 return vk::ShaderStageFlagBits::eTaskEXT;
1251 return vk::ShaderStageFlagBits::eCompute;
1258 if (!vk_stage.has_value()) {
1259 return std::nullopt;
1262 switch (*vk_stage) {
1263 case vk::ShaderStageFlagBits::eCompute:
1265 case vk::ShaderStageFlagBits::eVertex:
1267 case vk::ShaderStageFlagBits::eFragment:
1269 case vk::ShaderStageFlagBits::eGeometry:
1271 case vk::ShaderStageFlagBits::eTessellationControl:
1273 case vk::ShaderStageFlagBits::eTessellationEvaluation:
1275 case vk::ShaderStageFlagBits::eMeshEXT:
1277 case vk::ShaderStageFlagBits::eTaskEXT:
1280 return std::nullopt;
1290 return std::make_shared<Core::VKShaderModule>();
1295 return m_backend->get_context().get_device();
1300 return m_backend->get_context().get_physical_device();
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
static std::optional< vk::ShaderStageFlagBits > detect_stage_from_extension(const std::string &filepath)
Auto-detect shader stage from file extension.
vk::DescriptorSet get_descriptor_set(DescriptorSetID descriptor_set_id)
Get Vulkan descriptor set handle from DescriptorSetID.
vk::Queue get_graphics_queue() const
Get Vulkan graphics queue.
void wait_for_fences(const std::vector< FenceID > &fence_ids)
Wait for multiple fences to be signaled.
CommandBufferID begin_secondary_commands(vk::Format color_format, vk::Format depth_format=vk::Format::eUndefined)
Begin recording a secondary command buffer for dynamic rendering.
static std::optional< ShaderStage > detect_stage_from_extension(const std::string &filepath)
Auto-detect shader stage from file extension.
vk::Device get_device() const
Get logical device handle.
static bool s_initialized
void shutdown()
Shutdown and cleanup all ShaderFoundry resources.
std::atomic< uint64_t > m_next_fence_id
void wait_for_fence(FenceID fence_id)
Wait for fence to be signaled.
bool is_cached(const std::string &cache_key) const
Check if shader is cached.
std::shared_ptr< Core::VKShaderModule > compile(const ShaderSource &shader_source)
Compile shader from ShaderSource descriptor.
ShaderID reload_shader(const std::string &filepath)
Hot-reload shader (returns new ID)
void cleanup_sync_objects()
std::shared_ptr< Core::VKShaderModule > hot_reload(const std::string &filepath)
Hot-reload a shader from file.
std::atomic< uint64_t > m_next_shader_id
void set_config(const ShaderCompilerConfig &config)
Update compiler configuration.
void update_descriptor_storage_image(DescriptorSetID descriptor_set_id, uint32_t binding, vk::ImageView image_view, vk::ImageLayout layout=vk::ImageLayout::eGeneral)
Update descriptor set with storage image binding.
CommandBufferID begin_commands(CommandBufferType type)
Begin recording command buffer.
vk::Semaphore get_semaphore_handle(SemaphoreID semaphore_id)
Get Vulkan fence handle from FenceID.
std::shared_ptr< Core::VKShaderModule > get_vk_shader_module(ShaderID shader_id)
DetectedSourceType
Internal enum for source type detection.
vk::Queue m_transfer_queue
bool initialize(const std::shared_ptr< Core::VulkanBackend > &backend, const ShaderCompilerConfig &config={})
Initialize shader compiler.
std::unordered_map< std::string, ShaderID > m_shader_filepath_cache
DetectedSourceType detect_source_type(const std::string &content) const
std::unordered_map< FenceID, FenceState > m_fences
std::shared_ptr< Core::VKShaderModule > create_shader_module()
void cleanup_shader_modules()
void free_all_command_buffers()
Free all allocated command buffers.
void invalidate_cache(const std::string &cache_key)
Invalidate cache for specific shader.
std::atomic< uint64_t > m_next_command_id
TimestampResult get_timestamp_result(CommandBufferID cmd_id, const std::string &label)
void update_descriptor_image(DescriptorSetID descriptor_set_id, uint32_t binding, vk::ImageView image_view, vk::Sampler sampler, vk::ImageLayout layout=vk::ImageLayout::eShaderReadOnlyOptimal, uint32_t array_element=0)
Update descriptor set with image binding.
void add_define(const std::string &name, const std::string &value="")
Add preprocessor define for shader compilation.
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.
void update_descriptor_buffer(DescriptorSetID descriptor_set_id, uint32_t binding, vk::DescriptorType type, vk::Buffer buffer, size_t offset, size_t size)
Update descriptor set with buffer binding.
vk::Queue m_graphics_queue
CommandBufferID begin_commands_with_wait(CommandBufferType type, SemaphoreID wait_semaphore, vk::PipelineStageFlags wait_stage)
Begin command buffer that waits on a semaphore.
std::optional< std::filesystem::path > resolve_shader_path(const std::string &filepath) const
void stop()
Stop active command recording and free command buffers.
std::unordered_map< DescriptorSetID, DescriptorSetState > m_descriptor_sets
std::unordered_map< CommandBufferID, CommandBufferState > m_command_buffers
ShaderCompilerConfig m_config
SemaphoreID submit_with_signal(CommandBufferID cmd_id)
Submit command buffer asynchronously, returning a semaphore.
void cleanup_descriptor_resources()
std::shared_ptr< Core::VKDescriptorManager > m_global_descriptor_manager
vk::Queue get_compute_queue() const
Get Vulkan compute queue.
FenceID submit_async(CommandBufferID cmd_id)
Submit command buffer asynchronously, returning a fence.
std::string get_shader_entry_point(ShaderID shader_id)
Get entry point name for compiled shader.
std::shared_ptr< Core::VKShaderModule > compile_from_source_cached(const std::string &source, ShaderStage stage, const std::string &cache_key, const std::string &entry_point="main")
bool end_commands(CommandBufferID cmd_id)
End recording command buffer.
bool is_initialized() const
Check if compiler is initialized.
void destroy_shader(ShaderID shader_id)
Destroy shader (cleanup internal state)
void begin_timestamp(CommandBufferID cmd_id, const std::string &label="")
void image_barrier(CommandBufferID cmd_id, vk::Image image, vk::ImageLayout old_layout, vk::ImageLayout new_layout, vk::AccessFlags src_access, vk::AccessFlags dst_access, vk::PipelineStageFlags src_stage, vk::PipelineStageFlags dst_stage)
Insert image memory barrier.
static ShaderFoundry & instance()
void submit_and_wait(CommandBufferID cmd_id)
Submit command buffer and wait for completion.
vk::CommandBuffer get_command_buffer(CommandBufferID cmd_id)
Get Vulkan command buffer handle from CommandBufferID.
vk::Queue get_transfer_queue() const
Get Vulkan transfer queue.
void add_include_directory(const std::string &directory)
Add include directory for shader compilation.
std::vector< std::string > get_cached_keys() const
Get all cached shader keys.
vk::Queue m_compute_queue
void clear_cache()
Invalidate entire shader cache.
ShaderReflectionInfo get_shader_reflection(ShaderID shader_id)
Get reflection info for compiled shader.
vk::PhysicalDevice get_physical_device() const
Get physical device handle.
std::shared_ptr< Core::VKShaderModule > compile_from_source(const std::string &source, ShaderStage stage, const std::string &entry_point="main")
void buffer_barrier(CommandBufferID cmd_id, vk::Buffer buffer, vk::AccessFlags src_access, vk::AccessFlags dst_access, vk::PipelineStageFlags src_stage, vk::PipelineStageFlags dst_stage)
Insert buffer memory barrier.
std::atomic< uint64_t > m_next_descriptor_set_id
std::shared_ptr< Core::VKShaderModule > compile_from_file(const std::string &filepath, std::optional< ShaderStage > stage=std::nullopt, const std::string &entry_point="main")
void end_timestamp(CommandBufferID cmd_id, const std::string &label="")
std::shared_ptr< Core::VKShaderModule > compile_from_spirv(const std::string &spirv_path, ShaderStage stage, const std::string &entry_point="main")
ShaderID load_shader(const std::string &content, std::optional< ShaderStage > stage=std::nullopt, const std::string &entry_point="main")
Universal shader loader - auto-detects source type.
std::string generate_source_cache_key(const std::string &source, ShaderStage stage) const
std::shared_ptr< Core::VulkanBackend > m_backend
bool is_fence_signaled(FenceID fence_id)
Check if fence is signaled.
std::unordered_map< SemaphoreID, SemaphoreState > m_semaphores
ShaderStage get_shader_stage(ShaderID shader_id)
Get shader stage for compiled shader.
std::unordered_map< ShaderID, ShaderState > m_shaders
DescriptorSetID allocate_descriptor_set(vk::DescriptorSetLayout layout)
Allocate descriptor set for a pipeline.
std::atomic< uint64_t > m_next_semaphore_id
@ ShaderCompilation
Shader compilation tasks (Portal::Graphics::ShaderCompiler)
@ Portal
High-level user-facing API layer.
constexpr ShaderID INVALID_SHADER
ShaderStage
User-friendly shader stage enum.
constexpr FenceID INVALID_FENCE
constexpr SemaphoreID INVALID_SEMAPHORE
constexpr CommandBufferID INVALID_COMMAND_BUFFER
Extracted push constant range from shader reflection.
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.
Configuration for shader compilation.
vk::DescriptorSet descriptor_set
std::shared_ptr< Core::VKShaderModule > std::string filepath
std::optional< std::array< uint32_t, 3 > > workgroup_size
std::vector< PushConstantRangeInfo > push_constant_ranges
std::vector< DescriptorBindingInfo > descriptor_bindings
Extracted reflection information from compiled shader.
std::string content
Shader source code or SPIR-V path.
enum MayaFlux::Portal::Graphics::ShaderSource::SourceType type
@ GLSL_FILE
Path to .comp/.vert/.frag/etc.
@ GLSL_STRING
In-memory GLSL source.
@ SPIRV_FILE
Path to .spv file.
Shader source descriptor for compilation.