You are viewing the course site for a past offering of this course. The current offering may be found here.
Lecture 23: How GPUs work (26)
JayShenoy

With all of these fragment shaders running in parallel, which part of the graphics pipeline carries out z-buffering? It seems like each fragment represents a pixel sample that could potentially be occluded, so I'm wondering where the work for visibility is done.

Staffrishiu

From looking at OpenGL's documentation, it seems that at least for OpenGL, the z-buffer tests are carried out per fragment after all the fragment shaders have been run: https://learnopengl.com/Advanced-OpenGL/Depth-testing. However, it seems new GPU's often run the depth tests before any fragment shaders are run so it seems there are many ways of doing the depth test so that running fragment shaders in parallel isn't an issue.

You must be enrolled in the course to comment