Skip to content

Commit 73c6685

Browse files
authored
Merge pull request #20442 from pplux/webgpuattributtes-improper-4byte-alignment
Fixes size alignment in webgpu buffer creation
2 parents 0b9c0f3 + 1913eab commit 73c6685

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/jsm/renderers/webgpu/WebGPUAttributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class WebGPUAttributes {
6464
_createBuffer( attribute, usage ) {
6565

6666
const array = attribute.array;
67-
const size = array.byteLength + ( array.byteLength % 4 ); // ensure 4 byte alignment
67+
const size = array.byteLength + ( ( 4 - ( array.byteLength % 4 ) ) % 4 ); // ensure 4 byte alignment
6868

6969
const buffer = this.device.createBuffer( {
7070
size: size,

0 commit comments

Comments
 (0)