Documentation is work in progress and not completeEditor
GPU Constraints and 3D

WebGL Architecture in FlashFX

Render Pipeline Overview

FlashFX's rendering pipeline operates in the following stages:

Scene Graph (JavaScript)

Compositing Plan (determine draw order, blend modes, effects)

GPU Batching (group elements that share shader programs)

WebGL Draw Calls (submit geometry and textures to GPU)

Framebuffer Compositing (blend layers together)

Canvas Output (display or capture for export)

Draw Calls

Each operation that submits geometry to the GPU is a draw call. Fewer draw calls means less CPU-GPU communication overhead and faster rendering.

FlashFX batches elements that share:

  • -The same blend mode
  • -No intervening alpha compositing requirements
  • -Compatible shader programs

Elements that break batching:

  • -Any element with a non-Normal blend mode (requires isolation)
  • -Groups set to Isolated compositing mode
  • -Elements with certain filter types (require intermediate offscreen render passes)
  • -Transparent elements composited over other transparent elements (order-dependent)

Texture Upload

When an image is imported or a rasterized text/shape is generated, it is uploaded to GPU memory as a texture. This upload happens:

  • -Once per unique image asset
  • -When an asset's content changes (e.g., after a filter parameter changes)
  • -On session start when loading a project with embedded assets

Texture upload is expensive. Avoid situations where the GPU texture must be invalidated and re-uploaded on every frame (e.g., animating a filter that requires a full re-rasterize of vector content).

Offscreen Buffers

Certain operations require rendering to an intermediate offscreen framebuffer before compositing into the final output. Each offscreen buffer consumes GPU memory equal to its dimensions x 4 bytes per pixel.

Operations requiring offscreen buffers:

  • -Non-Normal blend modes (the layer must be isolated before blending)
  • -Blur effects (blur requires a copy of the pre-blur pixels)
  • -Some distortion effects (displacement needs both the target and the map simultaneously)
  • -Groups with isolated compositing
  • -Alpha masks

A complex composition with many elements using non-Normal blend modes or blur effects may require many simultaneous offscreen buffers. On devices with limited VRAM, this can cause rendering slowdowns, quality reduction, or in extreme cases, a tab crash.