Explorar el Código

bugfix partial buffers

Nicolas Cannasse hace 1 año
padre
commit
0384ea1ff8
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      h3d/scene/MeshBatch.hx

+ 3 - 1
h3d/scene/MeshBatch.hx

@@ -181,6 +181,8 @@ class MeshBatch extends MultiMaterial {
 							curPos += fmt[i].getBytesSize() >> 2;
 					}
 					b.bufferFormat = hxd.BufferFormat.make(fmt);
+					if( b.bufferFormat.stride & 3 != 0 )
+						throw "assert";
 				}
 
 				b.next = dataPasses;
@@ -396,7 +398,7 @@ class MeshBatch extends MultiMaterial {
 					count = p.maxInstance;
 				if( buf == null || buf.isDisposed() ) {
 					var bufferFlags : hxd.impl.Allocator.BufferFlags = allowGpuUpdate ? UniformReadWrite : UniformDynamic;
-					buf = alloc.allocBuffer(MAX_BUFFER_ELEMENTS,p.bufferFormat,bufferFlags);
+					buf = alloc.allocBuffer(Std.int(MAX_BUFFER_ELEMENTS * (4 / p.bufferFormat.stride)),p.bufferFormat,bufferFlags);
 					p.buffers[index] = buf;
 					upload = true;
 				}