diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-07-02 02:47:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-02 02:47:54 +0200 |
commit | 3b46bb73f781a011705ecbc8a1d3207dfb145829 (patch) | |
tree | 1d5d2714c7001775b512bc14ce91a1ebbfc808df /src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs | |
parent | 2457cfc9118a6ebb6008945c919edfd8b46af5e7 (diff) |
[Ryujinx.Graphics.Gpu] Address dotnet-format issues (#5367)1.1.951
* dotnet format style --severity info
Some changes were manually reverted.
* dotnet format analyzers --serverity info
Some changes have been minimally adapted.
* Restore a few unused methods and variables
* Silence dotnet format IDE0060 warnings
* Silence dotnet format IDE0052 warnings
* Address dotnet format CA1816 warnings
* Address or silence dotnet format CA1069 warnings
* Address or silence dotnet format CA2211 warnings
* Address remaining dotnet format analyzer warnings
* Address review comments
* Address most dotnet format whitespace warnings
* Apply dotnet format whitespace formatting
A few of them have been manually reverted and the corresponding warning was silenced
* Format if-blocks correctly
* Run dotnet format whitespace after rebase
* Run dotnet format style after rebase
* Another rebase, another dotnet format run
* Run dotnet format style after rebase
* Run dotnet format after rebase and remove unused usings
- analyzers
- style
- whitespace
* Disable 'prefer switch expression' rule
* Add comments to disabled warnings
* Remove a few unused parameters
* Replace MmeShadowScratch with Array256<uint>
* Simplify properties and array initialization, Use const when possible, Remove trailing commas
* Start working on disabled warnings
* Fix and silence a few dotnet-format warnings again
* Run dotnet format after rebase
* Address IDE0251 warnings
* Silence IDE0060 in .editorconfig
* Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas"
This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e.
* dotnet format whitespace after rebase
* First pass of dotnet format
* Add unsafe dotnet format changes
* Fix typos
* Add trailing commas
* Disable formatting for FormatTable
* Address review feedback
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs index 8df89824..8c2108bf 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs @@ -190,7 +190,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache private readonly BlockingCollection<AsyncProgramTranslation> _asyncTranslationQueue; private readonly SortedList<int, (CachedShaderProgram, byte[])> _programList; - private int _backendParallelCompileThreads; + private readonly int _backendParallelCompileThreads; private int _compiledCount; private int _totalCount; @@ -201,22 +201,21 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// <param name="graphicsCache">Graphics shader cache</param> /// <param name="computeCache">Compute shader cache</param> /// <param name="hostStorage">Disk cache host storage</param> - /// <param name="cancellationToken">Cancellation token</param> /// <param name="stateChangeCallback">Function to be called when there is a state change, reporting state, compiled and total shaders count</param> - public ParallelDiskCacheLoader( - GpuContext context, + /// <param name="cancellationToken">Cancellation token</param> + public ParallelDiskCacheLoader(GpuContext context, ShaderCacheHashTable graphicsCache, ComputeShaderCacheHashTable computeCache, DiskCacheHostStorage hostStorage, - CancellationToken cancellationToken, - Action<ShaderCacheState, int, int> stateChangeCallback) + Action<ShaderCacheState, int, int> stateChangeCallback, + CancellationToken cancellationToken) { _context = context; _graphicsCache = graphicsCache; _computeCache = computeCache; _hostStorage = hostStorage; - _cancellationToken = cancellationToken; _stateChangeCallback = stateChangeCallback; + _cancellationToken = cancellationToken; _validationQueue = new Queue<ProgramEntry>(); _compilationQueue = new ConcurrentQueue<ProgramCompilation>(); _asyncTranslationQueue = new BlockingCollection<AsyncProgramTranslation>(ThreadCount); @@ -235,7 +234,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache { workThreads[index] = new Thread(ProcessAsyncQueue) { - Name = $"GPU.AsyncTranslationThread.{index}" + Name = $"GPU.AsyncTranslationThread.{index}", }; } @@ -367,7 +366,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache { try { - AsyncProgramTranslation asyncTranslation = new AsyncProgramTranslation(guestShaders, specState, programIndex, isCompute); + AsyncProgramTranslation asyncTranslation = new(guestShaders, specState, programIndex, isCompute); _asyncTranslationQueue.Add(asyncTranslation, _cancellationToken); } catch (OperationCanceledException) @@ -491,7 +490,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache { ShaderSource[] shaderSources = new ShaderSource[compilation.TranslatedStages.Length]; - ShaderInfoBuilder shaderInfoBuilder = new ShaderInfoBuilder(_context, compilation.SpecializationState.TransformFeedbackDescriptors != null); + ShaderInfoBuilder shaderInfoBuilder = new(_context, compilation.SpecializationState.TransformFeedbackDescriptors != null); for (int index = 0; index < compilation.TranslatedStages.Length; index++) { @@ -502,7 +501,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache ShaderInfo shaderInfo = shaderInfoBuilder.Build(compilation.SpecializationState.PipelineState, fromCache: true); IProgram hostProgram = _context.Renderer.CreateProgram(shaderSources, shaderInfo); - CachedShaderProgram program = new CachedShaderProgram(hostProgram, compilation.SpecializationState, compilation.Shaders); + CachedShaderProgram program = new(hostProgram, compilation.SpecializationState, compilation.Shaders); // Vulkan's binary code is the SPIR-V used for compilation, so it is ready immediately. Other APIs get this after compilation. byte[] binaryCode = _context.Capabilities.Api == TargetApi.Vulkan ? ShaderBinarySerializer.Pack(shaderSources) : null; @@ -589,12 +588,12 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// <param name="programIndex">Program index</param> private void RecompileGraphicsFromGuestCode(GuestCodeAndCbData?[] guestShaders, ShaderSpecializationState specState, int programIndex) { - ShaderSpecializationState newSpecState = new ShaderSpecializationState( + ShaderSpecializationState newSpecState = new( ref specState.GraphicsState, specState.PipelineState, specState.TransformFeedbackDescriptors); - ResourceCounts counts = new ResourceCounts(); + ResourceCounts counts = new(); TranslatorContext[] translatorContexts = new TranslatorContext[Constants.ShaderStages + 1]; TranslatorContext nextStage = null; @@ -610,7 +609,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache byte[] guestCode = shader.Code; byte[] cb1Data = shader.Cb1Data; - DiskCacheGpuAccessor gpuAccessor = new DiskCacheGpuAccessor(_context, guestCode, cb1Data, specState, newSpecState, counts, stageIndex); + DiskCacheGpuAccessor gpuAccessor = new(_context, guestCode, cb1Data, specState, newSpecState, counts, stageIndex); TranslatorContext currentStage = DecodeGraphicsShader(gpuAccessor, api, DefaultFlags, 0); if (nextStage != null) @@ -623,7 +622,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache byte[] guestCodeA = guestShaders[0].Value.Code; byte[] cb1DataA = guestShaders[0].Value.Cb1Data; - DiskCacheGpuAccessor gpuAccessorA = new DiskCacheGpuAccessor(_context, guestCodeA, cb1DataA, specState, newSpecState, counts, 0); + DiskCacheGpuAccessor gpuAccessorA = new(_context, guestCodeA, cb1DataA, specState, newSpecState, counts, 0); translatorContexts[0] = DecodeGraphicsShader(gpuAccessorA, api, DefaultFlags | TranslationFlags.VertexA, 0); } @@ -638,7 +637,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache } CachedShaderStage[] shaders = new CachedShaderStage[guestShaders.Length]; - List<ShaderProgram> translatedStages = new List<ShaderProgram>(); + List<ShaderProgram> translatedStages = new(); TranslatorContext previousStage = null; @@ -699,9 +698,9 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache private void RecompileComputeFromGuestCode(GuestCodeAndCbData?[] guestShaders, ShaderSpecializationState specState, int programIndex) { GuestCodeAndCbData shader = guestShaders[0].Value; - ResourceCounts counts = new ResourceCounts(); - ShaderSpecializationState newSpecState = new ShaderSpecializationState(ref specState.ComputeState); - DiskCacheGpuAccessor gpuAccessor = new DiskCacheGpuAccessor(_context, shader.Code, shader.Cb1Data, specState, newSpecState, counts, 0); + ResourceCounts counts = new(); + ShaderSpecializationState newSpecState = new(ref specState.ComputeState); + DiskCacheGpuAccessor gpuAccessor = new(_context, shader.Code, shader.Cb1Data, specState, newSpecState, counts, 0); TranslatorContext translatorContext = DecodeComputeShader(gpuAccessor, _context.Capabilities.Api, 0); @@ -721,4 +720,4 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache _stateChangeCallback(ShaderCacheState.Loading, ++_compiledCount, _totalCount); } } -}
\ No newline at end of file +} |