CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
WGCommandBuffer.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "WebGPU.hpp"
11
14
16
17namespace CeresEngine {
18
19 class WGDevice;
20 class WGCommandQueue;
21
22 class WGGraphicsPipeline;
23
25 class WGCommandBuffer final : public GPUCommandBuffer, public WGDeviceObject<WGCommandBuffer, GPUCommandBuffer> {
26 friend class WGCommandQueue;
27
28 public:
33
34 private:
37
40
43
46
49
50 private: // State
53
56
59
60 public:
63
66
67 public:
70
72 void bindVertexBuffer(GPUBuffer& vertexBuffer, UInt32 offset = 0, UInt32 slot = 0) final;
73
76
78 void draw(UInt32 vertexCount, UInt32 instanceCount = 1, UInt32 firstVertex = 0, UInt32 firstInstance = 0) final;
79
82
84 void drawIndexed(UInt32 indexCount, UInt32 instanceCount = 1, UInt32 firstVertex = 0, Int32 vertexOffset = 0, UInt32 firstInstance = 0) final;
85
88
91
92 public: // Dynamic States
95
98
101
104
105 public: // Buffer read, write & copy.
108
111
114
115 public: // Image read, write & copy.
119
122 const TExtent3<UInt32>& extent) final;
123
127
130 const TExtent3<UInt32>& extent) final;
131
133 void clear(GPUImage& image) final;
134
137
140
141 public: // Synchronization
143 void barrier(GPUImage& image) final;
144
145 public:
147 void begin() final;
148
150 void end() final;
151
153 void wait() final;
154
155 private: // Encoders
159 };
160
161} // namespace CeresEngine
#define CE_EXPLICIT_FALSE
Definition Macros.hpp:416
A retain-release type of smart pointer.
Definition SmartPtr.hpp:132
Definition GPUBuffer.hpp:124
Definition GPUCommandBuffer.hpp:77
GPUDevice & device
The owning device this object was created from.
Definition Common.hpp:55
Definition GPUImage.hpp:331
A RenderAPI object that holds a set of resources that can be bound into shader.
Definition GPUResourceSet.hpp:735
const Descriptor & descriptor
A structure that describes the object and it's properties.
Definition Common.hpp:69
WebGPU RenderAPI command buffer object.
Definition WGCommandBuffer.hpp:25
WGLBlitCommandEncoderType mBlitCommandEncoder
The WebGPU API blit command encoder object.
Definition WGCommandBuffer.hpp:48
void resolveImage(GPUImage &dstImage, const GPUImageLocation &dstLocation, GPUImage &srcImage, const GPUImageLocation &srcLocation, const TExtent3< UInt32 > &extent) final
void setScissor(const Scissor &scissor) final
WGBufferPtr mIndexBuffer
A pointer to the latest bound index buffer.
Definition WGCommandBuffer.hpp:52
void setViewport(const Viewport &viewport) final
void clear(GPUImage &image) final
WGLComputeCommandEncoderType mComputeCommandEncoder
The WebGPU API compute command encoder object.
Definition WGCommandBuffer.hpp:45
void barrier(GPUImage &image) final
UInt32 mIndexBufferOffset
The offset, in bytes, to the bound index buffer.
Definition WGCommandBuffer.hpp:55
WGLRenderCommandEncoderType getRenderCommandEncoder()
void copyImageFromBuffer(GPUImage &dstImage, const GPUImageRegion &dstRegion, GPUBuffer &srcBuffer, std::uint64_t srcOffset, std::uint32_t rowStride=0, std::uint32_t layerStride=0) final
void drawIndexed(UInt32 indexCount, UInt32 instanceCount=1, UInt32 firstVertex=0, Int32 vertexOffset=0, UInt32 firstInstance=0) final
WGLRenderCommandEncoderType mRenderCommandEncoder
The WebGPU API render command encoder object.
Definition WGCommandBuffer.hpp:42
void draw(UInt32 vertexCount, UInt32 instanceCount=1, UInt32 firstVertex=0, UInt32 firstInstance=0) final
void copyBuffer(GPUBuffer &dstBuffer, std::uint64_t dstOffset, GPUBuffer &srcBuffer, std::uint64_t srcOffset, std::uint64_t size) final
void fillBuffer(GPUBuffer &dstBuffer, std::uint64_t dstOffset, std::uint32_t value, std::uint64_t fillSize=~0u) final
void bindVertexBuffer(GPUBuffer &vertexBuffer, UInt32 offset=0, UInt32 slot=0) final
CE_WG_HANDLE(WGLCommandBuffer) WGLCommandBufferType
Definition WGCommandBuffer.hpp:29
void bindResourceSet(GPUResourceSet &resourceSet, UInt32 firstSet=0, Int32 offset=-1) final
void updateBuffer(GPUBuffer &dstBuffer, std::uint64_t dstOffset, const void *data, std::uint16_t dataSize) final
CE_WG_HANDLE(WGLBlitCommandEncoder) WGLBlitCommandEncoderType
Definition WGCommandBuffer.hpp:32
void bindIndexBuffer(GPUBuffer &indexBuffer, UInt32 offset=0, IndexType indexType=IndexType::UInt32) final
void setViewports(const SmallVector< Viewport, 16 > &viewports) final
WGLBlitCommandEncoderType getBlitCommandEncoder()
void copyImage(GPUImage &dstImage, const GPUImageLocation &dstLocation, GPUImage &srcImage, const GPUImageLocation &srcLocation, const TExtent3< UInt32 > &extent) final
const GPUCommandBufferDescriptor mDescriptor
A structure that describes the command buffer and it's properties.
Definition WGCommandBuffer.hpp:36
CE_WG_HANDLE(WGLRenderCommandEncoder) WGLRenderCommandEncoderType
Definition WGCommandBuffer.hpp:30
WGLCommandBufferType mCommandBuffer
The WebGPU API command buffer object.
Definition WGCommandBuffer.hpp:39
void copyBufferFromImage(GPUBuffer &dstBuffer, std::uint64_t dstOffset, GPUImage &srcImage, const GPUImageRegion &srcImageRegion, std::uint32_t rowStride=0, std::uint32_t layerStride=0) final
WGCommandBuffer(WGDevicePtr device, const GPUCommandBufferDescriptor &descriptor)
IndexType mIndexBufferType
The type of index stored in the bound index buffer.
Definition WGCommandBuffer.hpp:58
CE_WG_HANDLE(WGLComputeCommandEncoder) WGLComputeCommandEncoderType
Definition WGCommandBuffer.hpp:31
void setScissors(const SmallVector< Scissor, 16 > &scissors) final
WGLComputeCommandEncoderType getComputeCommandEncoder()
void generateMips(GPUImage &image) final
WebGPU RenderAPI command queue object.
Definition WGCommandQueue.hpp:23
Definition WebGPU.hpp:119
Definition Application.hpp:19
std::int32_t Int32
Definition DataTypes.hpp:21
sfl::small_vector< T, N, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > SmallVector
SmallVector is a sequence container similar to Vector.
Definition SmallVector.hpp:31
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Span.hpp:668
Command buffer descriptor structure.
Definition GPUCommandBuffer.hpp:32
Structure specifying a draw indirect command.
Definition GPUCommandBuffer.hpp:59
Structure specifying a draw indirect command.
Definition GPUCommandBuffer.hpp:44
Image location structure: MIP-map level and offset.
Definition GPUImage.hpp:120
Image region structure: Subresource (MIP-map level and array layer range), offset,...
Definition GPUImage.hpp:156
Image subresource descriptor which specifies the array layer and MIP-map level range of a image resou...
Definition GPUImage.hpp:77
Definition IndexType.hpp:20
@ UInt32
The index buffer is represented as a 32-bit unsigned integer.
Definition IndexType.hpp:26
Definition GPUGraphicsPipeline.hpp:281
Definition GPUGraphicsPipeline.hpp:214