Sfoglia il codice sorgente

try/catch allocIndexes

Nicolas Cannasse 10 anni fa
parent
commit
8ebadc8ab3
1 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  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 ) {