Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add byte stride to metadata binary encoding for better GPU alignment #591

Open
lilleyse opened this issue Nov 19, 2021 · 0 comments
Open

Comments

@lilleyse
Copy link
Contributor

Property values should be well aligned for GPU architectures.

The one case we brainstormed a few weeks back is a color property like an RGB8

Class property

"color": {
  "type": "ARRAY",
  "componentType": "UINT8",
  "componentCount": 3
}

Property table

"color": {
  "bufferView": 0
}

If the data was packed tightly it would poorly aligned and either the client or driver would need to shuffle data to add padding so that each color is aligned to 4-bytes. glTF has rules that enforce good alignment like this and we should consider adding something similar. One way glTF accomplishes this is through a stride property

Property table

"color": {
  "bufferView": 0,
  "stride": 4
}

stride

The rules get trickier when we have strings, arrays with greater than 4 elements, or arrays of variable size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant