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

refactor: Using TypeGPU to alleviate need for manual struct-alignment & bind group index matching. #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

iwoplaza
Copy link

Hi there! 👋
First of all, I watched your video on YouTube, very impressive showcase of WebGPU. The code is very clear to follow and understand.

I have been working on a TypeScript toolkit to alleviate the most common pain-points of working with WebGPU, with a big focus on type-safety. I wanted to see how easy it would be to incorporate it into an existing WebGPU codebase, and if it would improve the readability or maintainability. Feel free to disregard or close this PR, but if you'd have the time, it would be amazing to get feedback on TypeGPU and its usability from your perspective 💜.

Have a great day!

Comment on lines -69 to -70
// todo: dive a little deeper into struct memory packing
// todo: for some reason, this needs to be 4th value, can't be the 1st one?
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vec3s and vec4s are aligned to multiples of 16 bytes, so:

  • blurTrail takes up 4 bytes
  • enableLighting takes up 4 bytes
  • (padding of 8 bytes, so that the following vec3f member starts at a multuple of 16)
  • slimeColor takes up 12 bytes.

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

Successfully merging this pull request may close these issues.

1 participant