ソースを参照

try/catch allocIndexes

Nicolas Cannasse 10 年 前
コミット
8ebadc8ab3
1 ファイル変更8 行追加1 行削除
  1. 8 1
      h3d/impl/Stage3dDriver.hx

+ 8 - 1
h3d/impl/Stage3dDriver.hx

@@ -218,7 +218,14 @@ class Stage3dDriver extends Driver {
 	}
 
 	override function allocIndexes( count : Int ) : IndexBuffer {
-		return ctx.createIndexBuffer(count);
+		try {
+			return ctx.createIndexBuffer(count);
+		} catch( e : flash.errors.Error ) {
+			// too many resources / out of memory
+			if( e.errorID == 3691 )
+				return null;
+			throw e;
+		}
 	}
 
 	function getMipLevels( t : h3d.mat.Texture ) {