WebGPUCommandBuffer.cpp [plain text]
#include "config.h"
#include "WebGPUCommandBuffer.h"
#if ENABLE(WEBGPU)
#include "GPUCommandBuffer.h"
#include "GPUCommandQueue.h"
#include "Logging.h"
#include "WebGPUCommandQueue.h"
#include "WebGPUComputeCommandEncoder.h"
#include "WebGPUDrawable.h"
#include "WebGPURenderCommandEncoder.h"
#include "WebGPURenderPassDescriptor.h"
#include "WebGPURenderingContext.h"
namespace WebCore {
Ref<WebGPUCommandBuffer> WebGPUCommandBuffer::create(WebGPURenderingContext* context, WebGPUCommandQueue* queue)
{
return adoptRef(*new WebGPUCommandBuffer(context, queue));
}
WebGPUCommandBuffer::WebGPUCommandBuffer(WebGPURenderingContext* context, WebGPUCommandQueue* queue)
: WebGPUObject(context)
{
LOG(WebGPU, "WebGPUCommandBuffer::WebGPUCommandBuffer()");
m_commandBuffer = queue->commandQueue()->createCommandBuffer();
}
WebGPUCommandBuffer::~WebGPUCommandBuffer()
{
LOG(WebGPU, "WebGPUCommandBuffer::~WebGPUCommandBuffer()");
}
void WebGPUCommandBuffer::commit()
{
LOG(WebGPU, "WebGPUCommandBuffer::commit()");
if (!m_commandBuffer)
return;
return m_commandBuffer->commit();
}
void WebGPUCommandBuffer::presentDrawable(WebGPUDrawable& drawable)
{
LOG(WebGPU, "WebGPUCommandBuffer::presentDrawable()");
if (!m_commandBuffer)
return;
return m_commandBuffer->presentDrawable(drawable.drawable());
}
RefPtr<WebGPURenderCommandEncoder> WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor(WebGPURenderPassDescriptor& descriptor)
{
RefPtr<WebGPURenderCommandEncoder> commandEncoder = WebGPURenderCommandEncoder::create(this->context(), this, &descriptor);
return commandEncoder;
}
RefPtr<WebGPUComputeCommandEncoder> WebGPUCommandBuffer::createComputeCommandEncoder()
{
RefPtr<WebGPUComputeCommandEncoder> commandEncoder = WebGPUComputeCommandEncoder::create(this->context(), this);
return commandEncoder;
}
DOMPromiseProxy<IDLVoid>& WebGPUCommandBuffer::completed()
{
return m_commandBuffer->completed();
}
}
#endif