Skip to content

Commit 4deae8f

Browse files
liuyalingreggman
authored andcommitted
Update WGSL storage buffer example to use array of vec2f. To reduce ambiguity in Chinese documents.
1 parent 46f5b83 commit 4deae8f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

webgpu/lessons/zh_cn/webgpu-storage-buffers.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,11 @@ struct Vertex {
428428
我们完全可以不使用结构体,直接使用 `vec2f`
429429

430430
```wgsl
431-
@group(0) @binding(2) var<storage, read> pos: vec2f;
431+
-@group(0) @binding(2) var<storage, read> pos: array<Vertex>;
432+
+@group(0) @binding(2) var<storage, read> pos: array<vec2f>;
433+
...
434+
-pos[vertexIndex].position * otherStruct.scale + ourStruct.offset, 0.0, 1.0);
435+
+pos[vertexIndex] * otherStruct.scale + ourStruct.offset, 0.0, 1.0);
432436
```
433437

434438
但是,如果把它变成一个结构体,以后添加每个顶点的数据会不会更容易呢?

0 commit comments

Comments
 (0)