PIXI.BufferSystem

class BufferSystem implements PIXI.ISystem

System plugin to the renderer to manage buffers.

WebGL uses Buffers as a way to store objects to the GPU. This system makes working with them a lot easier.

Buffers are used in three main places in WebGL

  • geometry information
  • Uniform information (via uniform buffer objects - a WebGL 2 only feature)
  • Transform feedback information. (WebGL 2 only feature)

This system will handle the binding of buffers to the GPU as well as uploading them. With this system, you never need to work directly with GPU buffers, but instead work with the PIXI.Buffer class.

Constructor


new PIXI.BufferSystem(renderer: PIXI.Renderer) → {}
Parameters:
Name Type Description
renderer PIXI.Renderer

The renderer this System works for.

Summary


Properties from BufferSystem

{ [key: number]: PIXI.Buffer }
boundBufferBases

Cache keeping track of the base bound buffer bases

{ [key: number]: PIXI.Buffer }
managedBuffers

Cache for all buffers by id, used in case renderer gets destroyed or for profiling

Methods from BufferSystem

void
bind(buffer: PIXI.Buffer)
void
bindBufferBase(buffer: PIXI.Buffer, index: number)

Binds an uniform buffer to at the given index.

void
bindBufferRange(buffer: PIXI.Buffer, index: number, offset: number)
void
dispose(buffer: PIXI.Buffer, contextLost: boolean)
void
disposeAll(contextLost: boolean)
void
update(buffer: PIXI.Buffer)
void
protected contextChange()

Sets up the renderer context and necessary buffers.

GLBuffer
protected createGLBuffer(buffer: PIXI.Buffer)

Public Properties


boundBufferBases BufferSystem.ts:33
boundBufferBases: { [key: number]: PIXI.Buffer }

Cache keeping track of the base bound buffer bases

managedBuffers BufferSystem.ts:30
managedBuffers: { [key: number]: PIXI.Buffer }

Cache for all buffers by id, used in case renderer gets destroyed or for profiling

Public Methods


bind BufferSystem.ts:67
bind(buffer: PIXI.Buffer) → {void}

This binds specified buffer. On first run, it will create the webGL buffers for the context too

Parameters:
Name Type Description
buffer PIXI.Buffer

the buffer to bind to the renderer

Returns:
Type Description
void
bindBufferBase BufferSystem.ts:80
bindBufferBase(buffer: PIXI.Buffer, index: number) → {void}

Binds an uniform buffer to at the given index.

A cache is used so a buffer will not be bound again if already bound.

Parameters:
Name Type Description
buffer PIXI.Buffer

the buffer to bind

index number

the base index to bind it to.

Returns:
Type Description
void
bindBufferRange BufferSystem.ts:101
bindBufferRange(buffer: PIXI.Buffer, index: number, offset: number) → {void}

Binds a buffer whilst also binding its range. This will make the buffer start from the offset supplied rather than 0 when it is read.

Parameters:
Name Type Attributes Description
buffer PIXI.Buffer

the buffer to bind

index number

<optional>

the base index to bind at, defaults to 0

offset number

<optional>

the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc

Returns:
Type Description
void
dispose BufferSystem.ts:152
dispose(buffer: PIXI.Buffer, contextLost: boolean) → {void}

Disposes buffer

Parameters:
Name Type Attributes Default Description
buffer PIXI.Buffer

buffer with data

contextLost boolean

<optional>

false

If context was lost, we suppress deleteVertexArray

Returns:
Type Description
void
disposeAll BufferSystem.ts:184
disposeAll(contextLost: boolean) → {void}

dispose all WebGL resources of all managed buffers

Parameters:
Name Type Attributes Default Description
contextLost boolean

<optional>

false

If context was lost, we suppress gl.delete calls

Returns:
Type Description
void
update BufferSystem.ts:119
update(buffer: PIXI.Buffer) → {void}

Will ensure the data in the buffer is uploaded to the GPU.

Parameters:
Name Type Description
buffer PIXI.Buffer

the buffer to update

Returns:
Type Description
void

Protected Methods


contextChange BufferSystem.ts:56
protected contextChange() → {void}

Sets up the renderer context and necessary buffers.

Returns:
Type Description
void
createGLBuffer BufferSystem.ts:198
protected createGLBuffer(buffer: PIXI.Buffer) → {GLBuffer}

creates and attaches a GLBuffer object tied to the current context.

Parameters:
Name Type Description
buffer PIXI.Buffer
Returns:
Type Description
GLBuffer

Powered by webdoc!