Hymn to Beauty
C++ 3D Engine
WebGPUBuffer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "../Interface/Buffer.hpp"
4
5#include "WebGPU.hpp"
6
7namespace Video {
8
9class RawBuffer;
10
12class WebGPUBuffer : public Buffer {
13 public:
15
20
22 ~WebGPUBuffer() final;
23
24 void Reset(BufferUsage bufferUsage, const BufferAllocation& allocation) final;
25 unsigned int GetSize() const final;
26
28
31 WGPUBuffer GetBuffer() const;
32
34
37 uint32_t GetOffset() const;
38
39 private:
40 WebGPUBuffer(const WebGPUBuffer& other) = delete;
41
42 RawBuffer* rawBuffer;
43 WGPUBuffer buffer;
44 uint32_t offset = 0;
45 uint32_t size = 0;
46 bool temporaryAllocation;
47};
48
49}
A buffer containing GPU accessible data.
Definition: Buffer.hpp:8
BufferUsage
How the buffer is going to be used.
Definition: Buffer.hpp:11
BufferUsage bufferUsage
How the buffer will be used.
Definition: Buffer.hpp:54
A large buffer from which buffers are sub-allocated.
Definition: BufferAllocator.hpp:21
WebGPU implementation of Buffer.
Definition: WebGPUBuffer.hpp:12
WGPUBuffer GetBuffer() const
Get the internal WebGPU buffer.
Definition: WebGPUBuffer.cpp:33
WebGPUBuffer(Buffer::BufferUsage bufferUsage, const BufferAllocation &allocation)
Create new WebGPU buffer.
Definition: WebGPUBuffer.cpp:9
~WebGPUBuffer() final
Destructor.
Definition: WebGPUBuffer.cpp:13
uint32_t GetOffset() const
Get the offset into the raw buffer.
Definition: WebGPUBuffer.cpp:37
unsigned int GetSize() const final
Get the size of the buffer.
Definition: WebGPUBuffer.cpp:29
void Reset(BufferUsage bufferUsage, const BufferAllocation &allocation) final
Reset the buffer.
Definition: WebGPUBuffer.cpp:19
Definition: Editor.hpp:18
An allocation.
Definition: BufferAllocator.hpp:36