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

[your-first-webgpu-app] #1440

Open
jahmezz opened this issue Oct 4, 2024 · 3 comments
Open

[your-first-webgpu-app] #1440

jahmezz opened this issue Oct 4, 2024 · 3 comments

Comments

@jahmezz
Copy link

jahmezz commented Oct 4, 2024

Draw A Grid

Your example is confusing because it currently talks about the bottom-right corner, when it should say bottom-left.

In the "Manipulate geometry in the shader" section.

One way you could fix this is to update the square's vertex buffer. By shifting the vertices so that the bottom-left corner is at, for example, (0.1, 0.1) instead of (-0.8, -0.8), you'd move this square to line up with the cell boundaries more nicely. But, since you have full control over how the vertices are processed in your shader, it's just as easy to simply nudge them into place using the shader code!

ChatGPT also provided me with a graph showing what you mean.
output (1)

@jahmezz
Copy link
Author

jahmezz commented Oct 4, 2024

If "Manage Cell State" (Section 7) used VertexInput for "Read the storage buffer in the shader" parameter 1, then it would be more consistent and easier to follow.

It currently uses the non-struct approach of pos and instance_index.

@beaufortfrancois
Copy link

Your example is confusing because it currently talks about the bottom-right corner, when it should say bottom-left.

Thank you for reporting this issue @jahmezz! It is now fixed in https://codelabs.developers.google.com/your-first-webgpu-app?hl=en#4

If "Manage Cell State" (Section 7) used VertexInput for "Read the storage buffer in the shader" parameter 1, then it would be more consistent and easier to follow.

@toji What do you think?

@beaufortfrancois
Copy link

@toji (gentle ping)

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

2 participants