3 ms·
As patrick said in another reply, this has not been true for a while. On all modern GPU hardware I know of, sliver triangles fall into the category of "degenera
by kevingadd 5y ago
As patrick said in another reply, this has not been true for a while. On all modern GPU hardware I know of, sliver triangles fall into the category of "degenerate triangles", where the hardware by necessity wastes a ton of time and energy shading pixels that can't ever hit the framebuffer.
You can partially avoid this with early-Z and early-stencil (which will reject entire groups of pixels), but those will only help if most or all of your degenerate triangle is invisible. If a single pixel passes that early culling, it will have to shade at least 4 pixels to produce that one output pixel.
If you are concerned about the cost of drawing a quad where 25-50% of it is transparent/discarded, you can create a simple hull out of 2-4 triangles where it suffers less from the overhead of shading those 2x2 groups. That is a common compromise that can produce improved performance by skipping 2x2 groups that don't contribute to the output frame.
In practice all quads suffer from this, and the larger the quad the more cycles you waste shading the seam between the two triangles twice. The overhead for large quads is still pretty small in comparison, but if you're doing full-screen post-processing effects it can produce a measurable speed-up to draw a single huge (viewport clipped) triangle instead.
It's possible some hardware has optimizations to mitigate this, but it's also the case that since shaders can do things like read/write from arbitrary buffers, any optimization that avoids shading the seam twice would cause incorrect differences in behavior, so it's hard to do that optimization in all cases.