Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
VulkanPipelineManager.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 <span>
16
18
19#ifdef CORRELATION_USE_VULKAN
20
26class VulkanPipelineManager {
27public:
28 VulkanPipelineManager() noexcept = default;
29 ~VulkanPipelineManager() noexcept { destroy(); }
30
31 VulkanPipelineManager(const VulkanPipelineManager &) = delete;
32 VulkanPipelineManager &operator=(const VulkanPipelineManager &) = delete;
33
34 VulkanPipelineManager(VulkanPipelineManager &&other) noexcept { moveFrom(other); }
35 VulkanPipelineManager &operator=(VulkanPipelineManager &&other) noexcept {
36 if (this != &other) {
37 destroy();
38 moveFrom(other);
39 }
40 return *this;
41 }
42
49 [[nodiscard]] bool initialize(VkDevice device, VkRenderPass render_pass);
50
54 void destroy() noexcept;
55
56 [[nodiscard]] VkPipeline spherePipeline() const noexcept { return sphere_pipeline_; }
57 [[nodiscard]] VkPipeline haloPipeline() const noexcept { return halo_pipeline_; }
58 [[nodiscard]] VkPipeline cylinderPipeline() const noexcept { return cylinder_pipeline_; }
59 [[nodiscard]] VkPipeline wireframePipeline() const noexcept { return wireframe_pipeline_; }
60 [[nodiscard]] VkPipelineLayout pipelineLayout() const noexcept { return pipeline_layout_; }
61 [[nodiscard]] VkDescriptorSetLayout descriptorSetLayout() const noexcept {
62 return descriptor_set_layout_;
63 }
64 [[nodiscard]] bool isValid() const noexcept { return sphere_pipeline_ != VK_NULL_HANDLE; }
65
66private:
67 void moveFrom(VulkanPipelineManager &other) noexcept;
68 [[nodiscard]] VkShaderModule createShaderModule(std::span<const uint32_t> spv_code) const;
69 [[nodiscard]] bool createDescriptorSetLayout();
70 [[nodiscard]] bool createPipelineLayout();
71 [[nodiscard]] bool createSpherePipeline(VkRenderPass render_pass);
72 [[nodiscard]] bool createHaloPipeline(VkRenderPass render_pass);
73 [[nodiscard]] bool createSphereOrHaloPipeline(VkRenderPass render_pass,
74 std::span<const uint32_t> frag_spv,
75 bool depth_write_enable, VkPipeline &out_pipeline);
76 [[nodiscard]] bool createCylinderPipeline(VkRenderPass render_pass);
77 [[nodiscard]] bool createWireframePipeline(VkRenderPass render_pass);
78
79 VkDevice device_{VK_NULL_HANDLE};
80 VkDescriptorSetLayout descriptor_set_layout_{VK_NULL_HANDLE};
81 VkPipelineLayout pipeline_layout_{VK_NULL_HANDLE};
82 VkPipeline sphere_pipeline_{VK_NULL_HANDLE};
83 VkPipeline halo_pipeline_{VK_NULL_HANDLE};
84 VkPipeline cylinder_pipeline_{VK_NULL_HANDLE};
85 VkPipeline wireframe_pipeline_{VK_NULL_HANDLE};
86};
87
88#endif // CORRELATION_USE_VULKAN
89
90} // namespace correlation::render3d::vulkan
Definition VulkanComputeService.hpp:24