How a GPU Draws a Pixel
Move the corner of a triangle and watch one pixel. See how a graphics chip tests whether the triangle covers that pixel and decides which colour appears.
Watch a keystroke
Scroll or pinch on the model to move closer.
Read the steps
- Send a drawing command
The GPU receives three vertices. A triangle is a building block for many images, including textured rectangles used by applications.
- Transform the vertices
For this experiment the three vertices are already in screen coordinates. Moving the top vertex changes the triangle while our selected pixel stays put.
- Test the sample position
Three edge functions decide which side of each edge the pixel centre lies on. The sample is covered only when all three tests pass.
- Enter one shader lane
A representative programmable lane evaluates the second edge test, E1 ≥ 0. It converts E1 to a signed fixed-point value so its sign bit tells us whether the test passes. Many lanes can work on different samples together.
- Inspect a lane’s logic
For a signed two’s-complement number, E1 ≥ 0 is NOT its sign bit. This actual comparison uses a CMOS inverter: one pMOS pulls the output high for sign 0; one nMOS pulls it low for sign 1. The other two edge tests must also pass before writing the pixel.
- Write the framebuffer
Covered samples write RGB (64, 200, 160); uncovered samples keep the dark clear colour. These stored colours make a frame.
- Read the frame for display
The display engine reads rows of framebuffer pixels in order and sends colour data to the screen. It is a different job from shading a triangle.
- See the changed picture
Move the top vertex across the fixed sample. Coverage, gate state, stored pixel colour and the visible picture change together.