<blockquote>
<p>Is there an option in OpenGL or GLSL to disable the creation of these duplicates?</p>
</blockquote>
<p>No.</p>
<p>The tessellation system generates primitives. That means that, at the point the primitive is generated, all of its vertices must be available to the next parts of the pipeline. However, that means having storage for all of that vertex data.</p>
<p>Because you can tessellate one primitive into a <em>lot</em> of primitives, OpenGL gives implementations wide latitude over how many TES invocations are used. The TES can be invoked over the same coordinates multiple times. This usually represents contention for the cache memory used to store post-TES vertex data. That is, the system forced a vertex out of the cache, then needed it for a later primitive.</p>
<p>There's no way to guarantee that this never happens.</p>
<blockquote>
<p>But I would like to use transform feedback buffer and after TES stage no other stages are used.</p>
</blockquote>
<p>The output of transform feedback is <em>always</em> a triangle list (or line list, or point list).</p>

CC BY-SA 4.0
2023-08-28T00:45:28.287Z
2023-08-28T00:45:28.287Z
Nicol Bolas
<p>I was very surprised when I ran my tessellation evaluation shader, which only counts the number of vertices through an atomicAdd command.</p>
<p>for the following tessellation levels:</p>
<pre><code>gl_TessLevelOuter[0] = 10;
gl_TessLevelOuter[1] = 10;
gl_TessLevelOuter[2] = 10;
gl_TessLevelInner[0] = 10;
</code></pre>
<p>As we can see (Figure 1), there are only 91 vertices.... but the atomic counter tells me that there are 141 vertices.</p>
<p><a href="https://i.sstatic.net/KDRo2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KDRo2.png" alt="enter image description here" /></a></p>
<p><strong>Figure 1:</strong> generated vertices in the TES stage.
all inner and outer TessLevels were set to value <code>10</code>.</p>
<p>So I used my <a href="https://computergraphics.stackexchange.com/questions/13655/enumerate-vertices-from-tessellation-evaluation-stage-triangle-patch/13663#13663">TES vertex enumeration algorithm</a> to store the variable <code>gl_TessCoord</code> in SSBO along with a uint incremented by the function <code>atomicAdd</code>. I saved the result in an obj file and added a comment telling us how often this vertex is generated.</p>
<pre><code>v 0.0666656 0.866653 0.0666809 #2
v 0.0666656 0.766647 0.166687 #3
v 0.0666656 0.666641 0.266693 #2
v 0.0666656 0.566635 0.366699 #2
v 0.0666656 0.46666 0.466675 #2
v 0.0666656 0.366684 0.56665 #2
v 0.0666656 0.266678 0.666656 #2
v 0.0666656 0.166672 0.766663 #2
v 0.133347 0.733307 0.133347 #2
v 0.133347 0.633301 0.233353 #1
v 0.133347 0.533295 0.333359 #1
v 0.133347 0.433319 0.433334 #1
v 0.133347 0.333344 0.53331 #1
v 0.133347 0.233337 0.633316 #1
v 0.200012 0.599976 0.200012 #1
v 0.200012 0.499969 0.300018 #1
v 0.200012 0.399994 0.399994 #1
v 0.200012 0.300018 0.499969 #1
v 0.266678 0.466629 0.266693 #2
v 0.266678 0.366653 0.366669 #2
v 0.0666656 0.0666656 0.866669 #3
v 0.166672 0.0666656 0.766663 #2
v 0.266678 0.0666656 0.666656 #2
v 0.366684 0.0666656 0.56665 #3
v 0.46666 0.0666656 0.466675 #3
v 0.566635 0.0666656 0.366699 #2
v 0.666641 0.0666656 0.266693 #2
v 0.766647 0.0666656 0.166687 #2
v 0.133331 0.133347 0.733322 #1
v 0.233337 0.133347 0.633316 #1
v 0.333344 0.133347 0.53331 #2
v 0.433319 0.133347 0.433334 #2
v 0.533295 0.133347 0.333359 #1
v 0.633301 0.133347 0.233353 #1
v 0.200012 0.200012 0.599976 #1
v 0.300018 0.200012 0.499969 #2
v 0.399994 0.200012 0.399994 #2
v 0.499969 0.200012 0.300018 #1
v 0.266678 0.266678 0.466644 #2
v 0.366653 0.266678 0.366669 #2
v 0.866653 0.0666809 0.0666656 #2
v 0.766647 0.166687 0.0666656 #2
v 0.666641 0.266693 0.0666656 #2
v 0.566635 0.366699 0.0666656 #3
v 0.46666 0.466675 0.0666656 #3
v 0.366684 0.56665 0.0666656 #2
v 0.266678 0.666656 0.0666656 #2
v 0.166672 0.766663 0.0666656 #2
v 0.733307 0.133347 0.133347 #1
v 0.633301 0.233353 0.133347 #1
v 0.533295 0.333359 0.133347 #1
v 0.433319 0.433334 0.133347 #3
v 0.333344 0.53331 0.133347 #3
v 0.233337 0.633316 0.133347 #2
v 0.599976 0.200012 0.200012 #1
v 0.499969 0.300018 0.200012 #1
v 0.399994 0.399994 0.200012 #2
v 0.300018 0.499969 0.200012 #2
v 0.466629 0.266693 0.266678 #1
v 0.366653 0.366669 0.266678 #2
v 0.333328 0.333328 0.333344 #2
v 0 1 0 #1
v 0 0.899994 0.100006 #1
v 0 0.799988 0.200012 #1
v 0 0.699982 0.300018 #1
v 0 0.599976 0.400024 #1
v 0 0.5 0.5 #1
v 0 0.400024 0.599976 #1
v 0 0.300018 0.699982 #1
v 0 0.200012 0.799988 #1
v 0 0.100006 0.899994 #1
v 0 0 1 #2
v 0.100006 0 0.899994 #1
v 0.200012 0 0.799988 #1
v 0.300018 0 0.699982 #1
v 0.400024 0 0.599976 #1
v 0.5 0 0.5 #1
v 0.599976 0 0.400024 #1
v 0.699982 0 0.300018 #1
v 0.799988 0 0.200012 #1
v 0.899994 0 0.100006 #1
v 1 0 0 #1
v 0.899994 0.100006 0 #1
v 0.799988 0.200012 0 #1
v 0.699982 0.300018 0 #2
v 0.599976 0.400024 0 #1
v 0.5 0.5 0 #1
v 0.400024 0.599976 0 #1
v 0.300018 0.699982 0 #1
v 0.200012 0.799988 0 #1
v 0.100006 0.899994 0 #1
</code></pre>
<p>As you can see, some vertices are created up to three times.
Is there an option in OpenGL or GLSL to disable the creation of these duplicates?</p>

