Skip to main content

Abstract Class: DeviceResource<Props>

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

Base class for GPU (WebGPU/WebGL) Resources

Extends​

Extended by​

Type Parameters​

Props​

Props extends DeviceResourceProps = DeviceResourceProps

Constructors​

Constructor​

new DeviceResource<Props>(device, props, defaultProps): DeviceResource<Props>

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

Create a new DeviceResource. Called from Subclass

Parameters​

device​

Device

props​

Props

defaultProps​

Required<Props>

Returns​

DeviceResource<Props>

Overrides​

Resource.constructor

Properties​

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


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


id​

id: string

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

props.id, for debugging.


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


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


defaultProps​

static defaultProps: Required<DeviceResourceProps>

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

Default properties for resource

Accessors​

[toStringTag]​

Get Signature​

get abstract [toStringTag](): string

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

Returns​

string


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​

Resource.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


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​

Resource.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​

Resource.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

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​

Resource.[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​

Resource.attachResource


delete()​

delete(): this

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

Returns​

this

Deprecated​

Use destroy().

Inherited from​

Resource.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​

Resource.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​

Resource.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​

Resource.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​

Resource.detachResource


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


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


toString()​

toString(): string

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

Returns a string representation of an object.

Returns​

string


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​

Resource.transferOwnershipTo