Skip to content

RedGPU API v4.4.0-Alpha


RedGPU API / RedGPU / Resource / DirectTexture

Class: DirectTexture ​

Defined in: src/resources/texture/DirectTexture.ts:18

2D texture class that directly receives and manages an externally created GPUTexture.


Example ​

typescript
const directTexture = new RedGPU.Resource.DirectTexture(redGPUContext, 'myDirectTexture', gpuTexture);

Extends ​

  • ADirectTexture

Constructors ​


Constructor ​

new DirectTexture(redGPUContext, cacheKey, gpuTexture?): DirectTexture

Defined in: src/resources/texture/DirectTexture.ts:38

Creates a DirectTexture instance.

Example ​

typescript
const directTexture = new RedGPU.Resource.DirectTexture(redGPUContext, 'myDirectTexture', gpuTexture);

Parameters ​

ParameterTypeDescription
redGPUContextRedGPUContextRedGPUContext instance
cacheKeystringCache key (returns the existing instance if the same key exists)
gpuTexture?GPUTextureExternal GPUTexture instance (optional)

Returns ​

DirectTexture

Overrides ​

ADirectTexture.constructor

Accessors ​


viewDescriptor ​

Get Signature ​

readonly get viewDescriptor(): GPUTextureViewDescriptor

Defined in: src/resources/texture/DirectTexture.ts:64

Returns the GPUTextureViewDescriptor for creating a 2D texture view.

Returns ​

GPUTextureViewDescriptor

GPUTextureViewDescriptor object

Overrides ​

ADirectTexture.viewDescriptor

Methods ​


registerResource() ​

protected registerResource(): void

Defined in: src/resources/texture/DirectTexture.ts:80

Registers the texture with ResourceManager.

Returns ​

void

Overrides ​

ADirectTexture.registerResource



unregisterResource() ​

protected unregisterResource(): void

Defined in: src/resources/texture/DirectTexture.ts:88

Unregisters the texture from ResourceManager.

Returns ​

void

Overrides ​

ADirectTexture.unregisterResource


Inherited Properties ​

View inherited properties (Click to expand)

antialiasingManager ​

Get Signature ​

readonly get antialiasingManager(): AntialiasingManager

Defined in: src/base/RedGPUObject.ts:80

Returns the AntialiasingManager instance managing anti-aliasing settings.

Returns ​

AntialiasingManager

AntialiasingManager instance

Inherited from ​

ADirectTexture.antialiasingManager



cacheKey ​

Get Signature ​

get cacheKey(): string

Defined in: src/resources/core/ResourceBase.ts:61

Gets or sets the cache key.

Returns ​

string

Cache key string

Set Signature ​

set cacheKey(value): void

Defined in: src/resources/core/ResourceBase.ts:65

Parameters ​
ParameterType
valuestring
Returns ​

void

Inherited from ​

ADirectTexture.cacheKey



commandEncoderManager ​

Get Signature ​

readonly get commandEncoderManager(): CommandEncoderManager

Defined in: src/base/RedGPUObject.ts:92

Returns the CommandEncoderManager instance managing WebGPU command encoding.

Returns ​

CommandEncoderManager

CommandEncoderManager instance

Inherited from ​

ADirectTexture.commandEncoderManager



format ​

Get Signature ​

readonly get format(): GPUTextureFormat

Defined in: src/resources/texture/core/ADirectTexture.ts:80

Returns the GPU texture format.

Returns ​

GPUTextureFormat

Inherited from ​

ADirectTexture.format



gpuDevice ​

Get Signature ​

readonly get gpuDevice(): GPUDevice

Defined in: src/resources/core/ResourceBase.ts:89

Returns the associated GPUDevice.

Returns ​

GPUDevice

GPUDevice instance

Inherited from ​

ADirectTexture.gpuDevice



gpuTexture ​

Get Signature ​

get gpuTexture(): GPUTexture

Defined in: src/resources/texture/core/ADirectTexture.ts:52

Gets or sets the internal WebGPU texture instance.

Returns ​

GPUTexture

Set Signature ​

set gpuTexture(value): void

Defined in: src/resources/texture/core/ADirectTexture.ts:56

Parameters ​
ParameterType
valueGPUTexture
Returns ​

void

Inherited from ​

ADirectTexture.gpuTexture



gpuTextureView ​

Get Signature ​

readonly get gpuTextureView(): GPUTextureView

Defined in: src/resources/texture/core/ADirectTexture.ts:64

Returns the internal WebGPU texture view.

Returns ​

GPUTextureView

Inherited from ​

ADirectTexture.gpuTextureView



instanceId ​

Get Signature ​

readonly get instanceId(): number

