3#include "../Interface/LowLevelRenderer.hpp"
16class WebGPUBufferAllocator;
18class WebGPURenderTargetAllocator;
51 const std::vector<Profiling::Event>&
GetTimeline()
const final;
112 void InitializeWebGPUBackend();
113 void CreateInstance();
115 void RequestAdapter();
118 void CreateSamplers();
120 WGPUInstance instance;
124 WGPUSwapChain swapChain;
126 WGPUTextureView currentFrame;
135 glm::uvec2 swapChainSize;
136 WGPUTextureFormat swapChainFormat;
140 Shader* blitFragmentShader;
144 std::vector<Profiling::Event> finishedEvents;
146 bool depthClipControlEnabled;
147 bool r11g11b10Enabled;
Definition: Window.hpp:14
A buffer containing GPU accessible data.
Definition: Buffer.hpp:8
BufferUsage
How the buffer is going to be used.
Definition: Buffer.hpp:11
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
IndexType
The type of values in the index buffer.
Definition: GeometryBinding.hpp:11
A graphics pipeline.
Definition: GraphicsPipeline.hpp:11
Low level renderer abstracting the underlaying graphics API (OpenGL or Vulkan).
Definition: LowLevelRenderer.hpp:27
Determines how a texture should be sampled.
Definition: Sampler.hpp:6
Filter
The interpolation to apply.
Definition: Sampler.hpp:9
@ COUNT
Number of entries in enum.
Clamping
How to handle sampling outside the texture dimensions.
Definition: Sampler.hpp:16
@ COUNT
Number of entries in enum.
Compiles and handles a shader. Shaders should be linked together into a ShaderProgram.
Definition: Shader.hpp:8
Type
The type of shader.
Definition: Shader.hpp:11
A shader program.
Definition: ShaderProgram.hpp:11
A texture.
Definition: Texture.hpp:8
Format
The format of the texture.
Definition: Texture.hpp:18
Describes how a vertex buffer is accessed by a shader.
Definition: VertexDescription.hpp:8
WebGPU implementation of BufferAllocator.
Definition: WebGPUBufferAllocator.hpp:40
WebGPU implementation of RenderTargetAllocator.
Definition: WebGPURenderTargetAllocator.hpp:15
Low-level renderer implementing WebGPU.
Definition: WebGPURenderer.hpp:22
ComputePipeline * CreateComputePipeline(const ShaderProgram *shaderProgram) final
Create a compute pipeline.
Definition: WebGPURenderer.cpp:176
WGPUTextureFormat GetSwapChainFormat() const
Get the format of the swap chain.
Definition: WebGPURenderer.cpp:311
Buffer * CreateTemporaryBuffer(Buffer::BufferUsage bufferUsage, uint32_t size, const void *data=nullptr) final
Definition: WebGPURenderer.cpp:131
const OptionalFeatures & GetOptionalFeatures() const final
Get which optional features are supported.
Definition: WebGPURenderer.cpp:275
const Sampler * GetSampler(Sampler::Filter filter, Sampler::Clamping clamping) const final
Get a sampler.
Definition: WebGPURenderer.cpp:157
GeometryBinding * CreateGeometryBinding(const VertexDescription *vertexDescription, Buffer *vertexBuffer, GeometryBinding::IndexType indexType=GeometryBinding::IndexType::NONE, const Buffer *indexBuffer=nullptr) final
Create a geometry binding.
Definition: WebGPURenderer.cpp:139
~WebGPURenderer() final
Destructor.
Definition: WebGPURenderer.cpp:75
Buffer * CreateBuffer(Buffer::BufferUsage bufferUsage, uint32_t size, const void *data=nullptr) final
Definition: WebGPURenderer.cpp:127
WebGPUTexture * CreateAttachmentlessRenderTarget(const glm::uvec2 &size, uint32_t sampleCount)
Create a render target to use for "attachmentless" rendering.
Definition: WebGPURenderer.cpp:279
WebGPURenderer(::Utility::Window *window)
Create new WebGPU renderer.
Definition: WebGPURenderer.cpp:47
WGPUQueue GetQueue() const
Get the WebGPU queue.
Definition: WebGPURenderer.cpp:291
void FreeRenderTarget(Texture *renderTarget) final
Free a render target.
Definition: WebGPURenderer.cpp:168
Texture * CreateTexture(const glm::uvec2 size, Texture::Format format, int components, unsigned char *data) final
Create a texture.
Definition: WebGPURenderer.cpp:151
void Submit(CommandBuffer *commandBuffer) final
Submit a command buffer for execution.
Definition: WebGPURenderer.cpp:109
ShaderProgram * CreateShaderProgram(std::initializer_list< const Shader * > shaders) final
Create a shader program.
Definition: WebGPURenderer.cpp:147
bool HasR11G11B10() const
Get whether R11G11B10 render targets can be used.
Definition: WebGPURenderer.cpp:307
WGPUTextureView GetCurrentFrame() const
Get the texture view of the current frame's swap chain image.
Definition: WebGPURenderer.cpp:295
WGPUDevice GetDevice() const
Get the WebGPU device.
Definition: WebGPURenderer.cpp:287
void BeginFrame() final
Begin a new frame.
Definition: WebGPURenderer.cpp:101
bool HasDepthClipControl() const
Get whether depth-clip-control can be used.
Definition: WebGPURenderer.cpp:303
CommandBuffer * CreateCommandBuffer() final
Create a command buffer.
Definition: WebGPURenderer.cpp:97
unsigned char * ReadImage(Texture *texture) final
Read a render texture color image.
Definition: WebGPURenderer.cpp:199
void FreeAttachmentlessRenderTarget(WebGPUTexture *renderTarget)
Free an "attachmentless" render target.
Definition: WebGPURenderer.cpp:283
Texture * CreateRenderTarget(const glm::uvec2 &size, Texture::Format format) final
Create a render target.
Definition: WebGPURenderer.cpp:164
const std::vector< Profiling::Event > & GetTimeline() const final
Get profiling timeline.
Definition: WebGPURenderer.cpp:271
void Wait() final
Wait for all rendering to finish.
Definition: WebGPURenderer.cpp:180
VertexDescription * CreateVertexDescription(unsigned int attributeCount, const VertexDescription::Attribute *attributes, bool indexBuffer=false) final
Create a vertex description.
Definition: WebGPURenderer.cpp:135
void Present() final
Present the rendered image to the swap chain.
Definition: WebGPURenderer.cpp:123
GraphicsPipeline * GetBlitGraphicsPipeline() const
Get the graphics pipeline used for blitting to the swap chain.
Definition: WebGPURenderer.cpp:299
GraphicsPipeline * CreateGraphicsPipeline(const ShaderProgram *shaderProgram, const GraphicsPipeline::Configuration &configuration, const VertexDescription *vertexDescription=nullptr) final
Create a graphics pipeline.
Definition: WebGPURenderer.cpp:172
Shader * CreateShader(const ShaderSource &shaderSource, Shader::Type type) final
Create a shader.
Definition: WebGPURenderer.cpp:143
WebGPU implementation of Sampler.
Definition: WebGPUSampler.hpp:10
WebGPU implementation of Texture.
Definition: WebGPUTexture.hpp:13
Definition: ResourceView.hpp:12
Definition: Editor.hpp:18
The configuration of the graphics pipeline.
Definition: GraphicsPipeline.hpp:14
Optional features.
Definition: LowLevelRenderer.hpp:30
Describes an attribute used in a vertex shader.
Definition: VertexDescription.hpp:18