SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
VulkanQueue.h
1#pragma once
2
3#include "spark/render/CommandQueue.h"
4#include "spark/render/Resource.h"
5#include "spark/render/vk/Export.h"
6#include "spark/render/vk/Helpers.h"
7#include "spark/render/vk/VulkanCommandBuffer.h"
8
9SPARK_FWD_DECLARE_VK_HANDLE(VkQueue)
10SPARK_FWD_DECLARE_VK_HANDLE(VkCommandPool)
11SPARK_FWD_DECLARE_VK_HANDLE(VkSemaphore)
12using VkPipelineStageFlags = std::uint32_t;
13
14namespace spark::render::vk
15{
16 class VulkanDevice;
17 class VulkanCommandBuffer;
18
22 class SPARK_RENDER_VK_EXPORT VulkanQueue final : public CommandQueue<VulkanCommandBuffer>, public Resource<VkQueue>
23 {
24 public:
25 explicit VulkanQueue(const VulkanDevice& device, QueueType type, QueuePriority priority, unsigned family_id, unsigned queue_id);
26 ~VulkanQueue() override;
27
28 VulkanQueue(const VulkanQueue& other) = delete;
29 VulkanQueue(VulkanQueue&& other) noexcept = delete;
30 VulkanQueue& operator=(const VulkanQueue& other) = delete;
31 VulkanQueue& operator=(VulkanQueue&& other) noexcept = delete;
32
37 [[nodiscard]] const VulkanDevice& device() const noexcept;
38
45 [[nodiscard]] const VkCommandPool& commandPool() const noexcept;
46
51 [[nodiscard]] unsigned familyId() const noexcept;
52
57 [[nodiscard]] unsigned queueId() const noexcept;
58
63 [[nodiscard]] const VkSemaphore& timelineSemaphore() const noexcept;
64
66 [[nodiscard]] bool isBound() const noexcept override;
67
69 [[nodiscard]] QueuePriority priority() const noexcept override;
70
72 [[nodiscard]] QueueType type() const noexcept override;
73
75 void bind() const noexcept override;
76
78 void release() const noexcept override;
79
81 void waitFor(std::size_t fence) const noexcept override;
82
84 [[nodiscard]] std::size_t currentFence() const noexcept override;
85
87 [[nodiscard]] std::shared_ptr<VulkanCommandBuffer> createCommandBuffer(bool begin_recording, bool secondary) const noexcept override;
88
102 [[nodiscard]] std::size_t submit(std::shared_ptr<const VulkanCommandBuffer> command_buffer,
103 std::span<VkSemaphore> wait_for_semaphores,
104 std::span<VkPipelineStageFlags> wait_for_stages,
105 std::span<VkSemaphore> signal_semaphores = {}) const;
106
120 [[nodiscard]] std::size_t submit(const std::vector<std::shared_ptr<const VulkanCommandBuffer>>& command_buffers,
121 std::span<VkSemaphore> wait_for_semaphores,
122 std::span<VkPipelineStageFlags> wait_for_stages,
123 std::span<VkSemaphore> signal_semaphores = {}) const;
124
126 [[nodiscard]] std::size_t submit(std::shared_ptr<VulkanCommandBuffer> command_buffer) const noexcept override;
127
129 [[nodiscard]] std::size_t submit(std::shared_ptr<const VulkanCommandBuffer> command_buffer) const noexcept override;
130
132 [[nodiscard]] std::size_t submit(const std::vector<std::shared_ptr<const VulkanCommandBuffer>>& command_buffers) const noexcept override;
133
135 [[nodiscard]] std::size_t submit(const std::vector<std::shared_ptr<VulkanCommandBuffer>>& command_buffers) const noexcept override;
136
137 private:
138 struct Impl;
139 std::unique_ptr<Impl> m_impl;
140 };
141}
Represents a ICommandQueue.
Definition CommandQueue.h:194
Definition Resource.h:34
Vulkan implementation of IGraphicsDevice.
Definition VulkanDevice.h:25
Vulkan implementation of ICommandQueue.
Definition VulkanQueue.h:23
std::size_t submit(std::shared_ptr< const VulkanCommandBuffer > command_buffer) const noexcept override
Submits a single command buffer to the queue and inserts a fence to wait for it.
Definition VulkanQueue.cpp:14