feedback icon indicating copy to clipboard operation
feedback copied to clipboard

[your-first-webgpu-app]

Open jahmezz opened this issue 1 year ago • 3 comments

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 avatar Oct 04 '24 05:10 jahmezz

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.

jahmezz avatar Oct 04 '24 07:10 jahmezz

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 avatar Oct 08 '24 07:10 beaufortfrancois

@toji (gentle ping)

beaufortfrancois avatar Oct 14 '24 07:10 beaufortfrancois