WebGPUCommandEncoder.h [plain text]
#pragma once
#if ENABLE(WEBGPU)
#include "GPUCommandBuffer.h"
#include "WebGPUCommandBuffer.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class WebGPUBuffer;
class WebGPUComputePassEncoder;
class WebGPURenderPassEncoder;
class WebGPUTexture;
struct GPUExtent3D;
struct WebGPURenderPassDescriptor;
struct WebGPUBufferCopyView : GPUBufferCopyViewBase {
Optional<GPUBufferCopyView> tryCreateGPUBufferCopyView() const;
RefPtr<WebGPUBuffer> buffer;
};
struct WebGPUTextureCopyView : GPUTextureCopyViewBase {
Optional<GPUTextureCopyView> tryCreateGPUTextureCopyView() const;
RefPtr<WebGPUTexture> texture;
};
class WebGPUCommandEncoder : public RefCounted<WebGPUCommandEncoder> {
public:
static Ref<WebGPUCommandEncoder> create(RefPtr<GPUCommandBuffer>&&);
Ref<WebGPURenderPassEncoder> beginRenderPass(const WebGPURenderPassDescriptor&);
Ref<WebGPUComputePassEncoder> beginComputePass();
void copyBufferToBuffer(WebGPUBuffer&, uint64_t srcOffset, WebGPUBuffer&, uint64_t dstOffset, uint64_t size);
void copyBufferToTexture(const WebGPUBufferCopyView&, const WebGPUTextureCopyView&, const GPUExtent3D&);
void copyTextureToBuffer(const WebGPUTextureCopyView&, const WebGPUBufferCopyView&, const GPUExtent3D&);
void copyTextureToTexture(const WebGPUTextureCopyView&, const WebGPUTextureCopyView&, const GPUExtent3D&);
Ref<WebGPUCommandBuffer> finish();
private:
WebGPUCommandEncoder(RefPtr<GPUCommandBuffer>&&);
RefPtr<GPUCommandBuffer> m_commandBuffer;
};
}
#endif // ENABLE(WEBGPU)