Your Search Bar For Shrewd Tips

How Do I Clear Vulkan Shader Cache Linux?


If a Vulkan game or application is crashing, showing visual glitches, or behaving strangely after a driver update, clearing its shader cache may help. A shader cache stores compiled graphics code so it can be reused instead of rebuilt every time an app starts. On Linux, however, there is no single Vulkan cache folder that applies to every system: the location can depend on your graphics driver, desktop environment, launcher, and the application itself. This guide explains how to find and clear Vulkan shader caches safely, including Mesa and Steam caches, and what to expect afterward.

What Happens When You Clear a Vulkan Shader Cache?

Vulkan applications compile shaders into forms the graphics driver can use. Caching those results can reduce loading times and prevent the same shaders from being compiled repeatedly. A cache may be managed by the application, the Vulkan driver, or a game launcher. Some applications also save pipeline-cache data in their own configuration or data directories.

Removing a cache generally does not uninstall the game, delete your saved games, or damage the graphics driver. The application or driver can usually build a fresh cache the next time it runs. The main trade-off is temporary: the first launch, level, or session after clearing may take longer and may stutter while shaders are compiled again.

Because cache ownership varies, avoid deleting broad folders such as ~/.cache, your entire Steam library, or your whole home directory. Target only a known shader-cache directory, and close the relevant games and launchers before removing anything.

Before You Start: Close Vulkan Applications

Exit the game or application whose cache you want to clear. Also close Steam or another launcher if you plan to remove its shader cache. A running application may recreate files while you delete them, or keep cache data open. If you are unsure whether an app has fully exited, check your desktop’s system monitor or use a process-listing command.

It is also useful to note which graphics driver you are using. Vulkan on Linux commonly runs through Mesa drivers such as RADV for AMD or ANV for Intel, or through a vendor driver such as NVIDIA’s. The Vulkan loader itself usually is not the owner of the shader cache; the application and driver are more likely places to look.

vulkaninfo --summary

If the command is unavailable, install the Vulkan tools package provided by your distribution, or skip this check. Package names vary between distributions. You can also identify the graphics card and driver through your system’s settings or hardware information tools.

Find the Vulkan Shader Cache on Linux

Start with the standard user cache directory. Unless you have changed the XDG cache location, this is usually ~/.cache. To see whether a custom location is configured, run:

printf '%s\n' "${XDG_CACHE_HOME:-$HOME/.cache}"

Mesa commonly stores its shader cache in a directory named mesa_shader_cache under that location. Some Mesa versions or configurations may use a related directory such as mesa_shader_cache_db. Mesa also supports a custom cache location through the MESA_SHADER_CACHE_DIR environment variable, so a game launched with custom environment settings may use a different path.

To check whether that variable is set in your current terminal, use:

printf '%s\n' "${MESA_SHADER_CACHE_DIR:-Not set}"

A variable set in the terminal does not necessarily reflect settings applied by Steam, a game launcher, or a desktop shortcut. If you suspect an override, review the game’s launch options and any scripts used to start it.

For Steam games, Steam maintains downloadable or generated shader data in a shadercache directory inside its library. Common locations include ~/.local/share/Steam/steamapps/shadercache and ~/.steam/steam/steamapps/shadercache. A separate Steam library may have its own steamapps/shadercache folder on another drive. The subdirectories are usually named with a game’s Steam app ID.

Other graphics drivers and applications may keep caches in vendor-specific or application-specific directories. Paths can differ by driver version and configuration. Rather than guessing, look for directories clearly named for a shader or pipeline cache, consult the driver or game documentation, and check the application’s settings. Do not assume that a folder containing “GL” in its name is irrelevant: some driver cache directories may be shared by more than one graphics API.

Clear the Mesa Vulkan Shader Cache

If you use Mesa and want to clear its standard cache, first check that the directories exist. The following command reports their sizes without deleting anything:

CACHE="${XDG_CACHE_HOME:-$HOME/.cache}"
du -sh "$CACHE/mesa_shader_cache" "$CACHE/mesa_shader_cache_db" 2>/dev/null

If the paths and sizes look right, close games and applications that use Mesa, then remove only those cache directories:

CACHE="${XDG_CACHE_HOME:-$HOME/.cache}"
rm -rf -- "$CACHE/mesa_shader_cache" "$CACHE/mesa_shader_cache_db"

This command is limited to the two named folders under your user cache location. Read it carefully before pressing Enter, especially if you modify it. If Mesa is using a custom MESA_SHADER_CACHE_DIR, inspect that exact directory first and remove only the cache contents you intend to reset. Do not run a guessed command with an empty or incorrect path.

You usually do not need to reinstall Mesa, change Vulkan packages, or delete driver files to clear a shader cache. Those steps can introduce new problems and do not necessarily remove the cache used by the affected game.

Clear a Steam Game’s Shader Cache

