From d2718b55de815713c71e5d3e1eea38b7c89ebdbe Mon Sep 17 00:00:00 2001 From: Karim Naaji Date: Tue, 12 May 2020 12:58:24 -0700 Subject: [PATCH] Warn on 4-bytes misalignment $ yarn run codegen Warning: The layout StructArrayLayout3ui6 is not aligned to 4-bytes boundaries. Warning: The layout StructArrayLayout3i6 is not aligned to 4-bytes boundaries. Warning: The layout StructArrayLayout3ui6 is not aligned to 4-bytes boundaries. Warning: The layout StructArrayLayout1ui2 is not aligned to 4-bytes boundaries. --- build/generate-struct-arrays.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/generate-struct-arrays.js b/build/generate-struct-arrays.js index ccbc1ecd179..f2ce2887159 100644 --- a/build/generate-struct-arrays.js +++ b/build/generate-struct-arrays.js @@ -93,6 +93,8 @@ function createStructArrayLayoutType({members, size, alignment}) { const key = `${members.map(m => `${m.components}${typeAbbreviations[m.type]}`).join('')}${size}`; const className = `StructArrayLayout${key}`; + // Layout alignment to 4 bytes boundaries can be an issue on some set of graphics cards. Particularly AMD. + if (size % 4 !== 0) { console.warn(`Warning: The layout ${className} is not aligned to 4-bytes boundaries.`); } if (!layoutCache[key]) { layoutCache[key] = { className,