コード例 #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);
            }
        }
コード例 #2
0
ファイル: ShaderCache.cs プロジェクト: Xpl0itR/Ryujinx
        /// <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);
            }
        }