3#include "../Interface/CommandBuffer.hpp"
4#include <vulkan/vulkan.h>
11class VulkanRenderPass;
12class VulkanRenderPassAllocator;
13class VulkanGraphicsPipeline;
14class VulkanComputePipeline;
49 void SetViewport(const glm::uvec2& origin, const glm::uvec2& size) final;
50 void SetScissor(const glm::uvec2& origin, const glm::uvec2& size) final;
57 void Draw(
unsigned int vertexCount,
unsigned int firstVertex) final;
58 void DrawIndexed(
unsigned int indexCount,
unsigned int firstIndex,
unsigned int baseVertex) final;
59 void DrawIndexedInstanced(
unsigned int indexCount,
unsigned int instanceCount,
unsigned int firstIndex,
unsigned int baseVertex) final;
62 void Dispatch(const glm::uvec3& numGroups, const std::
string& name) final;
98 void AllocateCommandBuffer();
100 void TransitionTexture(
VulkanTexture* texture, VkImageLayout destinationImageLayout);
101 void BufferBarrier(
VulkanBuffer* buffer, VkPipelineStageFlags stages,
bool write);
105 VkCommandPool commandPool;
108 struct FrameCommandBuffers {
109 uint32_t currentBuffer;
110 std::vector<VkCommandBuffer> commandBuffers;
112 FrameCommandBuffers* frameCommandBuffers;
113 VkCommandBuffer currentCommandBuffer;
114 VkCommandBuffer renderPassCommandBuffer;
115 std::vector<VkCommandBuffer>* secondaryCommandBuffers;
116 uint32_t currentFrame = 0;
117 uint32_t swapChainImages;
120 bool inRenderPass =
false;
121 bool containsBlitToSwapChain =
false;
122 bool renderPassIsAttachmentless =
false;
124 VkClearValue clearValues[2];
125 VkRenderPassBeginInfo renderPassBeginInfo;
131 std::vector<Timing> timings;
A buffer containing GPU accessible data.
Definition: Buffer.hpp:8
A buffer into which rendering commands are recorded.
Definition: CommandBuffer.hpp:24
A compute pipeline.
Definition: ComputePipeline.hpp:11
Binds together a vertex description with buffers.
Definition: GeometryBinding.hpp:8
A graphics pipeline.
Definition: GraphicsPipeline.hpp:11
A render pass.
Definition: RenderPass.hpp:11
Determines how a texture should be sampled.
Definition: Sampler.hpp:6
A shader program.
Definition: ShaderProgram.hpp:11
A texture.
Definition: Texture.hpp:8
Vulkan implementation of Buffer.
Definition: VulkanBuffer.hpp:13
Vulkan implementation of CommandBuffer.
Definition: VulkanCommandBuffer.hpp:18
void End()
Finish recording the command buffer.
Definition: VulkanCommandBuffer.cpp:450
void SetScissor(const glm::uvec2 &origin, const glm::uvec2 &size) final
Set the scissor box.
Definition: VulkanCommandBuffer.cpp:205
void BindMaterial(std::initializer_list< std::pair< Texture *, const Sampler * > > textures) final
Bind a material.
Definition: VulkanCommandBuffer.cpp:301
void SetLineWidth(float width) final
Set width of lines.
Definition: VulkanCommandBuffer.cpp:217
void DrawIndexed(unsigned int indexCount, unsigned int firstIndex, unsigned int baseVertex) final
Draw indexed geometry.
Definition: VulkanCommandBuffer.cpp:339
void BindGraphicsPipeline(GraphicsPipeline *graphicsPipeline) final
Bind graphics pipeline.
Definition: VulkanCommandBuffer.cpp:182
void Dispatch(const glm::uvec3 &numGroups, const std::string &name) final
Dispatch compute shader.
Definition: VulkanCommandBuffer.cpp:403
std::vector< VkCommandBuffer > GetCommandBuffers() const
Get command buffers.
Definition: VulkanCommandBuffer.cpp:442
~VulkanCommandBuffer() final
Destructor.
Definition: VulkanCommandBuffer.cpp:44
void BeginRenderPass(RenderPass *renderPass, const std::string &name) final
Begin render pass.
Definition: VulkanCommandBuffer.cpp:59
bool ContainsBlitToSwapChain() const
Get whether the command buffer contains a blit to the swap chain.
Definition: VulkanCommandBuffer.cpp:485
VkCommandBuffer GetCurrentCommandBuffer() const
Get the command buffer currently being recorded into.
Definition: VulkanCommandBuffer.cpp:438
void BindStorageBuffers(std::initializer_list< Buffer * > buffers) final
Bind storage buffers.
Definition: VulkanCommandBuffer.cpp:276
void NextFrame()
Cycle the command buffer for the next frame.
Definition: VulkanCommandBuffer.cpp:464
void EndRenderPass() final
End render pass.
Definition: VulkanCommandBuffer.cpp:154
VulkanCommandBuffer(VulkanRenderer *vulkanRenderer, VkDevice device, VkCommandPool commandPool, VulkanRenderPassAllocator &renderPassAllocator)
Create new Vulkan command buffer.
Definition: VulkanCommandBuffer.cpp:18
void PushConstants(const void *data) final
Update push constants.
Definition: VulkanCommandBuffer.cpp:315
void BindComputePipeline(ComputePipeline *computePipeline) final
Bind compute pipeline.
Definition: VulkanCommandBuffer.cpp:394
const std::vector< Timing > & GetTimings() const
Get the all timings in the command buffer.
Definition: VulkanCommandBuffer.cpp:489
void BindGeometry(GeometryBinding *geometryBinding) final
Bind geometry to be used in upcoming draw calls.
Definition: VulkanCommandBuffer.cpp:224
void Draw(unsigned int vertexCount, unsigned int firstVertex) final
Draw geometry.
Definition: VulkanCommandBuffer.cpp:333
void BeginAttachmentlessRenderPass(const glm::uvec2 &size, uint32_t msaaSamples, const std::string &name) final
Begin attachmentless render pass.
Definition: VulkanCommandBuffer.cpp:148
void ClearBuffer(Buffer *buffer) final
Clear a buffer (fill with 0).
Definition: VulkanCommandBuffer.cpp:424
void DrawIndexedInstanced(unsigned int indexCount, unsigned int instanceCount, unsigned int firstIndex, unsigned int baseVertex) final
Draw indexed instanced geometry.
Definition: VulkanCommandBuffer.cpp:345
void SetViewport(const glm::uvec2 &origin, const glm::uvec2 &size) final
Set the viewport to render to.
Definition: VulkanCommandBuffer.cpp:191
void BindUniformBuffer(ShaderProgram::BindingType bindingType, Buffer *uniformBuffer) final
Bind uniform buffer for use in a shader.
Definition: VulkanCommandBuffer.cpp:261
void BlitToSwapChain(Texture *texture) final
Blit a texture to the current swap chain image.
Definition: VulkanCommandBuffer.cpp:351
Vulkan implementation of ComputePipeline.
Definition: VulkanComputePipeline.hpp:13
Vulkan implementation of GraphicsPipeline.
Definition: VulkanGraphicsPipeline.hpp:19
Vulkan implementation of RenderPassAllocator.
Definition: VulkanRenderPassAllocator.hpp:9
Vulkan implementation of RenderPass.
Definition: VulkanRenderPass.hpp:14
Low-level renderer implementing Vulkan.
Definition: VulkanRenderer.hpp:24
Vulkan implementation of Texture.
Definition: VulkanTexture.hpp:13
Definition: Editor.hpp:18
Timing for a block of work.
Definition: VulkanCommandBuffer.hpp:21
uint32_t startQuery
The timestamp at the start of the block of work.
Definition: VulkanCommandBuffer.hpp:26
uint32_t endQuery
The timestamp at the end of the block of work.
Definition: VulkanCommandBuffer.hpp:29
std::string name
Name of the block of work.
Definition: VulkanCommandBuffer.hpp:23