diff --git a/lib/gpu-buffer.js b/lib/gpu-buffer.js index a064862..33264e5 100644 --- a/lib/gpu-buffer.js +++ b/lib/gpu-buffer.js @@ -48,6 +48,7 @@ const simpleTypes = { }; const getTypeData = (type, attributes, otherStructLayouts) => { + type = type.replaceAll(/\s/g, ""); if (simpleTypes[type] != null) { let [align, size, baseType, defaultValue] = simpleTypes[type]; if (attributes.align != null) { @@ -79,8 +80,8 @@ const getTypeData = (type, attributes, otherStructLayouts) => { defaultValue: () => makeDataForLayout(otherStructLayouts, innerLayout), }; } else if (type.startsWith("array<")) { - const arrayMatch = type.match(/array<(.*?)(, )?(\d+)?>$/); - const [_, innerType, __, fixedSize] = arrayMatch; + const arrayMatch = type.match(/array<(.*?),?(\d+)?>$/); + const [_, innerType, fixedSize] = arrayMatch; if (innerType == null) { return null; }