<p>That depends on how far apart the vertexes are reused.</p>

<p>For example the square <code>0, 1, 2, 2, 1, 3</code> will have a short enough interval that the <code>1</code> and <code>2</code> vertices will be reused. But if there are a hundred vertices between reuses then it's more likely that there will be no reuse.</p>

<p>But when they are much further apart then the vertex will fall out of the cache and have to be reprocessed by the vertex shader.</p>

<p>This is why some 3D software have a way to improve vertex locality for indexed meshes by reordering the vertices.</p>

CC BY-SA 3.0
2016-08-16T08:32:50.617Z
2016-08-16T08:32:50.617Z
ratchet freak
<p>The key expression you may be looking for is <a href="https://www.opengl.org/wiki/Post_Transform_Cache" rel="nofollow">"Post Transform Cache"</a>.</p>

<p>This is usually effective because of the natural vertex reuse, but reordering your mesh, e.g. with <a href="http://hhoppe.com/proj/tvc/" rel="nofollow">Hoppe's method</a> (note: the page also lists some more recent work) or <a href="https://tomforsyth1000.github.io/papers/fast_vert_cache_opt.html" rel="nofollow">Forsyth's</a> can improve things further.</p>

CC BY-SA 3.0
2016-08-16T09:06:03.783Z
Yup, that's the one. Thanks. :-) I've been doing indexed Marching Cubes on pretty large volumes and was curious about how they were being rendered, as vertex locality is pretty bad between slices. Makes sense to cache the vertices somewhere (I guess just in standard L1 / 2 cache?). My meshes are probably out-of order enough to be re-processing a lot of vertices, so I'll look into those algorithms.
russ
CC BY-SA 3.0
2016-08-16T08:20:34.033Z
2016-08-16T15:05:49.967Z
2016-08-16T15:05:49.967Z
Simon F
<p>I've been digging a bit into what actually happens at a hardware level on the GPU, and found NVidia's <a href="https://developer.nvidia.com/content/life-triangle-nvidias-logical-pipeline">Life of a triangle</a> which explains the pipeline pretty well, at least for green boxes. One thing I wasn't clear on is what happens with indexed meshes, when the same vertex is used for a bunch of different triangles. Since data is generally not persisted for any longer than necessary in a stream processor, I'm guessing the vertex is simply destroyed after being rasterized, then fetched and run through the vertex shader again whenever it appears in a new triangle. Can anyone confirm this? Also, what happens in line-strip or triangle-strip modes? Does the GPU persist the transformed vertex data somewhere until the 2 or 3 relevant primitives have been rasterized in these cases?</p>

<rendering>
Are vertices reprocessed per-poly for indexed meshes?
russ
# Are vertices reprocessed per-poly for indexed meshes?

(Asked by: username_0 on 2016-08-16)

I've been digging a bit into what actually happens at a hardware level on the GPU, and found NVidia's [Life of a triangle](https://developer.nvidia.com/content/life-triangle-nvidias-logical-pipeline) which explains the pipeline pretty well, at least for green boxes. One thing I wasn't clear on is what happens with indexed meshes, when the same vertex is used for a bunch of different triangles. Since data is generally not persisted for any longer than necessary in a stream processor, I'm guessing the vertex is simply destroyed after being rasterized, then fetched and run through the vertex shader again whenever it appears in a new triangle. Can anyone confirm this? Also, what happens in line-strip or triangle-strip modes? Does the GPU persist the transformed vertex data somewhere until the 2 or 3 relevant primitives have been rasterized in these cases?

**Tags:** rendering


---

## 2 answers

### Answer by username_2 on 2016-08-16. Score: 5 | Accepted answer

The key expression you may be looking for is ["Post Transform Cache"](https://www.opengl.org/wiki/Post_Transform_Cache).

This is usually effective because of the natural vertex reuse, but reordering your mesh, e.g. with [Hoppe's method](http://hhoppe.com/proj/tvc/) (note: the page also lists some more recent work) or [Forsyth's](https://tomforsyth1000.github.io/papers/fast_vert_cache_opt.html) can improve things further.

> **Comments:**
> **username_0**: Yup, that's the one. Thanks. :-) I've been doing indexed Marching Cubes on pretty large volumes and was curious about how they were being rendered, as vertex locality is pretty bad between slices. Makes sense to cache the vertices somewhere (I guess just in standard L1 / 2 cache?). My meshes are probably out-of order enough to be re-processing a lot of vertices, so I'll look into those algorithms.  

---

### Answer by username_1 on 2016-08-16. Score: 4

That depends on how far apart the vertexes are reused.

For example the square `0, 1, 2, 2, 1, 3` will have a short enough interval that the `1` and `2` vertices will be reused. But if there are a hundred vertices between reuses then it's more likely that there will be no reuse.

But when they are much further apart then the vertex will fall out of the cache and have to be reprocessed by the vertex shader.

This is why some 3D software have a way to improve vertex locality for indexed meshes by reordering the vertices.


---