Defined in: src/base/BaseObject.ts:36

Returns the unique sequential instance ID assigned per class.

Returns ​

number

Per-class unique instance ID

Inherited from ​

ADirectTexture.instanceId



mipLevelCount ​

Get Signature ​

readonly get mipLevelCount(): number

Defined in: src/resources/texture/core/ADirectTexture.ts:88

Returns the number of mip levels of the texture.

Returns ​

number

Inherited from ​

ADirectTexture.mipLevelCount



name ​

Get Signature ​

get name(): string

Defined in: src/base/BaseObject.ts:63

Gets or sets the object name. Returns a default name (ClassName Instance N) if not explicitly set.

Returns ​

string

Object name string

Set Signature ​

set name(value): void

Defined in: src/base/BaseObject.ts:70

Parameters ​
ParameterType
valuestring
Returns ​

void

Inherited from ​

ADirectTexture.name



redGPUContext ​

Get Signature ​

readonly get redGPUContext(): RedGPUContext

Defined in: src/base/RedGPUObject.ts:44

Returns the bound RedGPUContext instance.

Returns ​

RedGPUContext

RedGPUContext instance

Inherited from ​

ADirectTexture.redGPUContext



resourceManager ​

Get Signature ​

readonly get resourceManager(): ResourceManager

Defined in: src/base/RedGPUObject.ts:68

Returns the ResourceManager instance managing global GPU resources.

Returns ​

ResourceManager

ResourceManager instance

Inherited from ​

ADirectTexture.resourceManager



resourceManagerKey ​

Get Signature ​

readonly get resourceManagerKey(): string

Defined in: src/resources/core/ResourceBase.ts:77

Returns the resource manager key.

Returns ​

string

Resource manager key string

Inherited from ​

ADirectTexture.resourceManagerKey



revision ​

Get Signature ​

readonly get revision(): number

Defined in: src/resources/core/ResourceBase.ts:49

Returns the revision (update count) of the resource.

Returns ​

number

Resource revision number

Inherited from ​

ADirectTexture.revision



targetResourceManagedState ​

Get Signature ​

readonly get targetResourceManagedState(): ResourceStatusInfo

Defined in: src/resources/core/ManagementResourceBase.ts:50

Returns the managed state information of the resource.

Returns ​

ResourceStatusInfo

Resource managed status info object

Inherited from ​

ADirectTexture.targetResourceManagedState



uuid ​

Get Signature ​

readonly get uuid(): string

Defined in: src/base/BaseObject.ts:48

Returns the universally unique identifier (UUID) of the object.

Returns ​

string

UUID string of the object

Inherited from ​

ADirectTexture.uuid



videoMemorySize ​

Get Signature ​

readonly get videoMemorySize(): number

Defined in: src/resources/texture/core/ADirectTexture.ts:72

Returns the video memory size of the texture in bytes.

Returns ​

number

Inherited from ​

ADirectTexture.videoMemorySize



Inherited Methods ​

View inherited methods (Click to expand)

__addDirtyPipelineListener() ​

__addDirtyPipelineListener(listener): void

Defined in: src/resources/core/ResourceBase.ts:102

Adds a pipeline dirty listener to be called when the resource changes.

Parameters ​

ParameterTypeDescription
listener() => voidListener function to register

Returns ​

void

Inherited from ​

ADirectTexture.__addDirtyPipelineListener



__removeDirtyPipelineListener() ​

__removeDirtyPipelineListener(listener): void

Defined in: src/resources/core/ResourceBase.ts:115

Removes a registered pipeline dirty listener.

Parameters ​

ParameterTypeDescription
listener() => voidListener function to remove

Returns ​

void

Inherited from ​

ADirectTexture.__removeDirtyPipelineListener



destroy() ​

destroy(): void

Defined in: src/resources/texture/core/ADirectTexture.ts:96

Destroys the texture resource and releases video memory.

Returns ​

void

Inherited from ​

ADirectTexture.destroy



notifyUpdate() ​

notifyUpdate(resetList?): void

Defined in: src/resources/core/ResourceBase.ts:131

Notifies registered listeners that the resource has been updated.

Parameters ​

ParameterTypeDefault valueDescription
resetList?booleanfalseWhether to reset the listener list after notification (default: false)

Returns ​

void

Inherited from ​

ADirectTexture.notifyUpdate



setGpuTexture() ​

protected setGpuTexture(value): void

Defined in: src/resources/texture/core/ADirectTexture.ts:115

Sets the GPUTexture object and synchronizes internal state and video memory.

Parameters ​

ParameterTypeDescription
valueGPUTextureGPUTexture object to set

Returns ​

void

Inherited from ​

ADirectTexture.setGpuTexture