3#include "CommonWebGPU.h"
5#include "../Base/SyncObjectsCommon.h"
7#include "BuffersWebGPU.h"
8#include "CapabilitiesWebGPU.h"
9#include "ContextWebGPU.h"
10#include "EffectsWebGPU.h"
11#include "PipelineStatesWebGPU.h"
12#include "RenderTargetsWebGPU.h"
13#include "SwapChainWebGPU.h"
14#include "TexturesWebGPU.h"
16#include "../IGraphicsDevice.h"
25 void initialize_adapter(WGPUAdapter adapter);
26 void initialize_device(WGPUDevice device);
30 virtual void setSize(
int width,
int height)
override
32 defaultSwapChain.
setSize(width, height);
34 virtual bool getSize(
int &w,
int &h)
const override
56 virtual void* getNativeDevice()
override {
return device; }
58 bool has_device =
false;
60 CapabilitiesWebGPU capabilities;
61 ContextWebGPU context;
62 BuffersWebGPU buffers;
63 EffectsWebGPU effects;
64 PipelineStatesWebGPU pipeline_states;
65 RenderTargetsWebGPU renderTargets;
66 SyncObjectsCommon syncObjects;
67 TexturesWebGPU textures;
68 SwapChainWebGPU defaultSwapChain;
70 WGPUInstance instance = {};
71 WGPUSurface surface = {};
72 WGPUAdapter adapter = {};
73 WGPUDevice device = {};
76 WGPUCommandEncoder commandEncoder = {};
virtual void setSize(int width, int height) override
Set the size of the main drawing buffer used by the graphics device in pixels.
virtual IBuffers * getBuffers() override
Get a pointer to the buffer management interface.
virtual bool isInitializationFinished() override
Check if async initialization is finished.
virtual IRenderTargets * getRenderTargets() override
Get a pointer to the render target management interface.
virtual void beginFrame() override
Signal the beginning of a new frame to the graphics device.
virtual ITextures * getTextures() override
Get a pointer to the texture management interface.
virtual GraphicsDeviceType getType() const override
Get the type of the graphics device.
virtual void waitForCommandSync() override
Wait for any GPU commands on the current device to finish before returning.
virtual ISyncObjects * getSyncObjects() override
Get a pointer to the sync object management interface.
virtual ICapabilities * getCapabilities() override
Get a pointer to the capability management interface used to query the graphics device capability fla...
virtual std::string getIdentifier() const override
Get the graphics device identifier.
virtual void endFrame(uint32_t=0, uint32_t=PresentFlags::None) override
Signal the end of a frame to the graphics device.
virtual ISwapChain * getDefaultSwapChain() override
Get a pointer to the default swap chain for this graphics device.
virtual IEffects * getEffects() override
Get a pointer to the effect management interface.
virtual IPipelineStates * getPipelineStates() override
Get a pointer to the pipeline state management interface.
virtual void releaseResources() override
Release all resources allocated.
virtual bool initialize() override
Initializes the graphics device with the settings previous set through calling setSettings.
virtual IContext * getImmediateContext() override
Get a pointer to the immediate context used to issue commands to the graphics device.
virtual bool getSize(int &w, int &h) const override
Retrieve the size previously set by setSize.
Represents a graphics device used to manage graphics resources and issue drawing commands.
virtual int getWidth() const override
Returns the pixel width of this swap chain.
virtual int getHeight() const override
Returns the pixel height of this swap chain.
virtual void setSize(int newWidth, int newHeight, bool forceIt=false) override
Set the size of the main drawing buffer used by the graphics device in pixels.
Contains all Cogs related functionality.
GraphicsDeviceType
Contains types of graphics devices that may be supported.
@ WebGPU
Graphics device using the WebGPU API Backend.
Provides buffer management functionality.
Provides capability query functionality.
Represents a graphics device context which can receive rendering commands.
Provides effects and shader management functionality.
Provides render target management functionality.
Provides sync object management.
Provides texture management functionality.