Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply auto refactoring #45

Merged
merged 19 commits into from
Apr 30, 2024
Merged

Apply auto refactoring #45

merged 19 commits into from
Apr 30, 2024

Conversation

smoogipoo
Copy link

@smoogipoo smoogipoo commented Apr 30, 2024

Automated commits have been prefixed as such. This was done based on the DotSettings/editorconfig files via Rider.

I've kept the refactorings out of the MetalBindings and OpenGLBindings projects for the time being.

@smoogipoo
Copy link
Author

Note that this is a breaking change:

diff --git a/osu.Framework/Graphics/Rendering/Deferred/DeferredFrameBuffer.cs b/osu.Framework/Graphics/Rendering/Deferred/DeferredFrameBuffer.cs
index b055e35963..4cdd71cf27 100644
--- a/osu.Framework/Graphics/Rendering/Deferred/DeferredFrameBuffer.cs
+++ b/osu.Framework/Graphics/Rendering/Deferred/DeferredFrameBuffer.cs
@@ -139,7 +139,7 @@ public void EnsureCreated()
                             (uint)resourceSize.Y,
                             1,
                             1,
-                            PixelFormat.R8_G8_B8_A8_UNorm,
+                            PixelFormat.R8G8B8A8UNorm,
                             TextureUsage.Sampled | TextureUsage.RenderTarget)),
                     deferredFrameBuffer.renderer.Factory.CreateSampler(
                         new SamplerDescription(
diff --git a/osu.Framework/Graphics/Veldrid/Buffers/VeldridFrameBuffer.cs b/osu.Framework/Graphics/Veldrid/Buffers/VeldridFrameBuffer.cs
index 5481734ae9..d14c0d4822 100644
--- a/osu.Framework/Graphics/Veldrid/Buffers/VeldridFrameBuffer.cs
+++ b/osu.Framework/Graphics/Veldrid/Buffers/VeldridFrameBuffer.cs
@@ -47,7 +47,7 @@ public Vector2 Size
             }
         }
 
