Shader compilation stutter

On this page 7

Shader compilation stutter is a short, irregular freeze or hitch that occurs when a game must compile a shader program at runtime, on the CPU, at the exact moment a new visual effect, material or scene first appears. In PC gaming it is one of the most discussed performance problems because it appears regardless of how powerful the hardware is, and it can make a game running at a high average frame rate feel uneven.

The problem is rooted in how personal computers differ from consoles. A console has one fixed GPU and driver, so developers can ship precompiled shaders. A PC can contain thousands of combinations of graphics cards, driver versions and settings, so the final GPU machine code is usually produced on the player’s own system.

How shader compilation causes a frame hitch

A frame hitch happens because the render thread waits for the compiler before it can submit draw calls that use the new shader. Shaders are written in high-level languages such as HLSL or GLSL and are shipped in an intermediate format, such as DXIL for Direct3D 12 or SPIR-V for Vulkan. The graphics driver must translate that intermediate code into instructions for the specific GPU architecture installed in the machine.

In modern explicit APIs, shaders are combined with blend modes, vertex layouts and render target formats into a pipeline state object (PSO). Creating one PSO can take from a few milliseconds to more than 100 milliseconds. At 60 frames per second the frame budget is only 16.7 milliseconds, so a single synchronous compilation can turn one frame into a visible pause.

The following table traces the path from shader source to a finished frame and shows where the delay is introduced.

StageWhere it happensTypical cost
Source to intermediate codeDeveloper build machineNo cost for the player
Intermediate code to GPU codePlayer’s driver at runtime1-100+ ms per pipeline
Pipeline state creationPlayer’s CPU, often on demandMain source of the hitch
Loading from the driver cachePlayer’s storageUsually under 1 ms
Stages between shader source and a rendered frame

Once a pipeline has been built, the driver stores it in a shader cache on disk. The next time the same effect appears it loads almost instantly, which explains the typical pattern: stutter is worst on the first playthrough of an area and fades on later visits.

Why it differs from other kinds of stutter

Shader compilation stutter has a distinctive signature: it coincides with first-time events such as a new enemy type, an explosion, a weather change or a cutscene, and it rarely repeats in the same place. Other forms of stutter have different causes and therefore different fixes, which is why correct diagnosis matters before changing settings.

Stutter typeRoot causeTypical pattern
Shader compilation stutterRuntime pipeline creationFirst appearance of an effect only
Traversal stutterStreaming new world dataCrossing zone boundaries, repeats
VRAM overflow stutterTextures exceed GPU memoryPersistent, worse at high texture settings
Frame pacing stutterUneven frame deliveryConstant judder despite stable average
Background process stutterOverlays, scans or updatesRandom, unrelated to game events
Common types of game stutter compared

A frame time graph is the most reliable diagnostic tool. Shader stutter shows up as isolated tall spikes of 50-300 milliseconds, whereas frame pacing problems appear as a constant saw-tooth pattern. Average frames per second hide these spikes, so reviewers look at 1% and 0.1% low frame rates to quantify them.

How developers prevent shader compilation stutter

The most effective prevention is to compile pipelines before gameplay starts. Many PC ports now display a shader preparation screen on first launch or after a driver update. This moves the cost to a loading phase, where a wait of several minutes is acceptable, instead of spreading it across gameplay as hitches.

Precompilation is only possible if the game knows which pipelines it will need. Engines with material-heavy rendering, such as Unreal Engine 4 and 5, can generate tens of thousands of permutations, so developers record the pipelines seen during test playthroughs and ship that list as a PSO cache. Unreal Engine 5.2 and later add PSO precaching, which compiles likely pipelines asynchronously while assets load.

TechniqueHow it helpsMain drawback
Precompilation at startupRemoves most runtime compilesLong first launch, repeated after driver updates
Recorded PSO cacheTargets pipelines actually usedMisses paths not covered in testing
Asynchronous compilationKeeps the render thread movingObjects may appear late or simplified
UbershadersOne generic shader covers many casesLower GPU efficiency until specialized
Fewer shader permutationsReduces total compile workConstrains artists and material design
Developer techniques and their trade-offs

Vulkan offers an extension called graphics pipeline library, which allows parts of a pipeline to be compiled separately and linked quickly. Direct3D 12 provides pipeline libraries for caching. Neither removes the underlying work, so careful engineering and testing remain necessary.

What players can do about it

Players cannot eliminate shader compilation stutter, but they can reduce its impact. The most useful step is to let the shader preparation screen finish completely instead of skipping it. A larger driver shader cache helps games with many pipelines; both NVIDIA and AMD expose a cache size option in their control panels.

  • Avoid clearing the shader cache unless troubleshooting, because it forces every pipeline to compile again.
  • Expect a temporary return of stutter after a graphics driver update, since cached code is tied to the driver version.
  • A faster CPU with more cores shortens compile times, but no hardware makes the problem disappear.
  • On Linux and the Steam Deck, shader pre-caching can download pipelines compiled by other players with the same GPU and driver.

Some advice found in forums has little or no effect, such as lowering resolution, which reduces GPU load but not CPU compile time. The table below matches common actions with their realistic outcome.

ActionEffect on shader stutterReason
Waiting for shader precompilationStrong reductionMoves work to a loading screen
Increasing the driver cache sizeModerate reductionFewer pipelines are evicted
Upgrading the CPUShorter spikesCompilation runs on CPU cores
Lowering resolutionNo meaningful changeCompile cost does not depend on pixels
Updating the graphics driverTemporary increaseExisting cache becomes invalid
Player actions and their real effect

Common misconceptions

A frequent misconception is that a more powerful graphics card fixes stutter. The GPU sits idle during the wait; the bottleneck is CPU-side compilation and the synchronous design of the engine. Another error is blaming a poor PC port for every hitch, although some stutter is traversal stutter or asset streaming, which has a separate cause.

It is also wrong to assume that stutter which disappears after an hour means the game was fixed. The pipelines have simply been written to the local cache, and the problem will return on a fresh installation, a new driver or a different machine. For this reason reviewers often test first-run performance separately from repeated runs.

A non-technical view

A game tells the graphics card how to draw things through small programs called shaders. On a PC, these programs must be translated for your exact graphics card before they can run. If the game does that translation in the middle of play, the picture freezes for a split second while the computer catches up.

Think of a musician who must transcribe a new piece before playing it. If the sheet music is prepared before the concert, the performance flows. If it is written out on stage, there are awkward pauses. Good PC games prepare in advance, and the pauses become rare once the translation is saved for next time.

A concrete example

A player installs a new open-world action game built on Unreal Engine on a desktop with an eight-core CPU and a high-end graphics card. The game averages 110 frames per second, yet during the first hour the player notices sharp hitches of about 150 milliseconds whenever a new enemy casts a spell or a fire effect appears for the first time.

A frame time overlay confirms isolated spikes rather than constant judder. The player checks the settings and finds that the startup shader preparation step was skipped. After restarting and letting it run for about six minutes, the spikes drop to a handful of small hitches during the next session. Following a driver update two weeks later, the preparation step runs again, and the game returns to smooth frame delivery after it completes.