Browse Source

Remove assert on large buffer allocation if ReadWrite

clementlandrin 1 year ago
parent
commit
64780657b6
2 changed files with 12 additions and 2 deletions
  1. 6 1
      hxd/impl/CacheAllocator.hx
  2. 6 1
      hxd/impl/FIFOBufferAllocator.hx

+ 6 - 1
hxd/impl/CacheAllocator.hx

@@ -51,7 +51,12 @@ class CacheAllocator extends Allocator {
 	public var maxKeepTime = 60.;
 
 	override function allocBuffer(vertices:Int, format:hxd.BufferFormat, flags:BufferFlags=Dynamic):h3d.Buffer {
-		if( vertices >= 65536 ) throw "assert";
+		if( vertices >= 65536 ) {
+			switch ( flags ) {
+			case UniformReadWrite:
+			default: throw "assert";
+			}
+		}
 		checkFrame();
 		var id = flags.toInt() | (format.uid << 3) | (vertices << 16);
 		var c = buffers.get(id);

+ 6 - 1
hxd/impl/FIFOBufferAllocator.hx

@@ -77,7 +77,12 @@ class FIFOBufferAllocator extends Allocator {
 	public var maxMemSize : Int = 512 * 1024 * 1024;
 
 	override function allocBuffer(vertices:Int, format:hxd.BufferFormat, flags:BufferFlags=Dynamic):h3d.Buffer {
-		if( vertices >= 65536 ) throw "assert";
+		if( vertices >= 65536 ) {
+			switch ( flags ) {
+			case UniformReadWrite:
+			default: throw "assert";
+			}
+		}
 		checkFrame();
 		var id = flags.toInt() | (format.uid << 3) | (vertices << 16);
 		var c = buffers.get(id);