CC BY-SA 4.0
2023-08-25T13:47:40.370Z
I think it is because the output is a triangle list... which makes sense when using a geometry shader or fragment shader at the end... But I would like to use transform feedback buffer and after TES stage no other stages are used. The rasterizer will be turned off too.
Thomas
<opengl><tesselation>
Tessellation evaluation shader: vertex duplicates on triangle tessellation
Thomas
# Tessellation evaluation shader: vertex duplicates on triangle tessellation

(Asked by: username_0 on 2023-08-25)

I was very surprised when I ran my tessellation evaluation shader, which only counts the number of vertices through an atomicAdd command.

for the following tessellation levels:

```
gl_TessLevelOuter[0] = 10;
gl_TessLevelOuter[1] = 10;
gl_TessLevelOuter[2] = 10;
gl_TessLevelInner[0] = 10;

```

As we can see (Figure 1), there are only 91 vertices.... but the atomic counter tells me that there are 141 vertices.

[![enter image description here](https://i.sstatic.net/KDRo2.png)](https://i.sstatic.net/KDRo2.png)

**Figure 1:** generated vertices in the TES stage.
all inner and outer TessLevels were set to value `10`.

So I used my [TES vertex enumeration algorithm](https://computergraphics.stackexchange.com/questions/13655/enumerate-vertices-from-tessellation-evaluation-stage-triangle-patch/13663#13663) to store the variable `gl_TessCoord` in SSBO along with a uint incremented by the function `atomicAdd`. I saved the result in an obj file and added a comment telling us how often this vertex is generated.

```
v 0.0666656 0.866653 0.0666809 #2
v 0.0666656 0.766647 0.166687 #3
v 0.0666656 0.666641 0.266693 #2
v 0.0666656 0.566635 0.366699 #2
v 0.0666656 0.46666 0.466675 #2
v 0.0666656 0.366684 0.56665 #2
v 0.0666656 0.266678 0.666656 #2
v 0.0666656 0.166672 0.766663 #2
v 0.133347 0.733307 0.133347 #2
v 0.133347 0.633301 0.233353 #1
v 0.133347 0.533295 0.333359 #1
v 0.133347 0.433319 0.433334 #1
v 0.133347 0.333344 0.53331 #1
v 0.133347 0.233337 0.633316 #1
v 0.200012 0.599976 0.200012 #1
v 0.200012 0.499969 0.300018 #1
v 0.200012 0.399994 0.399994 #1
v 0.200012 0.300018 0.499969 #1
v 0.266678 0.466629 0.266693 #2
v 0.266678 0.366653 0.366669 #2
v 0.0666656 0.0666656 0.866669 #3
v 0.166672 0.0666656 0.766663 #2
v 0.266678 0.0666656 0.666656 #2
v 0.366684 0.0666656 0.56665 #3
v 0.46666 0.0666656 0.466675 #3
v 0.566635 0.0666656 0.366699 #2
v 0.666641 0.0666656 0.266693 #2
v 0.766647 0.0666656 0.166687 #2
v 0.133331 0.133347 0.733322 #1
v 0.233337 0.133347 0.633316 #1
v 0.333344 0.133347 0.53331 #2
v 0.433319 0.133347 0.433334 #2
v 0.533295 0.133347 0.333359 #1
v 0.633301 0.133347 0.233353 #1
v 0.200012 0.200012 0.599976 #1
v 0.300018 0.200012 0.499969 #2
v 0.399994 0.200012 0.399994 #2
v 0.499969 0.200012 0.300018 #1
v 0.266678 0.266678 0.466644 #2
v 0.366653 0.266678 0.366669 #2
v 0.866653 0.0666809 0.0666656 #2
v 0.766647 0.166687 0.0666656 #2
v 0.666641 0.266693 0.0666656 #2
v 0.566635 0.366699 0.0666656 #3
v 0.46666 0.466675 0.0666656 #3
v 0.366684 0.56665 0.0666656 #2
v 0.266678 0.666656 0.0666656 #2
v 0.166672 0.766663 0.0666656 #2
v 0.733307 0.133347 0.133347 #1
v 0.633301 0.233353 0.133347 #1
v 0.533295 0.333359 0.133347 #1
v 0.433319 0.433334 0.133347 #3
v 0.333344 0.53331 0.133347 #3
v 0.233337 0.633316 0.133347 #2
v 0.599976 0.200012 0.200012 #1
v 0.499969 0.300018 0.200012 #1
v 0.399994 0.399994 0.200012 #2
v 0.300018 0.499969 0.200012 #2
v 0.466629 0.266693 0.266678 #1
v 0.366653 0.366669 0.266678 #2
v 0.333328 0.333328 0.333344 #2
v 0 1 0 #1
v 0 0.899994 0.100006 #1
v 0 0.799988 0.200012 #1
v 0 0.699982 0.300018 #1
v 0 0.599976 0.400024 #1
v 0 0.5 0.5 #1
v 0 0.400024 0.599976 #1
v 0 0.300018 0.699982 #1
v 0 0.200012 0.799988 #1
v 0 0.100006 0.899994 #1
v 0 0 1 #2
v 0.100006 0 0.899994 #1
v 0.200012 0 0.799988 #1
v 0.300018 0 0.699982 #1
v 0.400024 0 0.599976 #1
v 0.5 0 0.5 #1
v 0.599976 0 0.400024 #1
v 0.699982 0 0.300018 #1
v 0.799988 0 0.200012 #1
v 0.899994 0 0.100006 #1
v 1 0 0 #1
v 0.899994 0.100006 0 #1
v 0.799988 0.200012 0 #1
v 0.699982 0.300018 0 #2
v 0.599976 0.400024 0 #1
v 0.5 0.5 0 #1
v 0.400024 0.599976 0 #1
v 0.300018 0.699982 0 #1
v 0.200012 0.799988 0 #1
v 0.100006 0.899994 0 #1

```

As you can see, some vertices are created up to three times.
Is there an option in OpenGL or GLSL to disable the creation of these duplicates?

**Tags:** opengl, tesselation

> **Comments:**
> **username_0**: I think it is because the output is a triangle list... which makes sense when using a geometry shader or fragment shader at the end... But I would like to use transform feedback buffer and after TES stage no other stages are used. The rasterizer will be turned off too.  

---

## 1 answers

### Answer by username_1 on 2023-08-28. Score: 2 | Accepted answer

> Is there an option in OpenGL or GLSL to disable the creation of these duplicates?

No.

The tessellation system generates primitives. That means that, at the point the primitive is generated, all of its vertices must be available to the next parts of the pipeline. However, that means having storage for all of that vertex data.

Because you can tessellate one primitive into a *lot* of primitives, OpenGL gives implementations wide latitude over how many TES invocations are used. The TES can be invoked over the same coordinates multiple times. This usually represents contention for the cache memory used to store post-TES vertex data. That is, the system forced a vertex out of the cache, then needed it for a later primitive.

There's no way to guarantee that this never happens.

> But I would like to use transform feedback buffer and after TES stage no other stages are used.

The output of transform feedback is *always* a triangle list (or line list, or point list).


---

