gpu-buffer now eliminates whitespace from types before identifying them

This commit is contained in:
Rezmason
2022-09-11 20:09:59 -07:00
parent ec831ce6f1
commit 0a5daa696a

View File

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