Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
CommandBuffer.hpp
1#pragma once
2
3#include <vector>
4#include "Framebuffer.hpp"
5
6namespace Grindstone::GraphicsAPI {
7 class RenderPass;
8 class Framebuffer;
9 class DescriptorSet;
10 class GraphicsPipeline;
11 class ComputePipeline;
12 class VertexArrayObject;
13 class VertexBuffer;
14 class DepthStencilTarget;
15 class IndexBuffer;
16
22 public:
23 virtual ~CommandBuffer() {};
24
25 virtual void BeginCommandBuffer() = 0;
26 virtual void BindRenderPass(
27 RenderPass* renderPass,
28 Framebuffer* framebuffer,
29 uint32_t width,
30 uint32_t height,
31 ClearColorValue* colorClearValues,
32 uint32_t colorClearCount,
33 ClearDepthStencil depthStencilClearValue
34 ) = 0;
35 virtual void UnbindRenderPass() = 0;
36 virtual void BeginDebugLabelSection(const char* name, float color[4] = nullptr) = 0;
37 virtual void EndDebugLabelSection() = 0;
38 virtual void BindGraphicsDescriptorSet(
39 GraphicsPipeline* graphicsPipeline,
40 DescriptorSet** descriptorSets,
41 uint32_t descriptorSetCount
42 ) = 0;
43 virtual void BindComputeDescriptorSet(
44 ComputePipeline* graphicsPipeline,
45 DescriptorSet** descriptorSets,
46 uint32_t descriptorSetCount
47 ) = 0;
48 virtual void BindCommandBuffers(CommandBuffer** commandBuffers, uint32_t commandBuffersCount) = 0;
49 virtual void SetViewport(float offsetX, float offsetY, float width, float height, float depthMin = 0.0f, float depthMax = 1.0f) = 0;
50 virtual void SetScissor(int32_t offsetX, int32_t offsetY, uint32_t width, uint32_t height) = 0;
51 virtual void SetDepthBias(float biasConstantFactor, float biasSlopeFactor) = 0;
52 virtual void BindGraphicsPipeline(GraphicsPipeline* pipeline) = 0;
53 virtual void BindComputePipeline(ComputePipeline* pipeline) = 0;
54 virtual void BindVertexArrayObject(VertexArrayObject* vertexArrayObject) = 0;
55 virtual void BindVertexBuffers(VertexBuffer** vb, uint32_t count) = 0;
56 virtual void BindIndexBuffer(IndexBuffer* indexBuffer) = 0;
57 virtual void DrawVertices(uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount, int32_t vertexOffset) = 0;
58 virtual void DrawIndices(uint32_t firstIndex, uint32_t indexCount, uint32_t firstInstance, uint32_t instanceCount, int32_t vertexOffset) = 0;
59 virtual void DispatchCompute(uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) = 0;
60 virtual void BlitDepthImage(DepthStencilTarget* src, DepthStencilTarget* dst) = 0;
61
62 virtual void WaitForComputeMemoryBarrier(RenderTarget* renderTarget, bool shouldMakeWritable) = 0;
63
64 virtual void EndCommandBuffer() = 0;
65
67 bool isSecondary = false;
68 Framebuffer *framebuffer = nullptr;
69 RenderPass *renderPass = nullptr;
70 };
71
72 struct CreateInfo {
73 const char* debugName = nullptr;
74 CommandBufferSecondaryInfo secondaryInfo{};
75 };
76 };
77}
Definition CommandBuffer.hpp:21
Definition ComputePipeline.hpp:18
Definition DepthStencilTarget.hpp:15
Definition DescriptorSet.hpp:11
Definition Framebuffer.hpp:19
Definition GraphicsPipeline.hpp:18
Definition IndexBuffer.hpp:11
Definition RenderPass.hpp:27
Definition RenderTarget.hpp:12
Definition VertexArrayObject.hpp:10
Definition VertexBuffer.hpp:130
Definition RenderPass.hpp:18
Definition RenderPass.hpp:11