1. Introduction
This section is non-normative.
Graphics Processing Units, or GPUs for short, have been essential in enabling rich rendering and computational applications in personal computing. WebGPU is an API that exposes the capabilities of GPU hardware for the Web. The API is designed from the ground up to efficiently map to the Vulkan, Direct3D 12, and Metal native GPU APIs. WebGPU is not related to WebGL and does not explicitly target OpenGL ES.
WebGPU sees physical GPU hardware as GPUAdapter
s. It provides a connection to an adapter via GPUDevice
, which manages resources, and the device’s GPUQueue
s, which execute commands. GPUDevice
may have its own memory with high-speed access to the processing units. GPUBuffer
and GPUTexture
are the physical resources backed by GPU memory. GPUCommandBuffer
and GPURenderBundle
are containers for user-recorded commands. GPUShaderModule
contains shader code. The other resources,
such as GPUSampler
or GPUBindGroup
, configure the way physical resources are used by the GPU.
GPUs execute commands encoded in GPUCommandBuffer
s by feeding data through a pipeline,
which is a mix of fixed-function and programmable stages. Programmable stages execute shaders, which are special programs designed to run on GPU hardware.
Most of the state of a pipeline is defined by
a GPURenderPipeline
or a GPUComputePipeline
object. The state not included
in these pipeline objects is set during encoding with commands,
such as beginRenderPass()
or setBlendColor()
.
2. Security considerations
2.1. CPU-based undefined behavior
A WebGPU implementation translates the workloads issued by the user into API commands specific to the target platform. Native APIs specify the valid usage for the commands (for example, see vkCreateDescriptorSetLayout) and generally don’t guarantee any outcome if the valid usage rules are not followed. This is called "undefined behavior", and it can be exploited by an attacker to access memory they don’t own, or force the driver to execute arbitrary code.In order to disallow insecure usage, the range of allowed WebGPU behaviors is defined for any input.
An implementation has to validate all the input from the user and only reach the driver
with the valid workloads. This document specifies all the error conditions and handling semantics.
For example, specifying the same buffer with intersecting ranges in both "source" and "destination"
of copyBufferToBuffer()
results in GPUCommandEncoder
generating an error, and no other operation occurring.
See § 19 Errors & Debugging for more information about error handling.
2.2. GPU-based undefined behavior
WebGPU shaders are executed by the compute units inside GPU hardware. In native APIs, some of the shader instructions may result in undefined behavior on the GPU. In order to address that, the shader instruction set and its defined behaviors are strictly defined by WebGPU. When a shader is provided, the WebGPU implementation has to validate it before doing any translation (to platform-specific shaders) or transformation passes.2.3. Out-of-bounds access in shaders
Shaders can access physical resources either directly or via texture units, which are fixed-function hardware blocks that handle texture coordinate conversions. Validation on the API side can only guarantee that all the inputs to the shader are provided and they have the correct usage and types. The API side can not guarantee that the data is accessed within bounds if the texture units are not involved.In order to prevent the shaders from accessing GPU memory an application doesn’t own, the WebGPU implementation may enable a special mode (called "robust buffer access") in the driver that guarantees that the access is limited to buffer bounds. Alternatively, an implementation may transform the shader code by inserting manual bounds checks.
If the shader attempts to load data outside of physical resource bounds, the implementation is allowed to:
-
return a value at a different location within the resource bounds
-
return a value vector of "(0, 0, 0, X)" with any "X"
-
partially discard the draw or dispatch call
If the shader attempts to write data outside of physical resource bounds, the implementation is allowed to:
-
write the value to a different location within the resource bounds
-
discard the write operation
-
partially discard the draw or dispatch call
2.4. Invalid data
When uploading floating-point data from CPU to GPU, or generating it on the GPU, we may end up with a binary representation that doesn’t correspond to a valid number, such as infinity or NaN (not-a-number). The GPU behavior in this case is subject to the accuracy of the GPU hardware implementation of the IEEE-754 standard. WebGPU guarantees that introducing invalid floating-point numbers would only affect the results of arithmetic computations and will not have other side effects.2.5. Driver bugs
GPU drivers are subject to bugs like any other software. If a bug occurs, an attacker could possibly exploit the incorrect behavior of the driver to get access to unprivileged data. In order to reduce the risk, the WebGPU working group will coordinate with GPU vendors to integrate the WebGPU Conformance Test Suite (CTS) as part of their driver testing process, like it was done for WebGL. WebGPU implementations are expected to have workarounds for some of the discovered bugs, and support blacklisting particular drivers from using some of the native API backends.2.6. Timing attacks
WebGPU is designed for multi-threaded use via Web Workers. Some of the objects, likeGPUBuffer
, have shared state which can be simultaneously accessed.
This allows race conditions to occur, similar to those of accessing an SharedArrayBuffer
from multiple Web Workers, which makes the thread scheduling observable
and allows the creation of high-precision timers.
The theoretical attack vectors are a subset of those of SharedArrayBuffer.
2.7. Denial of service
WebGPU applications have access to GPU memory and compute units. A WebGPU implementation may limit the available GPU memory to an application, in order to keep other applications responsive. For GPU processing time, a WebGPU implementation may set up "watchdog" timer that makes sure an application doesn’t cause GPU unresponsiveness for more than a few seconds. These measures are similar to those used in WebGL.2.8. Fingerprinting
WebGPU defines the lowest allowed limits and capabilities of anyGPUAdapter
.
and encourages applications to target these standard limits. The actual result from requestAdapter()
may have higher limits, and could be subject to finger printing.
3. Convention
3.1. Coordinate Systems
WebGPU’s coordinate systems match DirectX and Metal’s coordinate systems in graphics pipeline.-
Y-axis is up in normalized device coordinate (NDC): point(-1.0, -1.0) in NDC is located at the bottom-left corner of NDC. In addition, x and y in NDC should be between -1.0 and 1.0 inclusive, while z in NDC should be between 0.0 and 1.0 inclusive. Vertices out of this range in NDC will not introduce any errors, but they will be clipped.
-
Y-axis is down in framebuffer coordinate, viewport coordinate and fragment/pixel coordinate: origin(0, 0) is located at the top-left corner in these coordinate systems.
-
Window/present coordinate matches framebuffer coordinate.
-
UV of origin(0, 0) in texture coordinate represents the first texel (the lowest byte) in texture memory.
4. Type Definitions
typedef unsigned long long ;
GPUBufferSize
4.1. Colors and Vectors
dictionary {
GPUColorDict required double ;
r required double ;
g required double ;
b required double ; };
a typedef (sequence <double >or GPUColorDict );
GPUColor
Note: double
is large enough to precisely hold 32-bit signed/unsigned
integers and single-precision floats.
dictionary {
GPUOrigin2DDict unsigned long = 0;
x unsigned long = 0; };
y typedef (sequence <unsigned long >or GPUOrigin2DDict );
GPUOrigin2D
dictionary {
GPUOrigin3DDict unsigned long = 0;
x unsigned long = 0;
y unsigned long = 0; };
z typedef (sequence <unsigned long >or GPUOrigin3DDict );
GPUOrigin3D
dictionary {
GPUExtent3DDict required unsigned long ;
width required unsigned long ;
height required unsigned long ; };
depth typedef (sequence <unsigned long >or GPUExtent3DDict );
GPUExtent3D
typedef sequence <any >;
GPUMappedBuffer
GPUMappedBuffer
is always a sequence of 2 elements, of types GPUBuffer
and ArrayBuffer
, respectively.
4.2. Internal Objects
An internal object is a non-exposed conceptual WebGPU object. Internal objects track the state of an API object and hold any underlying implementation. If the state of a particular internal object can change in parallel from multiple agents, those changes are always atomic with respect to all agents.
Note: An "agent" refers to a JavaScript "thread" (i.e. main thread, or Web Worker).
4.3. WebGPU Interfaces
A WebGPU interface is an exposed interface which encapsulates an internal object. It provides the interface through which the internal object's state is changed.
Any interface which includes GPUObjectBase
is a WebGPU interface.
interface mixin {
GPUObjectBase attribute DOMString ?label ; };
label
, of type DOMString, nullable
[[device]]
, of type device, readonly-
An internal slot holding the device on which the object exists.
4.4. Object Descriptors
dictionary {
GPUObjectDescriptorBase DOMString ?; };
label
5. Initialization
5.1. Examples
GPUDevice
in the default configuration, from the default adapter.
navigator. gpu. requestAdapter(). then( adapter=> { adapter. requestDevice(). then( device=> { // Use 'device' as needed. }); }). catch ( error=> { // WebGPU is unsupported, or no adapters or devices are available. });
5.2. navigator.gpu
[Exposed =Window ]partial interface Navigator { [SameObject ]readonly attribute GPU ; }; [
gpu Exposed =DedicatedWorker ]partial interface WorkerNavigator { [SameObject ]readonly attribute GPU ; };
gpu
The gpu
attribute is used to access a GPU
object from the main thread or a dedicated worker.
5.3. GPU
[Exposed =Window ]interface GPU { // May reject with DOMException // TODO: DOMException("OperationError")?Promise <GPUAdapter >(
requestAdapter optional GPURequestAdapterOptions = {}); };
options
GPU
defines the interface of navigator.gpu
, the entry point to WebGPU.
It exposes requestAdapter()
, for acquiring adapters.
5.4. Adapters
An adapter represents an implementation of WebGPU on the system. Each adapter identifies both an instance of a hardware accelerator (e.g. GPU or CPU) and an instance of a browser’s implementation of WebGPU on top of that accelerator.
If an adapter becomes unavailable, it becomes invalid. Once invalid, it never becomes valid again.
Note: An adapter may be a physical display adapter (GPU), but it could also be
a software renderer.
A returned adapter could refer to different physical adapters, or to
different browser codepaths or system drivers on the same physical adapters.
Applications can hold onto multiple adapters at once (via GPUAdapter
)
(even if some are invalid),
and two of these could refer to different instances of the same physical
configuration (e.g. if the GPU reset, or were disconnected and reconnected).
5.4.1. GPUAdapter
A GPUAdapter
refers to an adapter,
and exposes its capabilities (extensions and limits).
interface GPUAdapter {readonly attribute DOMString name ;readonly attribute object extensions ; //readonly attribute GPULimits limits; Don’t expose higher limits for now. // May reject with DOMException // TODO: DOMException("OperationError")?Promise <GPUDevice >(
requestDevice optional GPUDeviceDescriptor = {}); };
descriptor
GPUAdapter
has the following attributes:
name
, of type DOMString, readonly-
A human-readable name identifying the adapter. The contents are implementation-defined.
extensions
, of type object, readonly-
A
GPUExtensions
object which enumerates the extensions supported by the user agent, and whether each extension is supported by the underlying implementation.
GPUAdapter
also has the following internal slots:
[[adapter]]
, of type adapter, readonly-
An internal slot holding the adapter to which this
GPUAdapter
refers.
5.4.2. Getting an Adapter
To get a GPUAdapter
, use requestAdapter()
.
dictionary GPURequestAdapterOptions {GPUPowerPreference powerPreference ; };
GPURequestAdapterOptions
provides requirements and hints to the user agent indicating what
configuration is suitable for the application.
powerPreference
, of type GPUPowerPreference-
Provides a hint indicating what class of adapter should be selected from the system’s available adapters.
If unspecified, the user agent decides which class of adapter is most suitable.
Note: This hint may influence which GPU is used in a system with multiple GPUs. For example, a dual-GPU system might have one GPU that consumes less power at the expense of performance.
Note: Depending on the exact hardware configuration, such as attached displays or removable GPUs, the user agent may select different adapters given the same power preference. Typically, given the same hardware configuration and state (e.g. battery percentage) and
powerPreference
, the user agent should select the same adapter.
enum {
GPUPowerPreference "low-power" ,"high-performance" };
"low-power"
-
Indicates a request to prioritize power savings over performance.
Note: Generally, content should use this if it is unlikely to be constrained by drawing performance; for example, if it renders only one frame per second, draws only relatively simple geometry with simple shaders, or uses a small HTML canvas element. Developers are encouraged to use this value if their content allows, since it may significantly improve battery life on portable devices.
"high-performance"
-
Indicates a request to prioritize performance over power consumption.
Note: By choosing this value, developers should be aware that, for devices created on the resulting adapter, user agents are more likely to force device loss, in order to save power. Developers are encouraged to only specify this value if they believe it is absolutely necessary, since it may significantly decrease battery life on portable devices.
5.5. Devices
A device is the logical instantiation of an adapter, through which internal objects are created. It can be shared across multiple agents (e.g. dedicated workers).
A device is the exclusive owner of all internal objects created from it: when the device is lost, all objects created from it become invalid.
A device has the following internal slots:
[[adapter]]
, of type adapter, readonly-
The adapter from which this device was created.
When a device is created, its capabilities are set to those requested by
the user in requestDevice()
(which must be no greater than the
capabilities specified by the adapter).
These capabilities are enforced upon the usage of objects on the device,
even if the underlying adapter can support higher capabilities.
5.5.1. GPUDevice
A GPUDevice
refers to a device and
exposes the capabilities with which the device was created.
It is the top-level object through which WebGPU interfaces are created.
[Exposed =(Window ,Worker ),Serializable ]interface :
GPUDevice EventTarget {readonly attribute GPUAdapter adapter ;readonly attribute object extensions ;readonly attribute object limits ; [SameObject ]readonly attribute GPUQueue ;
defaultQueue GPUBuffer createBuffer (GPUBufferDescriptor );
descriptor GPUMappedBuffer (
createBufferMapped GPUBufferDescriptor );
descriptor Promise <GPUMappedBuffer >(
createBufferMappedAsync GPUBufferDescriptor );
descriptor GPUTexture (
createTexture GPUTextureDescriptor );
descriptor GPUSampler (
createSampler optional GPUSamplerDescriptor = {});
descriptor GPUBindGroupLayout createBindGroupLayout (GPUBindGroupLayoutDescriptor );
descriptor GPUPipelineLayout (
createPipelineLayout GPUPipelineLayoutDescriptor );
descriptor GPUBindGroup (
createBindGroup GPUBindGroupDescriptor );
descriptor GPUShaderModule (
createShaderModule GPUShaderModuleDescriptor );
descriptor GPUComputePipeline (
createComputePipeline GPUComputePipelineDescriptor );
descriptor GPURenderPipeline (
createRenderPipeline GPURenderPipelineDescriptor );
descriptor GPUCommandEncoder (
createCommandEncoder optional GPUCommandEncoderDescriptor = {});
descriptor GPURenderBundleEncoder (
createRenderBundleEncoder GPURenderBundleEncoderDescriptor ); };
descriptor GPUDevice includes GPUObjectBase ;
GPUDevice
has the following attributes:
adapter
, of type GPUAdapter, readonly-
The
GPUAdapter
from which this device was created. extensions
, of type object, readonly-
A
GPUExtensions
object exposing the extensions with which this device was created. limits
, of type object, readonly-
A
GPULimits
object exposing the limits with which this device was created.
GPUDevice
also has the following internal slots:
GPUDevice
objects are serializable objects.
-
If forStorage is true, throw a "
DataCloneError
". -
Set serialized.device to the value of value.
[[device]]
.
-
Set value.
[[device]]
to serialized.device.
5.5.2. Getting a Device
To get a GPUDevice
, use requestDevice()
.
dictionary :
GPUDeviceDescriptor GPUObjectDescriptorBase {GPUExtensions extensions = {};GPULimits limits = {}; // TODO: are other things configurable like queues? };
extensions
, of type GPUExtensions, defaulting toNone
-
The extensions to request of device creation.
limits
, of type GPULimits, defaulting toNone
-
The limits to request of device creation.
-
If the requested configuration is not available (i.e. the requested extensions or limits cannot be supported),
requestDevice()
rejects with a "NotSupportedError
". -
Otherwise, a
GPUDevice
is created with theGPUExtensions
andGPULimits
specified.
dictionary {
GPUExtensions boolean =
anisotropicFiltering false ; };
dictionary {
GPULimits unsigned long = 4;
maxBindGroups unsigned long = 8;
maxDynamicUniformBuffersPerPipelineLayout unsigned long = 4;
maxDynamicStorageBuffersPerPipelineLayout unsigned long = 16;
maxSampledTexturesPerShaderStage unsigned long = 16;
maxSamplersPerShaderStage unsigned long = 4;
maxStorageBuffersPerShaderStage unsigned long = 4;
maxStorageTexturesPerShaderStage unsigned long = 12; };
maxUniformBuffersPerShaderStage
6. GPUBuffer
A GPUBuffer
represents a block of memory that can be used in GPU operations.
Data is stored in linear layout, meaning that each byte of the allocation can be
addressed by its offset from the start of the GPUBuffer
, subject to alignment
restrictions depending on the operation. Some GPUBuffers
can be
mapped which makes the block of memory accessible via an ArrayBuffer
called
its mapping.
GPUBuffers
can be created via the following functions:
-
GPUDevice.createBuffer(descriptor)
that returns a new unmapped buffer. -
GPUDevice.createBufferMapped(descriptor)
that returns a mapped buffer and its mapping. -
GPUDevice.createBufferMappedAsync(descriptor)
that returns a Promise of a mapped buffer and its mapping.
[Serializable ]interface {
GPUBuffer Promise <ArrayBuffer >();
mapReadAsync Promise <ArrayBuffer >();
mapWriteAsync void ();
unmap void destroy (); };GPUBuffer includes GPUObjectBase ;
GPUBuffer
has the following internal slots:
[[size]]
of typeGPUBufferSize
.-
The length of the
GPUBuffer
allocation in bytes. [[usage]]
of typeGPUBufferUsageFlags
.-
The allowed usages for this
GPUBuffer
. [[state]]
of type buffer state.-
The current state of the
GPUBuffer
.
Each GPUBuffer
has a current buffer state which is one of the following:
-
"mapped" where the
GPUBuffer
is available for CPU operations. -
"unmapped" where the
GPUBuffer
is available for GPU operations. -
"destroyed" where the
GPUBuffer
is no longer available for any operations exceptdestroy
.
Note: [[size]]
and [[usage]]
are immutable once the GPUBuffer
has been created.
GPUBuffer
is Serializable
. It is a reference to an internal buffer
object, and Serializable
means that the reference can be copied between
realms (threads/workers), allowing multiple realms to access it concurrently.
Since GPUBuffer
has internal state (mapped, destroyed), that state is
internally-synchronized - these state changes occur atomically across realms.
6.1. Buffer creation
6.1.1. GPUBufferDescriptor
This specifies the options to use in creating a GPUBuffer
.
dictionary :
GPUBufferDescriptor GPUObjectDescriptorBase {required GPUBufferSize ;
size required GPUBufferUsageFlags ; };
usage
- validating GPUBufferDescriptor(device, descriptor)
6.1.2. GPUDevice.createBuffer(descriptor)
createBuffer(descriptor)
-
-
If the result of validating GPUBufferDescriptor(this, descriptor) is false:
-
Record a validation error in the current scope.
-
Create an invalid
GPUBuffer
and return the result.
-
-
Let b be a new
GPUBuffer
object. -
Set the
[[size]]
slot of b to the value of thesize
attribute of descriptor. -
Set the
[[usage]]
slot of b to the value of theusage
attribute of descriptor. -
Set each byte of b’s allocation to zero.
-
Return b.
-
6.2. Buffer Destruction
An application that no longer requires a GPUBuffer
can choose to lose
access to it before garbage collection by calling destroy()
.
Note: This allows the user agent to reclaim the GPU memory associated with the GPUBuffer
once all previously submitted operations using it are complete.
destroy()
6.3. Buffer Usage
typedef unsigned long ;
GPUBufferUsageFlags interface {
GPUBufferUsage const GPUBufferUsageFlags = 0x0001;
MAP_READ const GPUBufferUsageFlags = 0x0002;
MAP_WRITE const GPUBufferUsageFlags = 0x0004;
COPY_SRC const GPUBufferUsageFlags = 0x0008;
COPY_DST const GPUBufferUsageFlags = 0x0010;
INDEX const GPUBufferUsageFlags = 0x0020;
VERTEX const GPUBufferUsageFlags = 0x0040;
UNIFORM const GPUBufferUsageFlags = 0x0080;
STORAGE const GPUBufferUsageFlags = 0x0100; };
INDIRECT
6.4. Buffer Mapping
7. Textures
7.1. GPUTexture
[Serializable ]interface {
GPUTexture GPUTextureView (
createView optional GPUTextureViewDescriptor = {});
descriptor void (); };
destroy GPUTexture includes GPUObjectBase ;
7.1.1. Texture Creation
dictionary :
GPUTextureDescriptor GPUObjectDescriptorBase {required GPUExtent3D ;
size unsigned long = 1;
arrayLayerCount unsigned long = 1;
mipLevelCount unsigned long = 1;
sampleCount GPUTextureDimension = "2d";
dimension required GPUTextureFormat ;
format required GPUTextureUsageFlags ; };
usage
enum {
GPUTextureDimension ,
"1d" ,
"2d" };
"3d"
typedef unsigned long ;
GPUTextureUsageFlags interface {
GPUTextureUsage const GPUTextureUsageFlags = 0x01;
COPY_SRC const GPUTextureUsageFlags = 0x02;
COPY_DST const GPUTextureUsageFlags = 0x04;
SAMPLED const GPUTextureUsageFlags = 0x08;
STORAGE const GPUTextureUsageFlags = 0x10; };
OUTPUT_ATTACHMENT
7.2. GPUTextureView
interface { };
GPUTextureView GPUTextureView includes GPUObjectBase ;
7.2.1. Texture View Creation
dictionary :
GPUTextureViewDescriptor GPUObjectDescriptorBase {GPUTextureFormat ;
format GPUTextureViewDimension ;
dimension GPUTextureAspect = "all";
aspect unsigned long = 0;
baseMipLevel unsigned long = 0;
mipLevelCount unsigned long = 0;
baseArrayLayer unsigned long = 0; };
arrayLayerCount
-
dimension
: If unspecified:-
-
If texture.
arrayLayerCount
is greater than 1 andarrayLayerCount
is 0, defaults to"2d-array"
. -
Otherwise, defaults to
"2d"
.
-
-
mipLevelCount
: If 0, defaults to texture.mipLevelCount
−baseMipLevel
. -
arrayLayerCount
: If 0, defaults to texture.arrayLayerCount
−baseArrayLayer
.
enum {
GPUTextureViewDimension ,
"1d" ,
"2d" ,
"2d-array" ,
"cube" ,
"cube-array" };
"3d"
enum {
GPUTextureAspect ,
"all" ,
"stencil-only" };
"depth-only"
7.3. Texture Formats
The name of the format specifies the order of components, bits per component, and data type for the component.
-
r
,g
,b
,a
= red, green, blue, alpha -
unorm
= unsigned normalized -
snorm
= signed normalized -
uint
= unsigned int -
sint
= signed int -
float
= floating point
If the format has the -srgb
suffix, then sRGB gamma compression and
decompression are applied during the reading and writing of color values in the
pixel. Compressed texture formats are provided by extensions. Their naming
should follow the convention here, with the texture name as a prefix. e.g. etc2-rgba8unorm
.
enum { // 8-bit formats
GPUTextureFormat ,
"r8unorm" ,
"r8snorm" ,
"r8uint" , // 16-bit formats
"r8sint" ,
"r16uint" ,
"r16sint" ,
"r16float" ,
"rg8unorm" ,
"rg8snorm" ,
"rg8uint" , // 32-bit formats
"rg8sint" ,
"r32uint" ,
"r32sint" ,
"r32float" ,
"rg16uint" ,
"rg16sint" ,
"rg16float" ,
"rgba8unorm" ,
"rgba8unorm-srgb" ,
"rgba8snorm" ,
"rgba8uint" ,
"rgba8sint" ,
"bgra8unorm" , // Packed 32-bit formats
"bgra8unorm-srgb" ,
"rgb10a2unorm" , // 64-bit formats
"rg11b10float" ,
"rg32uint" ,
"rg32sint" ,
"rg32float" ,
"rgba16uint" ,
"rgba16sint" , // 128-bit formats
"rgba16float" ,
"rgba32uint" ,
"rgba32sint" , // Depth and stencil formats
"rgba32float" ,
"depth32float" ,
"depth24plus" };
"depth24plus-stencil8"
-
The
depth24plus
family of formats (depth24plus
anddepth24plus-stencil8
) must have a depth-component precision of 1 ULP ≤ 1 / (224).Note: This is unlike the 24-bit unsigned normalized format family typically found in native APIs, which has a precision of 1 ULP = 1 / (224 − 1).
enum {
GPUTextureComponentType ,
"float" ,
"sint" };
"uint"
8. Samplers
8.1. GPUSampler
interface { };
GPUSampler GPUSampler includes GPUObjectBase ;
8.1.1. Creation
dictionary :
GPUSamplerDescriptor GPUObjectDescriptorBase {GPUAddressMode = "clamp-to-edge";
addressModeU GPUAddressMode = "clamp-to-edge";
addressModeV GPUAddressMode = "clamp-to-edge";
addressModeW GPUFilterMode = "nearest";
magFilter GPUFilterMode = "nearest";
minFilter GPUFilterMode = "nearest";
mipmapFilter float = 0;
lodMinClamp float = 0xffffffff; // TODO: What should this be? Was Number.MAX_VALUE.
lodMaxClamp GPUCompareFunction = "never"; };
compare
enum {
GPUAddressMode ,
"clamp-to-edge" ,
"repeat" };
"mirror-repeat"
enum {
GPUFilterMode ,
"nearest" };
"linear"
enum {
GPUCompareFunction ,
"never" ,
"less" ,
"equal" ,
"less-equal" ,
"greater" ,
"not-equal" ,
"greater-equal" };
"always"
9. Resource Binding
9.1. GPUBindGroupLayout
A GPUBindGroupLayout
defines the interface between a set of resources bound in a GPUBindGroup
and their accessibility in shader stages.
[Serializable ]interface { };
GPUBindGroupLayout GPUBindGroupLayout includes GPUObjectBase ;
9.1.1. Creation
A GPUBindGroupLayout
is created via GPUDevice.createBindGroupLayout()
.
dictionary :
GPUBindGroupLayoutDescriptor GPUObjectDescriptorBase {required sequence <GPUBindGroupLayoutBinding >; };
bindings
A GPUBindGroupLayoutBinding
describes a single shader resource binding to be included in a GPUBindGroupLayout
.
dictionary {
GPUBindGroupLayoutBinding required unsigned long ;
binding required GPUShaderStageFlags ;
visibility required GPUBindingType ;
type GPUTextureViewDimension = "2d";
textureDimension GPUTextureComponentType = "float";
textureComponentType boolean =
multisampled false ;boolean =
hasDynamicOffset false ; };
-
binding
: A unique identifier for a resource binding within aGPUBindGroupLayoutBinding
, a correspondingGPUBindGroupBinding
, and shader stages. -
visibility
: A bitset of the members ofGPUShaderStage
. Each set bit indicates that aGPUBindGroupLayoutBinding
's resource will be accessible from the associated shader stage.
typedef unsigned long ;
GPUShaderStageFlags interface {
GPUShaderStage const GPUShaderStageFlags = 0x1;
VERTEX const GPUShaderStageFlags = 0x2;
FRAGMENT const GPUShaderStageFlags = 0x4; };
COMPUTE
-
type
: A member ofGPUBindingType
that indicates the intended usage of a resource binding in its visibleGPUShaderStage
s.
enum {
GPUBindingType ,
"uniform-buffer" ,
"storage-buffer" ,
"readonly-storage-buffer" ,
"sampler" ,
"sampled-texture" // TODO: other binding types };
"storage-texture"
-
textureDimension
,multisampled
: Describes the dimensionality of texture view bindings, and indicates if they are multisampled.Note: This allows Metal-based implementations to back the respective bind groups with
MTLArgumentBuffer
objects that are more efficient to bind at run-time. -
hasDynamicOffset
: Foruniform-buffer
,storage-buffer
, andreadonly-storage-buffer
bindings, indicates that the binding has a dynamic offset. One offset must be passed to setBindGroup for each dynamic binding in increasing order ofbinding
number.
A GPUBindGroupLayout
object has the following internal slots:
[[bindings]]
of type sequence<GPUBindGroupLayoutBinding
>.-
The set of
GPUBindGroupLayoutBinding
s thisGPUBindGroupLayout
describes.
9.1.2. GPUDevice.createBindGroupLayout(GPUBindGroupLayoutDescriptor)
The createBindGroupLayout(descriptor)
method is used to create GPUBindGroupLayout
s.
-
Ensure device validation is not violated.
-
Let layout be a new valid
GPUBindGroupLayout
object. -
For each
GPUBindGroupLayoutBinding
bindingDescriptor in descriptor.bindings
:-
Ensure bindingDescriptor.
binding
does not violate binding validation. -
If bindingDescriptor.
type
isuniform-buffer
:-
Ensure uniform buffer validation is not violated.
-
If bindingDescriptor.
hasDynamicOffset
istrue
, ensure dynamic uniform buffer validation is not violated.
-
-
If bindingDescriptor.
type
isstorage-buffer
orreadonly-storage-buffer
:-
Ensure storage buffer validation is not violated.
-
If bindingDescriptor.
hasDynamicOffset
istrue
, ensure dynamic storage buffer validation is not violated.
-
-
If bindingDescriptor.
type
issampled-texture
, ensure sampled texture validation is not violated. -
If bindingDescriptor.
type
isstorage-texture
, ensure storage texture validation is not violated. -
If bindingDescriptor.
type
issampler
, ensure sampler validation is not violated. -
Insert bindingDescriptor into layout.
[[bindings]]
.
-
-
Return layout.
Validation Conditions
-
If any of the following conditions are violated:
-
Generate a
GPUValidationError
in the current scope with appropriate error message. -
Create a new invalid
GPUBindGroupLayout
and return the result.
device validation: The GPUDevice
must not be lost.
binding validation: Each bindingDescriptor.binding
in descriptor must be unique.
uniform buffer validation: There must be GPULimits.maxUniformBuffersPerShaderStage
or
fewer bindingDescriptors of type uniform-buffer
visible on each shader stage in descriptor.
dynamic uniform buffer validation: There must be GPULimits.maxDynamicUniformBuffersPerPipelineLayout
or
fewer bindingDescriptors of type uniform-buffer
with hasDynamicOffset
set to true
in descriptor that are visible to any shader stage.
storage buffer validation: There must be GPULimits.maxStorageBuffersPerShaderStage
or
fewer bindingDescriptors of type storage-buffer
visible on each shader stage in descriptor.
dynamic storage buffer validation: There must be GPULimits.maxDynamicStorageBuffersPerPipelineLayout
or
fewer bindingDescriptors of type storage-buffer
with hasDynamicOffset
set to true
in descriptor that are visible to any shader stage.
sampled texture validation: There must be GPULimits.maxSampledTexturesPerShaderStage
or
fewer bindingDescriptors of type sampled-texture
visible on each shader stage in descriptor.
storage texture validation: There must be GPULimits.maxStorageTexturesPerShaderStage
or
fewer bindingDescriptors of type storage-texture
visible on each shader stage in descriptor.
sampler validation: There must be GPULimits.maxSamplersPerShaderStage
or
fewer bindingDescriptors of type sampler
visible on each shader stage in descriptor.
9.2. GPUBindGroup
interface { };
GPUBindGroup GPUBindGroup includes GPUObjectBase ;
9.2.1. Bind Group Creation
dictionary :
GPUBindGroupDescriptor GPUObjectDescriptorBase {required GPUBindGroupLayout ;
layout required sequence <GPUBindGroupBinding >; };
bindings
typedef (GPUSampler or GPUTextureView or GPUBufferBinding );
GPUBindingResource dictionary {
GPUBindGroupBinding required unsigned long ;
binding required GPUBindingResource ; };
resource
dictionary {
GPUBufferBinding required GPUBuffer ;
buffer GPUBufferSize = 0;
offset GPUBufferSize ; };
size
9.3. GPUPipelineLayout
interface { };
GPUPipelineLayout GPUPipelineLayout includes GPUObjectBase ;
9.3.1. Creation
dictionary :
GPUPipelineLayoutDescriptor GPUObjectDescriptorBase {required sequence <GPUBindGroupLayout >; };
bindGroupLayouts
10. Shader Modules
10.1. GPUShaderModule
[Serializable ]interface { };
GPUShaderModule GPUShaderModule includes GPUObjectBase ;
GPUShaderModule
is Serializable
. It is a reference to an internal
shader module object, and Serializable
means that the reference can be copied between realms (threads/workers), allowing multiple realms to access
it concurrently. Since GPUShaderModule
immutable, there are no race
conditions.
10.1.1. Shader Module Creation
typedef (Uint32Array or DOMString );
GPUShaderCode dictionary :
GPUShaderModuleDescriptor GPUObjectDescriptorBase {required GPUShaderCode ; };
code
Note: While the choice of shader language is undecided, GPUShaderModuleDescriptor
will temporarily accept both text and binary input.
11. Pipelines
dictionary :
GPUPipelineDescriptorBase GPUObjectDescriptorBase {required GPUPipelineLayout ; };
layout
dictionary {
GPUProgrammableStageDescriptor required GPUShaderModule ;
module required DOMString ; // TODO: other stuff like specialization constants? };
entryPoint
11.1. GPUComputePipeline
[Serializable ]interface { };
GPUComputePipeline GPUComputePipeline includes GPUObjectBase ;
11.1.1. Creation
dictionary :
GPUComputePipelineDescriptor GPUPipelineDescriptorBase {required GPUProgrammableStageDescriptor ; };
computeStage
11.2. GPURenderPipeline
[Serializable ]interface { };
GPURenderPipeline GPURenderPipeline includes GPUObjectBase ;
11.2.1. Creation
dictionary :
GPURenderPipelineDescriptor GPUPipelineDescriptorBase {required GPUProgrammableStageDescriptor ;
vertexStage GPUProgrammableStageDescriptor ;
fragmentStage required GPUPrimitiveTopology ;
primitiveTopology GPURasterizationStateDescriptor = {};
rasterizationState required sequence <GPUColorStateDescriptor >;
colorStates GPUDepthStencilStateDescriptor ;
depthStencilState GPUVertexStateDescriptor = {};
vertexState unsigned long = 1;
sampleCount unsigned long = 0xFFFFFFFF;
sampleMask boolean =
alphaToCoverageEnabled false ; // TODO: other properties };
-
sampleCount
: Number of MSAA samples.
11.2.2. Primitive Topology
enum {
GPUPrimitiveTopology ,
"point-list" ,
"line-list" ,
"line-strip" ,
"triangle-list" };
"triangle-strip"
11.2.3. Rasterization State
dictionary {
GPURasterizationStateDescriptor GPUFrontFace = "ccw";
frontFace GPUCullMode = "none";
cullMode long = 0;
depthBias float = 0;
depthBiasSlopeScale float = 0; };
depthBiasClamp
enum {
GPUFrontFace ,
"ccw" };
"cw"
enum {
GPUCullMode ,
"none" ,
"front" };
"back"
11.2.4. Color State
dictionary {
GPUColorStateDescriptor required GPUTextureFormat ;
format GPUBlendDescriptor = {};
alphaBlend GPUBlendDescriptor = {};
colorBlend GPUColorWriteFlags = 0xF; // GPUColorWrite.ALL };
writeMask
typedef unsigned long ;
GPUColorWriteFlags interface {
GPUColorWrite const GPUColorWriteFlags = 0x1;
RED const GPUColorWriteFlags = 0x2;
GREEN const GPUColorWriteFlags = 0x4;
BLUE const GPUColorWriteFlags = 0x8;
ALPHA const GPUColorWriteFlags = 0xF; };
ALL
11.2.4.1. Blend State
dictionary {
GPUBlendDescriptor GPUBlendFactor = "one";
srcFactor GPUBlendFactor = "zero";
dstFactor GPUBlendOperation = "add"; };
operation
enum {
GPUBlendFactor ,
"zero" ,
"one" ,
"src-color" ,
"one-minus-src-color" ,
"src-alpha" ,
"one-minus-src-alpha" ,
"dst-color" ,
"one-minus-dst-color" ,
"dst-alpha" ,
"one-minus-dst-alpha" ,
"src-alpha-saturated" ,
"blend-color" };
"one-minus-blend-color"
enum {
GPUBlendOperation ,
"add" ,
"subtract" ,
"reverse-subtract" ,
"min" };
"max"
enum {
GPUStencilOperation ,
"keep" ,
"zero" ,
"replace" ,
"invert" ,
"increment-clamp" ,
"decrement-clamp" ,
"increment-wrap" };
"decrement-wrap"
11.2.5. Depth/Stencil State
dictionary {
GPUDepthStencilStateDescriptor required GPUTextureFormat ;
format boolean =
depthWriteEnabled false ;GPUCompareFunction = "always";
depthCompare GPUStencilStateFaceDescriptor = {};
stencilFront GPUStencilStateFaceDescriptor = {};
stencilBack unsigned long = 0xFFFFFFFF;
stencilReadMask unsigned long = 0xFFFFFFFF; };
stencilWriteMask
dictionary {
GPUStencilStateFaceDescriptor GPUCompareFunction = "always";
compare GPUStencilOperation = "keep";
failOp GPUStencilOperation = "keep";
depthFailOp GPUStencilOperation = "keep"; };
passOp
11.2.6. Vertex State
enum {
GPUIndexFormat ,
"uint16" };
"uint32"
11.2.6.1. Vertex formats
The name of the format specifies the data type of the component, the number of values, and whether the data is normalized.
-
uchar
= unsigned 8-bit value -
char
= signed 8-bit value -
ushort
= unsigned 16-bit value -
short
= signed 16-bit value -
half
= half-precision 16-bit floating point value -
float
= 32-bit floating point value -
uint
= unsigned 32-bit integer value -
int
= signed 32-bit integer value
If no number of values is given in the name, a single value is provided.
If the format has the -bgra
suffix, it means the values are arranged as
blue, green, red and alpha values.
enum {
GPUVertexFormat ,
"uchar2" ,
"uchar4" ,
"char2" ,
"char4" ,
"uchar2norm" ,
"uchar4norm" ,
"char2norm" ,
"char4norm" ,
"ushort2" ,
"ushort4" ,
"short2" ,
"short4" ,
"ushort2norm" ,
"ushort4norm" ,
"short2norm" ,
"short4norm" ,
"half2" ,
"half4" ,
"float" ,
"float2" ,
"float3" ,
"float4" ,
"uint" ,
"uint2" ,
"uint3" ,
"uint4" ,
"int" ,
"int2" ,
"int3" };
"int4"
enum {
GPUInputStepMode ,
"vertex" };
"instance"
dictionary {
GPUVertexStateDescriptor GPUIndexFormat = "uint32";
indexFormat sequence <GPUVertexBufferLayoutDescriptor ?>= []; };
vertexBuffers
A vertex buffer is, conceptually, a view into buffer memory as an array of structures. arrayStride
is the stride, in bytes, between elements of that array.
Each element of a vertex buffer is like a structure with a memory layout defined by its attributes
, which describe the members of the structure.
Each GPUVertexAttributeDescriptor
describes its format
and its offset
, in bytes, within the structure.
Each attribute appears as a separate input in a vertex shader, each bound by a numeric location,
which is specified by shaderLocation
.
Every location must be unique within the GPUVertexStateDescriptor
.
dictionary {
GPUVertexBufferLayoutDescriptor required GPUBufferSize ;
arrayStride GPUInputStepMode = "vertex";
stepMode required sequence <GPUVertexAttributeDescriptor >; };
attributes
dictionary {
GPUVertexAttributeDescriptor required GPUVertexFormat ;
format required GPUBufferSize ;
offset required unsigned long ; };
shaderLocation
12. Command Buffers
12.1. GPUCommandBuffer
interface { };
GPUCommandBuffer GPUCommandBuffer includes GPUObjectBase ;
12.1.1. Creation
dictionary :
GPUCommandBufferDescriptor GPUObjectDescriptorBase { };
13. Command Encoding
13.1. GPUCommandEncoder
interface {
GPUCommandEncoder GPURenderPassEncoder (
beginRenderPass GPURenderPassDescriptor );
descriptor GPUComputePassEncoder (
beginComputePass optional GPUComputePassDescriptor = {});
descriptor void (
copyBufferToBuffer GPUBuffer ,
source GPUBufferSize ,
sourceOffset GPUBuffer ,
destination GPUBufferSize ,
destinationOffset GPUBufferSize );
size void (
copyBufferToTexture GPUBufferCopyView ,
source GPUTextureCopyView ,
destination GPUExtent3D );
copySize void (
copyTextureToBuffer GPUTextureCopyView ,
source GPUBufferCopyView ,
destination GPUExtent3D );
copySize void (
copyTextureToTexture GPUTextureCopyView ,
source GPUTextureCopyView ,
destination GPUExtent3D );
copySize void (
copyImageBitmapToTexture GPUImageBitmapCopyView ,
source GPUTextureCopyView ,
destination GPUExtent3D );
copySize void (
pushDebugGroup DOMString );
groupLabel void ();
popDebugGroup void (
insertDebugMarker DOMString );
markerLabel GPUCommandBuffer (
finish optional GPUCommandBufferDescriptor = {}); };
descriptor GPUCommandEncoder includes GPUObjectBase ;
-
-
For now,
copySize.z
must be1
.
-
13.1.1. Creation
dictionary :
GPUCommandEncoderDescriptor GPUObjectDescriptorBase { // TODO: reusability flag? };
13.2. Copy Commands
dictionary {
GPUBufferCopyView required GPUBuffer ;
buffer GPUBufferSize = 0;
offset required unsigned long ;
rowPitch required unsigned long ; };
imageHeight
dictionary {
GPUTextureCopyView required GPUTexture ;
texture unsigned long = 0;
mipLevel unsigned long = 0;
arrayLayer GPUOrigin3D = {}; };
origin
-
origin
: If unspecified, defaults to[0, 0, 0]
.
dictionary {
GPUImageBitmapCopyView required ImageBitmap ;
imageBitmap GPUOrigin2D = {}; };
origin
-
origin
: If unspecified, defaults to[0, 0]
.
13.3. Programmable Passes
interface mixin {
GPUProgrammablePassEncoder void (
setBindGroup unsigned long ,
index GPUBindGroup ,
bindGroup optional sequence <unsigned long >= []);
dynamicOffsets void (
setBindGroup unsigned long ,
index GPUBindGroup ,
bindGroup Uint32Array ,
dynamicOffsetsData unsigned long long ,
dynamicOffsetsDataStart unsigned long long );
dynamicOffsetsDataLength void (
pushDebugGroup DOMString );
groupLabel void ();
popDebugGroup void (
insertDebugMarker DOMString ); };
markerLabel
Debug groups in a GPUCommandEncoder
or GPUProgrammablePassEncoder
must be well nested.
14. Compute Passes
14.1. GPUComputePassEncoder
interface {
GPUComputePassEncoder void (
setPipeline GPUComputePipeline );
pipeline void (
dispatch unsigned long ,
x optional unsigned long = 1,
y optional unsigned long = 1);
z void (
dispatchIndirect GPUBuffer ,
indirectBuffer GPUBufferSize );
indirectOffset void (); };
endPass GPUComputePassEncoder includes GPUObjectBase ;GPUComputePassEncoder includes GPUProgrammablePassEncoder ;
14.1.1. Creation
dictionary :
GPUComputePassDescriptor GPUObjectDescriptorBase { };
15. Render Passes
15.1. GPURenderPassEncoder
interface mixin {
GPURenderEncoderBase void (
setPipeline GPURenderPipeline );
pipeline void (
setIndexBuffer GPUBuffer ,
buffer optional GPUBufferSize = 0);
offset void (
setVertexBuffer unsigned long ,
slot GPUBuffer ,
buffer optional GPUBufferSize = 0);
offset void (
draw unsigned long ,
vertexCount unsigned long ,
instanceCount unsigned long ,
firstVertex unsigned long );
firstInstance void (
drawIndexed unsigned long ,
indexCount unsigned long ,
instanceCount unsigned long ,
firstIndex long ,
baseVertex unsigned long );
firstInstance void (
drawIndirect GPUBuffer ,
indirectBuffer GPUBufferSize );
indirectOffset void (
drawIndexedIndirect GPUBuffer ,
indirectBuffer GPUBufferSize ); };
indirectOffset interface {
GPURenderPassEncoder void (
setViewport float ,
x float ,
y float ,
width float ,
height float ,
minDepth float );
maxDepth void (
setScissorRect unsigned long ,
x unsigned long ,
y unsigned long ,
width unsigned long );
height void (
setBlendColor GPUColor );
color void (
setStencilReference unsigned long );
reference void (
executeBundles sequence <GPURenderBundle >);
bundles void (); };
endPass GPURenderPassEncoder includes GPUObjectBase ;GPURenderPassEncoder includes GPUProgrammablePassEncoder ;GPURenderPassEncoder includes GPURenderEncoderBase ;
-
In indirect draw calls, the base instance field (inside the indirect buffer data) must be set to zero.
-
-
An error is generated if
width
orheight
is not greater than 0.
-
When a GPURenderPassEncoder
is created, it has the following default state:
-
Viewport:
-
x, y
=0.0, 0.0
-
width, height
= the dimensions of the pass’s render targets -
minDepth, maxDepth
=0.0, 1.0
-
-
Scissor rectangle:
-
x, y
=0, 0
-
width, height
= the dimensions of the pass’s render targets
-
When a GPURenderBundle
is executed, it does not inherit the pass’s pipeline,
bind groups, or vertex or index buffers. After a GPURenderBundle
has executed,
the pass’s pipeline, bind groups, and vertex and index buffers are cleared. If zero GPURenderBundle
s are executed, the command buffer state is unchanged.
15.1.1. Creation
dictionary :
GPURenderPassDescriptor GPUObjectDescriptorBase {required sequence <GPURenderPassColorAttachmentDescriptor >;
colorAttachments GPURenderPassDepthStencilAttachmentDescriptor ; };
depthStencilAttachment
15.1.1.1. Color Attachments
dictionary {
GPURenderPassColorAttachmentDescriptor required GPUTextureView ;
attachment GPUTextureView ;
resolveTarget required (GPULoadOp or GPUColor );
loadValue GPUStoreOp = "store"; };
storeOp
15.1.1.2. Depth/Stencil Attachments
dictionary {
GPURenderPassDepthStencilAttachmentDescriptor required GPUTextureView ;
attachment required (GPULoadOp or float );
depthLoadValue required GPUStoreOp ;
depthStoreOp required (GPULoadOp or unsigned long );
stencilLoadValue required GPUStoreOp ; };
stencilStoreOp
15.1.2. Load & Store Operations
enum {
GPULoadOp };
"load"
enum {
GPUStoreOp ,
"store" };
"clear"
16. Bundles
16.1. GPURenderBundle
interface { };
GPURenderBundle GPURenderBundle includes GPUObjectBase ;
16.1.1. Creation
dictionary :
GPURenderBundleDescriptor GPUObjectDescriptorBase { };
interface {
GPURenderBundleEncoder GPURenderBundle (
finish optional GPURenderBundleDescriptor = {}); };
descriptor GPURenderBundleEncoder includes GPUObjectBase ;GPURenderBundleEncoder includes GPUProgrammablePassEncoder ;GPURenderBundleEncoder includes GPURenderEncoderBase ;
16.1.2. Encoding
dictionary :
GPURenderBundleEncoderDescriptor GPUObjectDescriptorBase {required sequence <GPUTextureFormat >;
colorFormats GPUTextureFormat ;
depthStencilFormat unsigned long = 1; };
sampleCount
17. Queues
interface {
GPUQueue void (
submit sequence <GPUCommandBuffer >);
commandBuffers GPUFence (
createFence optional GPUFenceDescriptor = {});
descriptor void (
signal GPUFence ,
fence unsigned long long ); };
signalValue GPUQueue includes GPUObjectBase ;
submit(commandBuffers)
does nothing and produces an error if any of the following is true:
-
Any
GPUBuffer
referenced in any element ofcommandBuffers
isn’t in the"unmapped"
buffer state.
17.1. GPUFence
interface {
GPUFence unsigned long long ();
getCompletedValue Promise <void >(
onCompletion unsigned long long ); };
completionValue GPUFence includes GPUObjectBase ;
17.1.1. Creation
dictionary :
GPUFenceDescriptor GPUObjectDescriptorBase {unsigned long long = 0; };
initialValue
18. Canvas Rendering and Swap Chain
interface {
GPUCanvasContext GPUSwapChain (
configureSwapChain GPUSwapChainDescriptor );
descriptor Promise <GPUTextureFormat >(
getSwapChainPreferredFormat GPUDevice ); };
device
-
configureSwapChain()
: Configures the swap chain for this canvas, and returns a newGPUSwapChain
object representing it. Destroys any swapchain previously returned byconfigureSwapChain
, including all of the textures it has produced.
dictionary :
GPUSwapChainDescriptor GPUObjectDescriptorBase {required GPUDevice ;
device required GPUTextureFormat ;
format GPUTextureUsageFlags = 0x10; // GPUTextureUsage.OUTPUT_ATTACHMENT };
usage
interface {
GPUSwapChain GPUTexture (); };
getCurrentTexture GPUSwapChain includes GPUObjectBase ;
19. Errors & Debugging
19.1. Fatal Errors
interface {
GPUDeviceLostInfo readonly attribute DOMString ; };
message partial interface GPUDevice {readonly attribute Promise <GPUDeviceLostInfo >; };
lost
19.2. Error Scopes
enum {
GPUErrorFilter ,
"none" ,
"out-of-memory" };
"validation"
interface {
GPUOutOfMemoryError (); };
constructor interface {
GPUValidationError (
constructor DOMString );
message readonly attribute DOMString ; };
message typedef (GPUOutOfMemoryError or GPUValidationError );
GPUError
partial interface GPUDevice {void (
pushErrorScope GPUErrorFilter );
filter Promise <GPUError ?>(); };
popErrorScope
popErrorScope()
throws OperationError
if there are no error scopes on the stack. popErrorScope()
rejects with OperationError
if the device is lost.
19.3. Telemetry
[Exposed =Window ]interface :
GPUUncapturedErrorEvent Event {(
constructor DOMString ,
type GPUUncapturedErrorEventInit );
gpuUncapturedErrorEventInitDict readonly attribute GPUError ; };
error dictionary :
GPUUncapturedErrorEventInit EventInit {required GPUError ; };
error
partial interface GPUDevice { [Exposed =Window ]attribute EventHandler ; };
onuncapturederror
20. Temporary usages of non-exported dfns #
Eventually all of these should disappear but they are useful to avoid warning while building the specification.