Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
VulkanComputePipelineManager.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
11#ifdef CORRELATION_USE_VULKAN
12#include <vulkan/vulkan.h>
13#endif
14
15#include <array>
16#include <cstdint>
17#include <span>
18
20
21#ifdef CORRELATION_USE_VULKAN
22
23enum class ComputeKernelType : uint8_t {
24 NeighborGrid = 0,
25 SteinhardtOrder = 1,
26 TetrahedralOrder = 2,
27 LocalEntropy = 3,
28 TenWoldeFrenkel = 4,
29 HaloApply = 5,
30 HistogramReduce = 6,
31 CellListBuild = 7
32};
33
34class VulkanComputePipelineManager {
35public:
36 static constexpr size_t KERNEL_COUNT = 8;
37
38 VulkanComputePipelineManager() = default;
39 ~VulkanComputePipelineManager() noexcept { cleanup(); }
40
41 VulkanComputePipelineManager(const VulkanComputePipelineManager &) = delete;
42 VulkanComputePipelineManager &operator=(const VulkanComputePipelineManager &) = delete;
43 VulkanComputePipelineManager(VulkanComputePipelineManager &&) noexcept = default;
44 VulkanComputePipelineManager &operator=(VulkanComputePipelineManager &&) noexcept = default;
45
46 [[nodiscard]] bool initialize(VkDevice device);
47 void cleanup() noexcept;
48
49 [[nodiscard]] VkPipeline pipeline(ComputeKernelType type) const noexcept;
50 [[nodiscard]] VkPipelineLayout pipelineLayout(ComputeKernelType type) const noexcept;
51 [[nodiscard]] VkDescriptorSetLayout descriptorSetLayout(ComputeKernelType type) const noexcept;
52
53private:
54 [[nodiscard]] bool createComputePipeline(ComputeKernelType type, std::span<const uint32_t> spirv,
55 uint32_t push_constant_size,
56 uint32_t num_storage_buffers);
57
58 VkDevice device_{VK_NULL_HANDLE};
59 std::array<VkDescriptorSetLayout, KERNEL_COUNT> descriptor_layouts_{};
60 std::array<VkPipelineLayout, KERNEL_COUNT> pipeline_layouts_{};
61 std::array<VkPipeline, KERNEL_COUNT> pipelines_{};
62 bool initialized_{false};
63};
64
65#endif // CORRELATION_USE_VULKAN
66
67} // namespace correlation::render3d::vulkan
@ LocalEntropy
Local Entropic Fingerprint (s_i / k_B).
Definition PhaseSearchTypes.hpp:30
Definition VulkanComputeService.hpp:24