Quick answer: Flickering graphics, surfaces, objects, or the whole screen flashing or shimmering, has several distinct causes: z-fighting (two surfaces at nearly the same depth fighting over which renders), rendering/buffering problems (improper double buffering, not clearing buffers), uninitialized data, and GPU-specific precision issues. Identify which kind of flicker you have, then apply the matching fix, depth separation for z-fighting, correct buffering, clearing buffers, or precision/compatibility handling.
Flickering is a broad symptom with several underlying causes, so the key to fixing it is identifying what kind of flicker you have. A flickering surface (z-fighting) is a different problem from a flickering whole screen (buffering) or flicker that only appears on certain GPUs (precision/compatibility). Diagnosing the type narrows it to a specific, fixable cause.
The Types of Flickering and Their Causes
Flickering comes in distinct forms. Z-fighting, two surfaces at the same or nearly-the-same depth flicker as the GPU alternates which is in front (covered in depth separately), this is surface-level flicker on specific overlapping geometry. Buffering issues, problems with double buffering (rendering to a buffer being displayed, or not swapping correctly) cause screen-wide flicker. Uninitialized/uncleared buffers, not clearing the frame buffer between frames can leave garbage or previous-frame data flickering through. And GPU-specific precision/compatibility, flicker that appears only on certain GPUs often indicates a precision issue (insufficient depth/float precision) or a rendering path that misbehaves on that hardware.
So 'flickering' could be localized surface flicker (z-fighting), screen-wide flicker (buffering/clearing), or hardware-specific flicker (precision/compatibility). Each is a different fix, so determining the type is step one.
How to Diagnose It
Characterize the flicker. Is it specific surfaces/objects flickering (likely z-fighting, surfaces overlapping at the same depth)? The whole screen flickering (likely buffering or buffer-clearing)? Garbage/previous-frame data showing through (uncleared buffers)? Or flicker only on certain GPUs (precision/compatibility)? When and where it flickers, and whether it's GPU-specific, points at the cause.
For GPU-specific flicker, capture device context to see which GPUs are affected. Bugnet captures reports with device context, so flicker reports and any GPU correlation surface, distinguishing a universal rendering bug (z-fighting, buffering) from a hardware-specific one (precision on certain GPUs). Universal flicker is reproducible locally; GPU-specific flicker needs the device pattern to identify the affected hardware.
How to Fix It
Fix per type. For z-fighting, separate the depths of overlapping surfaces (offset them, adjust the depth range/precision, use depth bias), see the dedicated z-fighting fix. For buffering issues, ensure proper double buffering, render to the back buffer and swap correctly, so you're not displaying a partially-rendered or mismatched buffer. For uncleared buffers, clear the frame (and depth) buffer appropriately each frame so no garbage or stale data flickers through. For GPU-specific precision/compatibility, address the precision issue (sufficient depth-buffer precision, careful float precision in shaders) or provide an alternate rendering path for the affected GPUs.
Match the fix to the diagnosed type, applying the wrong fix won't help. After fixing, verify the flicker is gone (and for GPU-specific flicker, confirm on the affected hardware or via field data). Flickering is very fixable once you've identified which of these distinct causes you have, so the diagnostic step, what kind of flicker, is the most important part.
Flickering has several causes, z-fighting, buffering, uncleared buffers, GPU precision. Identify the type (surface, screen-wide, or GPU-specific) first, then apply the matching fix.