brianchirls / Seriously.js

A real-time, node-based video effects compositor for the web built with HTML5, Javascript and WebGL
MIT License
3.87k stars 354 forks source link

Need a way to temporarily release unused GPU memory without destroying nodes #81

Open brianchirls opened 9 years ago

brianchirls commented 9 years ago

Sometimes large compositions with multiple scenes can cause problems running on devices without great GPU resources, like a mobile phone/tablet. For example, when running this piece on a MacBook Air, WebGL crashes (lost context) when switching between scenes.

I propose to add .purge() and .restore() methods to all node types and to the Seriously composition object for releasing all GPU resources (shaders, textures, frame buffers, etc.). All the resources will be rebuilt when .restore() is called or automatically when any purged nodes need to be rendered.

darkyen commented 9 years ago

I am worried about the performance implecation of purge and restore methods, are they supposed to be called in realtime ?

brianchirls commented 9 years ago

No, they're supposed to be called outside of "hot" render cycles, when you're shutting down or spinning up sections of a composition. On Feb 10, 2015 3:57 PM, "Abhishek Hingnikar" notifications@github.com wrote:

I am worried about the performance implecation of purge and restore methods, are they supposed to be called in realtime ?

— Reply to this email directly or view it on GitHub https://github.com/brianchirls/Seriously.js/issues/81#issuecomment-73781963 .

darkyen commented 9 years ago

Ah then they definitely make sense. :D