152 std::shared_ptr<Core::VKShaderModule>
module;
179 const
std::shared_ptr<Core::VulkanBackend>& backend,
235 const std::string& content,
236 std::optional<ShaderStage> stage = std::nullopt,
237 const std::string& entry_point =
"main");
268 ShaderID reload_shader(
const std::string& filepath);
273 void destroy_shader(
ShaderID shader_id);
283 std::shared_ptr<Core::VKShaderModule> compile(
const ShaderSource& shader_source);
304 std::vector<DescriptorBindingInfo> get_active_descriptor_bindings(
ShaderID shader_id);
318 std::string get_shader_entry_point(
ShaderID shader_id);
331 void invalidate_cache(
const std::string& cache_key);
349 std::shared_ptr<Core::VKShaderModule> hot_reload(
const std::string& filepath);
375 void add_include_directory(
const std::string& directory);
384 void add_define(
const std::string&
name,
const std::string&
value =
"");
394 [[nodiscard]]
bool is_cached(
const std::string& cache_key)
const;
399 [[nodiscard]] std::vector<std::string> get_cached_keys()
const;
416 DescriptorSetID allocate_descriptor_set(vk::DescriptorSetLayout layout);
427 void update_descriptor_buffer(
430 vk::DescriptorType
type,
448 void update_descriptor_buffers(std::span<const DescriptorBufferWrite> writes);
459 void update_descriptor_image(
462 vk::ImageView image_view,
464 vk::ImageLayout layout = vk::ImageLayout::eShaderReadOnlyOptimal,
465 uint32_t array_element = 0);
474 void update_descriptor_storage_image(
477 vk::ImageView image_view,
478 vk::ImageLayout layout = vk::ImageLayout::eGeneral);
491 void update_descriptor_images(std::span<const DescriptorImageWrite> writes);
498 vk::DescriptorSet get_descriptor_set(
DescriptorSetID descriptor_set_id);
520 vk::Format color_format,
521 vk::Format depth_format = vk::Format::eUndefined);
539 void free_all_command_buffers();
569 void wait_for_fence(
FenceID fence_id);
575 void wait_for_fences(
const std::vector<FenceID>& fence_ids);
588 void release_fence(
FenceID fence_id);
595 bool is_fence_signaled(
FenceID fence_id);
605 CommandBufferType
type,
607 vk::PipelineStageFlags wait_stage);
613 vk::Semaphore get_semaphore_handle(
SemaphoreID semaphore_id);
621 vk::AccessFlags src_access,
622 vk::AccessFlags dst_access,
623 vk::PipelineStageFlags src_stage,
624 vk::PipelineStageFlags dst_stage);
632 vk::ImageLayout old_layout,
633 vk::ImageLayout new_layout,
634 vk::AccessFlags src_access,
635 vk::AccessFlags dst_access,
636 vk::PipelineStageFlags src_stage,
637 vk::PipelineStageFlags dst_stage);
661 [[nodiscard]] vk::Queue get_graphics_queue()
const;
666 [[nodiscard]] vk::Queue get_compute_queue()
const;
671 [[nodiscard]] vk::Queue get_transfer_queue()
const;
695 static vk::ShaderStageFlagBits to_vulkan_stage(
ShaderStage stage);
704 static std::optional<ShaderStage> detect_stage_from_extension(
const std::string& filepath);
713 [[nodiscard]] vk::Device get_device()
const;
722 [[nodiscard]] vk::PhysicalDevice get_physical_device()
const;
742 std::unordered_map<std::string, std::shared_ptr<Core::VKShaderModule>>
m_shader_cache;
756 static constexpr size_t k_finished_timestamp_capacity = 1024;
766 std::atomic<uint64_t> m_next_shader_id { 1 };
767 std::atomic<uint64_t> m_next_descriptor_set_id { 1 };
768 std::atomic<uint64_t> m_next_command_id { 1 };
769 std::atomic<uint64_t> m_next_fence_id { 1 };
770 std::atomic<uint64_t> m_next_semaphore_id { 1 };
772 DetectedSourceType detect_source_type(
const std::string& content)
const;
773 std::optional<std::filesystem::path> resolve_shader_path(
const std::string& filepath)
const;
774 std::string generate_source_cache_key(
const std::string& source,
ShaderStage stage)
const;
776 std::shared_ptr<Core::VKShaderModule> create_shader_module();
778 TimestampResult resolve_timestamp(
const CommandBufferState& state,
const std::string&
label,
bool wait);
780 void cleanup_sync_objects();
781 void cleanup_descriptor_resources();
782 void cleanup_shader_modules();
788 std::shared_ptr<Core::VKShaderModule> compile_from_file(
789 const std::string& filepath,
790 std::optional<ShaderStage> stage = std::nullopt,
791 const std::string& entry_point =
"main");
793 std::shared_ptr<Core::VKShaderModule> compile_from_source(
794 const std::string& source,
796 const std::string& entry_point =
"main");
798 std::shared_ptr<Core::VKShaderModule> compile_from_source_cached(
799 const std::string& source,
801 const std::string& cache_key,
802 const std::string& entry_point =
"main");
804 std::shared_ptr<Core::VKShaderModule> compile_from_spirv(
805 const std::string& spirv_path,
807 const std::string& entry_point =
"main");
809 std::shared_ptr<Core::VKShaderModule> compile_from_spirv_asm(
810 const std::string& spirv_asm,
812 const std::string& entry_point =
"main");
814 std::shared_ptr<Core::VKShaderModule> get_vk_shader_module(
ShaderID shader_id);
History buffer for difference equations and recursive relations.