Abstract Class: Buffer
Defined in: modules/core/src/adapter/resources/buffer.ts:29
Abstract GPU buffer
Extends
Constructors
Constructor
new Buffer(
device,props):Buffer
Defined in: modules/core/src/adapter/resources/buffer.ts:60
Parameters
device
props
Returns
Buffer
Overrides
Properties
byteLength
abstractbyteLength:number
Defined in: modules/core/src/adapter/resources/buffer.ts:56
Length of buffer in bytes
debugData
debugData:
ArrayBuffer
Defined in: modules/core/src/adapter/resources/buffer.ts:125
A partial CPU-side copy of the data in this buffer, for debugging purposes
destroyed
destroyed:
boolean=false
Defined in: modules/core/src/adapter/resources/resource.ts:131
Whether this resource has been destroyed
Inherited from
device
abstractreadonlydevice:Device
Defined in: modules/core/src/adapter/resources/resource.ts:124
The device that this resource is associated with
Inherited from
handle
abstractreadonlyhandle:unknown
Defined in: modules/core/src/adapter/resources/resource.ts:126
The handle for the underlying resource, e.g. WebGL object or WebGPU handle
Inherited from
id
id:
string
Defined in: modules/core/src/adapter/resources/resource.ts:118
props.id, for debugging.
Inherited from
indexType?
readonlyoptionalindexType?:"uint8"|"uint16"|"uint32"
Defined in: modules/core/src/adapter/resources/buffer.ts:54
For index buffers, whether indices are 8, 16 or 32 bit. Note: uint8 indices are automatically converted to uint16 for WebGPU compatibility
props
readonlyprops:Required<Props>
Defined in: modules/core/src/adapter/resources/resource.ts:120
The props that this resource was created with
Inherited from
updateTimestamp
updateTimestamp:
number
Defined in: modules/core/src/adapter/resources/buffer.ts:58
"Time" of last update, can be used to check if redraw is needed
usage
readonlyusage:number
Defined in: modules/core/src/adapter/resources/buffer.ts:52
The usage with which this buffer was created
userData
readonlyuserData:Record<string,unknown> ={}
Defined in: modules/core/src/adapter/resources/resource.ts:122
User data object, reserved for the application
Inherited from
COPY_DST
staticCOPY_DST:number=0x0008
Defined in: modules/core/src/adapter/resources/buffer.ts:45
COPY_SRC
staticCOPY_SRC:number=0x0004
Defined in: modules/core/src/adapter/resources/buffer.ts:44
DEBUG_DATA_MAX_LENGTH
staticDEBUG_DATA_MAX_LENGTH:number=32
Defined in: modules/core/src/adapter/resources/buffer.ts:122
Max amount of debug data saved. Two vec4's
defaultProps
staticdefaultProps:Required<BufferProps>
Defined in: modules/core/src/adapter/resources/buffer.ts:159
Default properties for resource
Overrides
INDEX
staticINDEX:number=0x0010
Defined in: modules/core/src/adapter/resources/buffer.ts:31
Index buffer
INDIRECT
staticINDIRECT:number=0x0100
Defined in: modules/core/src/adapter/resources/buffer.ts:38
MAP_READ
staticMAP_READ:number=0x01
Defined in: modules/core/src/adapter/resources/buffer.ts:42
MAP_WRITE
staticMAP_WRITE:number=0x02
Defined in: modules/core/src/adapter/resources/buffer.ts:43
QUERY_RESOLVE
staticQUERY_RESOLVE:number=0x0200
Defined in: modules/core/src/adapter/resources/buffer.ts:39
STORAGE
staticSTORAGE:number=0x0080
Defined in: modules/core/src/adapter/resources/buffer.ts:37
Storage buffer
UNIFORM
staticUNIFORM:number=0x0040
Defined in: modules/core/src/adapter/resources/buffer.ts:35
Uniform buffer
VERTEX
staticVERTEX:number=0x0020
Defined in: modules/core/src/adapter/resources/buffer.ts:33
Vertex buffer
Accessors
[toStringTag]
Get Signature
get [toStringTag]():
string
Defined in: modules/core/src/adapter/resources/buffer.ts:47
Returns
string
Overrides
isHandleBorrowed
Get Signature
get isHandleBorrowed():
boolean
Defined in: modules/core/src/adapter/resources/resource.ts:147
Whether luma.gl may only reference the opaque externally owned resource handle.
Returns
boolean
Inherited from
ownsHandle
Get Signature
get ownsHandle():
boolean
Defined in: modules/core/src/adapter/resources/resource.ts:140
Whether luma.gl created and owns the underlying resource handle.
Returns
boolean
Inherited from
Methods
attachResource()
attachResource(
resource):void
Defined in: modules/core/src/adapter/resources/resource.ts:200
Attaches a resource. Attached resources are auto destroyed when this resource is destroyed Called automatically when sub resources are auto created but can be called by application
Parameters
resource
Returns
void
Inherited from
clone()
clone(
props):Buffer
Defined in: modules/core/src/adapter/resources/buffer.ts:90
Create a copy of this Buffer with new byteLength, with same props but of the specified size.
Parameters
props
byteLength
number
Returns
Buffer
Note
Does not copy contents of the cloned Buffer.
delete()
delete():
this
Defined in: modules/core/src/adapter/resources/resource.ts:181
Returns
this
Deprecated
Use destroy()
Inherited from
destroy()
destroy():
void
Defined in: modules/core/src/adapter/resources/resource.ts:173
destroy can be called on any resource to release it before it is garbage collected.
Returns
void
Inherited from
destroyAttachedResource()
destroyAttachedResource(
resource):void
Defined in: modules/core/src/adapter/resources/resource.ts:214
Destroys a resource (only if owned), and removes from the owned (auto-destroy) list for this resource.
Parameters
resource
Returns
void
Inherited from
Resource.destroyAttachedResource
destroyAttachedResources()
destroyAttachedResources():
void
Defined in: modules/core/src/adapter/resources/resource.ts:221
Destroy all owned resources. Make sure the resources are no longer needed before calling.
Returns
void
Inherited from
Resource.destroyAttachedResources
detachResource()
detachResource(
resource):void
Defined in: modules/core/src/adapter/resources/resource.ts:207
Detach an attached resource. The resource will no longer be auto-destroyed when this resource is destroyed.
Parameters
resource
Returns
void
Inherited from
getProps()
getProps():
object
Defined in: modules/core/src/adapter/resources/resource.ts:190
Combines a map of user props and default props, only including props from defaultProps
Returns
object
returns a map of overridden default props
Inherited from
mapAndReadAsync()
abstractmapAndReadAsync<T>(onMapped,byteOffset?,byteLength?):Promise<T>
Defined in: modules/core/src/adapter/resources/buffer.ts:110
Maps buffer data to CPU memory. Mapped memory is only accessible in the callback
Type Parameters
T
T
Parameters
onMapped
byteOffset?
number
byteLength?
number
Returns
Promise<T>
mapAndWriteAsync()
abstractmapAndWriteAsync(onMapped,byteOffset?,byteLength?):Promise<void>
Defined in: modules/core/src/adapter/resources/buffer.ts:100
Parameters
onMapped
BufferMapCallback<void | Promise<void>>
byteOffset?
number
byteLength?
number
Returns
Promise<void>
readAsync()
abstractreadAsync(byteOffset?,byteLength?):Promise<Uint8Array<ArrayBufferLike>>
Defined in: modules/core/src/adapter/resources/buffer.ts:107
Reads data asynchronously, returns a copy of the buffer data
Parameters
byteOffset?
number
byteLength?
number
Returns
Promise<Uint8Array<ArrayBufferLike>>
readSyncWebGL()
abstractreadSyncWebGL(byteOffset?,byteLength?):Uint8Array
Defined in: modules/core/src/adapter/resources/buffer.ts:117
Read data synchronously.
Parameters
byteOffset?
number
byteLength?
number
Returns
Uint8Array
Note
WebGL2 only
toJSON()
toJSON():
string
Defined in: modules/core/src/adapter/resources/resource.ts:113
Compact serialization for assertion diffs and structured debug logs.
Returns
string
Inherited from
toString()
toString():
string
Defined in: modules/core/src/adapter/resources/resource.ts:108
Returns
string
Inherited from
write()
abstractwrite(data,byteOffset?):void
Defined in: modules/core/src/adapter/resources/buffer.ts:95
Write data to buffer
Parameters
data
ArrayBufferLike | ArrayBufferView<ArrayBufferLike>
byteOffset?
number
Returns
void