WebGPURenderingContext.h [plain text]
#pragma once
#if ENABLE(WEBGPU)
#include "GPUBasedCanvasRenderingContext.h"
#include "GPUDevice.h"
#include <JavaScriptCore/ArrayBuffer.h>
namespace WebCore {
class WebGPUCommandQueue;
class WebGPUComputePipelineState;
class WebGPUFunction;
class WebGPULibrary;
class WebGPURenderPipelineDescriptor;
class WebGPURenderPipelineState;
class WebGPUDepthStencilDescriptor;
class WebGPUDepthStencilState;
class WebGPURenderPassDescriptor;
class WebGPUDrawable;
class WebGPUBuffer;
class WebGPUTexture;
class WebGPUTextureDescriptor;
class WebGPURenderingContext : public GPUBasedCanvasRenderingContext {
public:
static std::unique_ptr<WebGPURenderingContext> create(CanvasBase&);
HTMLCanvasElement* canvas() const;
bool isWebGPU() const final { return true; }
void reshape(int width, int height) final;
void markLayerComposited() final;
PlatformLayer* platformLayer() const override;
RefPtr<GPUDevice> device() { return m_device; }
RefPtr<WebGPULibrary> createLibrary(const String);
RefPtr<WebGPURenderPipelineState> createRenderPipelineState(WebGPURenderPipelineDescriptor&);
RefPtr<WebGPUDepthStencilState> createDepthStencilState(WebGPUDepthStencilDescriptor&);
RefPtr<WebGPUComputePipelineState> createComputePipelineState(WebGPUFunction&);
RefPtr<WebGPUCommandQueue> createCommandQueue();
RefPtr<WebGPUDrawable> nextDrawable();
RefPtr<WebGPUBuffer> createBuffer(ArrayBufferView& data);
RefPtr<WebGPUTexture> createTexture(WebGPUTextureDescriptor&);
protected:
bool hasPendingActivity() const override;
void stop() override;
const char* activeDOMObjectName() const override;
bool canSuspendForDocumentSuspension() const override;
IntSize clampedCanvasSize() const;
void initializeNewContext();
private:
WebGPURenderingContext(CanvasBase&, Ref<GPUDevice>&&);
RefPtr<GPUDevice> m_device;
};
}
SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::WebGPURenderingContext, isWebGPU())
#endif