Skip to main content

Abstract Class: CommandEncoder

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:160

Records commands onto a single backend command encoder and can finish them into one command buffer. DeviceResource helpers invoked through a CommandEncoder must record onto that encoder rather than allocating hidden encoders or submitting work eagerly.

Extends​

Constructors​

Constructor​

new CommandEncoder(device, props): CommandEncoder

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:169

Parameters​

device​

Device

props​

CommandEncoderProps

Returns​

CommandEncoder

Overrides​

DeviceResource.constructor

Properties​

_gpuTimeMs?​

optional _gpuTimeMs?: number

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:167


device​

abstract readonly device: Device

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:127

The device that this resource is associated with

Inherited from​

DeviceResource.device


handle​

abstract readonly handle: unknown

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:129

The handle for the underlying resource, e.g. WebGL object or WebGPU handle

Inherited from​

DeviceResource.handle


id​

id: string

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:121

props.id, for debugging.

Inherited from​

DeviceResource.id


props​

readonly props: Required<Props>

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:123

The props that this resource was created with

Inherited from​

DeviceResource.props


userData​

readonly userData: Record<string, unknown> = {}

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:125

User data object, reserved for the application

Inherited from​

DeviceResource.userData


defaultProps​

static defaultProps: Required<CommandEncoderProps>

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:307

Default properties for resource

Overrides​

DeviceResource.defaultProps

Accessors​

[toStringTag]​

Get Signature​

get [toStringTag](): string

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:161

Returns​

string

Overrides​

DeviceResource.[toStringTag]


destroyed​

Get Signature​

get destroyed(): boolean

Defined in: modules/core/src/api/adapter/resources/resource.ts:27

Whether destruction has completed, including when cleanup reported an error.

Returns​

boolean

Inherited from​

DeviceResource.destroyed


isHandleBorrowed​

Get Signature​

get isHandleBorrowed(): boolean

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:146

Whether luma.gl may only reference the opaque externally owned resource handle.

Returns​

boolean

Inherited from​

DeviceResource.isHandleBorrowed


ownedResources​

Get Signature​

get ownedResources(): readonly Resource[]

Defined in: modules/core/src/api/adapter/resources/resource.ts:22

A snapshot of this resource's children. Mutating the snapshot cannot change ownership.

Returns​

readonly Resource[]

Inherited from​

DeviceResource.ownedResources


owner​

Get Signature​

get owner(): Resource | null

Defined in: modules/core/src/api/adapter/resources/resource.ts:17

The resource responsible for destroying this resource, or null for caller-managed lifetime.

Returns​

Resource | null

Inherited from​

DeviceResource.owner


ownsHandle​

Get Signature​

get ownsHandle(): boolean

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:139

Whether luma.gl created and owns the underlying resource handle.

Returns​

boolean

Inherited from​

DeviceResource.ownsHandle

Methods​

[dispose]()​

[dispose](): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:50

Destroy the resource when leaving a using scope.

Returns​

void

Inherited from​

DeviceResource.[dispose]


attachResource()​

attachResource(resource): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:96

Parameters​

resource​

Resource

Returns​

void

Deprecated​

Use resource.transferOwnershipTo(this).

Inherited from​

DeviceResource.attachResource


beginComputePass()​

abstract beginComputePass(props?): ComputePass

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:186

Create a ComputePass using the default CommandEncoder

Parameters​

props?​

ComputePassProps

Returns​

ComputePass


beginRenderPass()​

abstract beginRenderPass(props?): RenderPass

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:183

Create a RenderPass using the default CommandEncoder

Parameters​

props?​

RenderPassProps

Returns​

RenderPass


captureTimestampQuerySet()?​

optional captureTimestampQuerySet(querySet): TimestampQuerySnapshot

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:250

WebGPU-only capture of this encoding's timestamp results, resolved before query reuse.

Parameters​

querySet​

QuerySet

Returns​

TimestampQuerySnapshot


copyBufferToBuffer()​

abstract copyBufferToBuffer(options): void

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:189

Add a command that that copies data from a sub-region of a Buffer to a sub-region of another Buffer.

Parameters​

options​

CopyBufferToBufferOptions

Returns​

void


copyBufferToTexture()​

abstract copyBufferToTexture(options): void

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:192

Add a command that copies data from a sub-region of a GPUBuffer to a sub-region of one or multiple continuous texture subresources.

Parameters​

options​

CopyBufferToTextureOptions

