Explorar o código

ensure 8 bytes alignment on streaming data (fix for some low end android devices)

Nicolas Cannasse %!s(int64=7) %!d(string=hai) anos
pai
achega
59eccd6eeb
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      h3d/impl/GlDriver.hx

+ 3 - 2
h3d/impl/GlDriver.hx

@@ -881,10 +881,11 @@ class GlDriver extends Driver {
 	inline function streamData(data, pos:Int, length:Int) {
 		#if hl
 		var needed = streamPos + length;
-		if( needed > streamLen ) expandStream(needed);
+		var total = (needed + 7) & ~7; // align on 8 bytes
+		if( total > streamLen ) expandStream(total);
 		streamBytes.blit(streamPos, data, pos, length);
 		data = streamBytes.offset(streamPos);
-		streamPos += length;
+		streamPos = total;
 		#end
 		return data;
 	}