From 0a5daa696aec7de4c8c08f3f1adb5f9a1f6d8b43 Mon Sep 17 00:00:00 2001 From: Rezmason Date: Sun, 11 Sep 2022 20:09:59 -0700 Subject: [PATCH] gpu-buffer now eliminates whitespace from types before identifying them --- lib/gpu-buffer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; }