#include "third_party/blink/renderer/modules/webgpu/gpu_command_encoder.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_command_buffer_descriptor.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_command_encoder_descriptor.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_compute_pass_descriptor.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_compute_pass_timestamp_writes.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_copy_buffer.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_copy_texture.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_render_pass_color_attachment.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_render_pass_depth_stencil_attachment.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_render_pass_descriptor.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_render_pass_timestamp_writes.h"
#include "third_party/blink/renderer/modules/webgpu/dawn_conversions.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_buffer.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_command_buffer.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_compute_pass_encoder.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_device.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_query_set.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_supported_features.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_texture.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_texture_view.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
namespace blink {
bool ConvertToDawn(const GPURenderPassColorAttachment* in,
wgpu::RenderPassColorAttachment* out,
ExceptionState& exception_state) { … }
namespace {
std::string ValidateColorAttachmentsDepthSlice(
const HeapVector<Member<GPURenderPassColorAttachment>>& in,
const char* desc_label) { … }
template <typename GPUTimestampWrites, typename TimestampWrites>
std::string ValidateAndConvertTimestampWrites(
const GPUTimestampWrites* webgpu_desc,
TimestampWrites* dawn_desc,
const char* desc_type,
const char* desc_label) { … }
wgpu::RenderPassDepthStencilAttachment AsDawnType(
GPUDevice* device,
const GPURenderPassDepthStencilAttachment* webgpu_desc) { … }
wgpu::ImageCopyBuffer ValidateAndConvertImageCopyBuffer(
const GPUImageCopyBuffer* webgpu_view,
const char** error) { … }
wgpu::CommandEncoderDescriptor AsDawnType(
const GPUCommandEncoderDescriptor* webgpu_desc,
std::string* label) { … }
}
GPUCommandEncoder* GPUCommandEncoder::Create(
GPUDevice* device,
const GPUCommandEncoderDescriptor* webgpu_desc) { … }
GPUCommandEncoder::GPUCommandEncoder(GPUDevice* device,
wgpu::CommandEncoder command_encoder,
const String& label)
: … { … }
GPURenderPassEncoder* GPUCommandEncoder::beginRenderPass(
const GPURenderPassDescriptor* descriptor,
ExceptionState& exception_state) { … }
GPUComputePassEncoder* GPUCommandEncoder::beginComputePass(
const GPUComputePassDescriptor* descriptor,
ExceptionState& exception_state) { … }
void GPUCommandEncoder::copyBufferToTexture(GPUImageCopyBuffer* source,
GPUImageCopyTexture* destination,
const V8GPUExtent3D* copy_size,
ExceptionState& exception_state) { … }
void GPUCommandEncoder::copyTextureToBuffer(GPUImageCopyTexture* source,
GPUImageCopyBuffer* destination,
const V8GPUExtent3D* copy_size,
ExceptionState& exception_state) { … }
void GPUCommandEncoder::copyTextureToTexture(GPUImageCopyTexture* source,
GPUImageCopyTexture* destination,
const V8GPUExtent3D* copy_size,
ExceptionState& exception_state) { … }
void GPUCommandEncoder::writeTimestamp(DawnObject<wgpu::QuerySet>* querySet,
uint32_t queryIndex,
ExceptionState& exception_state) { … }
GPUCommandBuffer* GPUCommandEncoder::finish(
const GPUCommandBufferDescriptor* descriptor) { … }
}