From dd5e1b6262e5ec86ac563b3a28a7423a75045749 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 22 May 2022 01:10:59 +0200 Subject: [PATCH] Rename and move D2D1ShaderCompilerOptions enum --- .../Enums/D2D1CompileOptions.cs} | 5 +++-- .../Shaders/Interop/D2D1ShaderCompiler.cs | 8 ++++---- .../ComputeSharp.D2D1.Tests/D2D1ShaderCompilerTests.cs | 10 +++++----- 3 files changed, 12 insertions(+), 11 deletions(-) rename src/ComputeSharp.D2D1/{Shaders/Interop/D2D1ShaderCompilerOptions.cs => Attributes/Enums/D2D1CompileOptions.cs} (98%) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompilerOptions.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs similarity index 98% rename from src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompilerOptions.cs rename to src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs index a1cacc59..32500128 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompilerOptions.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs @@ -1,7 +1,8 @@ using System; +using ComputeSharp.D2D1.Interop; using TerraFX.Interop.DirectX; -namespace ComputeSharp.D2D1.Interop; +namespace ComputeSharp.D2D1; /// /// Flags to control the options that can be used to compile a D2D1 shader. @@ -10,7 +11,7 @@ namespace ComputeSharp.D2D1.Interop; /// For more info, see For more info, see . /// [Flags] -public enum D2D1ShaderCompilerOptions +public enum D2D1CompileOptions { /// /// Directs the compiler to insert debug file/line/type/symbol information into the output code. diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs index c52b142a..ac459e8b 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs @@ -29,7 +29,7 @@ public static class D2D1ShaderCompiler ReadOnlySpan hlslSource, ReadOnlySpan entryPoint, D2D1ShaderProfile shaderProfile, - D2D1ShaderCompilerOptions options) + D2D1CompileOptions options) { // Encode the HLSL source to ASCII int maxSourceLength = Encoding.ASCII.GetMaxByteCount(hlslSource.Length); @@ -60,13 +60,13 @@ public static class D2D1ShaderCompiler ReadOnlySpan hlslSourceAscii, ReadOnlySpan entryPointAscii, D2D1ShaderProfile shaderProfile, - D2D1ShaderCompilerOptions options) + D2D1CompileOptions options) { // Check linking support - bool enableLinking = (options & D2D1ShaderCompilerOptions.EnableLinking) == D2D1ShaderCompilerOptions.EnableLinking; + bool enableLinking = (options & D2D1CompileOptions.EnableLinking) == D2D1CompileOptions.EnableLinking; // Remove the linking flag to make the options blittable to flags - options &= ~D2D1ShaderCompilerOptions.EnableLinking; + options &= ~D2D1CompileOptions.EnableLinking; // Compile the standalone D2D1 full shader using ComPtr d3DBlobFullShader = D3DCompiler.CompileShader( diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ShaderCompilerTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ShaderCompilerTests.cs index 06c208bf..9a7424b9 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1ShaderCompilerTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ShaderCompilerTests.cs @@ -31,7 +31,7 @@ public partial class D2D1ShaderCompilerTests source, "PSMain", D2D1ShaderProfile.PixelShader40Level93, - D2D1ShaderCompilerOptions.Default); + D2D1CompileOptions.Default); Assert.IsTrue(bytecode.Length > 0); } @@ -57,7 +57,7 @@ public partial class D2D1ShaderCompilerTests source, "PSMain", D2D1ShaderProfile.PixelShader40Level93, - D2D1ShaderCompilerOptions.Default | D2D1ShaderCompilerOptions.EnableLinking); + D2D1CompileOptions.Default | D2D1CompileOptions.EnableLinking); Assert.IsTrue(bytecode.Length > 0); } @@ -84,7 +84,7 @@ public partial class D2D1ShaderCompilerTests source, "Execute", D2D1ShaderProfile.PixelShader40Level93, - D2D1ShaderCompilerOptions.Default); + D2D1CompileOptions.Default); Assert.IsTrue(bytecode.Length > 0); } @@ -111,7 +111,7 @@ public partial class D2D1ShaderCompilerTests source, "PSMain", D2D1ShaderProfile.PixelShader40Level93, - D2D1ShaderCompilerOptions.Default); + D2D1CompileOptions.Default); Assert.IsTrue(bytecode.Length > 0); } @@ -158,7 +158,7 @@ public partial class D2D1ShaderCompilerTests source, "PSMain", D2D1ShaderProfile.PixelShader40, - D2D1ShaderCompilerOptions.Default); + D2D1CompileOptions.Default); Assert.IsTrue(bytecode.Length > 0); }