소스 검색

Fixes size alignment in webgpu buffer creation

Fixes #20441
Jose L. Hidalgo (PpluX) 5 년 전
부모
커밋
1913eab71e
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      examples/jsm/renderers/webgpu/WebGPUAttributes.js

+ 1 - 1
examples/jsm/renderers/webgpu/WebGPUAttributes.js

@@ -64,7 +64,7 @@ class WebGPUAttributes {
 	_createBuffer( attribute, usage ) {
 
 		const array = attribute.array;
-		const size = array.byteLength + ( array.byteLength % 4 ); // ensure 4 byte alignment
+		const size = array.byteLength + ( ( 4 - ( array.byteLength % 4 ) ) % 4 ); // ensure 4 byte alignment
 
 		const buffer = this.device.createBuffer( {
 			size: size,