Stencil buffer
A small integer buffer alongside the depth buffer that masks where rasterization is allowed to write, pixel by pixel.
Usually eight bits, often packed together with depth as D24S8. At each pixel a reference value is compared against the buffer according to a stencil test, and depending on the outcome the value can be written, incremented or decremented. The result is a masking stamp: draw mirrors only inside the frame, cut out portals, lay decals onto a surface, or trace an outline around a selected object.
Its most famous use is stencil shadows — shadow volumes whose coverage is counted by incrementing and decrementing the stencil at the volume's front and back faces. Doom 3 (2004) built its entire shadowing on the "Carmack's reverse" variant. The technique lost ground once shadow maps took over, but the stencil lives on wherever something needs masking.