Skip to main content

Abstract Class: CommandEncoder

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

Records commands onto a single backend command encoder and can finish them into one command buffer. Resource 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/adapter/resources/command-encoder.ts:154

Parameters​

device​

Device

props​

CommandEncoderProps

Returns​

CommandEncoder

Overrides​

Resource.constructor

Properties​

_gpuTimeMs?​

optional _gpuTimeMs?: number

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


destroyed​

destroyed: boolean = false

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

Whether this resource has been destroyed

Inherited from​

Resource.destroyed


device​

abstract readonly device: Device

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

The device that this resource is associated with

Inherited from​

Resource.device


handle​

abstract readonly handle: 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​

Resource.handle


id​

id: string

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

props.id, for debugging.

Inherited from​

Resource.id


props​

readonly props: Required<Props>

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

The props that this resource was created with

Inherited from​

Resource.props


userData​

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

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

User data object, reserved for the application

Inherited from​

Resource.userData


defaultProps​

static defaultProps: Required<CommandEncoderProps>

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

Default properties for resource

Overrides​

Resource.defaultProps

Accessors​

[toStringTag]​

Get Signature​

get [toStringTag](): string

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

Returns​

string

Overrides​

Resource.[toStringTag]


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​

Resource.isHandleBorrowed


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​

Resource.ownsHandle

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​

Resource<ResourceProps>

Returns​

void

Inherited from​

Resource.attachResource


beginComputePass()​

abstract beginComputePass(props?): ComputePass

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

Create a ComputePass using the default CommandEncoder

Parameters​

props?​

ComputePassProps

Returns​

ComputePass


beginRenderPass()​

abstract beginRenderPass(props?): RenderPass

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

Create a RenderPass using the default CommandEncoder

Parameters​

props?​

RenderPassProps

Returns​

RenderPass


copyBufferToBuffer()​

abstract copyBufferToBuffer(options): void

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

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/adapter/resources/command-encoder.ts:177

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/adapter/resources/command-encoder.ts:180

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/adapter/resources/command-encoder.ts:183

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/adapter/resources/resource.ts:181

Returns​

this

Deprecated​

Use destroy()

Inherited from​

Resource.delete


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​

Resource.destroy


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​

Resource<ResourceProps>

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​

Resource<ResourceProps>

Returns​

void

Inherited from​

Resource.detachResource


finish()​

abstract finish(): CommandBuffer

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

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/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​

Resource.getProps


getTimeProfilingQuerySet()​

getTimeProfilingQuerySet(): QuerySet | null

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

Returns​

QuerySet | null


getTimeProfilingSlotCount()​

getTimeProfilingSlotCount(): number

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

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/adapter/resources/command-encoder.ts:280

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/adapter/resources/command-encoder.ts:278

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

Returns​

void


pushDebugGroup()​

abstract pushDebugGroup(groupLabel): void

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

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/adapter/resources/command-encoder.ts:191

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/adapter/resources/command-encoder.ts:205

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/adapter/resources/resource.ts:113

Compact serialization for assertion diffs and structured debug logs.

Returns​

string

Inherited from​

Resource.toJSON


toString()​

toString(): string

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

Returns​

string

Inherited from​

Resource.toString