@@ -227,9 +227,10 @@ class Engine {
width = window.width;
height = window.height;
}
- if( disposed )
+ if( disposed ) {
+ hxd.impl.Allocator.get().onContextLost();
mem.onContextLost();
- else {
+ } else {
mem = new h3d.impl.MemoryManager(driver);
mem.init();
@@ -32,6 +32,9 @@ class Allocator {
i.dispose();
+ public function onContextLost() {
+ }
+
// CPU
public function allocFloats( count : Int, ?pos : AllocPos ) : hxd.FloatBuffer {
@@ -59,6 +59,10 @@ class CacheAllocator extends Allocator {
checkGC();
+ override function onContextLost() {
+ buffers = new Map();
public function checkGC() {
var t = haxe.Timer.stamp();
if( t - lastGC > maxKeepTime * 0.1 ) gc();