62 std::filesystem::path
path;
180 std::optional<ShaderCacheInfo>
getCacheInfo(
const std::filesystem::path& path)
const;
201 const std::filesystem::path& winePrefix = {},
202 uint32_t steamAppId = 0)
const;
209 std::optional<ShaderCacheInfo>
findDXVKCache(
const std::filesystem::path& winePrefix)
const;
216 std::optional<ShaderCacheInfo>
findVKD3DCache(
const std::filesystem::path& winePrefix)
const;
278 const std::filesystem::path& winePrefix = {},
279 uint32_t steamAppId = 0);
308 std::filesystem::path
backupCache(
const std::filesystem::path& cachePath,
309 const std::filesystem::path& backupDir = {});
317 bool restoreCache(
const std::filesystem::path& backupPath,
318 const std::filesystem::path& targetPath);
370 std::optional<ShaderCacheType>
identifyCacheType(
const std::filesystem::path& path)
const;
381 std::unique_ptr<Impl> impl_;
384 void scanMesaCaches();
385 void scanNVIDIACaches();
386 void scanDXVKCaches();
387 void scanVKD3DCaches();
388 void scanSteamCaches();
389 void scanFossilizeCaches();
390 void scanWineStateCaches();
392 int64_t calculateDirectorySize(
const std::filesystem::path& path)
const;
393 int countFiles(
const std::filesystem::path& path)
const;
std::optional< ShaderCacheInfo > findSteamShaderCache(uint32_t steamAppId) const
Find Steam shader cache for a game.
std::vector< ShaderCacheInfo > getCachesByType(ShaderCacheType type) const
Get caches by type.
std::filesystem::path backupCache(const std::filesystem::path &cachePath, const std::filesystem::path &backupDir={})
Backup a shader cache before clearing.
std::filesystem::path getBackupDirectory() const
Get the backup directory.
void setBackupDirectory(const std::filesystem::path &path)
Set the backup directory.
std::optional< ShaderCacheType > identifyCacheType(const std::filesystem::path &path) const
Check if a path is a valid shader cache.
CacheClearResult clearCache(const std::filesystem::path &cachePath)
Clear a specific cache.
int scanCaches(const ProgressCallback &progressCallback=nullptr)
Scan for all shader caches on the system.
int64_t getTotalCacheSize() const
Get total cache size.
void addCustomCacheLocation(const std::filesystem::path &path, ShaderCacheType type)
Add a custom cache location to scan.
std::vector< std::filesystem::path > getDefaultCacheLocations(ShaderCacheType type) const
Get the default cache location for a type.
void setSteamLibraryPaths(const std::vector< std::filesystem::path > &paths)
Set Steam library paths.
ShaderCacheStats getStats() const
Get overall shader cache statistics.
CacheClearResult clearCachesByType(ShaderCacheType type, const ProgressCallback &progressCallback=nullptr)
Clear all caches of a specific type.
CacheClearResult clearAllCaches(const ProgressCallback &progressCallback=nullptr)
Clear all shader caches (use with caution!).
std::optional< ShaderCacheInfo > findDXVKCache(const std::filesystem::path &winePrefix) const
Find DXVK cache for a game.
std::vector< std::filesystem::path > getCacheBackups() const
Get list of cache backups.
std::optional< ShaderCacheInfo > findVKD3DCache(const std::filesystem::path &winePrefix) const
Find VKD3D cache for a game.
GameShaderCache getGameCache(const std::string &gameId, const std::filesystem::path &winePrefix={}, uint32_t steamAppId=0) const
Get shader caches for a specific game.
int64_t getCacheSizeByType(ShaderCacheType type) const
Get cache size by type.
int pruneBackups(int keepCount=3)
Delete old cache backups.
std::function< void(int percent, const std::string &status)> ProgressCallback
std::optional< ShaderCacheInfo > getCacheInfo(const std::filesystem::path &path) const
Get cache info for a specific path.
std::vector< ShaderCacheInfo > getAllCaches() const
Get all detected shader caches.
CacheClearResult clearGameCache(const std::string &gameId, ShaderCacheType type=ShaderCacheType::All, const std::filesystem::path &winePrefix={}, uint32_t steamAppId=0)
Clear shader cache for a specific game.
bool restoreCache(const std::filesystem::path &backupPath, const std::filesystem::path &targetPath)
Restore a shader cache from backup.
CacheClearResult clearStaleCaches(std::chrono::hours olderThan=std::chrono::hours(720), const ProgressCallback &progressCallback=nullptr)
Clear old/stale caches.
ShaderCacheType
Types of shader caches.
@ WineState
Wine/Proton state cache.
@ Fossilize
Fossilize pipeline cache.
@ Mesa
Mesa (AMD/Intel) GLCache and shader_cache.
@ NVIDIA
NVIDIA proprietary driver cache.
@ DXVK
DXVK Vulkan-based D3D implementation.
@ VKD3D
VKD3D-Proton D3D12 implementation.
@ SteamShader
Steam's shader pre-caching.
std::string shaderCacheTypeName(ShaderCacheType type)
Get human-readable cache type name.
Result of a cache clearing operation.
std::vector< std::string > errors
std::string getFormattedBytesCleared() const
Shader cache information for a specific game.
std::string getFormattedTotalSize() const
std::vector< ShaderCacheInfo > caches
Information about a shader cache.
bool exists
Whether the cache exists.
std::string name
Human-readable name.
int64_t size
Size in bytes.
int fileCount
Number of cache files.
std::string getTypeName() const
std::chrono::system_clock::time_point lastModified
std::string getFormattedSize() const
std::filesystem::path path
Path to cache directory/file.
Overall shader cache statistics.
std::string getFormattedTotalSize() const