// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://gpuweb.github.io/gpuweb/
[
Exposed=(Window, Worker),
SecureContext
] interface GPUDevice : EventTarget {
[SameObject] readonly attribute GPUSupportedFeatures features;
[SameObject] readonly attribute GPUSupportedLimits limits;
[CallWith=ScriptState] readonly attribute Promise<GPUDeviceLostInfo> lost;
[SameObject] readonly attribute GPUQueue queue;
[CallWith=Isolate] void destroy();
[RaisesException] GPUBuffer createBuffer(GPUBufferDescriptor descriptor);
[RaisesException] GPUTexture createTexture(GPUTextureDescriptor descriptor);
GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
[RaisesException] GPUExternalTexture importExternalTexture(GPUExternalTextureDescriptor descriptor);
[RaisesException] GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor);
[RaisesException] GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor);
GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor);
[RaisesException] GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
[CallWith=ScriptState] GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
[RaisesException] GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
[CallWith=ScriptState, RaisesException] Promise<GPURenderPipeline> createRenderPipelineAsync(GPURenderPipelineDescriptor descriptor);
[CallWith=ScriptState] Promise<GPUComputePipeline> createComputePipelineAsync(GPUComputePipelineDescriptor descriptor);
GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
[RaisesException] GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
[RaisesException] GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor);
void pushErrorScope(GPUErrorFilter filter);
[CallWith=ScriptState] Promise<GPUError?> popErrorScope();
attribute EventHandler onuncapturederror;
};
GPUDevice includes GPUObjectBase;
enum GPUErrorFilter {
"out-of-memory",
"validation",
"internal",
};
typedef sequence<(GPUBuffer or ArrayBuffer)> GPUMappedBuffer;