92 vk::CommandBuffer
cmd;
112 std::shared_ptr<Core::VKShaderModule>
module;
139 const
std::shared_ptr<Core::VulkanBackend>& backend,
195 const std::string& content,
196 std::optional<ShaderStage> stage = std::nullopt,
197 const std::string& entry_point =
"main");
228 ShaderID reload_shader(
const std::string& filepath);
233 void destroy_shader(
ShaderID shader_id);
243 std::shared_ptr<Core::VKShaderModule> compile(
const ShaderSource& shader_source);
271 std::string get_shader_entry_point(
ShaderID shader_id);
284 void invalidate_cache(
const std::string& cache_key);
302 std::shared_ptr<Core::VKShaderModule> hot_reload(
const std::string& filepath);
328 void add_include_directory(
const std::string& directory);
337 void add_define(
const std::string& name,
const std::string&
value =
"");
347 [[nodiscard]]
bool is_cached(
const std::string& cache_key)
const;
352 [[nodiscard]] std::vector<std::string> get_cached_keys()
const;
369 DescriptorSetID allocate_descriptor_set(vk::DescriptorSetLayout layout);
380 void update_descriptor_buffer(
383 vk::DescriptorType type,
397 void update_descriptor_image(
400 vk::ImageView image_view,
402 vk::ImageLayout layout = vk::ImageLayout::eShaderReadOnlyOptimal,
403 uint32_t array_element = 0);
412 void update_descriptor_storage_image(
415 vk::ImageView image_view,
416 vk::ImageLayout layout = vk::ImageLayout::eGeneral);
423 vk::DescriptorSet get_descriptor_set(
DescriptorSetID descriptor_set_id);
445 vk::Format color_format,
446 vk::Format depth_format = vk::Format::eUndefined);
464 void free_all_command_buffers();
494 void wait_for_fence(
FenceID fence_id);
500 void wait_for_fences(
const std::vector<FenceID>& fence_ids);
513 void release_fence(
FenceID fence_id);
520 bool is_fence_signaled(
FenceID fence_id);
530 CommandBufferType type,
532 vk::PipelineStageFlags wait_stage);
538 vk::Semaphore get_semaphore_handle(
SemaphoreID semaphore_id);
546 vk::AccessFlags src_access,
547 vk::AccessFlags dst_access,
548 vk::PipelineStageFlags src_stage,
549 vk::PipelineStageFlags dst_stage);
557 vk::ImageLayout old_layout,
558 vk::ImageLayout new_layout,
559 vk::AccessFlags src_access,
560 vk::AccessFlags dst_access,
561 vk::PipelineStageFlags src_stage,
562 vk::PipelineStageFlags dst_stage);
586 [[nodiscard]] vk::Queue get_graphics_queue()
const;
591 [[nodiscard]] vk::Queue get_compute_queue()
const;
596 [[nodiscard]] vk::Queue get_transfer_queue()
const;
602 void begin_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
603 void end_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
620 static vk::ShaderStageFlagBits to_vulkan_stage(
ShaderStage stage);
629 static std::optional<ShaderStage> detect_stage_from_extension(
const std::string& filepath);
638 [[nodiscard]] vk::Device get_device()
const;
647 [[nodiscard]] vk::PhysicalDevice get_physical_device()
const;
667 std::unordered_map<std::string, std::shared_ptr<Core::VKShaderModule>>
m_shader_cache;
682 std::atomic<uint64_t> m_next_shader_id { 1 };
683 std::atomic<uint64_t> m_next_descriptor_set_id { 1 };
684 std::atomic<uint64_t> m_next_command_id { 1 };
685 std::atomic<uint64_t> m_next_fence_id { 1 };
686 std::atomic<uint64_t> m_next_semaphore_id { 1 };
688 DetectedSourceType detect_source_type(
const std::string& content)
const;
689 std::optional<std::filesystem::path> resolve_shader_path(
const std::string& filepath)
const;
690 std::string generate_source_cache_key(
const std::string& source,
ShaderStage stage)
const;
692 std::shared_ptr<Core::VKShaderModule> create_shader_module();
694 void cleanup_sync_objects();
695 void cleanup_descriptor_resources();
696 void cleanup_shader_modules();
702 std::shared_ptr<Core::VKShaderModule> compile_from_file(
703 const std::string& filepath,
704 std::optional<ShaderStage> stage = std::nullopt,
705 const std::string& entry_point =
"main");
707 std::shared_ptr<Core::VKShaderModule> compile_from_source(
708 const std::string& source,
710 const std::string& entry_point =
"main");
712 std::shared_ptr<Core::VKShaderModule> compile_from_source_cached(
713 const std::string& source,
715 const std::string& cache_key,
716 const std::string& entry_point =
"main");
718 std::shared_ptr<Core::VKShaderModule> compile_from_spirv(
719 const std::string& spirv_path,
721 const std::string& entry_point =
"main");
723 std::shared_ptr<Core::VKShaderModule> compile_from_spirv_asm(
724 const std::string& spirv_asm,
726 const std::string& entry_point =
"main");
728 std::shared_ptr<Core::VKShaderModule> get_vk_shader_module(
ShaderID shader_id);