Skip to main content

ShaderPass

A single shader pass: draws a full-destination quad with a fragment shader, reading explicit sources and writing to an explicit destination.

const tint = new ex.ShaderPass({ graphicsContext, fragmentSource: myGlsl });
tint.draw(sourceFramebuffer, destinationFramebuffer);

// multiple named sources + per-draw uniforms
merge.draw({
  sources: { u_smaller: quarterRes, u_larger: halfRes },
  destination: halfResOut,
  uniforms: { u_strength: 2 }
});

There is no hidden bind state to sequence, each draw states its inputs and output.

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

publicreadonlyfiltering

filtering: ImageFiltering

Filtering used by ShaderPipeline for this pass's intermediate framebuffer

publicreadonlyname

name: string

publicreadonlyscale

scale: number

Relative resolution used by ShaderPipeline for this pass's intermediate framebuffer

Accessors

publicuniforms

  • Declarative uniforms for this pass, changes are uploaded on the next draw


    Returns UniformDictionary

Methods

publicdispose

  • dispose(): void
  • Deletes the compiled shader program, the pass cannot be used afterwards


    Returns void

publicdraw

publicgetShader

  • The compiled Shader backing this pass, compiling it if necessary


    Returns Shader