diff --git a/Ryujinx.Common/Utilities/EmbeddedResources.cs b/Ryujinx.Common/Utilities/EmbeddedResources.cs index caa171873b..97f349c192 100644 --- a/Ryujinx.Common/Utilities/EmbeddedResources.cs +++ b/Ryujinx.Common/Utilities/EmbeddedResources.cs @@ -33,7 +33,9 @@ namespace Ryujinx.Common using (var stream = GetStream(assembly, filename)) { if (stream == null) + { return null; + } using (var mem = new MemoryStream()) { @@ -49,7 +51,9 @@ namespace Ryujinx.Common using (var stream = GetStream(assembly, filename)) { if (stream == null) + { return null; + } using (var mem = new MemoryStream()) { @@ -79,7 +83,9 @@ namespace Ryujinx.Common using (var stream = GetStream(assembly, filename)) { if (stream == null) + { return null; + } using (var reader = new StreamReader(stream)) { @@ -93,7 +99,9 @@ namespace Ryujinx.Common using (var stream = GetStream(assembly, filename)) { if (stream == null) + { return null; + } using (var reader = new StreamReader(stream)) { @@ -104,7 +112,7 @@ namespace Ryujinx.Common public static Stream GetStream(string filename) { - var (assembly, path) = ResolveManifestPath(filename); + var (assembly, _) = ResolveManifestPath(filename); return GetStream(assembly, filename); } @@ -116,9 +124,6 @@ namespace Ryujinx.Common var stream = assembly.GetManifestResourceStream(manifestUri); - if (stream == null) - return null; - return stream; } @@ -131,11 +136,13 @@ namespace Ryujinx.Common foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { if (assembly.GetName().Name == segments[0]) + { return (assembly, segments[1]); + } } } - return (EmbeddedResources.ResourceAssembly, filename); + return (ResourceAssembly, filename); } } } \ No newline at end of file diff --git a/Ryujinx.Graphics.GAL/TextureCreateInfo.cs b/Ryujinx.Graphics.GAL/TextureCreateInfo.cs index 8e8c5ff7e1..d74ac62dd2 100644 --- a/Ryujinx.Graphics.GAL/TextureCreateInfo.cs +++ b/Ryujinx.Graphics.GAL/TextureCreateInfo.cs @@ -61,42 +61,42 @@ namespace Ryujinx.Graphics.GAL SwizzleA = swizzleA; } - public int GetMipSize(int level) + public readonly int GetMipSize(int level) { return GetMipStride(level) * GetLevelHeight(level) * GetLevelDepth(level); } - public int GetMipSize2D(int level) + public readonly int GetMipSize2D(int level) { return GetMipStride(level) * GetLevelHeight(level); } - public int GetMipStride(int level) + public readonly int GetMipStride(int level) { return BitUtils.AlignUp(GetLevelWidth(level) * BytesPerPixel, 4); } - private int GetLevelWidth(int level) + private readonly int GetLevelWidth(int level) { return BitUtils.DivRoundUp(GetLevelSize(Width, level), BlockWidth); } - private int GetLevelHeight(int level) + private readonly int GetLevelHeight(int level) { return BitUtils.DivRoundUp(GetLevelSize(Height, level), BlockHeight); } - private int GetLevelDepth(int level) + private readonly int GetLevelDepth(int level) { return Target == Target.Texture3D ? GetLevelSize(Depth, level) : GetLayers(); } - public int GetDepthOrLayers() + public readonly int GetDepthOrLayers() { return Target == Target.Texture3D ? Depth : GetLayers(); } - public int GetLayers() + public readonly int GetLayers() { if (Target == Target.Texture2DArray || Target == Target.Texture2DMultisampleArray || diff --git a/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs b/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs index 4b6b8fd0a3..173989c388 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs @@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Engine { partial class Methods { - private const int NsToTicksFractionNumerator = 384; + private const int NsToTicksFractionNumerator = 384; private const int NsToTicksFractionDenominator = 625; private ulong _runningCounter; diff --git a/Ryujinx.Graphics.Gpu/State/RtFormat.cs b/Ryujinx.Graphics.Gpu/State/RtFormat.cs index 003da9ed55..ffd2492b64 100644 --- a/Ryujinx.Graphics.Gpu/State/RtFormat.cs +++ b/Ryujinx.Graphics.Gpu/State/RtFormat.cs @@ -81,66 +81,66 @@ namespace Ryujinx.Graphics.Gpu.State { return format switch { - RtFormat.D32Float => new FormatInfo(Format.D32Float, 1, 1, 4), - RtFormat.D16Unorm => new FormatInfo(Format.D16Unorm, 1, 1, 2), - RtFormat.D24UnormS8Uint => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4), - RtFormat.D24Unorm => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4), - RtFormat.S8UintD24Unorm => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4), - RtFormat.S8Uint => new FormatInfo(Format.S8Uint, 1, 1, 1), - RtFormat.D32FloatS8Uint => new FormatInfo(Format.D32FloatS8Uint, 1, 1, 8), + RtFormat.D32Float => new FormatInfo(Format.D32Float, 1, 1, 4), + RtFormat.D16Unorm => new FormatInfo(Format.D16Unorm, 1, 1, 2), + RtFormat.D24UnormS8Uint => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4), + RtFormat.D24Unorm => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4), + RtFormat.S8UintD24Unorm => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4), + RtFormat.S8Uint => new FormatInfo(Format.S8Uint, 1, 1, 1), + RtFormat.D32FloatS8Uint => new FormatInfo(Format.D32FloatS8Uint, 1, 1, 8), RtFormat.R32G32B32A32Float => new FormatInfo(Format.R32G32B32A32Float, 1, 1, 16), - RtFormat.R32G32B32A32Sint => new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16), - RtFormat.R32G32B32A32Uint => new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16), + RtFormat.R32G32B32A32Sint => new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16), + RtFormat.R32G32B32A32Uint => new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16), RtFormat.R32G32B32X32Float => new FormatInfo(Format.R32G32B32A32Float, 1, 1, 16), - RtFormat.R32G32B32X32Sint => new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16), - RtFormat.R32G32B32X32Uint => new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16), + RtFormat.R32G32B32X32Sint => new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16), + RtFormat.R32G32B32X32Uint => new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16), RtFormat.R16G16B16X16Unorm => new FormatInfo(Format.R16G16B16A16Unorm, 1, 1, 8), RtFormat.R16G16B16X16Snorm => new FormatInfo(Format.R16G16B16A16Snorm, 1, 1, 8), - RtFormat.R16G16B16X16Sint => new FormatInfo(Format.R16G16B16A16Sint, 1, 1, 8), - RtFormat.R16G16B16X16Uint => new FormatInfo(Format.R16G16B16A16Uint, 1, 1, 8), + RtFormat.R16G16B16X16Sint => new FormatInfo(Format.R16G16B16A16Sint, 1, 1, 8), + RtFormat.R16G16B16X16Uint => new FormatInfo(Format.R16G16B16A16Uint, 1, 1, 8), RtFormat.R16G16B16A16Float => new FormatInfo(Format.R16G16B16A16Float, 1, 1, 8), - RtFormat.R32G32Float => new FormatInfo(Format.R32G32Float, 1, 1, 8), - RtFormat.R32G32Sint => new FormatInfo(Format.R32G32Sint, 1, 1, 8), - RtFormat.R32G32Uint => new FormatInfo(Format.R32G32Uint, 1, 1, 8), + RtFormat.R32G32Float => new FormatInfo(Format.R32G32Float, 1, 1, 8), + RtFormat.R32G32Sint => new FormatInfo(Format.R32G32Sint, 1, 1, 8), + RtFormat.R32G32Uint => new FormatInfo(Format.R32G32Uint, 1, 1, 8), RtFormat.R16G16B16X16Float => new FormatInfo(Format.R16G16B16A16Float, 1, 1, 8), - RtFormat.B8G8R8A8Unorm => new FormatInfo(Format.B8G8R8A8Unorm, 1, 1, 4), - RtFormat.B8G8R8A8Srgb => new FormatInfo(Format.B8G8R8A8Srgb, 1, 1, 4), - RtFormat.R10G10B10A2Unorm => new FormatInfo(Format.R10G10B10A2Unorm, 1, 1, 4), - RtFormat.R10G10B10A2Uint => new FormatInfo(Format.R10G10B10A2Uint, 1, 1, 4), - RtFormat.R8G8B8A8Unorm => new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4), - RtFormat.R8G8B8A8Srgb => new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4), - RtFormat.R8G8B8X8Snorm => new FormatInfo(Format.R8G8B8A8Snorm, 1, 1, 4), - RtFormat.R8G8B8X8Sint => new FormatInfo(Format.R8G8B8A8Sint, 1, 1, 4), - RtFormat.R8G8B8X8Uint => new FormatInfo(Format.R8G8B8A8Uint, 1, 1, 4), - RtFormat.R16G16Unorm => new FormatInfo(Format.R16G16Unorm, 1, 1, 4), - RtFormat.R16G16Snorm => new FormatInfo(Format.R16G16Snorm, 1, 1, 4), - RtFormat.R16G16Sint => new FormatInfo(Format.R16G16Sint, 1, 1, 4), - RtFormat.R16G16Uint => new FormatInfo(Format.R16G16Uint, 1, 1, 4), - RtFormat.R16G16Float => new FormatInfo(Format.R16G16Float, 1, 1, 4), - RtFormat.R11G11B10Float => new FormatInfo(Format.R11G11B10Float, 1, 1, 4), - RtFormat.R32Sint => new FormatInfo(Format.R32Sint, 1, 1, 4), - RtFormat.R32Uint => new FormatInfo(Format.R32Uint, 1, 1, 4), - RtFormat.R32Float => new FormatInfo(Format.R32Float, 1, 1, 4), - RtFormat.B8G8R8X8Unorm => new FormatInfo(Format.B8G8R8A8Unorm, 1, 1, 4), - RtFormat.B8G8R8X8Srgb => new FormatInfo(Format.B8G8R8A8Srgb, 1, 1, 4), - RtFormat.B5G6R5Unorm => new FormatInfo(Format.B5G6R5Unorm, 1, 1, 2), - RtFormat.B5G5R5A1Unorm => new FormatInfo(Format.B5G5R5A1Unorm, 1, 1, 2), - RtFormat.R8G8Unorm => new FormatInfo(Format.R8G8Unorm, 1, 1, 2), - RtFormat.R8G8Snorm => new FormatInfo(Format.R8G8Snorm, 1, 1, 2), - RtFormat.R8G8Sint => new FormatInfo(Format.R8G8Sint, 1, 1, 2), - RtFormat.R8G8Uint => new FormatInfo(Format.R8G8Uint, 1, 1, 2), - RtFormat.R16Unorm => new FormatInfo(Format.R16Unorm, 1, 1, 2), - RtFormat.R16Snorm => new FormatInfo(Format.R16Snorm, 1, 1, 2), - RtFormat.R16Sint => new FormatInfo(Format.R16Sint, 1, 1, 2), - RtFormat.R16Uint => new FormatInfo(Format.R16Uint, 1, 1, 2), - RtFormat.R16Float => new FormatInfo(Format.R16Float, 1, 1, 2), - RtFormat.R8Unorm => new FormatInfo(Format.R8Unorm, 1, 1, 1), - RtFormat.R8Snorm => new FormatInfo(Format.R8Snorm, 1, 1, 1), - RtFormat.R8Sint => new FormatInfo(Format.R8Sint, 1, 1, 1), - RtFormat.R8Uint => new FormatInfo(Format.R8Uint, 1, 1, 1), - RtFormat.B5G5R5X1Unorm => new FormatInfo(Format.B5G5R5X1Unorm, 1, 1, 2), - RtFormat.R8G8B8X8Unorm => new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4), - RtFormat.R8G8B8X8Srgb => new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4), + RtFormat.B8G8R8A8Unorm => new FormatInfo(Format.B8G8R8A8Unorm, 1, 1, 4), + RtFormat.B8G8R8A8Srgb => new FormatInfo(Format.B8G8R8A8Srgb, 1, 1, 4), + RtFormat.R10G10B10A2Unorm => new FormatInfo(Format.R10G10B10A2Unorm, 1, 1, 4), + RtFormat.R10G10B10A2Uint => new FormatInfo(Format.R10G10B10A2Uint, 1, 1, 4), + RtFormat.R8G8B8A8Unorm => new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4), + RtFormat.R8G8B8A8Srgb => new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4), + RtFormat.R8G8B8X8Snorm => new FormatInfo(Format.R8G8B8A8Snorm, 1, 1, 4), + RtFormat.R8G8B8X8Sint => new FormatInfo(Format.R8G8B8A8Sint, 1, 1, 4), + RtFormat.R8G8B8X8Uint => new FormatInfo(Format.R8G8B8A8Uint, 1, 1, 4), + RtFormat.R16G16Unorm => new FormatInfo(Format.R16G16Unorm, 1, 1, 4), + RtFormat.R16G16Snorm => new FormatInfo(Format.R16G16Snorm, 1, 1, 4), + RtFormat.R16G16Sint => new FormatInfo(Format.R16G16Sint, 1, 1, 4), + RtFormat.R16G16Uint => new FormatInfo(Format.R16G16Uint, 1, 1, 4), + RtFormat.R16G16Float => new FormatInfo(Format.R16G16Float, 1, 1, 4), + RtFormat.R11G11B10Float => new FormatInfo(Format.R11G11B10Float, 1, 1, 4), + RtFormat.R32Sint => new FormatInfo(Format.R32Sint, 1, 1, 4), + RtFormat.R32Uint => new FormatInfo(Format.R32Uint, 1, 1, 4), + RtFormat.R32Float => new FormatInfo(Format.R32Float, 1, 1, 4), + RtFormat.B8G8R8X8Unorm => new FormatInfo(Format.B8G8R8A8Unorm, 1, 1, 4), + RtFormat.B8G8R8X8Srgb => new FormatInfo(Format.B8G8R8A8Srgb, 1, 1, 4), + RtFormat.B5G6R5Unorm => new FormatInfo(Format.B5G6R5Unorm, 1, 1, 2), + RtFormat.B5G5R5A1Unorm => new FormatInfo(Format.B5G5R5A1Unorm, 1, 1, 2), + RtFormat.R8G8Unorm => new FormatInfo(Format.R8G8Unorm, 1, 1, 2), + RtFormat.R8G8Snorm => new FormatInfo(Format.R8G8Snorm, 1, 1, 2), + RtFormat.R8G8Sint => new FormatInfo(Format.R8G8Sint, 1, 1, 2), + RtFormat.R8G8Uint => new FormatInfo(Format.R8G8Uint, 1, 1, 2), + RtFormat.R16Unorm => new FormatInfo(Format.R16Unorm, 1, 1, 2), + RtFormat.R16Snorm => new FormatInfo(Format.R16Snorm, 1, 1, 2), + RtFormat.R16Sint => new FormatInfo(Format.R16Sint, 1, 1, 2), + RtFormat.R16Uint => new FormatInfo(Format.R16Uint, 1, 1, 2), + RtFormat.R16Float => new FormatInfo(Format.R16Float, 1, 1, 2), + RtFormat.R8Unorm => new FormatInfo(Format.R8Unorm, 1, 1, 1), + RtFormat.R8Snorm => new FormatInfo(Format.R8Snorm, 1, 1, 1), + RtFormat.R8Sint => new FormatInfo(Format.R8Sint, 1, 1, 1), + RtFormat.R8Uint => new FormatInfo(Format.R8Uint, 1, 1, 1), + RtFormat.B5G5R5X1Unorm => new FormatInfo(Format.B5G5R5X1Unorm, 1, 1, 2), + RtFormat.R8G8B8X8Unorm => new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4), + RtFormat.R8G8B8X8Srgb => new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4), _ => FormatInfo.Default }; } diff --git a/Ryujinx.Graphics.OpenGL/TextureCopy.cs b/Ryujinx.Graphics.OpenGL/TextureCopy.cs index 244ace8a2e..5566642696 100644 --- a/Ryujinx.Graphics.OpenGL/TextureCopy.cs +++ b/Ryujinx.Graphics.OpenGL/TextureCopy.cs @@ -96,7 +96,7 @@ namespace Ryujinx.Graphics.OpenGL private static bool IsDepthOnly(Format format) { - return format == Format.D16Unorm || + return format == Format.D16Unorm || format == Format.D24X8Unorm || format == Format.D32Float; } diff --git a/Ryujinx.Graphics.OpenGL/TextureView.cs b/Ryujinx.Graphics.OpenGL/TextureView.cs index da0872f6d3..91f1865d32 100644 --- a/Ryujinx.Graphics.OpenGL/TextureView.cs +++ b/Ryujinx.Graphics.OpenGL/TextureView.cs @@ -19,9 +19,6 @@ namespace Ryujinx.Graphics.OpenGL private int _firstLayer; private int _firstLevel; - private bool _acquired; - private bool _pendingDelete; - public int Width => _info.Width; public int Height => _info.Height; public int DepthOrLayers => _info.GetDepthOrLayers(); diff --git a/Ryujinx.Graphics.Shader/Decoders/BarrierLevel.cs b/Ryujinx.Graphics.Shader/Decoders/BarrierLevel.cs index 2d99dcfe92..95c71e0097 100644 --- a/Ryujinx.Graphics.Shader/Decoders/BarrierLevel.cs +++ b/Ryujinx.Graphics.Shader/Decoders/BarrierLevel.cs @@ -1,6 +1,6 @@ namespace Ryujinx.Graphics.Shader.Decoders { - enum BarrierLevel + enum BarrierLevel { Cta = 0, Gl = 1, diff --git a/Ryujinx.Graphics.Shader/Decoders/Decoder.cs b/Ryujinx.Graphics.Shader/Decoders/Decoder.cs index 5cee5b3ae7..db63712bff 100644 --- a/Ryujinx.Graphics.Shader/Decoders/Decoder.cs +++ b/Ryujinx.Graphics.Shader/Decoders/Decoder.cs @@ -285,8 +285,8 @@ namespace Ryujinx.Graphics.Shader.Decoders private static bool IsBranch(OpCode opCode) { return (opCode is OpCodeBranch opBranch && !opBranch.PushTarget) || - opCode is OpCodeBranchIndir || - opCode is OpCodeBranchPop || + opCode is OpCodeBranchIndir || + opCode is OpCodeBranchPop || opCode is OpCodeExit; } diff --git a/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs b/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs index 59261fbf06..8efd2c5209 100644 --- a/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs +++ b/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs @@ -48,7 +48,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations { Operand addrLow = operation.GetSource(0); - Operand baseAddrLow = Cbuf(0, GetStorageCbOffset(config.Stage, storageIndex)); + Operand baseAddrLow = Cbuf(0, GetStorageCbOffset(config.Stage, storageIndex)); Operand baseAddrTrunc = Local(); diff --git a/Ryujinx.Graphics.Shader/Translation/TranslationFlags.cs b/Ryujinx.Graphics.Shader/Translation/TranslationFlags.cs index 1327abaed4..b871574627 100644 --- a/Ryujinx.Graphics.Shader/Translation/TranslationFlags.cs +++ b/Ryujinx.Graphics.Shader/Translation/TranslationFlags.cs @@ -1,5 +1,8 @@ +using System; + namespace Ryujinx.Graphics.Shader.Translation { + [Flags] public enum TranslationFlags { None = 0, diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvDeviceFile.cs b/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvDeviceFile.cs index de6c9ba9ef..b6e6b8f8fa 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvDeviceFile.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvDeviceFile.cs @@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices abstract class NvDeviceFile { public readonly ServiceCtx Context; - public readonly KProcess Owner; + public readonly KProcess Owner; public NvDeviceFile(ServiceCtx context) { diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/NvHostAsGpuDeviceFile.cs b/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/NvHostAsGpuDeviceFile.cs index 84a9d3d507..008c6059ba 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/NvHostAsGpuDeviceFile.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/NvHostAsGpuDeviceFile.cs @@ -295,8 +295,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu long result = (long)gmm.Map( ((ulong)arguments[index].MapOffset << 16) + (ulong)map.Address, - (ulong)arguments[index].GpuOffset << 16, - (ulong)arguments[index].Pages << 16); + (ulong)arguments[index].GpuOffset << 16, + (ulong)arguments[index].Pages << 16); if (result < 0) {