Skip to main content

Class: Swap<T>

Defined in: modules/engine/src/compute/swap.ts:14

Helper class for working with repeated transformations / computations Primarily intended for GPU buffers Swap<Buffer> or textures Swap<Texture>)

Note​

the two resources are expected to be structurally identical (same size, length, format, etc)

Note​

the two resources can be destroyed by calling destroy()

Extended by​

Type Parameters​

T​

T extends Resource<any>

Constructors​

Constructor​

new Swap<T>(props): Swap<T>

Defined in: modules/engine/src/compute/swap.ts:22

Parameters​

props​
current​

T

id?​

string

next​

T

Returns​

Swap<T>

Properties​

current​

current: T

Defined in: modules/engine/src/compute/swap.ts:18

The current resource - usually the source for renders or computations


id​

id: string

Defined in: modules/engine/src/compute/swap.ts:15


next​

next: T

Defined in: modules/engine/src/compute/swap.ts:20

The next resource - usually the target/destination for transforms / computations

Methods​

destroy()​

destroy(): void

Defined in: modules/engine/src/compute/swap.ts:29

Destroys the two managed resources

Returns​

void


swap()​

swap(): void

Defined in: modules/engine/src/compute/swap.ts:35

Make the next resource into the current resource, and reuse the current resource as the next resource

Returns​

void