Class ContextResourceAbstract

This is a resources organized in the context.

Other than most normal objects in JavaScript it means once created it won't die when it is not referenced anymore. Instead it lives until:

  1. context lost: - canvas resize - canvas removed - some OS event
  2. program actively frees it

Context resources live in GPU until either (1) or (2) happened.

This means that if we fail to identify when we can free memory we'll fill up out GPU memory.

To organize this we fall back to reference counting:

Every time we like this kind of resource to outlive a certain context we need to call retain. When we are done with it we use release. If more than one owner exists release won't harm the resource.

Classes that create a resource will internally call releaseLater() to let them fail if retain isn't used explicitly.




ref: number = 1
released: boolean = false


Generated using TypeDoc