Skip to content

Commit

Permalink
Warn on 4-bytes misalignment
Browse files Browse the repository at this point in the history
$ 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.
  • Loading branch information
karimnaaji committed May 12, 2020
1 parent faf8ba7 commit d2718b5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build/generate-struct-arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d2718b5

Please sign in to comment.