Skip to main content

Abstract Class: Shader

Defined in: modules/core/src/api/adapter/resources/shader.ts:34

Immutable Shader object In WebGPU the handle can be copied between threads

Extends​

Constructors​

Constructor​

new Shader(device, props): Shader

Defined in: modules/core/src/api/adapter/resources/shader.ts:47

Create a new Shader instance

Parameters​

device​

Device

props​

ShaderProps

Returns​

Shader

Overrides​

DeviceResource.constructor

Properties​

compilationStatus​

compilationStatus: "error" | "pending" | "success" = 'pending'

Defined in: modules/core/src/api/adapter/resources/shader.ts:44

The compilation status of the shader. 'pending' if compilation is asynchronous, and on production


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


source​

readonly source: string

Defined in: modules/core/src/api/adapter/resources/shader.ts:42

The source code of this shader


stage​

readonly stage: "vertex" | "fragment" | "compute"

Defined in: modules/core/src/api/adapter/resources/shader.ts:40

The stage of this shader


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<ShaderProps>

Defined in: modules/core/src/api/adapter/resources/shader.ts:147

Default properties for resource

Overrides​

DeviceResource.defaultProps

Accessors​

[toStringTag]​

Get Signature​

get [toStringTag](): string

Defined in: modules/core/src/api/adapter/resources/shader.ts:35

Returns​

string

Overrides​

DeviceResource.[toStringTag]


asyncCompilationStatus​

Get Signature​

get abstract asyncCompilationStatus(): Promise<"error" | "pending" | "success">

Defined in: modules/core/src/api/adapter/resources/shader.ts:54

Returns​

Promise<"error" | "pending" | "success">


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


debugShader()​

debugShader(): Promise<void>

Defined in: modules/core/src/api/adapter/resources/shader.ts:72

In browser logging of errors

Returns​

Promise<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


getCompilationInfo()​

abstract getCompilationInfo(): Promise<readonly CompilerMessage[]>

Defined in: modules/core/src/api/adapter/resources/shader.ts:57

Get compiler log asynchronously

Returns​

Promise<readonly CompilerMessage[]>


getCompilationInfoSync()​

getCompilationInfoSync(): readonly CompilerMessage[] | null

Defined in: modules/core/src/api/adapter/resources/shader.ts:60

Get compiler log synchronously (WebGL only)

Returns​

readonly CompilerMessage[] | null


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


getTranslatedSource()​

getTranslatedSource(): string | null

Defined in: modules/core/src/api/adapter/resources/shader.ts:65

Get translated shader source in host platform's native language (HLSL, GLSL, and even GLSL ES), if available

Returns​

string | null


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