71 vk::CommandBuffer
cmd;
89 std::shared_ptr<Core::VKShaderModule>
module;
116 const
std::shared_ptr<Core::VulkanBackend>& backend,
172 const std::string& content,
173 std::optional<ShaderStage> stage = std::nullopt,
174 const std::string& entry_point =
"main");
186 ShaderID reload_shader(
const std::string& filepath);
191 void destroy_shader(
ShaderID shader_id);
201 std::shared_ptr<Core::VKShaderModule> compile(
const ShaderSource& shader_source);
229 std::string get_shader_entry_point(
ShaderID shader_id);
242 void invalidate_cache(
const std::string& cache_key);
260 std::shared_ptr<Core::VKShaderModule> hot_reload(
const std::string& filepath);
286 void add_include_directory(
const std::string& directory);
295 void add_define(
const std::string& name,
const std::string& value =
"");
305 [[nodiscard]]
bool is_cached(
const std::string& cache_key)
const;
310 [[nodiscard]] std::vector<std::string> get_cached_keys()
const;
327 DescriptorSetID allocate_descriptor_set(vk::DescriptorSetLayout layout);
338 void update_descriptor_buffer(
341 vk::DescriptorType type,
355 void update_descriptor_image(
358 vk::ImageView image_view,
360 vk::ImageLayout layout = vk::ImageLayout::eShaderReadOnlyOptimal,
361 uint32_t array_element = 0);
370 void update_descriptor_storage_image(
373 vk::ImageView image_view,
374 vk::ImageLayout layout = vk::ImageLayout::eGeneral);
381 vk::DescriptorSet get_descriptor_set(
DescriptorSetID descriptor_set_id);
403 vk::Format color_format,
404 vk::Format depth_format = vk::Format::eUndefined);
422 void free_all_command_buffers();
452 void wait_for_fence(
FenceID fence_id);
458 void wait_for_fences(
const std::vector<FenceID>& fence_ids);
465 bool is_fence_signaled(
FenceID fence_id);
475 CommandBufferType type,
477 vk::PipelineStageFlags wait_stage);
483 vk::Semaphore get_semaphore_handle(
SemaphoreID semaphore_id);
491 vk::AccessFlags src_access,
492 vk::AccessFlags dst_access,
493 vk::PipelineStageFlags src_stage,
494 vk::PipelineStageFlags dst_stage);
502 vk::ImageLayout old_layout,
503 vk::ImageLayout new_layout,
504 vk::AccessFlags src_access,
505 vk::AccessFlags dst_access,
506 vk::PipelineStageFlags src_stage,
507 vk::PipelineStageFlags dst_stage);
531 [[nodiscard]] vk::Queue get_graphics_queue()
const;
536 [[nodiscard]] vk::Queue get_compute_queue()
const;
541 [[nodiscard]] vk::Queue get_transfer_queue()
const;
547 void begin_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
548 void end_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
565 static vk::ShaderStageFlagBits to_vulkan_stage(
ShaderStage stage);
574 static std::optional<ShaderStage> detect_stage_from_extension(
const std::string& filepath);
583 [[nodiscard]] vk::Device get_device()
const;
592 [[nodiscard]] vk::PhysicalDevice get_physical_device()
const;
612 std::unordered_map<std::string, std::shared_ptr<Core::VKShaderModule>>
m_shader_cache;
627 std::atomic<uint64_t> m_next_shader_id { 1 };
628 std::atomic<uint64_t> m_next_descriptor_set_id { 1 };
629 std::atomic<uint64_t> m_next_command_id { 1 };
630 std::atomic<uint64_t> m_next_fence_id { 1 };
631 std::atomic<uint64_t> m_next_semaphore_id { 1 };
633 DetectedSourceType detect_source_type(
const std::string& content)
const;
634 std::optional<std::filesystem::path> resolve_shader_path(
const std::string& filepath)
const;
635 std::string generate_source_cache_key(
const std::string& source,
ShaderStage stage)
const;
637 std::shared_ptr<Core::VKShaderModule> create_shader_module();
639 void cleanup_sync_objects();
640 void cleanup_descriptor_resources();
641 void cleanup_shader_modules();
647 std::shared_ptr<Core::VKShaderModule> compile_from_file(
648 const std::string& filepath,
649 std::optional<ShaderStage> stage = std::nullopt,
650 const std::string& entry_point =
"main");
652 std::shared_ptr<Core::VKShaderModule> compile_from_source(
653 const std::string& source,
655 const std::string& entry_point =
"main");
657 std::shared_ptr<Core::VKShaderModule> compile_from_source_cached(
658 const std::string& source,
660 const std::string& cache_key,
661 const std::string& entry_point =
"main");
663 std::shared_ptr<Core::VKShaderModule> compile_from_spirv(
664 const std::string& spirv_path,
666 const std::string& entry_point =
"main");
668 std::shared_ptr<Core::VKShaderModule> get_vk_shader_module(
ShaderID shader_id);