WebMetalCommandBuffer.cpp [plain text]
#include "config.h"
#include "WebMetalCommandBuffer.h"
#if ENABLE(WEBMETAL)
#include "GPULegacyCommandBuffer.h"
#include "GPULegacyCommandQueue.h"
#include "Logging.h"
#include "WebMetalComputeCommandEncoder.h"
#include "WebMetalDrawable.h"
#include "WebMetalRenderCommandEncoder.h"
#include "WebMetalRenderPassDescriptor.h"
namespace WebCore {
Ref<WebMetalCommandBuffer> WebMetalCommandBuffer::create(const GPULegacyCommandQueue& queue)
{
return adoptRef(*new WebMetalCommandBuffer(queue));
}
WebMetalCommandBuffer::WebMetalCommandBuffer(const GPULegacyCommandQueue& queue)
: m_buffer { queue, [this] () { m_completed.resolve(); } }
{
LOG(WebMetal, "WebMetalCommandBuffer::WebMetalCommandBuffer()");
}
WebMetalCommandBuffer::~WebMetalCommandBuffer()
{
LOG(WebMetal, "WebMetalCommandBuffer::~WebMetalCommandBuffer()");
}
void WebMetalCommandBuffer::commit()
{
LOG(WebMetal, "WebMetalCommandBuffer::commit()");
m_buffer.commit();
}
void WebMetalCommandBuffer::presentDrawable(WebMetalDrawable& drawable)
{
LOG(WebMetal, "WebMetalCommandBuffer::presentDrawable()");
m_buffer.presentDrawable(drawable.drawable());
}
Ref<WebMetalRenderCommandEncoder> WebMetalCommandBuffer::createRenderCommandEncoderWithDescriptor(WebMetalRenderPassDescriptor& descriptor)
{
return WebMetalRenderCommandEncoder::create(GPULegacyRenderCommandEncoder { m_buffer, descriptor.descriptor() });
}
Ref<WebMetalComputeCommandEncoder> WebMetalCommandBuffer::createComputeCommandEncoder()
{
return WebMetalComputeCommandEncoder::create(GPULegacyComputeCommandEncoder { m_buffer });
}
DOMPromiseProxy<IDLVoid>& WebMetalCommandBuffer::completed()
{
return m_completed;
}
}
#endif