From eb528ae0f05f057e671eb9e92f44f1caa9bcc84b Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Mon, 24 Jul 2023 18:35:04 +0200 Subject: [PATCH] Add workflow to automatically check code style issues for PRs (#4670) * Add workflow to perform automated checks for PRs * Downgrade Microsoft.CodeAnalysis to 4.4.0 This is a workaround to fix issues with dotnet-format. See: - https://github.com/dotnet/format/issues/1805 - https://github.com/dotnet/format/issues/1800 * Adjust editorconfig to be more compatible with Ryujinx code-style * Adjust .editorconfig line endings to match .gitattributes * Disable 'prefer switch expression' rule * Remove naming styles These are the default rules, so we don't need to override them. * Silence IDE0060 in .editorconfig * Slightly adjust .editorconfig * Add lost workflow changes * Move .editorconfig comment to the top * .editorconfig: private static readonly fields should be _lowerCamelCase * .editorconfig: Remove alignment for declarations as well * editorconfig: Add rule for local constants * Disable CA1822 for HLE services * Disable CA1822 for ViewModels Bindings won't work with static members, but this issue is silently ignored. * Run dotnet format for the whole solution * Check result code of SDL_GetDisplayBounds * Fix dotnet format style issues * Add missing trailing commas * Update Microsoft.CodeAnalysis.CSharp to 4.6.0 Skipping 4.5.0 since it breaks dotnet format * Restore old default naming rules for dotnet format * Add naming rule exception for CPU tests * checks: Include all files before excluding paths * Fix dotnet format issues * Check dotnet format version * checks: Run dotnet format with severity info again * checks: Disable naming style rules until they won't crash the process anymore * Remove unread private member * checks: Attempt to run analyzers 3 times before giving up * checks: Enable naming style rules again with the new retry logic --- .editorconfig | 78 ++++++++++++++----- .github/workflows/build.yml | 13 +--- .github/workflows/checks.yml | 71 +++++++++++++++++ .github/workflows/nightly_pr_comment.yml | 4 +- Directory.Packages.props | 2 +- .../Decoders/OpCode32SimdCvtFFixed.cs | 2 +- .../OpenALHardwareDeviceDriver.cs | 2 +- .../OpenALHardwareDeviceSession.cs | 2 +- .../SDL2HardwareDeviceDriver.cs | 3 +- .../Native/SoundIoBackend.cs | 2 +- .../Native/SoundIoDeviceAim.cs | 2 +- src/Ryujinx.Ava/UI/Helpers/Glyph.cs | 2 +- src/Ryujinx.Common/AsyncWorkQueue.cs | 2 +- .../Configuration/BackendThreading.cs | 2 +- .../Configuration/GraphicsBackend.cs | 2 +- .../Configuration/GraphicsDebugLevel.cs | 2 +- .../Motion/MotionInputBackendType.cs | 2 +- .../Configuration/MemoryManagerMode.cs | 2 +- .../GraphicsDriver/NVAPI/Nvapi.cs | 2 +- src/Ryujinx.Common/Logging/LogLevel.cs | 2 +- src/Ryujinx.Cpu/AddressSpace.cs | 6 +- src/Ryujinx.Cpu/AppleHv/Arm/ApFlags.cs | 2 +- src/Ryujinx.Graphics.Device/SizeCalculator.cs | 2 +- .../Multithreading/ThreadedRenderer.cs | 2 +- .../Memory/SupportBufferUpdater.cs | 4 +- src/Ryujinx.Graphics.Gpu/Window.cs | 6 +- src/Ryujinx.Graphics.Host1x/ClassId.cs | 2 +- src/Ryujinx.Graphics.Host1x/Host1xClass.cs | 2 +- src/Ryujinx.Graphics.Host1x/OpCode.cs | 2 +- src/Ryujinx.Graphics.Host1x/ThiDevice.cs | 2 +- .../H264/SpsAndPpsReconstruction.cs | 4 +- .../Native/AVLog.cs | 2 +- .../Native/FFmpegApi.cs | 2 +- src/Ryujinx.Graphics.Nvdec/NvdecDevice.cs | 2 +- .../Types/H264/PictureInfo.cs | 2 +- .../Types/Vp8/PictureInfo.cs | 2 +- .../Types/Vp9/FrameFlags.cs | 2 +- .../Types/Vp9/PictureInfo.cs | 2 +- src/Ryujinx.Graphics.OpenGL/EnumConversion.cs | 2 +- src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs | 2 +- src/Ryujinx.Graphics.OpenGL/Image/Sampler.cs | 2 +- .../Image/TextureCopyIncompatible.cs | 6 +- .../Image/TextureCopyMS.cs | 2 +- .../Image/TextureView.cs | 6 +- src/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs | 2 +- src/Ryujinx.Graphics.OpenGL/Pipeline.cs | 3 +- .../Queries/CounterQueue.cs | 6 +- .../Queries/Counters.cs | 4 +- src/Ryujinx.Graphics.OpenGL/ResourcePool.cs | 2 +- src/Ryujinx.Graphics.OpenGL/Sync.cs | 2 +- .../BufferDescriptor.cs | 2 +- .../CodeGen/Glsl/OperandManager.cs | 2 +- .../CodeGen/Spirv/Declarations.cs | 9 +-- .../StructuredIr/TextureDefinition.cs | 2 +- .../TextureDescriptor.cs | 2 +- .../Translation/ResourceManager.cs | 2 +- .../Astc/AstcDecoder.cs | 4 +- .../Astc/IntegerEncoded.cs | 8 +- src/Ryujinx.Graphics.Texture/ETC2Decoder.cs | 6 +- .../Encoders/BC7Encoder.cs | 4 +- .../Encoders/EncodeMode.cs | 2 +- .../LayoutConverter.cs | 8 +- .../Utils/BC67Tables.cs | 22 +++--- .../Utils/BC67Utils.cs | 2 +- .../Utils/RgbaColor8.cs | 2 +- .../Image/SurfaceReader.cs | 2 +- .../Types/DeinterlaceMode.cs | 2 +- src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs | 2 +- src/Ryujinx.Graphics.Vic/Types/PixelFormat.cs | 2 +- src/Ryujinx.Graphics.Vic/VicDevice.cs | 2 +- src/Ryujinx.Graphics.Video/FrameField.cs | 2 +- src/Ryujinx.Graphics.Vulkan/PipelineBase.cs | 2 + .../Services/Mii/Types/RandomMiiConstants.cs | 2 +- .../Nfc/Nfp/NfpManager/Types/DeviceType.cs | 2 +- .../OpenGL/OpenGLWindow.cs | 11 ++- src/Ryujinx.Horizon.Common/ResultNames.cs | 2 +- .../Hipc/CommandArgType.cs | 2 +- .../Hipc/HipcGenerator.cs | 2 +- .../SyscallGenerator.cs | 2 +- .../Sdk/OsTypes/Impl/MultiWaitImpl.cs | 2 +- .../MultiRegionTrackingTests.cs | 4 +- src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs | 2 +- src/Ryujinx/Ui/MainWindow.cs | 2 +- src/Spv.Generator/Instruction.cs | 2 +- 84 files changed, 252 insertions(+), 160 deletions(-) create mode 100644 .github/workflows/checks.yml diff --git a/.editorconfig b/.editorconfig index 8a30542875..e5a5e6174c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,8 +1,7 @@ # Remove the line below if you want to inherit .editorconfig settings from higher directories root = true -# C# files -[*.cs] +[*] #### Core EditorConfig Options #### @@ -12,8 +11,11 @@ indent_style = space tab_width = 4 # New line preferences -end_of_line = crlf -insert_final_newline = false +end_of_line = lf +insert_final_newline = true + +# C# files +[*.cs] #### .NET Coding Conventions #### @@ -59,7 +61,7 @@ dotnet_style_prefer_simplified_interpolation = true:suggestion dotnet_style_readonly_field = true:suggestion # Parameter preferences -dotnet_code_quality_unused_parameters = all:suggestion +dotnet_code_quality_unused_parameters = all:silent #### C# Coding Conventions #### @@ -85,7 +87,7 @@ csharp_style_expression_bodied_properties = true:silent # Pattern matching preferences csharp_style_pattern_matching_over_as_with_null_check = true:suggestion csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion -csharp_style_prefer_switch_expression = true:suggestion +csharp_style_prefer_switch_expression = false:silent # Null-checking preferences csharp_style_conditional_delegate_call = true:suggestion @@ -94,6 +96,7 @@ csharp_style_conditional_delegate_call = true:suggestion csharp_prefer_static_local_function = true:suggestion csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent csharp_style_prefer_readonly_struct = true +csharp_style_prefer_method_group_conversion = true # Code-block preferences csharp_prefer_braces = true:silent @@ -109,6 +112,7 @@ csharp_style_prefer_range_operator = true:suggestion csharp_style_throw_expression = true:suggestion csharp_style_unused_value_assignment_preference = discard_variable:suggestion csharp_style_unused_value_expression_statement_preference = discard_variable:silent +csharp_style_implicit_object_creation_when_type_is_apparent = true # 'using' directive preferences csharp_using_directive_placement = outside_namespace:silent @@ -140,7 +144,6 @@ csharp_space_after_dot = false csharp_space_after_keywords_in_control_flow_statements = true csharp_space_after_semicolon_in_for_statement = true csharp_space_around_binary_operators = before_and_after -csharp_space_around_declaration_statements = false csharp_space_before_colon_in_inheritance_clause = true csharp_space_before_comma = false csharp_space_before_dot = false @@ -158,23 +161,31 @@ csharp_space_between_square_brackets = false # Wrapping preferences csharp_preserve_single_line_blocks = true -csharp_preserve_single_line_statements = true +csharp_preserve_single_line_statements = false #### Naming styles #### # Naming rules -dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion -dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface -dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i +dotnet_naming_rule.interfaces_should_be_prefixed_with_I.severity = suggestion +dotnet_naming_rule.interfaces_should_be_prefixed_with_I.symbols = interface +dotnet_naming_rule.interfaces_should_be_prefixed_with_I.style = IPascalCase dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion dotnet_naming_rule.types_should_be_pascal_case.symbols = types -dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.types_should_be_pascal_case.style = PascalCase dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members -dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = PascalCase + +dotnet_naming_rule.private_static_readonly_fields_should_be_camel_case_and_prefixed_with__.symbols = private_static_readonly_fields +dotnet_naming_rule.private_static_readonly_fields_should_be_camel_case_and_prefixed_with__.severity = suggestion +dotnet_naming_rule.private_static_readonly_fields_should_be_camel_case_and_prefixed_with__.style = _camelCase + +dotnet_naming_rule.local_constants_should_be_pascal_case.symbols = local_constants +dotnet_naming_rule.local_constants_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.local_constants_should_be_pascal_case.style = PascalCase # Symbol specifications @@ -190,14 +201,39 @@ dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, meth dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.non_field_members.required_modifiers = +dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private +dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static, readonly + +dotnet_naming_symbols.local_constants.applicable_kinds = local +dotnet_naming_symbols.local_constants.applicable_accessibilities = local +dotnet_naming_symbols.local_constants.required_modifiers = const + # Naming styles -dotnet_naming_style.pascal_case.required_prefix = -dotnet_naming_style.pascal_case.required_suffix = -dotnet_naming_style.pascal_case.word_separator = -dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_naming_style._camelCase.required_prefix = _ +dotnet_naming_style._camelCase.required_suffix = +dotnet_naming_style._camelCase.word_separator = +dotnet_naming_style._camelCase.capitalization = camel_case -dotnet_naming_style.begins_with_i.required_prefix = I -dotnet_naming_style.begins_with_i.required_suffix = -dotnet_naming_style.begins_with_i.word_separator = -dotnet_naming_style.begins_with_i.capitalization = pascal_case \ No newline at end of file +dotnet_naming_style.PascalCase.required_prefix = +dotnet_naming_style.PascalCase.required_suffix = +dotnet_naming_style.PascalCase.word_separator = +dotnet_naming_style.PascalCase.capitalization = pascal_case + +dotnet_naming_style.IPascalCase.required_prefix = I +dotnet_naming_style.IPascalCase.required_suffix = +dotnet_naming_style.IPascalCase.word_separator = +dotnet_naming_style.IPascalCase.capitalization = pascal_case + +[src/Ryujinx.HLE/HOS/Services/**.cs] +# Disable "mark members as static" rule for services +dotnet_diagnostic.CA1822.severity = none + +[src/Ryujinx.Ava/UI/ViewModels/**.cs] +# Disable "mark members as static" rule for ViewModels +dotnet_diagnostic.CA1822.severity = none + +[src/Ryujinx.Tests/Cpu/*.cs] +# Disable naming rules for CPU tests +dotnet_diagnostic.IDE1006.severity = none diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf8fd000a8..c93fd0d305 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,19 +1,10 @@ name: Build job on: - workflow_dispatch: - inputs: {} - pull_request: - branches: [ master ] - paths-ignore: - - '.github/**' - - '*.yml' - - '*.json' - - '*.config' - - 'README.md' + workflow_call: concurrency: - group: pr-checks-${{ github.event.number }} + group: pr-builds-${{ github.event.number }} cancel-in-progress: true env: diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000000..c34d196f20 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,71 @@ +name: Perform checks + +on: + pull_request: + branches: [ master ] + paths: + - '**' + - '!.github/**' + - '!*.yml' + - '!*.config' + - '!README.md' + - '.github/workflows/*.yml' + +permissions: + pull-requests: write + checks: write + +concurrency: + group: pr-checks-${{ github.event.number }} + cancel-in-progress: true + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: actions/setup-dotnet@v3 + with: + global-json-file: global.json + + - run: dotnet restore + + - name: Print dotnet format version + run: dotnet format --version + + - name: Run dotnet format whitespace + run: | + dotnet format whitespace --verify-no-changes --report ./whitespace-report.json -v d + + - name: Run dotnet format style + run: | + dotnet format style --severity info --verify-no-changes --report ./style-report.json -v d + + # For some reason this step sometimes fails with exit code 139 (segfault?), + # so should that be the case we'll try again (3 tries max). + - name: Run dotnet format analyzers + run: | + attempt=0 + exit_code=139 + until [ $attempt -ge 3 ] || [ $exit_code -ne 139 ]; do + ((attempt+=1)) + exit_code=0 + echo "Attempt: ${attempt}/3" + dotnet format analyzers --severity info --verify-no-changes --report ./analyzers-report.json -v d || exit_code=$? + done + exit $exit_code + + - name: Upload report + if: failure() + uses: actions/upload-artifact@v3 + with: + name: dotnet-format + path: ./*-report.json + + pr_build: + uses: ./.github/workflows/build.yml + needs: format + secrets: inherit diff --git a/.github/workflows/nightly_pr_comment.yml b/.github/workflows/nightly_pr_comment.yml index deabae6700..f59a6be1fb 100644 --- a/.github/workflows/nightly_pr_comment.yml +++ b/.github/workflows/nightly_pr_comment.yml @@ -1,8 +1,10 @@ name: Comment PR artifacts links + on: workflow_run: - workflows: ['Build job'] + workflows: ['Perform checks'] types: [completed] + jobs: pr_comment: if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' diff --git a/Directory.Packages.props b/Directory.Packages.props index 4b6bb19179..bc740afcf2 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -20,7 +20,7 @@ - + diff --git a/src/ARMeilleure/Decoders/OpCode32SimdCvtFFixed.cs b/src/ARMeilleure/Decoders/OpCode32SimdCvtFFixed.cs index f8564d0e5b..32faad1ecd 100644 --- a/src/ARMeilleure/Decoders/OpCode32SimdCvtFFixed.cs +++ b/src/ARMeilleure/Decoders/OpCode32SimdCvtFFixed.cs @@ -20,4 +20,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceDriver.cs b/src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceDriver.cs index 92946900f7..86a2efa404 100644 --- a/src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceDriver.cs +++ b/src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceDriver.cs @@ -31,7 +31,7 @@ namespace Ryujinx.Audio.Backends.OpenAL _stillRunning = true; _updaterThread = new Thread(Update) { - Name = "HardwareDeviceDriver.OpenAL" + Name = "HardwareDeviceDriver.OpenAL", }; _updaterThread.Start(); diff --git a/src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceSession.cs b/src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceSession.cs index 4a2d521feb..ee177c3110 100644 --- a/src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceSession.cs +++ b/src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceSession.cs @@ -67,7 +67,7 @@ namespace Ryujinx.Audio.Backends.OpenAL { DriverIdentifier = buffer.DataPointer, BufferId = AL.GenBuffer(), - SampleCount = GetSampleCount(buffer) + SampleCount = GetSampleCount(buffer), }; AL.BufferData(driverBuffer.BufferId, _targetFormat, buffer.Data, (int)RequestedSampleRate); diff --git a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs index 550cc3491d..f1de42b016 100644 --- a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs +++ b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Concurrent; using System.Runtime.InteropServices; using System.Threading; - using static Ryujinx.Audio.Integration.IHardwareDeviceDriver; using static SDL2.SDL; @@ -111,7 +110,7 @@ namespace Ryujinx.Audio.Backends.SDL2 channels = (byte)requestedChannelCount, format = GetSDL2Format(requestedSampleFormat), freq = (int)requestedSampleRate, - samples = (ushort)sampleCount + samples = (ushort)sampleCount, }; } diff --git a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoBackend.cs b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoBackend.cs index 4e9123a0f6..7094b7d5b6 100644 --- a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoBackend.cs +++ b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoBackend.cs @@ -8,6 +8,6 @@ Alsa = 3, CoreAudio = 4, Wasapi = 5, - Dummy = 6 + Dummy = 6, } } diff --git a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoDeviceAim.cs b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoDeviceAim.cs index a0689d6d6e..a1943810db 100644 --- a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoDeviceAim.cs +++ b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoDeviceAim.cs @@ -3,6 +3,6 @@ public enum SoundIoDeviceAim { SoundIoDeviceAimInput = 0, - SoundIoDeviceAimOutput = 1 + SoundIoDeviceAimOutput = 1, } } diff --git a/src/Ryujinx.Ava/UI/Helpers/Glyph.cs b/src/Ryujinx.Ava/UI/Helpers/Glyph.cs index 4aae854f7c..e30de69bb1 100644 --- a/src/Ryujinx.Ava/UI/Helpers/Glyph.cs +++ b/src/Ryujinx.Ava/UI/Helpers/Glyph.cs @@ -4,6 +4,6 @@ { List, Grid, - Chip + Chip, } } diff --git a/src/Ryujinx.Common/AsyncWorkQueue.cs b/src/Ryujinx.Common/AsyncWorkQueue.cs index 746ef4cace..e9f7589851 100644 --- a/src/Ryujinx.Common/AsyncWorkQueue.cs +++ b/src/Ryujinx.Common/AsyncWorkQueue.cs @@ -25,7 +25,7 @@ namespace Ryujinx.Common _workerThread = new Thread(DoWork) { Name = name, - IsBackground = true + IsBackground = true, }; _workerThread.Start(); } diff --git a/src/Ryujinx.Common/Configuration/BackendThreading.cs b/src/Ryujinx.Common/Configuration/BackendThreading.cs index 8833b3f074..44aa422e41 100644 --- a/src/Ryujinx.Common/Configuration/BackendThreading.cs +++ b/src/Ryujinx.Common/Configuration/BackendThreading.cs @@ -8,6 +8,6 @@ namespace Ryujinx.Common.Configuration { Auto, Off, - On + On, } } diff --git a/src/Ryujinx.Common/Configuration/GraphicsBackend.cs b/src/Ryujinx.Common/Configuration/GraphicsBackend.cs index d74dd6e198..8957c5ccc2 100644 --- a/src/Ryujinx.Common/Configuration/GraphicsBackend.cs +++ b/src/Ryujinx.Common/Configuration/GraphicsBackend.cs @@ -7,6 +7,6 @@ namespace Ryujinx.Common.Configuration public enum GraphicsBackend { Vulkan, - OpenGl + OpenGl, } } diff --git a/src/Ryujinx.Common/Configuration/GraphicsDebugLevel.cs b/src/Ryujinx.Common/Configuration/GraphicsDebugLevel.cs index ad12302a63..dfe28405c7 100644 --- a/src/Ryujinx.Common/Configuration/GraphicsDebugLevel.cs +++ b/src/Ryujinx.Common/Configuration/GraphicsDebugLevel.cs @@ -9,6 +9,6 @@ namespace Ryujinx.Common.Configuration None, Error, Slowdowns, - All + All, } } diff --git a/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/MotionInputBackendType.cs b/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/MotionInputBackendType.cs index c65510478a..fac4e0f7af 100644 --- a/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/MotionInputBackendType.cs +++ b/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/MotionInputBackendType.cs @@ -8,6 +8,6 @@ namespace Ryujinx.Common.Configuration.Hid.Controller.Motion { Invalid, GamepadDriver, - CemuHook + CemuHook, } } diff --git a/src/Ryujinx.Common/Configuration/MemoryManagerMode.cs b/src/Ryujinx.Common/Configuration/MemoryManagerMode.cs index f10fd6f1bc..8b7150b5c4 100644 --- a/src/Ryujinx.Common/Configuration/MemoryManagerMode.cs +++ b/src/Ryujinx.Common/Configuration/MemoryManagerMode.cs @@ -8,6 +8,6 @@ namespace Ryujinx.Common.Configuration { SoftwarePageTable, HostMapped, - HostMappedUnsafe + HostMappedUnsafe, } } diff --git a/src/Ryujinx.Common/GraphicsDriver/NVAPI/Nvapi.cs b/src/Ryujinx.Common/GraphicsDriver/NVAPI/Nvapi.cs index 99eaa68f46..60b9455c78 100644 --- a/src/Ryujinx.Common/GraphicsDriver/NVAPI/Nvapi.cs +++ b/src/Ryujinx.Common/GraphicsDriver/NVAPI/Nvapi.cs @@ -6,6 +6,6 @@ OglThreadControlDefault = 0, OglThreadControlEnable = 1, - OglThreadControlDisable = 2 + OglThreadControlDisable = 2, } } diff --git a/src/Ryujinx.Common/Logging/LogLevel.cs b/src/Ryujinx.Common/Logging/LogLevel.cs index 3786c7561e..54261cee56 100644 --- a/src/Ryujinx.Common/Logging/LogLevel.cs +++ b/src/Ryujinx.Common/Logging/LogLevel.cs @@ -14,6 +14,6 @@ namespace Ryujinx.Common.Logging Guest, AccessLog, Notice, - Trace + Trace, } } diff --git a/src/Ryujinx.Cpu/AddressSpace.cs b/src/Ryujinx.Cpu/AddressSpace.cs index c467eb6228..beea14beec 100644 --- a/src/Ryujinx.Cpu/AddressSpace.cs +++ b/src/Ryujinx.Cpu/AddressSpace.cs @@ -179,7 +179,7 @@ namespace Ryujinx.Cpu { addressSpace = null; - const MemoryAllocationFlags asFlags = MemoryAllocationFlags.Reserve | MemoryAllocationFlags.ViewCompatible; + const MemoryAllocationFlags AsFlags = MemoryAllocationFlags.Reserve | MemoryAllocationFlags.ViewCompatible; ulong minAddressSpaceSize = Math.Min(asSize, 1UL << 36); @@ -191,8 +191,8 @@ namespace Ryujinx.Cpu try { - baseMemory = new MemoryBlock(addressSpaceSize, asFlags); - mirrorMemory = new MemoryBlock(addressSpaceSize, asFlags); + baseMemory = new MemoryBlock(addressSpaceSize, AsFlags); + mirrorMemory = new MemoryBlock(addressSpaceSize, AsFlags); addressSpace = new AddressSpace(backingMemory, baseMemory, mirrorMemory, addressSpaceSize, supports4KBPages); break; diff --git a/src/Ryujinx.Cpu/AppleHv/Arm/ApFlags.cs b/src/Ryujinx.Cpu/AppleHv/Arm/ApFlags.cs index 95e6743276..8935f52472 100644 --- a/src/Ryujinx.Cpu/AppleHv/Arm/ApFlags.cs +++ b/src/Ryujinx.Cpu/AppleHv/Arm/ApFlags.cs @@ -22,6 +22,6 @@ namespace Ryujinx.Cpu.AppleHv.Arm UserNoneKernelReadWrite = (1UL << (int)PxnShift) | (1UL << (int)UxnShift) | (0UL << (int)ApShift), UserNoneKernelRead = (1UL << (int)PxnShift) | (1UL << (int)UxnShift) | (2UL << (int)ApShift), - UserReadKernelRead = (1UL << (int)PxnShift) | (1UL << (int)UxnShift) | (3UL << (int)ApShift) + UserReadKernelRead = (1UL << (int)PxnShift) | (1UL << (int)UxnShift) | (3UL << (int)ApShift), } } diff --git a/src/Ryujinx.Graphics.Device/SizeCalculator.cs b/src/Ryujinx.Graphics.Device/SizeCalculator.cs index 7409c04185..d5697fe5e3 100644 --- a/src/Ryujinx.Graphics.Device/SizeCalculator.cs +++ b/src/Ryujinx.Graphics.Device/SizeCalculator.cs @@ -56,7 +56,7 @@ namespace Ryujinx.Graphics.Device TypeCode.Double => sizeof(double), TypeCode.Decimal => sizeof(decimal), TypeCode.Boolean => sizeof(bool), - _ => throw new ArgumentException($"Length for type \"{type.Name}\" is unknown.") + _ => throw new ArgumentException($"Length for type \"{type.Name}\" is unknown."), }; } } diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs index e59a3928bb..b11ccb0a35 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs @@ -412,7 +412,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading public ICounterEvent ReportCounter(CounterType type, EventHandler resultHandler, float divisor, bool hostReserved) { - ThreadedCounterEvent evt = new ThreadedCounterEvent(this, type, _lastSampleCounterClear); + ThreadedCounterEvent evt = new(this, type, _lastSampleCounterClear); New().Set(Ref(evt), type, Ref(resultHandler), divisor, hostReserved); QueueCommand(); diff --git a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs index 3ea37c55af..50c042fb96 100644 --- a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs +++ b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs @@ -187,7 +187,7 @@ namespace Ryujinx.Graphics.Gpu.Memory X = scale * 2f / viewportWidth, Y = scale * 2f / viewportHeight, Z = 1, - W = disableTransformF + W = disableTransformF, }); } } @@ -210,7 +210,7 @@ namespace Ryujinx.Graphics.Gpu.Memory ReadOnlySpan data = MemoryMarshal.Cast(MemoryMarshal.CreateSpan(ref _data, 1)); - _renderer.SetBufferData(_handle, _startOffset, data.Slice(_startOffset, _endOffset - _startOffset)); + _renderer.SetBufferData(_handle, _startOffset, data[_startOffset.._endOffset]); _startOffset = -1; _endOffset = -1; diff --git a/src/Ryujinx.Graphics.Gpu/Window.cs b/src/Ryujinx.Graphics.Gpu/Window.cs index 89addc8a81..1f94122d81 100644 --- a/src/Ryujinx.Graphics.Gpu/Window.cs +++ b/src/Ryujinx.Graphics.Gpu/Window.cs @@ -8,8 +8,6 @@ using System.Threading; namespace Ryujinx.Graphics.Gpu { - using Texture = Image.Texture; - /// /// GPU image presentation window. /// @@ -202,13 +200,13 @@ namespace Ryujinx.Graphics.Gpu { pt.AcquireCallback(_context, pt.UserObj); - Texture texture = pt.Cache.FindOrCreateTexture(null, TextureSearchFlags.WithUpscale, pt.Info, 0, pt.Range); + Image.Texture texture = pt.Cache.FindOrCreateTexture(null, TextureSearchFlags.WithUpscale, pt.Info, 0, pt.Range); pt.Cache.Tick(); texture.SynchronizeMemory(); - ImageCrop crop = new ImageCrop( + ImageCrop crop = new( (int)(pt.Crop.Left * texture.ScaleFactor), (int)MathF.Ceiling(pt.Crop.Right * texture.ScaleFactor), (int)(pt.Crop.Top * texture.ScaleFactor), diff --git a/src/Ryujinx.Graphics.Host1x/ClassId.cs b/src/Ryujinx.Graphics.Host1x/ClassId.cs index dfeadd4c42..6da461ef86 100644 --- a/src/Ryujinx.Graphics.Host1x/ClassId.cs +++ b/src/Ryujinx.Graphics.Host1x/ClassId.cs @@ -15,6 +15,6 @@ Tsec = 0xe0, Tsecb = 0xe1, Nvjpg = 0xc0, - Nvdec = 0xf0 + Nvdec = 0xf0, } } diff --git a/src/Ryujinx.Graphics.Host1x/Host1xClass.cs b/src/Ryujinx.Graphics.Host1x/Host1xClass.cs index 1a1297f911..6f5ba32560 100644 --- a/src/Ryujinx.Graphics.Host1x/Host1xClass.cs +++ b/src/Ryujinx.Graphics.Host1x/Host1xClass.cs @@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Host1x _syncMgr = syncMgr; _state = new DeviceState(new Dictionary { - { nameof(Host1xClassRegisters.WaitSyncpt32), new RwCallback(WaitSyncpt32, null) } + { nameof(Host1xClassRegisters.WaitSyncpt32), new RwCallback(WaitSyncpt32, null) }, }); } diff --git a/src/Ryujinx.Graphics.Host1x/OpCode.cs b/src/Ryujinx.Graphics.Host1x/OpCode.cs index 2ec6034b38..39b19b1d18 100644 --- a/src/Ryujinx.Graphics.Host1x/OpCode.cs +++ b/src/Ryujinx.Graphics.Host1x/OpCode.cs @@ -16,6 +16,6 @@ NonIncrW, GatherW, RestartW, - Extend + Extend, } } diff --git a/src/Ryujinx.Graphics.Host1x/ThiDevice.cs b/src/Ryujinx.Graphics.Host1x/ThiDevice.cs index 259c883662..ecdf0f75c0 100644 --- a/src/Ryujinx.Graphics.Host1x/ThiDevice.cs +++ b/src/Ryujinx.Graphics.Host1x/ThiDevice.cs @@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Host1x _state = new DeviceState(new Dictionary { { nameof(ThiRegisters.IncrSyncpt), new RwCallback(IncrSyncpt, null) }, - { nameof(ThiRegisters.Method1), new RwCallback(Method1, null) } + { nameof(ThiRegisters.Method1), new RwCallback(Method1, null) }, }); _previousContextId = -1; diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs index d8bf6f7461..82c5932b7e 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs @@ -127,7 +127,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, - 53, 60, 61, 54, 47, 55, 62, 63 + 53, 60, 61, 54, 47, 55, 62, 63, }; private static ReadOnlySpan ZigZagScan => new byte[] @@ -135,7 +135,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264 0 + 0 * 4, 1 + 0 * 4, 0 + 1 * 4, 0 + 2 * 4, 1 + 1 * 4, 2 + 0 * 4, 3 + 0 * 4, 2 + 1 * 4, 1 + 2 * 4, 0 + 3 * 4, 1 + 3 * 4, 2 + 2 * 4, - 3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4 + 3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4, }; private static void WriteScalingList(ref H264BitStreamWriter writer, IArray list) diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVLog.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVLog.cs index 4224de9eb9..fda014a888 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVLog.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/AVLog.cs @@ -10,6 +10,6 @@ Verbose = 40, Debug = 48, Trace = 56, - MaxOffset = 64 + MaxOffset = 64, } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFmpegApi.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFmpegApi.cs index 262d26431a..e04b1fc49a 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFmpegApi.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFmpegApi.cs @@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native private static readonly Dictionary _librariesWhitelist = new() { { AvCodecLibraryName, (58, 59) }, - { AvUtilLibraryName, (56, 57) } + { AvUtilLibraryName, (56, 57) }, }; private static string FormatLibraryNameForCurrentOs(string libraryName, int version) diff --git a/src/Ryujinx.Graphics.Nvdec/NvdecDevice.cs b/src/Ryujinx.Graphics.Nvdec/NvdecDevice.cs index 4ab7886d00..833ee2d420 100644 --- a/src/Ryujinx.Graphics.Nvdec/NvdecDevice.cs +++ b/src/Ryujinx.Graphics.Nvdec/NvdecDevice.cs @@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Nvdec _rm = new ResourceManager(gmm, new SurfaceCache(gmm)); _state = new DeviceState(new Dictionary { - { nameof(NvdecRegisters.Execute), new RwCallback(Execute, null) } + { nameof(NvdecRegisters.Execute), new RwCallback(Execute, null) }, }); _contexts = new ConcurrentDictionary(); } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs index c0e0a463d5..aff88a965f 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs @@ -116,7 +116,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 FrameType = 0, PicWidthInMbsMinus1 = PicWidthInMbs - 1, PicHeightInMapUnitsMinus1 = (PicHeightInMbs >> (FrameMbsOnlyFlag != 0 ? 0 : 1)) - 1, - QpprimeYZeroTransformBypassFlag = QpprimeYZeroTransformBypassFlag + QpprimeYZeroTransformBypassFlag = QpprimeYZeroTransformBypassFlag, }; } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs index 76e07a3ff0..1c4e36c90e 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp8/PictureInfo.cs @@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp8 FirstPartSize = FirstPartSize, Version = Version, FrameWidth = FrameWidth, - FrameHeight = FrameHeight + FrameHeight = FrameHeight, }; } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameFlags.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameFlags.cs index 88f1ac205f..9666208110 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameFlags.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/FrameFlags.cs @@ -7,6 +7,6 @@ FrameSizeChanged = 1 << 2, ErrorResilientMode = 1 << 3, LastShowFrame = 1 << 4, - IntraOnly = 1 << 5 + IntraOnly = 1 << 5, } } diff --git a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs index 50569dbffa..371680dee0 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/Vp9/PictureInfo.cs @@ -80,7 +80,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9 SegmentFeatureData = Seg.FeatureData, ModeRefDeltaEnabled = Lf.ModeRefDeltaEnabled != 0, RefDeltas = Lf.RefDeltas, - ModeDeltas = Lf.ModeDeltas + ModeDeltas = Lf.ModeDeltas, }; } } diff --git a/src/Ryujinx.Graphics.OpenGL/EnumConversion.cs b/src/Ryujinx.Graphics.OpenGL/EnumConversion.cs index c9a1eaa93f..417dc3f60c 100644 --- a/src/Ryujinx.Graphics.OpenGL/EnumConversion.cs +++ b/src/Ryujinx.Graphics.OpenGL/EnumConversion.cs @@ -668,7 +668,7 @@ namespace Ryujinx.Graphics.OpenGL ShaderStage.TessellationEvaluation => ShaderType.TessEvaluationShader, ShaderStage.Geometry => ShaderType.GeometryShader, ShaderStage.Fragment => ShaderType.FragmentShader, - _ => ShaderType.VertexShader + _ => ShaderType.VertexShader, }; } } diff --git a/src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs b/src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs index d7d993459e..617b129ab9 100644 --- a/src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs +++ b/src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs @@ -37,7 +37,7 @@ namespace Ryujinx.Graphics.OpenGL AmdUnix, IntelWindows, IntelUnix, - Nvidia + Nvidia, } private static readonly Lazy _gpuVendor = new(GetGpuVendor); diff --git a/src/Ryujinx.Graphics.OpenGL/Image/Sampler.cs b/src/Ryujinx.Graphics.OpenGL/Image/Sampler.cs index 18dd1b72a3..6cf0482967 100644 --- a/src/Ryujinx.Graphics.OpenGL/Image/Sampler.cs +++ b/src/Ryujinx.Graphics.OpenGL/Image/Sampler.cs @@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.OpenGL.Image info.BorderColor.Red, info.BorderColor.Green, info.BorderColor.Blue, - info.BorderColor.Alpha + info.BorderColor.Alpha, }; GL.SamplerParameter(Handle, SamplerParameterName.TextureBorderColor, borderColor); diff --git a/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyIncompatible.cs b/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyIncompatible.cs index 6b5fb376bb..082e6ccf8b 100644 --- a/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyIncompatible.cs +++ b/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyIncompatible.cs @@ -133,7 +133,7 @@ void main() 1 => SizedInternalFormat.R8ui, 2 => SizedInternalFormat.Rg8ui, 4 => SizedInternalFormat.Rgba8ui, - _ => throw new ArgumentException($"Invalid components count {componentsCount}.") + _ => throw new ArgumentException($"Invalid components count {componentsCount}."), }; } else if (componentSize == 2) @@ -143,7 +143,7 @@ void main() 1 => SizedInternalFormat.R16ui, 2 => SizedInternalFormat.Rg16ui, 4 => SizedInternalFormat.Rgba16ui, - _ => throw new ArgumentException($"Invalid components count {componentsCount}.") + _ => throw new ArgumentException($"Invalid components count {componentsCount}."), }; } else if (componentSize == 4) @@ -153,7 +153,7 @@ void main() 1 => SizedInternalFormat.R32ui, 2 => SizedInternalFormat.Rg32ui, 4 => SizedInternalFormat.Rgba32ui, - _ => throw new ArgumentException($"Invalid components count {componentsCount}.") + _ => throw new ArgumentException($"Invalid components count {componentsCount}."), }; } else diff --git a/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyMS.cs b/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyMS.cs index 39f2327234..0fa6453dc1 100644 --- a/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyMS.cs +++ b/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyMS.cs @@ -173,7 +173,7 @@ void main() 4 => SizedInternalFormat.R32ui, 8 => SizedInternalFormat.Rg32ui, 16 => SizedInternalFormat.Rgba32ui, - _ => throw new ArgumentException($"Invalid bytes per pixel {bytesPerPixel}.") + _ => throw new ArgumentException($"Invalid bytes per pixel {bytesPerPixel}."), }; } diff --git a/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs b/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs index f4b1e0dadb..0f5fe46a5f 100644 --- a/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs +++ b/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs @@ -72,7 +72,7 @@ namespace Ryujinx.Graphics.OpenGL.Image (int)Info.SwizzleR.Convert(), (int)Info.SwizzleG.Convert(), (int)Info.SwizzleB.Convert(), - (int)Info.SwizzleA.Convert() + (int)Info.SwizzleA.Convert(), }; if (Info.Format == Format.A1B5G5R5Unorm) @@ -210,7 +210,7 @@ namespace Ryujinx.Graphics.OpenGL.Image { Target.Texture2DMultisample => Target.Texture2D, Target.Texture2DMultisampleArray => Target.Texture2DArray, - _ => Target + _ => Target, }; TextureView intermmediate = _renderer.TextureCopy.IntermediatePool.GetOrCreateWithAtLeast( @@ -354,7 +354,7 @@ namespace Ryujinx.Graphics.OpenGL.Image TextureTarget.TextureCubeMapArray => (layer / 6) * mipSize, TextureTarget.Texture1DArray => layer * mipSize, TextureTarget.Texture2DArray => layer * mipSize, - _ => 0 + _ => 0, }; } diff --git a/src/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs b/src/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs index 1ad927ea60..47b832f28f 100644 --- a/src/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs +++ b/src/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs @@ -210,7 +210,7 @@ namespace Ryujinx.Graphics.OpenGL GL.Arb.MaxShaderCompilerThreads(Math.Min(Environment.ProcessorCount, 8)); } - _counters.Initialize(_pipeline); + _counters.Initialize(); // This is required to disable [0, 1] clamping for SNorm outputs on compatibility profiles. // This call is expected to fail if we're running with a core profile, diff --git a/src/Ryujinx.Graphics.OpenGL/Pipeline.cs b/src/Ryujinx.Graphics.OpenGL/Pipeline.cs index 85f5b1139f..923c85d7e3 100644 --- a/src/Ryujinx.Graphics.OpenGL/Pipeline.cs +++ b/src/Ryujinx.Graphics.OpenGL/Pipeline.cs @@ -5,7 +5,6 @@ using Ryujinx.Graphics.OpenGL.Image; using Ryujinx.Graphics.OpenGL.Queries; using Ryujinx.Graphics.Shader; using System; -using System.Runtime.CompilerServices; namespace Ryujinx.Graphics.OpenGL { @@ -44,7 +43,7 @@ namespace Ryujinx.Graphics.OpenGL private CounterQueueEvent _activeConditionalRender; - private Vector4[] _fpIsBgra = new Vector4[SupportBuffer.FragmentIsBgraCount]; + private readonly Vector4[] _fpIsBgra = new Vector4[SupportBuffer.FragmentIsBgraCount]; private readonly (TextureBase, Format)[] _images; private TextureBase _unit0Texture; diff --git a/src/Ryujinx.Graphics.OpenGL/Queries/CounterQueue.cs b/src/Ryujinx.Graphics.OpenGL/Queries/CounterQueue.cs index 1724616eaf..c430ffc34d 100644 --- a/src/Ryujinx.Graphics.OpenGL/Queries/CounterQueue.cs +++ b/src/Ryujinx.Graphics.OpenGL/Queries/CounterQueue.cs @@ -13,8 +13,6 @@ namespace Ryujinx.Graphics.OpenGL.Queries public CounterType Type { get; } public bool Disposed { get; private set; } - private readonly Pipeline _pipeline; - private readonly Queue _events = new(); private CounterQueueEvent _current; @@ -30,12 +28,10 @@ namespace Ryujinx.Graphics.OpenGL.Queries private readonly Thread _consumerThread; - internal CounterQueue(Pipeline pipeline, CounterType type) + internal CounterQueue(CounterType type) { Type = type; - _pipeline = pipeline; - QueryTarget glType = GetTarget(Type); _queryPool = new Queue(QueryPoolInitialSize); diff --git a/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs b/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs index 88e8bf917b..1530c9d263 100644 --- a/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs +++ b/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs @@ -14,12 +14,12 @@ namespace Ryujinx.Graphics.OpenGL.Queries _counterQueues = new CounterQueue[count]; } - public void Initialize(Pipeline pipeline) + public void Initialize() { for (int index = 0; index < _counterQueues.Length; index++) { CounterType type = (CounterType)index; - _counterQueues[index] = new CounterQueue(pipeline, type); + _counterQueues[index] = new CounterQueue(type); } } diff --git a/src/Ryujinx.Graphics.OpenGL/ResourcePool.cs b/src/Ryujinx.Graphics.OpenGL/ResourcePool.cs index 43410c99bf..20ef9e87a8 100644 --- a/src/Ryujinx.Graphics.OpenGL/ResourcePool.cs +++ b/src/Ryujinx.Graphics.OpenGL/ResourcePool.cs @@ -41,7 +41,7 @@ namespace Ryujinx.Graphics.OpenGL { Info = view.Info, View = view, - RemainingFrames = DisposedLiveFrames + RemainingFrames = DisposedLiveFrames, }); } } diff --git a/src/Ryujinx.Graphics.OpenGL/Sync.cs b/src/Ryujinx.Graphics.OpenGL/Sync.cs index 54e9c6d3f5..b7ee3d3c10 100644 --- a/src/Ryujinx.Graphics.OpenGL/Sync.cs +++ b/src/Ryujinx.Graphics.OpenGL/Sync.cs @@ -24,7 +24,7 @@ namespace Ryujinx.Graphics.OpenGL SyncHandle handle = new() { ID = id, - Handle = GL.FenceSync(SyncCondition.SyncGpuCommandsComplete, WaitSyncFlags.None) + Handle = GL.FenceSync(SyncCondition.SyncGpuCommandsComplete, WaitSyncFlags.None), }; diff --git a/src/Ryujinx.Graphics.Shader/BufferDescriptor.cs b/src/Ryujinx.Graphics.Shader/BufferDescriptor.cs index d8cad1df8b..ead1c5e67b 100644 --- a/src/Ryujinx.Graphics.Shader/BufferDescriptor.cs +++ b/src/Ryujinx.Graphics.Shader/BufferDescriptor.cs @@ -1,6 +1,6 @@ namespace Ryujinx.Graphics.Shader { - public struct BufferDescriptor + public readonly struct BufferDescriptor { // New fields should be added to the end of the struct to keep disk shader cache compatibility. diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs index 17ffad9a52..9346341f84 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl { class OperandManager { - private Dictionary _locals; + private readonly Dictionary _locals; public OperandManager() { diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs index 2c849cd499..b14fead8a0 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs @@ -13,8 +13,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { static class Declarations { - private static readonly string[] _stagePrefixes = { "cp", "vp", "tcp", "tep", "gp", "fp" }; - public static void DeclareParameters(CodeGenContext context, StructuredFunction function) { DeclareParameters(context, function.InArguments, 0); @@ -192,7 +190,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv SamplerType.Texture3D => Dim.Dim3D, SamplerType.TextureCube => Dim.Cube, SamplerType.TextureBuffer => Dim.Buffer, - _ => throw new InvalidOperationException($"Invalid sampler type \"{sampler.Type & SamplerType.Mask}\".") + _ => throw new InvalidOperationException($"Invalid sampler type \"{sampler.Type & SamplerType.Mask}\"."), }; var imageType = context.TypeImage( @@ -519,10 +517,5 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv : (isOutput ? context.Outputs : context.Inputs); dict.Add(ioDefinition, spvVar); } - - private static string GetStagePrefix(ShaderStage stage) - { - return _stagePrefixes[(int)stage]; - } } } diff --git a/src/Ryujinx.Graphics.Shader/StructuredIr/TextureDefinition.cs b/src/Ryujinx.Graphics.Shader/StructuredIr/TextureDefinition.cs index ba31dae6c6..e45c82854b 100644 --- a/src/Ryujinx.Graphics.Shader/StructuredIr/TextureDefinition.cs +++ b/src/Ryujinx.Graphics.Shader/StructuredIr/TextureDefinition.cs @@ -24,4 +24,4 @@ namespace Ryujinx.Graphics.Shader return new TextureDefinition(Set, Binding, Name, Type, Format, Flags | flag); } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Graphics.Shader/TextureDescriptor.cs b/src/Ryujinx.Graphics.Shader/TextureDescriptor.cs index 58b8e5a513..1130b63b81 100644 --- a/src/Ryujinx.Graphics.Shader/TextureDescriptor.cs +++ b/src/Ryujinx.Graphics.Shader/TextureDescriptor.cs @@ -1,6 +1,6 @@ namespace Ryujinx.Graphics.Shader { - public struct TextureDescriptor + public readonly struct TextureDescriptor { // New fields should be added to the end of the struct to keep disk shader cache compatibility. diff --git a/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs b/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs index 5991cd25d2..555acd35ca 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs @@ -266,7 +266,7 @@ namespace Ryujinx.Graphics.Shader.Translation { AccurateType = accurateType, Type = type, - UsageFlags = usageFlags + UsageFlags = usageFlags, }; int binding; diff --git a/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs b/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs index 6f633e4ae8..1f781d2f88 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs @@ -889,7 +889,7 @@ namespace Ryujinx.Graphics.Texture.Astc 0 => 0, 1 => 32, 2 => 63, - _ => 0 + _ => 0, }; break; @@ -942,7 +942,7 @@ namespace Ryujinx.Graphics.Texture.Astc 2 => 32, 3 => 47, 4 => 63, - _ => 0 + _ => 0, }; break; diff --git a/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs b/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs index 56e78cc364..361140ddd5 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Texture.Astc { JustBits, Quint, - Trit + Trit, } readonly EIntegerEncoding _encoding; @@ -162,7 +162,7 @@ namespace Ryujinx.Graphics.Texture.Astc IntegerEncoded intEncoded = new(EIntegerEncoding.Quint, numberBitsPerValue) { BitValue = m[i], - QuintValue = encodings[i] + QuintValue = encodings[i], }; listIntegerEncoded.Add(ref intEncoded); @@ -309,7 +309,7 @@ namespace Ryujinx.Graphics.Texture.Astc 2, 1, 1, 1, 2, 1, 1, 2, 1, 2, 0, 2, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 1, 2, 1, 2, 0, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 1, 2, 2, 2 + 2, 1, 2, 2, 2, }; private static ReadOnlySpan QuintEncodings => new byte[] @@ -339,7 +339,7 @@ namespace Ryujinx.Graphics.Texture.Astc 0, 1, 4, 1, 1, 4, 0, 2, 3, 1, 2, 3, 2, 2, 3, 3, 2, 3, 4, 2, 3, 2, 4, 3, 0, 2, 4, 1, 2, 4, 0, 3, 3, 1, 3, 3, 2, 3, 3, 3, 3, 3, 4, 3, 3, - 3, 4, 3, 0, 3, 4, 1, 3, 4 + 3, 4, 3, 0, 3, 4, 1, 3, 4, }; } } diff --git a/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs b/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs index 21ff4be4b7..57f2e98d08 100644 --- a/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs +++ b/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs @@ -21,12 +21,12 @@ namespace Ryujinx.Graphics.Texture new int[] { 18, 60, -18, -60 }, new int[] { 24, 80, -24, -80 }, new int[] { 33, 106, -33, -106 }, - new int[] { 47, 183, -47, -183 } + new int[] { 47, 183, -47, -183 }, }; private static readonly int[] _etc2Lut = { - 3, 6, 11, 16, 23, 32, 41, 64 + 3, 6, 11, 16, 23, 32, 41, 64, }; private static readonly int[][] _etc2AlphaLut = @@ -46,7 +46,7 @@ namespace Ryujinx.Graphics.Texture new int[] { -3, -4, -7, -10, 2, 3, 6, 9 }, new int[] { -1, -2, -3, -10, 0, 1, 2, 9 }, new int[] { -4, -6, -8, -9, 3, 5, 7, 8 }, - new int[] { -3, -5, -7, -9, 2, 4, 6, 8 } + new int[] { -3, -5, -7, -9, 2, 4, 6, 8 }, }; public static byte[] DecodeRgb(ReadOnlySpan data, int width, int height, int depth, int levels, int layers) diff --git a/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs b/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs index d0d1666a09..21aa225a7a 100644 --- a/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs +++ b/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs @@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Texture.Encoders private static readonly int[] _mostFrequentPartitions = new int[] { - 0, 13, 2, 1, 15, 14, 10, 23 + 0, 13, 2, 1, 15, 14, 10, 23, }; private static Block CompressBlock(ReadOnlySpan data, int x, int y, int width, int height, bool fastMode) @@ -233,7 +233,7 @@ namespace Ryujinx.Graphics.Texture.Encoders 1 => new RgbaColor8(255, 0, 0, 0).ToUInt32(), 2 => new RgbaColor8(0, 255, 0, 0).ToUInt32(), 3 => new RgbaColor8(0, 0, 255, 0).ToUInt32(), - _ => new RgbaColor8(0, 0, 0, 255).ToUInt32() + _ => new RgbaColor8(0, 0, 0, 255).ToUInt32(), }; } else diff --git a/src/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs b/src/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs index 5734d301e3..8db3b3c0d0 100644 --- a/src/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs +++ b/src/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs @@ -5,6 +5,6 @@ Fast, Exhaustive, ModeMask = 0xff, - Multithreaded = 1 << 8 + Multithreaded = 1 << 8, } } diff --git a/src/Ryujinx.Graphics.Texture/LayoutConverter.cs b/src/Ryujinx.Graphics.Texture/LayoutConverter.cs index 0f7c304e04..d9a666c3f0 100644 --- a/src/Ryujinx.Graphics.Texture/LayoutConverter.cs +++ b/src/Ryujinx.Graphics.Texture/LayoutConverter.cs @@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.Texture 8 => Convert(dst, data), 12 => Convert(dst, data), 16 => Convert>(dst, data), - _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format.") + _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."), }; } @@ -240,7 +240,7 @@ namespace Ryujinx.Graphics.Texture 8 => Convert(output, data), 12 => Convert(output, data), 16 => Convert>(output, data), - _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format.") + _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."), }; } return output; @@ -359,7 +359,7 @@ namespace Ryujinx.Graphics.Texture 8 => Convert(dst, data), 12 => Convert(dst, data), 16 => Convert>(dst, data), - _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format.") + _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."), }; } @@ -504,7 +504,7 @@ namespace Ryujinx.Graphics.Texture 8 => Convert(output, data), 12 => Convert(output, data), 16 => Convert>(output, data), - _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format.") + _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."), }; } diff --git a/src/Ryujinx.Graphics.Texture/Utils/BC67Tables.cs b/src/Ryujinx.Graphics.Texture/Utils/BC67Tables.cs index d890652cbb..f1745d2350 100644 --- a/src/Ryujinx.Graphics.Texture/Utils/BC67Tables.cs +++ b/src/Ryujinx.Graphics.Texture/Utils/BC67Tables.cs @@ -11,21 +11,21 @@ new BC7ModeInfo(1, 0, 0, 2, 1, 2, 3, 5, 6), new BC7ModeInfo(1, 0, 0, 2, 0, 2, 2, 7, 8), new BC7ModeInfo(1, 0, 2, 0, 0, 4, 0, 7, 7), - new BC7ModeInfo(2, 6, 4, 0, 0, 2, 0, 5, 5) + new BC7ModeInfo(2, 6, 4, 0, 0, 2, 0, 5, 5), }; public static readonly byte[][] Weights = { new byte[] { 0, 21, 43, 64 }, new byte[] { 0, 9, 18, 27, 37, 46, 55, 64 }, - new byte[] { 0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 60, 64 } + new byte[] { 0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 60, 64 }, }; public static readonly byte[][] InverseWeights = { new byte[] { 64, 43, 21, 0 }, new byte[] { 64, 55, 46, 37, 27, 18, 9, 0 }, - new byte[] { 64, 60, 55, 51, 47, 43, 38, 34, 30, 26, 21, 17, 13, 9, 4, 0 } + new byte[] { 64, 60, 55, 51, 47, 43, 38, 34, 30, 26, 21, 17, 13, 9, 4, 0 }, }; public static readonly byte[][][] FixUpIndices = new byte[3][][] @@ -47,7 +47,7 @@ new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, - new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 } + new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, }, new byte[64][] { @@ -66,7 +66,7 @@ new byte[] { 0, 6, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 6, 0 }, new byte[] { 0, 8, 0 }, new byte[] { 0, 15, 0 }, new byte[] { 0, 15, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 15, 0 }, new byte[] { 0, 15, 0 }, new byte[] { 0, 15, 0 }, new byte[] { 0, 15, 0 }, - new byte[] { 0, 15, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 15, 0 } + new byte[] { 0, 15, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 15, 0 }, }, new byte[64][] { @@ -85,8 +85,8 @@ new byte[] { 0, 3, 15 }, new byte[] { 0, 15, 3 }, new byte[] { 0, 5, 15 }, new byte[] { 0, 5, 15 }, new byte[] { 0, 5, 15 }, new byte[] { 0, 8, 15 }, new byte[] { 0, 5, 15 }, new byte[] { 0, 10, 15 }, new byte[] { 0, 5, 15 }, new byte[] { 0, 10, 15 }, new byte[] { 0, 8, 15 }, new byte[] { 0, 13, 15 }, - new byte[] { 0, 15, 3 }, new byte[] { 0, 12, 15 }, new byte[] { 0, 3, 15 }, new byte[] { 0, 3, 8 } - } + new byte[] { 0, 15, 3 }, new byte[] { 0, 12, 15 }, new byte[] { 0, 3, 15 }, new byte[] { 0, 3, 8 }, + }, }; public static readonly byte[][][] PartitionTable = new byte[3][][] @@ -156,7 +156,7 @@ new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 60 new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 61 new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 62 - new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } // 63 + new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 63 }, new byte[64][] { @@ -223,7 +223,7 @@ new byte[16] { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, // 60 new byte[16] { 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, // 61 new byte[16] { 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0 }, // 62 - new byte[16] { 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1 } // 63 + new byte[16] { 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1 }, // 63 }, new byte[64][] { @@ -290,8 +290,8 @@ new byte[16] { 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1 }, // 60 new byte[16] { 0, 2, 2, 2, 1, 2, 2, 2, 0, 2, 2, 2, 1, 2, 2, 2 }, // 61 new byte[16] { 0, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, // 62 - new byte[16] { 0, 1, 1, 1, 2, 0, 1, 1, 2, 2, 0, 1, 2, 2, 2, 0 } // 63 - } + new byte[16] { 0, 1, 1, 1, 2, 0, 1, 1, 2, 2, 0, 1, 2, 2, 2, 0 }, // 63 + }, }; } } diff --git a/src/Ryujinx.Graphics.Texture/Utils/BC67Utils.cs b/src/Ryujinx.Graphics.Texture/Utils/BC67Utils.cs index 3f69cb4c17..0916cc2ca1 100644 --- a/src/Ryujinx.Graphics.Texture/Utils/BC67Utils.cs +++ b/src/Ryujinx.Graphics.Texture/Utils/BC67Utils.cs @@ -1199,7 +1199,7 @@ namespace Ryujinx.Graphics.Texture.Utils RgbaColor32 weightV = new(colorWeight) { - A = alphaWeight + A = alphaWeight, }; RgbaColor32 invWeightV = new RgbaColor32(64) - weightV; diff --git a/src/Ryujinx.Graphics.Texture/Utils/RgbaColor8.cs b/src/Ryujinx.Graphics.Texture/Utils/RgbaColor8.cs index 401bec387d..eced3d75f4 100644 --- a/src/Ryujinx.Graphics.Texture/Utils/RgbaColor8.cs +++ b/src/Ryujinx.Graphics.Texture/Utils/RgbaColor8.cs @@ -77,7 +77,7 @@ namespace Ryujinx.Graphics.Texture.Utils 1 => G, 2 => B, 3 => A, - _ => throw new ArgumentOutOfRangeException(nameof(index)) + _ => throw new ArgumentOutOfRangeException(nameof(index)), }; } } diff --git a/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs b/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs index 079b4ef121..5175d911a3 100644 --- a/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs +++ b/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs @@ -417,7 +417,7 @@ namespace Ryujinx.Graphics.Vic.Image 0 => offsets.LumaOffset, 1 => offsets.ChromaUOffset, 2 => offsets.ChromaVOffset, - _ => throw new ArgumentOutOfRangeException(nameof(plane)) + _ => throw new ArgumentOutOfRangeException(nameof(plane)), }; } diff --git a/src/Ryujinx.Graphics.Vic/Types/DeinterlaceMode.cs b/src/Ryujinx.Graphics.Vic/Types/DeinterlaceMode.cs index 216995b393..f1b729f089 100644 --- a/src/Ryujinx.Graphics.Vic/Types/DeinterlaceMode.cs +++ b/src/Ryujinx.Graphics.Vic/Types/DeinterlaceMode.cs @@ -7,6 +7,6 @@ namespace Ryujinx.Graphics.Vic.Types Bob, NewBob, Disi1, - WeaveLumaBobFieldChroma + WeaveLumaBobFieldChroma, } } diff --git a/src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs b/src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs index f6007f924a..b8f821631d 100644 --- a/src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs +++ b/src/Ryujinx.Graphics.Vic/Types/FrameFormat.cs @@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Vic.Types TopFieldChromaBottom, BottomFieldChromaTop, SubPicTopFieldChromaBottom, - SubPicBottomFieldChromaTop + SubPicBottomFieldChromaTop, } static class FrameFormatExtensions diff --git a/src/Ryujinx.Graphics.Vic/Types/PixelFormat.cs b/src/Ryujinx.Graphics.Vic/Types/PixelFormat.cs index 72dc789945..8f5eda8b68 100644 --- a/src/Ryujinx.Graphics.Vic/Types/PixelFormat.cs +++ b/src/Ryujinx.Graphics.Vic/Types/PixelFormat.cs @@ -76,6 +76,6 @@ Y8___U8___V8_N422R, Y8___U8___V8_N420, U8, - V8 + V8, } } diff --git a/src/Ryujinx.Graphics.Vic/VicDevice.cs b/src/Ryujinx.Graphics.Vic/VicDevice.cs index b2bc98d81d..5053c0cc5f 100644 --- a/src/Ryujinx.Graphics.Vic/VicDevice.cs +++ b/src/Ryujinx.Graphics.Vic/VicDevice.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Vic _rm = new ResourceManager(gmm, new BufferPool(), new BufferPool()); _state = new DeviceState(new Dictionary { - { nameof(VicRegisters.Execute), new RwCallback(Execute, null) } + { nameof(VicRegisters.Execute), new RwCallback(Execute, null) }, }); } diff --git a/src/Ryujinx.Graphics.Video/FrameField.cs b/src/Ryujinx.Graphics.Video/FrameField.cs index eafd74e079..dbfd5c4466 100644 --- a/src/Ryujinx.Graphics.Video/FrameField.cs +++ b/src/Ryujinx.Graphics.Video/FrameField.cs @@ -3,6 +3,6 @@ namespace Ryujinx.Graphics.Video public enum FrameField { Progressive, - Interlaced + Interlaced, } } diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index b0bc1d0d07..8b931e526c 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -709,12 +709,14 @@ namespace Ryujinx.Graphics.Vulkan return CommandBuffer.Handle == cb.Handle; } +#pragma warning disable CA1822 // Mark member as static public void SetAlphaTest(bool enable, float reference, CompareOp op) { // This is currently handled using shader specialization, as Vulkan does not support alpha test. // In the future, we may want to use this to write the reference value into the support buffer, // to avoid creating one version of the shader per reference value used. } +#pragma warning restore CA1822 public void SetBlendState(AdvancedBlendDescriptor blend) { diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs index 5599d0dfc0..590f0f01e4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs @@ -321,7 +321,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - , }; + }; private static ReadOnlySpan RandomMiiFacelineColorRawArray => new byte[] { diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/Types/DeviceType.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/Types/DeviceType.cs index 44c8a79a4a..17b09eb786 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/Types/DeviceType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/Types/DeviceType.cs @@ -2,6 +2,6 @@ { enum DeviceType : uint { - Amiibo + Amiibo, } } diff --git a/src/Ryujinx.Headless.SDL2/OpenGL/OpenGLWindow.cs b/src/Ryujinx.Headless.SDL2/OpenGL/OpenGLWindow.cs index 355dcf6c7a..a2b26bbc58 100644 --- a/src/Ryujinx.Headless.SDL2/OpenGL/OpenGLWindow.cs +++ b/src/Ryujinx.Headless.SDL2/OpenGL/OpenGLWindow.cs @@ -155,13 +155,18 @@ namespace Ryujinx.Headless.SDL2.OpenGL { // NOTE: grabbing the main display's dimensions directly as OpenGL doesn't scale along like the VulkanWindow. // we might have to amend this if people run this on a non-primary display set to a different resolution. - SDL_Rect displayBounds; - SDL_GetDisplayBounds(0, out displayBounds); + if (SDL_GetDisplayBounds(0, out SDL_Rect displayBounds) < 0) + { + Logger.Warning?.Print(LogClass.Application, $"Could not retrieve display bounds: {SDL_GetError()}"); + + // Fallback to defaults + displayBounds.w = DefaultWidth; + displayBounds.h = DefaultHeight; + } Renderer?.Window.SetSize(displayBounds.w, displayBounds.h); MouseDriver.SetClientSize(displayBounds.w, displayBounds.h); } - else { Renderer?.Window.SetSize(DefaultWidth, DefaultHeight); diff --git a/src/Ryujinx.Horizon.Common/ResultNames.cs b/src/Ryujinx.Horizon.Common/ResultNames.cs index 84058cf2c2..55a33d6807 100644 --- a/src/Ryujinx.Horizon.Common/ResultNames.cs +++ b/src/Ryujinx.Horizon.Common/ResultNames.cs @@ -1690,7 +1690,7 @@ namespace Ryujinx.Horizon.Common { 0x821AC, "InvalidPackage1" }, { 0x823AC, "InvalidPackage1SectionSize" }, { 0x825AC, "InvalidPackage1MarikoBodySize" }, - { 0x827AC, "InvalidPackage1Pk11Size" } + { 0x827AC, "InvalidPackage1Pk11Size" }, }; public static bool TryGet(int errorCode, out string name) diff --git a/src/Ryujinx.Horizon.Generators/Hipc/CommandArgType.cs b/src/Ryujinx.Horizon.Generators/Hipc/CommandArgType.cs index b859f1f372..a5e6ec4a01 100644 --- a/src/Ryujinx.Horizon.Generators/Hipc/CommandArgType.cs +++ b/src/Ryujinx.Horizon.Generators/Hipc/CommandArgType.cs @@ -13,6 +13,6 @@ OutCopyHandle, OutMoveHandle, OutObject, - ProcessId + ProcessId, } } diff --git a/src/Ryujinx.Horizon.Generators/Hipc/HipcGenerator.cs b/src/Ryujinx.Horizon.Generators/Hipc/HipcGenerator.cs index 47b3c8cfb2..1b92e91808 100644 --- a/src/Ryujinx.Horizon.Generators/Hipc/HipcGenerator.cs +++ b/src/Ryujinx.Horizon.Generators/Hipc/HipcGenerator.cs @@ -36,7 +36,7 @@ namespace Ryujinx.Horizon.Generators.Hipc None, Ref, Out, - In + In, } private readonly struct OutParameter diff --git a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs index 75f966f398..638b2ea8f3 100644 --- a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs +++ b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs @@ -40,7 +40,7 @@ namespace Ryujinx.Horizon.Kernel.Generators $"{TypeKernelResultName}.TimedOut", $"{TypeKernelResultName}.Cancelled", $"{TypeKernelResultName}.PortRemoteClosed", - $"{TypeKernelResultName}.InvalidState" + $"{TypeKernelResultName}.InvalidState", }; private readonly struct OutParameter diff --git a/src/Ryujinx.Horizon/Sdk/OsTypes/Impl/MultiWaitImpl.cs b/src/Ryujinx.Horizon/Sdk/OsTypes/Impl/MultiWaitImpl.cs index ad57152cbb..057aac890a 100644 --- a/src/Ryujinx.Horizon/Sdk/OsTypes/Impl/MultiWaitImpl.cs +++ b/src/Ryujinx.Horizon/Sdk/OsTypes/Impl/MultiWaitImpl.cs @@ -168,7 +168,7 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl long minTime = endTime; - foreach (MultiWaitHolder holder in _multiWaits) + foreach (MultiWaitHolderBase holder in _multiWaits) { long currentTime = holder.GetAbsoluteTimeToWakeup(); diff --git a/src/Ryujinx.Tests.Memory/MultiRegionTrackingTests.cs b/src/Ryujinx.Tests.Memory/MultiRegionTrackingTests.cs index a975712934..564ebd8061 100644 --- a/src/Ryujinx.Tests.Memory/MultiRegionTrackingTests.cs +++ b/src/Ryujinx.Tests.Memory/MultiRegionTrackingTests.cs @@ -337,7 +337,7 @@ namespace Ryujinx.Tests.Memory { granular.GetHandles(), singlePages, - doublePages + doublePages, }; MultiRegionHandle combined = _tracking.BeginGranularTracking(0, PageSize * 18, handleGroups.SelectMany((handles) => handles), PageSize, 0); @@ -349,7 +349,7 @@ namespace Ryujinx.Tests.Memory true, true, // Gap. false, true, false, // Individual handles. false, false, true, true, false, false, // Double size handles. - true // Gap. + true, // Gap. }; for (int i = 0; i < 18; i++) diff --git a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs index 6532beab8d..245487771a 100644 --- a/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs +++ b/src/Ryujinx.Tests.Unicorn/UnicornAArch32.cs @@ -159,7 +159,7 @@ namespace Ryujinx.Tests.Unicorn Arm.UC_ARM_REG_Q12, Arm.UC_ARM_REG_Q13, Arm.UC_ARM_REG_Q14, - Arm.UC_ARM_REG_Q15 + Arm.UC_ARM_REG_Q15, }; #pragma warning restore IDE0051, IDE0052 diff --git a/src/Ryujinx/Ui/MainWindow.cs b/src/Ryujinx/Ui/MainWindow.cs index a022b55356..8f562a83bb 100644 --- a/src/Ryujinx/Ui/MainWindow.cs +++ b/src/Ryujinx/Ui/MainWindow.cs @@ -1914,4 +1914,4 @@ namespace Ryujinx.Ui UpdateGameTable(); } } -} \ No newline at end of file +} diff --git a/src/Spv.Generator/Instruction.cs b/src/Spv.Generator/Instruction.cs index 1c92d49919..27250e0f94 100644 --- a/src/Spv.Generator/Instruction.cs +++ b/src/Spv.Generator/Instruction.cs @@ -234,7 +234,7 @@ namespace Spv.Generator { { Specification.Op.OpConstant, new [] { "Value" } }, { Specification.Op.OpTypeInt, new [] { "Width", "Signed" } }, - { Specification.Op.OpTypeFloat, new [] { "Width" } } + { Specification.Op.OpTypeFloat, new [] { "Width" } }, }; public override string ToString()