Beispiel #1
0
        /// <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);
            }
        }
Beispiel #2
0
        /// <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);
            }
        }