From 4bb96e1fcda25a27d7146880137c754e24878d79 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 7 May 2022 03:35:55 +0200 Subject: [PATCH] Change D2D1PixelShader input APIs to use int values --- .../Shaders/Interop/D2D1PixelShader.cs | 10 +++++----- .../D2D1InteropServicesTests.cs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs index b7c80bb6..54b4a683 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs @@ -85,12 +85,12 @@ public static class D2D1PixelShader /// /// The type of D2D1 pixel shader to get the input count for. /// The number of inputs for the D2D1 pixel shader of type . - public static uint GetInputCount() + public static int GetInputCount() where T : unmanaged, ID2D1PixelShader { Unsafe.SkipInit(out T shader); - return shader.GetInputCount(); + return (int)shader.GetInputCount(); } /// @@ -100,17 +100,17 @@ public static class D2D1PixelShader /// The index of the input to get the type for. /// The type of the input of the target D2D1 pixel shader at the specified index. /// Thrown if is not in range for the available inputs for the shader type. - public static D2D1PixelShaderInputType GetInputType(uint index) + public static D2D1PixelShaderInputType GetInputType(int index) where T : unmanaged, ID2D1PixelShader { Unsafe.SkipInit(out T shader); - if (index >= shader.GetInputCount()) + if ((uint)index >= shader.GetInputCount()) { ThrowHelper.ThrowArgumentOutOfRangeException(nameof(index), "The input index is outside of range for the target pixel shader type."); } - return (D2D1PixelShaderInputType)shader.GetInputType(index); + return (D2D1PixelShaderInputType)shader.GetInputType((uint)index); } /// diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs index 14cd09c4..c797a527 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs @@ -11,10 +11,10 @@ public partial class D2D1InteropServicesTests [TestMethod] public unsafe void GetInputCount() { - Assert.AreEqual(D2D1PixelShader.GetInputCount(), 1u); - Assert.AreEqual(D2D1PixelShader.GetInputCount(), 1u); - Assert.AreEqual(D2D1PixelShader.GetInputCount(), 0u); - Assert.AreEqual(D2D1PixelShader.GetInputCount(), 7u); + Assert.AreEqual(D2D1PixelShader.GetInputCount(), 1); + Assert.AreEqual(D2D1PixelShader.GetInputCount(), 1); + Assert.AreEqual(D2D1PixelShader.GetInputCount(), 0); + Assert.AreEqual(D2D1PixelShader.GetInputCount(), 7); } [TestMethod]