Skip to main content

Class: SwapBuffers

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

Helper for managing double-buffered GPU buffers

Extends​

Constructors​

Constructor​

new SwapBuffers(device, props): SwapBuffers

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

Parameters​

device​

Device

props​

BufferProps

Returns​

SwapBuffers

Overrides​

Swap.constructor

Properties​

current​

current: Buffer

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

The current resource - usually the source for renders or computations

Inherited from​

Swap.current


id​

id: string

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

Inherited from​

Swap.id


next​

next: Buffer

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

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

Inherited from​

Swap.next

Methods​

destroy()​

destroy(): void

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

Destroys the two managed resources

Returns​

void

Inherited from​

Swap.destroy


resize()​

resize(props): boolean

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

Resizes the Buffers.

Parameters​

props​
byteLength​

number

Returns​

boolean

true if the size changed, otherwise exiting buffers were preserved.

Note​

any contents are not preserved!


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

Inherited from​

Swap.swap