71 vk::CommandBuffer
cmd;
89 std::shared_ptr<Core::VKShaderModule>
module;
116 const
std::shared_ptr<Core::VulkanBackend>& backend,
170 const std::string& content,
171 std::optional<ShaderStage> stage = std::nullopt,
172 const std::string& entry_point =
"main");
184 ShaderID reload_shader(
const std::string& filepath);
189 void destroy_shader(
ShaderID shader_id);
199 std::shared_ptr<Core::VKShaderModule> compile(
const ShaderSource& shader_source);
227 std::string get_shader_entry_point(
ShaderID shader_id);
240 void invalidate_cache(
const std::string& cache_key);
258 std::shared_ptr<Core::VKShaderModule> hot_reload(
const std::string& filepath);
284 void add_include_directory(
const std::string& directory);
293 void add_define(
const std::string& name,
const std::string& value =
"");
303 [[nodiscard]]
bool is_cached(
const std::string& cache_key)
const;
308 [[nodiscard]] std::vector<std::string> get_cached_keys()
const;
325 DescriptorSetID allocate_descriptor_set(vk::DescriptorSetLayout layout);
336 void update_descriptor_buffer(
339 vk::DescriptorType type,
352 void update_descriptor_image(
355 vk::ImageView image_view,
357 vk::ImageLayout layout = vk::ImageLayout::eShaderReadOnlyOptimal);
366 void update_descriptor_storage_image(
369 vk::ImageView image_view,
370 vk::ImageLayout layout = vk::ImageLayout::eGeneral);
377 vk::DescriptorSet get_descriptor_set(
DescriptorSetID descriptor_set_id);
416 void free_all_command_buffers();
446 void wait_for_fence(
FenceID fence_id);
452 void wait_for_fences(
const std::vector<FenceID>& fence_ids);
459 bool is_fence_signaled(
FenceID fence_id);
469 CommandBufferType type,
471 vk::PipelineStageFlags wait_stage);
477 vk::Semaphore get_semaphore_handle(
SemaphoreID semaphore_id);
485 vk::AccessFlags src_access,
486 vk::AccessFlags dst_access,
487 vk::PipelineStageFlags src_stage,
488 vk::PipelineStageFlags dst_stage);
496 vk::ImageLayout old_layout,
497 vk::ImageLayout new_layout,
498 vk::AccessFlags src_access,
499 vk::AccessFlags dst_access,
500 vk::PipelineStageFlags src_stage,
501 vk::PipelineStageFlags dst_stage);
525 [[nodiscard]] vk::Queue get_graphics_queue()
const;
530 [[nodiscard]] vk::Queue get_compute_queue()
const;
535 [[nodiscard]] vk::Queue get_transfer_queue()
const;
541 void begin_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
542 void end_timestamp(
CommandBufferID cmd_id,
const std::string& label =
"");
559 static vk::ShaderStageFlagBits to_vulkan_stage(
ShaderStage stage);
568 static std::optional<ShaderStage> detect_stage_from_extension(
const std::string& filepath);
588 std::unordered_map<std::string, std::shared_ptr<Core::VKShaderModule>>
m_shader_cache;
603 std::atomic<uint64_t> m_next_shader_id { 1 };
604 std::atomic<uint64_t> m_next_descriptor_set_id { 1 };
605 std::atomic<uint64_t> m_next_command_id { 1 };
606 std::atomic<uint64_t> m_next_fence_id { 1 };
607 std::atomic<uint64_t> m_next_semaphore_id { 1 };
609 DetectedSourceType detect_source_type(
const std::string& content)
const;
610 std::optional<std::filesystem::path> resolve_shader_path(
const std::string& filepath)
const;
611 std::string generate_source_cache_key(
const std::string& source,
ShaderStage stage)
const;
613 std::shared_ptr<Core::VKShaderModule> create_shader_module();
614 vk::Device get_device()
const;
616 void cleanup_sync_objects();
617 void cleanup_descriptor_resources();
618 void cleanup_shader_modules();
624 std::shared_ptr<Core::VKShaderModule> compile_from_file(
625 const std::string& filepath,
626 std::optional<ShaderStage> stage = std::nullopt,
627 const std::string& entry_point =
"main");
629 std::shared_ptr<Core::VKShaderModule> compile_from_source(
630 const std::string& source,
632 const std::string& entry_point =
"main");
634 std::shared_ptr<Core::VKShaderModule> compile_from_source_cached(
635 const std::string& source,
637 const std::string& cache_key,
638 const std::string& entry_point =
"main");
640 std::shared_ptr<Core::VKShaderModule> compile_from_spirv(
641 const std::string& spirv_path,
643 const std::string& entry_point =
"main");
645 std::shared_ptr<Core::VKShaderModule> get_vk_shader_module(
ShaderID shader_id);