187 std::shared_ptr<Core::VKShaderModule>
module;
214 const
std::shared_ptr<Core::VulkanBackend>& backend,
259 const std::string& content,
260 std::optional<ShaderStage> stage = std::nullopt,
261 const std::string& entry_point =
"main");
273 ShaderID reload_shader(
const std::string& filepath);
278 void destroy_shader(
ShaderID shader_id);
288 std::shared_ptr<Core::VKShaderModule> compile(
const ShaderSource& shader_source);
316 std::string get_shader_entry_point(
ShaderID shader_id);
329 void invalidate_cache(
const std::string& cache_key);
347 std::shared_ptr<Core::VKShaderModule> hot_reload(
const std::string& filepath);
373 void add_include_directory(
const std::string& directory);
382 void add_define(
const std::string& name,
const std::string& value =
"");
392 [[nodiscard]]
bool is_cached(
const std::string& cache_key)
const;
397 [[nodiscard]] std::vector<std::string> get_cached_keys()
const;
414 DescriptorSetID allocate_descriptor_set(vk::DescriptorSetLayout layout);
425 void update_descriptor_buffer(
428 vk::DescriptorType type,
441 void update_descriptor_image(
444 vk::ImageView image_view,
446 vk::ImageLayout layout = vk::ImageLayout::eShaderReadOnlyOptimal);
455 void update_descriptor_storage_image(
458 vk::ImageView image_view,
459 vk::ImageLayout layout = vk::ImageLayout::eGeneral);
466 vk::DescriptorSet get_descriptor_set(
DescriptorSetID descriptor_set_id);
513 void wait_for_fence(
FenceID fence_id);
519 void wait_for_fences(
const std::vector<FenceID>& fence_ids);
526 bool is_fence_signaled(
FenceID fence_id);
536 CommandBufferType type,
538 vk::PipelineStageFlags wait_stage);
544 vk::Semaphore get_semaphore_handle(
SemaphoreID semaphore_id);
552 vk::AccessFlags src_access,
553 vk::AccessFlags dst_access,
554 vk::PipelineStageFlags src_stage,
555 vk::PipelineStageFlags dst_stage);
563 vk::ImageLayout old_layout,
564 vk::ImageLayout new_layout,
565 vk::AccessFlags src_access,
566 vk::AccessFlags dst_access,
567 vk::PipelineStageFlags src_stage,
568 vk::PipelineStageFlags dst_stage);
592 [[nodiscard]] vk::Queue get_graphics_queue()
const;
597 [[nodiscard]] vk::Queue get_compute_queue()
const;
602 [[nodiscard]] vk::Queue get_transfer_queue()
const;
608 void begin_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
609 void end_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
626 static vk::ShaderStageFlagBits to_vulkan_stage(
ShaderStage stage);
635 static std::optional<ShaderStage> detect_stage_from_extension(
const std::string& filepath);
655 std::unordered_map<std::string, std::shared_ptr<Core::VKShaderModule>>
m_shader_cache;
670 std::atomic<uint64_t> m_next_shader_id { 1 };
671 std::atomic<uint64_t> m_next_descriptor_set_id { 1 };
672 std::atomic<uint64_t> m_next_command_id { 1 };
673 std::atomic<uint64_t> m_next_fence_id { 1 };
674 std::atomic<uint64_t> m_next_semaphore_id { 1 };
676 DetectedSourceType detect_source_type(
const std::string& content)
const;
677 std::optional<std::filesystem::path> resolve_shader_path(
const std::string& filepath)
const;
678 std::string generate_source_cache_key(
const std::string& source,
ShaderStage stage)
const;
680 std::shared_ptr<Core::VKShaderModule> create_shader_module();
681 vk::Device get_device()
const;
687 std::shared_ptr<Core::VKShaderModule> compile_from_file(
688 const std::string& filepath,
689 std::optional<ShaderStage> stage = std::nullopt,
690 const std::string& entry_point =
"main");
692 std::shared_ptr<Core::VKShaderModule> compile_from_source(
693 const std::string& source,
695 const std::string& entry_point =
"main");
697 std::shared_ptr<Core::VKShaderModule> compile_from_source_cached(
698 const std::string& source,
700 const std::string& cache_key,
701 const std::string& entry_point =
"main");
703 std::shared_ptr<Core::VKShaderModule> compile_from_spirv(
704 const std::string& spirv_path,
706 const std::string& entry_point =
"main");
708 std::shared_ptr<Core::VKShaderModule> get_vk_shader_module(
ShaderID shader_id);