#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_DAWN_CONVERSIONS_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_DAWN_CONVERSIONS_H_
#include <memory>
#include "base/check.h"
#include "base/containers/heap_array.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_typedefs.h"
#include "third_party/blink/renderer/modules/webgpu/dawn_enum_conversions.h"
#include "third_party/blink/renderer/modules/webgpu/dawn_object.h"
#include "third_party/blink/renderer/platform/graphics/gpu/webgpu_cpp.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
#include "third_party/blink/renderer/platform/heap/member.h"
namespace blink {
class GPUImageCopyTexture;
class GPUImageDataLayout;
class V8UnionGPUAutoLayoutModeOrGPUPipelineLayout;
wgpu::TextureFormat AsDawnType(SkColorType color_type);
wgpu::PipelineLayout AsDawnType(
V8UnionGPUAutoLayoutModeOrGPUPipelineLayout* webgpu_layout);
bool ConvertToDawn(const V8GPUColor* in, wgpu::Color* out, ExceptionState&);
bool ConvertToDawn(const V8GPUExtent3D* in,
wgpu::Extent3D* out,
GPUDevice* device,
ExceptionState&);
bool ConvertToDawn(const V8GPUOrigin3D* in,
wgpu::Origin3D* out,
ExceptionState&);
bool ConvertToDawn(const V8GPUOrigin2D* in,
wgpu::Origin2D* out,
ExceptionState&);
bool ConvertToDawn(const GPUImageCopyTexture* in,
wgpu::ImageCopyTexture* out,
ExceptionState&);
const char* ValidateTextureDataLayout(const GPUImageDataLayout* webgpu_layout,
wgpu::TextureDataLayout* layout);
template <typename Handle>
Handle AsDawnType(const DawnObject<Handle>* object) { … }
TypeOfDawnType;
template <typename WebGPUType>
std::unique_ptr<TypeOfDawnType<WebGPUType>[]> AsDawnType(
const HeapVector<Member<WebGPUType>>& webgpu_objects) { … }
template <typename WebGPUType, typename DawnType>
bool ConvertToDawn(const HeapVector<Member<WebGPUType>>& in,
std::unique_ptr<DawnType[]>* out,
ExceptionState& exception_state) { … }
template <typename DawnEnum, typename WebGPUEnum>
base::HeapArray<DawnEnum> AsDawnEnum(const Vector<WebGPUEnum>& webgpu_enums) { … }
template <typename DawnEnum, typename WebGPUEnum>
base::HeapArray<DawnEnum> AsDawnEnum(
const Vector<std::optional<WebGPUEnum>>& webgpu_enums) { … }
}
#endif