Add D2D1InteropServices.GetPixelShaderInputCount() API

このコミットが含まれているのは:
Sergio Pedri committed 2022-04-27 23:59:25 +02:00
1 親 5a4b7a8a86
コミット b156b3c98a
2ファイル変更
+31

検索条件に一致するファイルはありません

+13
ファイルの表示
@@ -79,6 +79,19 @@ public static unsafe class D2D1InteropServices
return new ReadOnlySpan<byte>(bytecodePtr, bytecodeSize).ToArray();
}
/// <summary>
/// Gets the number of inputs from an input D2D1 pixel shader.
/// </summary>
/// <typeparam name="T">The type of D2D1 pixel shader to get the input count for.</typeparam>
/// <returns>The number of inputs for the D2D1 pixel shader of type <typeparamref name="T"/>.</returns>
public static uint GetPixelShaderInputCount<T>()
where T : unmanaged, ID2D1PixelShader
{
Unsafe.SkipInit(out T shader);
return shader.GetInputCount();
}
/// <summary>
/// Gets the constant buffer from an input D2D1 pixel shader.
/// </summary>
+18
ファイルの表示
@@ -0,0 +1,18 @@
using ComputeSharp.D2D1.Interop;
using ComputeSharp.D2D1.Tests.Effects;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ComputeSharp.D2D1.Tests;
[TestClass]
[TestCategory("D2D1InteropServices")]
public class D2D1InteropServicesTests
{
[TestMethod]
public unsafe void GetInputCount()
{
Assert.AreEqual(D2D1InteropServices.GetPixelShaderInputCount<InvertEffect>(), 1u);
Assert.AreEqual(D2D1InteropServices.GetPixelShaderInputCount<PixelateEffect.Shader>(), 1u);
Assert.AreEqual(D2D1InteropServices.GetPixelShaderInputCount<ZonePlateEffect>(), 0u);
}
}