From e81a39d27aced6e052ab8424d8fa9622a88d683e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 7 May 2022 23:45:41 +0200 Subject: [PATCH] Set D2D1 enum values to be the same as D2D1 ones Also some minor tweaks to the enums --- .../Attributes/Enums/D2D1BufferPrecision.cs | 16 +++++++++------- .../Attributes/Enums/D2D1ChannelDepth.cs | 12 +++++++----- .../D2D1InteropServicesTests.cs | 8 ++++---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1BufferPrecision.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1BufferPrecision.cs index 8b1bc9a8..55c0bfd4 100644 --- a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1BufferPrecision.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1BufferPrecision.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1; +using static TerraFX.Interop.DirectX.D2D1_BUFFER_PRECISION; + +namespace ComputeSharp.D2D1; /// /// Indicates the bit depth to use in the imaging pipeline in Direct2D to produce the result of a D2D1 shader. @@ -12,30 +14,30 @@ public enum D2D1BufferPrecision /// /// The buffer precision is not specified. /// - Unknown, + Unknown = (int)D2D1_BUFFER_PRECISION_UNKNOWN, /// /// The buffer precision uses 8-bit normalized integer values per channel. /// - Int8Normalized, + UInt8Normalized = (int)D2D1_BUFFER_PRECISION_8BPC_UNORM, /// /// The buffer precision uses 8-bit normalized integer values per channel with standard RGB data. /// - Int8NormalizedSRGB, + UInt8NormalizedSrgb = (int)D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB, /// /// The buffer precision uses 16-bit normalized integer values per channel. /// - Int16Normalized, + UInt16Normalized = (int)D2D1_BUFFER_PRECISION_16BPC_UNORM, /// /// The buffer precision uses 16-bit float values per channel. /// - Float16, + Float16 = (int)D2D1_BUFFER_PRECISION_16BPC_FLOAT, /// /// The buffer precision uses 32-bit float values per channel. /// - Float32 + Float32 = (int)D2D1_BUFFER_PRECISION_32BPC_FLOAT } diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ChannelDepth.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ChannelDepth.cs index e712cce0..a83794ec 100644 --- a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ChannelDepth.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ChannelDepth.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1; +using static TerraFX.Interop.DirectX.D2D1_CHANNEL_DEPTH; + +namespace ComputeSharp.D2D1; /// /// Indicates the channel depth of a stage in a Direct2D rendering pipeline. @@ -10,17 +12,17 @@ public enum D2D1ChannelDepth { /// - /// The channel depth is the default, and it will be inherited by the inputs. + /// The channel depth is the default, and it will be inherited from the inputs. /// - Default = 0, + Default = (int)D2D1_CHANNEL_DEPTH_DEFAULT, /// /// The channel depth is 1. /// - One = 1, + One = (int)D2D1_CHANNEL_DEPTH_1, /// /// The channel depth is 4. /// - Four = 4 + Four = (int)D2D1_CHANNEL_DEPTH_4 } diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs index fa89d21e..3e6d1919 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs @@ -47,9 +47,9 @@ public partial class D2D1InteropServicesTests public unsafe void GetOutputBufferPrecision() { Assert.AreEqual(D2D1PixelShader.GetOutputBufferPrecision(), D2D1BufferPrecision.Unknown); - Assert.AreEqual(D2D1PixelShader.GetOutputBufferPrecision(), D2D1BufferPrecision.Int16Normalized); + Assert.AreEqual(D2D1PixelShader.GetOutputBufferPrecision(), D2D1BufferPrecision.UInt16Normalized); Assert.AreEqual(D2D1PixelShader.GetOutputBufferPrecision(), D2D1BufferPrecision.Unknown); - Assert.AreEqual(D2D1PixelShader.GetOutputBufferPrecision(), D2D1BufferPrecision.Int8NormalizedSRGB); + Assert.AreEqual(D2D1PixelShader.GetOutputBufferPrecision(), D2D1BufferPrecision.UInt8NormalizedSrgb); } [TestMethod] @@ -71,7 +71,7 @@ public partial class D2D1InteropServicesTests } [D2DInputCount(0)] - [D2DOutputBuffer(D2D1BufferPrecision.Int16Normalized)] + [D2DOutputBuffer(D2D1BufferPrecision.UInt16Normalized)] partial struct OnlyBufferPrecisionShader : ID2D1PixelShader { public Float4 Execute() @@ -91,7 +91,7 @@ public partial class D2D1InteropServicesTests } [D2DInputCount(0)] - [D2DOutputBuffer(D2D1BufferPrecision.Int8NormalizedSRGB, D2D1ChannelDepth.One)] + [D2DOutputBuffer(D2D1BufferPrecision.UInt8NormalizedSrgb, D2D1ChannelDepth.One)] partial struct CustomBufferOutputShader : ID2D1PixelShader { public Float4 Execute()