Steam’s shader cache is separate from many driver-level caches. To reset it for one game, find the game’s app ID, close Steam, and remove only that game’s directory within steamapps/shadercache. You can find an app ID on the game’s Steam store page or in the game’s properties and local Steam files. The directory might be under either common Steam path, or inside a different Steam library.

For example, replace APPID with the numeric app ID and use the path that actually exists on your system:

rm -rf -- "$HOME/.local/share/Steam/steamapps/shadercache/APPID"

Some installations use the alternative path:

rm -rf -- "$HOME/.steam/steam/steamapps/shadercache/APPID"

Do not paste the placeholder literally. Confirm the app ID and directory before deleting it. If you want Steam to recreate shader data for every game, you can remove the contents of the correct shadercache directory, but that may cause larger downloads or longer first launches across your library. Clearing one game’s folder is the more targeted option.

Steam settings may also offer shader pre-caching controls. Disabling pre-caching is not the same as clearing an existing cache, and it can change whether Steam downloads or prepares shaders in advance. If the problem returns after a cache rebuild, consider checking those settings and the game’s launch options.

What About NVIDIA, AMD, and Other Drivers?

There is no universal NVIDIA Vulkan shader-cache path that is guaranteed across every Linux driver release and application. NVIDIA’s driver may maintain graphics caches in a user-level directory, while a game or launcher may keep separate Vulkan pipeline data. If documentation for your installed driver identifies a specific cache directory, close applications first and clear only that directory. Avoid deleting all of ~/.nv unless you have confirmed what its contents are and understand the consequences.

AMD users may be running Mesa’s RADV driver or another Vulkan implementation. With RADV, the Mesa cache guidance above is often relevant, but application-level caches can remain elsewhere. Intel’s ANV driver is also part of Mesa, so its driver-managed cache may follow Mesa’s cache configuration. For either vendor, changing the driver does not automatically guarantee that every old application cache is removed.

When the graphics stack is not using Mesa, check the driver vendor’s documentation and the affected application’s support notes. If a cache location is unclear, search the application’s configuration directories for a clearly named cache rather than deleting unrelated settings. Keep saved-game folders and application profiles intact.

Verify the Cache Was Cleared

After deleting a cache, launch the affected application and test the issue. The first run may be slower than usual. You can check whether a known cache directory has been recreated with:

du -sh "${XDG_CACHE_HOME:-$HOME/.cache}/mesa_shader_cache" 2>/dev/null

A missing directory does not necessarily mean anything is wrong; it may be created only after an application compiles shaders. Steam may also repopulate its cache when the game starts or when Steam prepares pre-cached data. If the original problem is gone after rebuilding, the old cache may have been stale or corrupted.

If the same error or graphical issue persists, the shader cache may not be the cause. Check for graphics-driver updates, game updates, Vulkan runtime problems, unsupported launch options, or issues reported by other users with the same hardware. For troubleshooting, change one thing at a time so you can tell which action helped.

Common Mistakes to Avoid

  • Deleting the wrong directory: Confirm that a folder is a shader cache before removing it. Do not delete your whole ~/.cache directory as a shortcut.
  • Clearing files while a game is open: Exit the game and its launcher first to prevent files from being recreated during cleanup.
  • Expecting an immediate performance boost: A fresh cache may make the next session slower or cause temporary stutter while shaders compile.
  • Removing saved data: Shader caches are not the same as save files, but they can sit near game configuration folders. Target only the cache folder.
  • Assuming every Vulkan app uses the same cache: Driver, launcher, and application caches can be independent, so clearing one may not reset the others.

Conclusion

To clear a Vulkan shader cache on Linux, first close the affected game, identify which driver or launcher owns the cache, and remove only the relevant directory. For Mesa, check the configured XDG cache location and look for mesa_shader_cache or a related cache folder. For Steam, remove the individual game’s directory under steamapps/shadercache. NVIDIA and other driver setups may use different locations, so confirm the path before deleting files.

Once the cache is cleared, let the application rebuild it and expect a slower first launch or brief shader-compilation stutter. If clearing the cache does not fix the problem, investigate the driver, game, or Vulkan runtime rather than deleting additional system folders. A careful, targeted cleanup is the safest way to reset a Linux Vulkan shader cache.


Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.

Shrewdnia

Shrewdnia

Shrewdnia is a destination for curious minds seeking clarity, knowledge, and informed perspectives. Through insightful articles and practical guides our passionate team explores a wide range of topics designed to help readers understand the world around them, make smarter decisions, and stay informed in an ever-changing landscape.


💡 Every question sparks discovery, and every perspective enriches the conversation. Share your thoughts and insights in the comments 👇

Back to blog

Leave a comment

JOIN THE SHREWDNIA COMMUNITY FORUM

What do you think?

Have an opinion, experience, or question about this topic? Join the Shrewdnia Forum and share your thoughts with other readers.

Join the Forum →