Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Great question — this is a subtle but important point in GPU rendering performance. Let me break it down in the context of your image and the phrase:
- **“zig-zag topology increases the chance for quad leakage, which is multiplied by MSAA.”**
- ---
- ### 1. What is **quad leakage**?
- Modern GPUs shade in **2×2 pixel quads** (called “fragments”) rather than on an exact per-pixel basis. This allows for things like derivative calculations (`ddx`, `ddy` in HLSL/GLSL) and efficient SIMD execution.
- * If a triangle only partially covers a 2×2 pixel quad, **all 4 pixels in the quad may still be shaded**, even if only 1 or 2 are visible.
- * This extra shading work is called **quad overdraw** or **quad leakage**.
- So, even if you render 421K pixels (as the image says), the GPU might actually execute shading on significantly more fragments.
- ---
- ### 2. Why does **zig-zag topology** make it worse?
- Looking at your wireframe:
- * You can see lots of **thin, diagonal, zig-zagging triangles** instead of clean, rectangular or strip-like geometry.
- * When geometry cuts across screen space in odd shapes (especially diagonals), it tends to intersect more 2×2 pixel quads inefficiently.
- * This means more quads are “leaking” shading work — i.e., more fragments get shaded that don’t actually contribute to the final image.
- ---
- ### 3. Why is it **multiplied by MSAA**?
- MSAA (multisample anti-aliasing) increases the number of **coverage samples per pixel**.
- * For example, 4× MSAA means **4 coverage tests per pixel**.
- * If quad leakage causes the GPU to shade “extra” pixels, then under MSAA, each of those extra pixels must be evaluated across multiple samples.
- * This multiplies the wasted work: **quad leakage × MSAA sample count**.
- ---
- ### 4. Why is it relevant here?
- The image shows:
- * Large textures (4K×4K, 2K×2K).
- * A relatively modest pixel count (421K).
- * A wireframe with zig-zag patterns highlighted.
- Despite “only” 421K visible pixels, the zig-zag topology caused high quad leakage, and with MSAA enabled, that ballooned the shading cost.
- That’s why this particular draw call took much longer than average: **too much wasted fragment shading due to poor triangle layout + MSAA overhead**.
- ---
- ✅ **In short:**
- “Zig-zag topology” means triangles are poorly aligned to screen-space quads. This increases **quad leakage** (shading fragments that aren’t actually used). With MSAA, each of those wasted fragments requires multiple evaluations, so the cost grows dramatically.
- ---
- Do you want me to illustrate this with a small **2×2 quad diagram** showing how a zig-zag triangle can trigger extra shading compared to a well-aligned triangle?
Advertisement
Add Comment
Please, Sign In to add comment