You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/typegpu-docs/src/content/docs/fundamentals/buffers.mdx
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -315,3 +315,20 @@ import ListItem from '../../../components/ListItem.astro';
315
315
data will be copied to the staging buffer before being read. After the data is read, the staging buffer will be destroyed.
316
316
</ListItem>
317
317
:::
318
+
319
+
## Index Buffers
320
+
TypeGPU also allows for the use of index buffers. An index buffer is a buffer containing a sequence of `u32` or `u16` indices, which indicate in which order vertices will be processed. This is particulary useful for rendering geometry, where vertices are often shared between multiple primitives (e.g., triangles), as it avoids duplicating vertex data.
321
+
You may refer to the [pipelines](/TypeGPU/fundamentals/pipelines/#drawing-with-drawindexed) section for usage details.
Copy file name to clipboardExpand all lines: apps/typegpu-docs/src/content/docs/fundamentals/pipelines.mdx
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -329,6 +329,65 @@ Unlike render pipelines, after running this method, the execution is not submitt
329
329
In order to do so, `root['~unstable'].flush()` needs to be run.
330
330
However, that is usually not necessary, as it is done automatically when trying to read the result of computation.
331
331
332
+
### Drawing with `drawIndexed`
333
+
334
+
The `drawIndexed` is analogous to draw, but takes advantage of [index buffer](/TypeGPU/fundamentals/buffers/#index-buffers) to explicitly map vertex data onto primitives. When using an index buffer, you don't need to list every vertex for every primitive explicitly. Instead, you provide a list of unique vertices in a vertex buffer. Then, the index buffer defines how these vertices are connected to form primitives.
The higher-level API has several limitations, therefore another way of executing pipelines is exposed, for some custom, more demanding scenarios. For example, with the high-level API, it is not possible to execute multiple pipelines per one render pass. It also may be missing some more niche features of the WebGPU API.
0 commit comments