/// <summary> /// Creates a new instance of the shader cache. /// </summary> /// <param name="context">GPU context that the shader cache belongs to</param> public ShaderCache(GpuContext context) { _context = context; _dumper = new ShaderDumper(); _cpPrograms = new Dictionary <ulong, CachedShaderProgram>(); _gpPrograms = new Dictionary <ShaderAddresses, CachedShaderProgram>(); _programsToSaveQueue = new Queue <ProgramToSave>(); string diskCacheTitleId = GetDiskCachePath(); _computeShaderCache = new ComputeShaderCacheHashTable(); _graphicsShaderCache = new ShaderCacheHashTable(); _diskCacheHostStorage = new DiskCacheHostStorage(diskCacheTitleId); if (_diskCacheHostStorage.CacheEnabled) { _cacheWriter = new BackgroundDiskCacheWriter(context, _diskCacheHostStorage); } }
/// <summary> /// Creates a new instance of the shader cache. /// </summary> /// <param name="context">GPU context that the shader cache belongs to</param> public ShaderCache(GpuContext context) { _context = context; _dumper = new ShaderDumper(); _cpPrograms = new Dictionary <ulong, CachedShaderProgram>(); _gpPrograms = new Dictionary <ShaderAddresses, CachedShaderProgram>(); _programsToSaveQueue = new Queue <ProgramToSave>(); string diskCacheTitleId = GraphicsConfig.EnableShaderCache && GraphicsConfig.TitleId != null ? CacheHelper.GetBaseCacheDirectory(GraphicsConfig.TitleId) : null; _computeShaderCache = new ComputeShaderCacheHashTable(); _graphicsShaderCache = new ShaderCacheHashTable(); _diskCacheHostStorage = new DiskCacheHostStorage(diskCacheTitleId); if (_diskCacheHostStorage.CacheEnabled) { _cacheWriter = new BackgroundDiskCacheWriter(context, _diskCacheHostStorage); } }