chromium/third_party/blink/renderer/modules/webgpu/gpu_buffer.idl

// Copyright 2019 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/

typedef unsigned long long GPUSize64Out;

[
    Exposed=(Window, Worker),
    SecureContext
] interface GPUBuffer {
    [CallWith=ScriptState, RaisesException] Promise<undefined> mapAsync(
        GPUMapModeFlags mode,
        optional GPUSize64 offset = 0,
        optional GPUSize64 size);
    [CallWith=ScriptState, RaisesException] ArrayBuffer getMappedRange(
        optional GPUSize64 offset = 0,
        optional GPUSize64 size);
    [CallWith=Isolate] void unmap();
    [CallWith=Isolate] void destroy();

    readonly attribute GPUSize64Out size;
    readonly attribute GPUFlagsConstant usage;
    readonly attribute GPUBufferMapState mapState;
};
GPUBuffer includes GPUObjectBase;

enum GPUBufferMapState {
    "unmapped",
    "pending",
    "mapped"
};