From 9d28a4d7687c62fea6ff83920419a41bbe9a10c7 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Tue, 6 Dec 2022 14:05:49 -0500 Subject: [PATCH] Mark enums used with bitwise operators `[Flags]` --- Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs | 3 +++ Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs | 3 +++ Ryujinx.Graphics.Shader/Decoders/InstProps.cs | 3 +++ Ryujinx.Graphics.Shader/Translation/AggregateType.cs | 5 ++++- Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs | 5 ++++- Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs | 2 ++ Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/Qualifier.cs | 3 +++ Ryujinx.HLE/HOS/Kernel/Common/KernelResult.cs | 3 +++ Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs | 5 ++++- Ryujinx.HLE/HOS/Kernel/Threading/ThreadSchedState.cs | 3 +++ Ryujinx.Tests.Unicorn/MemoryPermission.cs | 3 +++ Spv.Generator/spirv.cs | 4 ++++ 12 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs index d78aa4982..bba6ab82c 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Threed/IndirectDrawType.cs @@ -1,8 +1,11 @@ +using System; + namespace Ryujinx.Graphics.Gpu.Engine.Threed { /// /// Indirect draw type, which can be indexed or non-indexed, with or without a draw count. /// + [Flags] enum IndirectDrawType { /// diff --git a/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs b/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs index 98a436407..26ef474d4 100644 --- a/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs +++ b/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs @@ -1,3 +1,5 @@ +using System; + namespace Ryujinx.Graphics.Shader.Decoders { enum AlSize @@ -710,6 +712,7 @@ namespace Ryujinx.Graphics.Shader.Decoders TexSamplerBorderColor = 22, } + [Flags] enum VectorSelect { U8B0 = 0, diff --git a/Ryujinx.Graphics.Shader/Decoders/InstProps.cs b/Ryujinx.Graphics.Shader/Decoders/InstProps.cs index 1af94ab59..3f39e631d 100644 --- a/Ryujinx.Graphics.Shader/Decoders/InstProps.cs +++ b/Ryujinx.Graphics.Shader/Decoders/InstProps.cs @@ -1,5 +1,8 @@ +using System; + namespace Ryujinx.Graphics.Shader.Decoders { + [Flags] enum InstProps : ushort { None = 0, diff --git a/Ryujinx.Graphics.Shader/Translation/AggregateType.cs b/Ryujinx.Graphics.Shader/Translation/AggregateType.cs index dcd1e0bd4..c8dfb4083 100644 --- a/Ryujinx.Graphics.Shader/Translation/AggregateType.cs +++ b/Ryujinx.Graphics.Shader/Translation/AggregateType.cs @@ -1,5 +1,8 @@ -namespace Ryujinx.Graphics.Shader.Translation +using System; + +namespace Ryujinx.Graphics.Shader.Translation { + [Flags] enum AggregateType { Invalid, diff --git a/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs b/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs index 5734d301e..c53ea40ac 100644 --- a/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs +++ b/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs @@ -1,5 +1,8 @@ -namespace Ryujinx.Graphics.Texture.Encoders +using System; + +namespace Ryujinx.Graphics.Texture.Encoders { + [Flags] enum EncodeMode { Fast, diff --git a/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs b/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs index b4d6e95c7..cf5f02aa3 100644 --- a/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs +++ b/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs @@ -1,5 +1,6 @@ using Ryujinx.Common.Memory; using Silk.NET.Vulkan; +using System; namespace Ryujinx.Graphics.Vulkan { @@ -24,6 +25,7 @@ namespace Ryujinx.Graphics.Vulkan public int ViewportsCount; public Array16 Viewports; + [Flags] private enum DirtyFlags { None = 0, diff --git a/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/Qualifier.cs b/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/Qualifier.cs index cb6dd6bf6..c13f2b770 100644 --- a/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/Qualifier.cs +++ b/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/Qualifier.cs @@ -1,7 +1,9 @@ +using System; using System.IO; namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast { + [Flags] public enum Cv { None, @@ -10,6 +12,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast Restricted = 4 } + [Flags] public enum Reference { None, diff --git a/Ryujinx.HLE/HOS/Kernel/Common/KernelResult.cs b/Ryujinx.HLE/HOS/Kernel/Common/KernelResult.cs index 357b01ea5..873fca4ed 100644 --- a/Ryujinx.HLE/HOS/Kernel/Common/KernelResult.cs +++ b/Ryujinx.HLE/HOS/Kernel/Common/KernelResult.cs @@ -1,5 +1,8 @@ +using System; + namespace Ryujinx.HLE.HOS.Kernel.Common { + [Flags] enum KernelResult { Success = 0, diff --git a/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs b/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs index a34481e55..a79978ac4 100644 --- a/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs +++ b/Ryujinx.HLE/HOS/Kernel/Process/ProcessCreationFlags.cs @@ -1,5 +1,8 @@ -namespace Ryujinx.HLE.HOS.Kernel.Process +using System; + +namespace Ryujinx.HLE.HOS.Kernel.Process { + [Flags] enum ProcessCreationFlags { Is64Bit = 1 << 0, diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/ThreadSchedState.cs b/Ryujinx.HLE/HOS/Kernel/Threading/ThreadSchedState.cs index 9577075c0..1d09e021e 100644 --- a/Ryujinx.HLE/HOS/Kernel/Threading/ThreadSchedState.cs +++ b/Ryujinx.HLE/HOS/Kernel/Threading/ThreadSchedState.cs @@ -1,5 +1,8 @@ +using System; + namespace Ryujinx.HLE.HOS.Kernel.Threading { + [Flags] enum ThreadSchedState : ushort { LowMask = 0xf, diff --git a/Ryujinx.Tests.Unicorn/MemoryPermission.cs b/Ryujinx.Tests.Unicorn/MemoryPermission.cs index a14c4e9cf..d0ddfe908 100644 --- a/Ryujinx.Tests.Unicorn/MemoryPermission.cs +++ b/Ryujinx.Tests.Unicorn/MemoryPermission.cs @@ -1,5 +1,8 @@ +using System; + namespace Ryujinx.Tests.Unicorn { + [Flags] public enum MemoryPermission { NONE = 0, diff --git a/Spv.Generator/spirv.cs b/Spv.Generator/spirv.cs index df28438bb..4027fb514 100644 --- a/Spv.Generator/spirv.cs +++ b/Spv.Generator/spirv.cs @@ -42,6 +42,8 @@ // "Mask" in their name, and a parallel enum that has the shift // amount (1 << x) for each corresponding enumerant. +using System; + namespace Spv { @@ -341,6 +343,7 @@ namespace Spv ZeroExtend = 13, } + [Flags] public enum ImageOperandsMask { MaskNone = 0, @@ -717,6 +720,7 @@ namespace Spv Volatile = 15, } + [Flags] public enum MemorySemanticsMask { MaskNone = 0,