Platform/GFX/WebGL/Compositing

< Platform‎ | GFX‎ | WebGL

The overall diagram around compositing WebGL frames looks like this:

WebGLContext
   |
   | owns a
   V
GLContext
   |
   | owns a
   V
ScreenBuffer ----------------------------------------------+
   |                                                       |
   | owns a                                                | owns a
   V              Creates/recycles surfs as needed         V
SurfaceStream  <------------------------------------ SurfaceFactory
   |
   |  Swaps buffers.
   |  In OMTC case, the inter-thread communication/syncing happens here.
   |
   |                  (Content)
---+---------------------------------------------------------------------
   |                 (Compositor)
   V
SurfaceStream
   |
   | obtains a
   V
SharedSurface
   |
   | is composited by
   V
CanvasLayer

SharedSurfaces are owned by SurfaceStream when they are active. When SurfaceStream is done with a SharedSurface, it returns control of it to the GLScreenBuffer's SurfaceFactory, which will either delete it immediately, or cache it to possibly be reused later.