Bruno Croci wrote a Voronoi-noise fragment shader as a background for a music video. It ran fine on an Intel iGPU laptop, a Pixel 9 Pro and an RTX 2070 — and stuttered on exactly one machine: a Windows PC with an RTX 4070. The investigation that followed is a clean model of how to debug “the compiler did something weird.”

The one-line clue came before any deep dive: changing the scalar multiplying the noise input from 398.0 to 398.1 made the stutter disappear.

The path, including the dead ends:

  • An LLM proposed that an Nvidia driver miscompiles fract() for large operands, and suggested replacing fract(x) with the mathematically identical x - floor(x). That fix worked.
  • The explanation was still wrong. Every attempt to build a minimal reproducer failed — across several models — and the supposed value discrepancies either never appeared or appeared on healthy devices too. The working fix was found by chance.
  • By hand, he found the real signature: any fractional literal in the multiplier removed the stutter (398.1, even 1.001), while 1.0 or no multiply kept it.
  • A RenderDoc capture of a clean Chromium install showed the shader compiled to DXBC, DirectX 11 bytecode — not OpenGL ES. WebGL on Windows goes through ANGLE, which transpiles GLSL to HLSL and hands it to D3D. Forcing --use-angle=vulkan made the bug vanish.
  • Dumping ANGLE’s translated HLSL showed a near 1:1 translation, so the blame moved to Microsoft’s HLSL compiler.
  • Reproduced natively in a DirectX 11 renderer: with D3DCOMPILE_SKIP_OPTIMIZATION the shader works; at the default O3 it breaks. That is the bug.
  • The decompiled O3 output shows the value being reassigned to its own floor(...), with the frac call optimized away entirely. The fractional part is truncated, and the Voronoi centers teleport instead of gliding.

A WebGL shader on Windows passes through GLSL → ANGLE → HLSL → FXC → DXBC → proprietary driver JIT. Any layer can be wrong, and the only test device that failed happened to be the only Windows one.

Two transferable lessons. First, “works on my machine” in graphics means works on your OS, API, browser and driver stack — an accurate root cause can hide behind a working patch. Second, verifying the cause rather than the fix matters: the driver-miscompile story was plausible, produced a result, and was still false.

The bug remains unreproduced in minimal form, and FXC is closed source — which is why people still targeting DX11 keep asking Microsoft to open it.