Interface GPUBuffer
__brand: "GPUBuffer";
label: string;
mapState: GPUBufferMapState;
size: number;
usage: number;
destroy(): undefined;
getMappedRange(offset?: number, size?: number): ArrayBuffer;
mapAsync(mode: number, offset?: number, size?: number): Promise<undefined>;
unmap(): undefined;
}
Hierarchy
- GPUObjectBase
- GPUBuffer (view full)
Properties
Readonly
Internal
__brand
label
Readonly
mapState
Readonly
size
Readonly
usage
Methods
destroy
- destroy(): undefined
Destroys the GPUBuffer. Note: It is valid to destroy a buffer multiple times. Note: Since no further operations can be enqueued using this buffer, implementations can free resource allocations, including mapped memory that was just unmapped.
Returns undefined
getMappedRange
- get
Mapped (offset?, size?): ArrayBufferRange Returns an ArrayBuffer with the contents of the GPUBuffer in the given mapped range.
Parameters
Optional
offset: numberOffset in bytes into the buffer to return buffer contents from.
Optional
size: numberSize in bytes of the ArrayBuffer to return.
Returns ArrayBuffer
mapAsync
- map
Async (mode, offset?, size?): Promise<undefined> Maps the given range of the GPUBuffer and resolves the returned Promise when the GPUBuffer's content is ready to be accessed with GPUBuffer#getMappedRange. The resolution of the returned Promise only indicates that the buffer has been mapped. It does not guarantee the completion of any other operations visible to the content timeline, and in particular does not imply that any other Promise returned from () or GPUBuffer#mapAsync on other GPUBuffers have resolved. The resolution of the Promise returned from GPUQueue#onSubmittedWorkDone does imply the completion of GPUBuffer#mapAsync calls made prior to that call, on GPUBuffers last used exclusively on that queue.
Parameters
- mode: number
Whether the buffer should be mapped for reading or writing.
Optional
offset: numberOffset in bytes into the buffer to the start of the range to map.
Optional
size: numberSize in bytes of the range to map.
Returns Promise<undefined>
- mode: number
unmap
- unmap(): undefined
Unmaps the mapped range of the GPUBuffer and makes it's contents available for use by the GPU again.
Returns undefined
Nominal type branding. https://github.com/microsoft/TypeScript/pull/33038