Interface GPUBuffer
label: string;
mapState: GPUBufferMapState;
size: number;
usage: number;
destroy(): void;
getMappedRange(offset?: number, size?: number): ArrayBuffer;
mapAsync(mode: number, offset?: number, size?: number): Promise<void>;
unmap(): void;
}
Hierarchy (View Summary)
- GPUObjectBase
- GPUBuffer
Properties
label
ReadonlymapState
The mapState read-only property of the GPUBuffer interface represents the mapped state of the GPUBuffer.
Readonlysize
The size read-only property of the GPUBuffer interface represents the length of the GPUBuffer's memory allocation, in bytes.
Readonlyusage
The usage read-only property of the GPUBuffer interface contains the bitwise flags representing the allowed usages of the GPUBuffer.
Methods
destroy
-
The
destroy()method of the GPUBuffer interface destroys the GPUBuffer.Returns void
getMappedRange
-
The
getMappedRange()method of the GPUBuffer interface returns an ArrayBuffer containing the mapped contents of the GPUBuffer in the specified range.Parameters
Optionaloffset: numberOptionalsize: number
Returns ArrayBuffer
mapAsync
-
The
mapAsync()method of the GPUBuffer interface maps the specified range of the GPUBuffer. It returns a Promise that resolves when the GPUBuffer's content is ready to be accessed. While the GPUBuffer is mapped it cannot be used in any GPU commands.Parameters
- mode: number
Optionaloffset: numberOptionalsize: number
Returns Promise<void>
unmap
-
The
unmap()method of the GPUBuffer interface unmaps the mapped range of the GPUBuffer, making its contents available for use by the GPU again after it has previously been mapped with GPUBuffer.mapAsync() (the GPU cannot access a mapped GPUBuffer).Returns void
The
GPUBufferinterface of the WebGPU API represents a block of memory that can be used to store raw data to use in GPU operations. Available only in secure contexts.MDN Reference