Returns​

void


copyTextureToBuffer()​

abstract copyTextureToBuffer(options): void

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:195

Add a command that copies data from a sub-region of one or multiple continuous texture subresources to a sub-region of a Buffer.

Parameters​

options​

CopyTextureToBufferOptions

Returns​

void


copyTextureToTexture()​

abstract copyTextureToTexture(options): void

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:198

Add a command that copies data from a sub-region of one or multiple contiguous texture subresources to another sub-region of one or multiple continuous texture subresources.

Parameters​

options​

CopyTextureToTextureOptions

Returns​

void


delete()​

delete(): this

Defined in: modules/core/src/api/adapter/resources/resource.ts:90

Returns​

this

Deprecated​

Use destroy().

Inherited from​

DeviceResource.delete


destroy()​

destroy(): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:55

Destroy children before this resource. Subclasses implement hooks instead of overriding.

Returns​

void

Inherited from​

DeviceResource.destroy


destroyAttachedResource()​

destroyAttachedResource(resource): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:108

Parameters​

resource​

Resource

Returns​

void

Deprecated​

Check resource.owner and call resource.destroy().

Inherited from​

DeviceResource.destroyAttachedResource


destroyAttachedResources()​

destroyAttachedResources(): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:115

Returns​

void

Deprecated​

Destroy individually owned resources, or destroy the owner.

Inherited from​

DeviceResource.destroyAttachedResources


detachResource()​

detachResource(resource): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:101

Parameters​

resource​

Resource

Returns​

void

Deprecated​

Use resource.transferOwnershipTo(null). Only detaches a child owned by this.

Inherited from​

DeviceResource.detachResource


finish()​

abstract finish(): CommandBuffer

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:180

Completes recording and invalidates this encoder.

Returns​

CommandBuffer

A single-use CommandBuffer that inherits this encoder's id and userData.


getProps()​

getProps(): object

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:174

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​

DeviceResource.getProps


getTimeProfilingQuerySet()​

getTimeProfilingQuerySet(): QuerySet | null

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:257

Returns​

QuerySet | null


getTimeProfilingSlotCount()​

getTimeProfilingSlotCount(): number

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:253

Returns the number of query slots consumed by automatic pass profiling on this encoder.

Returns​

number


insertDebugMarker()​

abstract insertDebugMarker(markerLabel): void

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:301

Marks a point in a stream of commands with a label

Parameters​

markerLabel​

string

Returns​

void


popDebugGroup()​

abstract popDebugGroup(): void

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:299

Ends the labeled debug group most recently started by pushDebugGroup()

Returns​

void


pushDebugGroup()​

abstract pushDebugGroup(groupLabel): void

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:297

Begins a labeled debug group containing subsequent commands

Parameters​

groupLabel​

string

Returns​

void


resolveQuerySet()​

abstract resolveQuerySet(querySet, destination, options?): void

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:206

Reads results from a query set into a GPU buffer. Values are 64 bits so byteLength must be querySet.props.count * 8

Parameters​

querySet​

QuerySet

destination​

Buffer

options?​
destinationOffset?​

number

firstQuery?​

number

queryCount?​

number

Returns​

void


resolveTimeProfilingQuerySet()​

resolveTimeProfilingQuerySet(): Promise<void>

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:223

Reads all resolved timestamp pairs on the current profiler query set and caches the sum as milliseconds on this encoder.

Returns​

Promise<void>


toJSON()​

toJSON(): string

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:116

Compact serialization for assertion diffs and structured debug logs.

Returns​

string

Inherited from​

DeviceResource.toJSON


toString()​

toString(): string

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:111

Returns a string representation of an object.

Returns​

string

Inherited from​

DeviceResource.toString


transferOwnershipTo()​

transferOwnershipTo(owner): this

Defined in: modules/core/src/api/adapter/resources/resource.ts:32

Transfer exclusive ownership, or return lifetime responsibility to the caller with null.

Parameters​

owner​

Resource | null

Returns​

this

Inherited from​

DeviceResource.transferOwnershipTo


withTimeProfilingQuerySet()?​

optional withTimeProfilingQuerySet<Result>(querySet, encode): Result

Defined in: modules/core/src/api/adapter/resources/command-encoder.ts:217

WebGPU-only scoped profiling. Use a fresh query set for each scope.

Type Parameters​

Result​

Result

Parameters​

querySet​

QuerySet

encode​

() => Result

Returns​

Result