-        public VeldridFrameBuffer(VeldridRenderer renderer, PixelFormat[]? formats = null, SamplerFilter filteringMode = SamplerFilter.MinLinear_MagLinear_MipLinear)
+        public VeldridFrameBuffer(VeldridRenderer renderer, PixelFormat[]? formats = null, SamplerFilter filteringMode = SamplerFilter.MinLinearMagLinearMipLinear)
         {
             // todo: we probably want the arguments separated to "PixelFormat[] colorFormats, PixelFormat depthFormat".
             if (formats?.Length > 1)
@@ -147,7 +147,7 @@ private class FrameBufferTexture : VeldridTexture
         {
             protected override TextureUsage Usages => base.Usages | TextureUsage.RenderTarget;
 
-            public FrameBufferTexture(VeldridRenderer renderer, SamplerFilter filteringMode = SamplerFilter.MinLinear_MagLinear_MipLinear)
+            public FrameBufferTexture(VeldridRenderer renderer, SamplerFilter filteringMode = SamplerFilter.MinLinearMagLinearMipLinear)
                 : base(renderer, 1, 1, true, filteringMode)
             {
                 BypassTextureUploadQueueing = true;
diff --git a/osu.Framework/Graphics/Veldrid/Pipelines/GraphicsPipeline.cs b/osu.Framework/Graphics/Veldrid/Pipelines/GraphicsPipeline.cs
index c2be61aef9..76ff428298 100644
--- a/osu.Framework/Graphics/Veldrid/Pipelines/GraphicsPipeline.cs
+++ b/osu.Framework/Graphics/Veldrid/Pipelines/GraphicsPipeline.cs
@@ -27,8 +27,8 @@ internal class GraphicsPipeline : BasicPipeline
 
         private GraphicsPipelineDescription pipelineDesc = new GraphicsPipelineDescription
         {
-            RasterizerState = RasterizerStateDescription.CullNone,
-            BlendState = BlendStateDescription.SingleOverrideBlend,
+            RasterizerState = RasterizerStateDescription.CULL_NONE,
+            BlendState = BlendStateDescription.SINGLE_OVERRIDE_BLEND,
             ShaderSet = { VertexLayouts = new VertexLayoutDescription[1] }
         };
 
diff --git a/osu.Framework/Graphics/Veldrid/Textures/VeldridTexture.cs b/osu.Framework/Graphics/Veldrid/Textures/VeldridTexture.cs
index f5b570bb4d..8e50c8f5cb 100644
--- a/osu.Framework/Graphics/Veldrid/Textures/VeldridTexture.cs
+++ b/osu.Framework/Graphics/Veldrid/Textures/VeldridTexture.cs
@@ -85,7 +85,7 @@ protected virtual TextureUsage Usages
         /// <param name="manualMipmaps">Whether manual mipmaps will be uploaded to the texture. If false, the texture will compute mipmaps automatically.</param>
         /// <param name="filteringMode">The filtering mode.</param>
         /// <param name="initialisationColour">The colour to initialise texture levels with (in the case of sub region initial uploads). If null, no initialisation is provided out-of-the-box.</param>
-        public VeldridTexture(IVeldridRenderer renderer, int width, int height, bool manualMipmaps = false, SamplerFilter filteringMode = SamplerFilter.MinLinear_MagLinear_MipLinear,
+        public VeldridTexture(IVeldridRenderer renderer, int width, int height, bool manualMipmaps = false, SamplerFilter filteringMode = SamplerFilter.MinLinearMagLinearMipLinear,
                               Color4? initialisationColour = null)
         {
             this.manualMipmaps = manualMipmaps;
@@ -458,7 +458,7 @@ protected virtual void DoUpload(ITextureUpload upload)
             {
                 texture?.Dispose();
 
-                var textureDescription = TextureDescription.Texture2D((uint)Width, (uint)Height, (uint)CalculateMipmapLevels(Width, Height), 1, PixelFormat.R8_G8_B8_A8_UNorm, Usages);
+                var textureDescription = TextureDescription.Texture2D((uint)Width, (uint)Height, (uint)CalculateMipmapLevels(Width, Height), 1, PixelFormat.R8G8B8A8UNorm, Usages);
                 texture = Renderer.Factory.CreateTexture(ref textureDescription);
 
                 // todo: we may want to look into not having to allocate chunks of zero byte region for initialising textures
diff --git a/osu.Framework/Graphics/Veldrid/Textures/VeldridVideoTexture.cs b/osu.Framework/Graphics/Veldrid/Textures/VeldridVideoTexture.cs
index d2d3d4b076..0243cdb675 100644
--- a/osu.Framework/Graphics/Veldrid/Textures/VeldridVideoTexture.cs
+++ b/osu.Framework/Graphics/Veldrid/Textures/VeldridVideoTexture.cs
@@ -48,13 +48,13 @@ protected override void DoUpload(ITextureUpload upload)
 
                     resourceList[i] = new VeldridTextureResources
                     (
-                        Renderer.Factory.CreateTexture(TextureDescription.Texture2D((uint)width, (uint)height, 1, 1, PixelFormat.R8_UNorm, Usages)),
+                        Renderer.Factory.CreateTexture(TextureDescription.Texture2D((uint)width, (uint)height, 1, 1, PixelFormat.R8UNorm, Usages)),
                         Renderer.Factory.CreateSampler(new SamplerDescription
                         {
                             AddressModeU = SamplerAddressMode.Clamp,
                             AddressModeV = SamplerAddressMode.Clamp,
                             AddressModeW = SamplerAddressMode.Clamp,
-                            Filter = SamplerFilter.MinLinear_MagLinear_MipLinear,
+                            Filter = SamplerFilter.MinLinearMagLinearMipLinear,
                             MinimumLod = 0,
                             MaximumLod = IRenderer.MAX_MIPMAP_LEVELS,
                             MaximumAnisotropy = 0,
diff --git a/osu.Framework/Graphics/Veldrid/VeldridDevice.cs b/osu.Framework/Graphics/Veldrid/VeldridDevice.cs
index 2f10ac2a1c..01129f936b 100644
--- a/osu.Framework/Graphics/Veldrid/VeldridDevice.cs
+++ b/osu.Framework/Graphics/Veldrid/VeldridDevice.cs
@@ -14,7 +14,7 @@
 using SixLabors.ImageSharp.Processing;
 using Veldrid;
 using Veldrid.OpenGL;
-using Veldrid.OpenGLBinding;
+using Veldrid.OpenGLBindings;
 
 namespace osu.Framework.Graphics.Veldrid
 {
@@ -106,7 +106,7 @@ public VeldridDevice(IGraphicsSurface graphicsSurface)
             var options = new GraphicsDeviceOptions
             {
                 HasMainSwapchain = true,
-                SwapchainDepthFormat = PixelFormat.R16_UNorm,
+                SwapchainDepthFormat = PixelFormat.R16UNorm,
                 SyncToVerticalBlank = true,
                 ResourceBindingModel = ResourceBindingModel.Improved,
             };
diff --git a/osu.Framework/Graphics/Veldrid/VeldridExtensions.cs b/osu.Framework/Graphics/Veldrid/VeldridExtensions.cs
index 0ef17a07da..272452a14d 100644
--- a/osu.Framework/Graphics/Veldrid/VeldridExtensions.cs
+++ b/osu.Framework/Graphics/Veldrid/VeldridExtensions.cs
@@ -14,15 +14,13 @@
 using SharpGen.Runtime;
 using Veldrid;
 using Veldrid.MetalBindings;
-using Veldrid.OpenGLBinding;
+using Veldrid.OpenGLBindings;
 using Vortice.Direct3D11;
 using Vortice.DXGI;
 using Vulkan;
-using GetPName = Veldrid.OpenGLBinding.GetPName;
 using GraphicsBackend = Veldrid.GraphicsBackend;
 using PrimitiveTopology = Veldrid.PrimitiveTopology;
 using StencilOperation = Veldrid.StencilOperation;
-using StringName = Veldrid.OpenGLBinding.StringName;
 using VertexAttribPointerType = osuTK.Graphics.ES30.VertexAttribPointerType;
 
 namespace osu.Framework.Graphics.Veldrid
@@ -125,19 +123,19 @@ public static PixelFormat[] ToPixelFormats(this RenderBufferFormat[] renderBuffe
                 switch (renderBufferFormats[i])
                 {
                     case RenderBufferFormat.D16:
-                        pixelFormats[i] = PixelFormat.R16_UNorm;
+                        pixelFormats[i] = PixelFormat.R16UNorm;
                         break;
 
                     case RenderBufferFormat.D32:
-                        pixelFormats[i] = PixelFormat.R32_Float;
+                        pixelFormats[i] = PixelFormat.R32Float;
                         break;
 
                     case RenderBufferFormat.D24S8:
-                        pixelFormats[i] = PixelFormat.D24_UNorm_S8_UInt;
+                        pixelFormats[i] = PixelFormat.D24UNormS8UInt;
                         break;
 
                     case RenderBufferFormat.D32S8:
-                        pixelFormats[i] = PixelFormat.D32_Float_S8_UInt;
+                        pixelFormats[i] = PixelFormat.D32FloatS8UInt;
                         break;
 
                     default:
@@ -153,10 +151,10 @@ public static SamplerFilter ToSamplerFilter(this TextureFilteringMode mode)
             switch (mode)
             {
                 case TextureFilteringMode.Linear:
-                    return SamplerFilter.MinLinear_MagLinear_MipLinear;
+                    return SamplerFilter.MinLinearMagLinearMipLinear;
 
                 case TextureFilteringMode.Nearest:
-                    return SamplerFilter.MinPoint_MagPoint_MipPoint;
+                    return SamplerFilter.MinPointMagPointMipPoint;
 
                 default:
                     throw new ArgumentOutOfRangeException(nameof(mode));

@smoogipoo smoogipoo merged commit ef7ba1f into ppy:master Apr 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant