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,
354 void update_descriptor_image(
357 vk::ImageView image_view,
359 vk::ImageLayout layout = vk::ImageLayout::eShaderReadOnlyOptimal);
368 void update_descriptor_storage_image(
371 vk::ImageView image_view,
372 vk::ImageLayout layout = vk::ImageLayout::eGeneral);
379 vk::DescriptorSet get_descriptor_set(
DescriptorSetID descriptor_set_id);
418 void free_all_command_buffers();
448 void wait_for_fence(
FenceID fence_id);
454 void wait_for_fences(
const std::vector<FenceID>& fence_ids);
461 bool is_fence_signaled(
FenceID fence_id);
471 CommandBufferType type,
473 vk::PipelineStageFlags wait_stage);
479 vk::Semaphore get_semaphore_handle(
SemaphoreID semaphore_id);
487 vk::AccessFlags src_access,
488 vk::AccessFlags dst_access,
489 vk::PipelineStageFlags src_stage,
490 vk::PipelineStageFlags dst_stage);
498 vk::ImageLayout old_layout,
499 vk::ImageLayout new_layout,
500 vk::AccessFlags src_access,
501 vk::AccessFlags dst_access,
502 vk::PipelineStageFlags src_stage,
503 vk::PipelineStageFlags dst_stage);
527 [[nodiscard]] vk::Queue get_graphics_queue()
const;
532 [[nodiscard]] vk::Queue get_compute_queue()
const;
537 [[nodiscard]] vk::Queue get_transfer_queue()
const;
543 void begin_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
544 void end_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
561 static vk::ShaderStageFlagBits to_vulkan_stage(
ShaderStage stage);
570 static std::optional<ShaderStage> detect_stage_from_extension(
const std::string& filepath);
590 std::unordered_map<std::string, std::shared_ptr<Core::VKShaderModule>>
m_shader_cache;
605 std::atomic<uint64_t> m_next_shader_id { 1 };
606 std::atomic<uint64_t> m_next_descriptor_set_id { 1 };
607 std::atomic<uint64_t> m_next_command_id { 1 };
608 std::atomic<uint64_t> m_next_fence_id { 1 };
609 std::atomic<uint64_t> m_next_semaphore_id { 1 };
611 DetectedSourceType detect_source_type(
const std::string& content)
const;
612 std::optional<std::filesystem::path> resolve_shader_path(
const std::string& filepath)
const;
613 std::string generate_source_cache_key(
const std::string& source,
ShaderStage stage)
const;
615 std::shared_ptr<Core::VKShaderModule> create_shader_module();
616 vk::Device get_device()
const;
618 void cleanup_sync_objects();
619 void cleanup_descriptor_resources();
620 void cleanup_shader_modules();
626 std::shared_ptr<Core::VKShaderModule> compile_from_file(
627 const std::string& filepath,
628 std::optional<ShaderStage> stage = std::nullopt,
629 const std::string& entry_point =
"main");
631 std::shared_ptr<Core::VKShaderModule> compile_from_source(
632 const std::string& source,
634 const std::string& entry_point =
"main");
636 std::shared_ptr<Core::VKShaderModule> compile_from_source_cached(
637 const std::string& source,
639 const std::string& cache_key,
640 const std::string& entry_point =
"main");
642 std::shared_ptr<Core::VKShaderModule> compile_from_spirv(
643 const std::string& spirv_path,
645 const std::string& entry_point =
"main");
647 std::shared_ptr<Core::VKShaderModule> get_vk_shader_module(
ShaderID shader_id);