From 308eab5fbcdee58aafd8316c167e6e623cdf1d6f Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 20 Sep 2023 14:12:35 +0200 Subject: [PATCH] Add APIs to get other metadata, update effect XML --- .../Shaders/Interop/D2D1PixelShaderEffect.cs | 77 +++++++++++++++++-- 1 file changed, 70 insertions(+), 7 deletions(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs index 66758318..add62e86 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs @@ -34,7 +34,7 @@ public static unsafe class D2D1PixelShaderEffect /// /// Gets the effect display name of the D2D effect using this shader, if available. /// - /// The type of D2D1 pixel shader to get the effect id for. + /// The type of D2D1 pixel shader to get the effect display name for. /// The effect display name of the D2D effect using shaders, if available. public static string? GetEffectDisplayName() where T : unmanaged, ID2D1PixelShader @@ -44,6 +44,45 @@ public static unsafe class D2D1PixelShaderEffect return shader.EffectDisplayName; } + /// + /// Gets the effect description of the D2D effect using this shader, if available. + /// + /// The type of D2D1 pixel shader to get the effect description for. + /// The effect description of the D2D effect using shaders, if available. + public static string? GetEffectDescription() + where T : unmanaged, ID2D1PixelShader + { + Unsafe.SkipInit(out T shader); + + return shader.EffectDescription; + } + + /// + /// Gets the effect category of the D2D effect using this shader, if available. + /// + /// The type of D2D1 pixel shader to get the effect category for. + /// The effect category of the D2D effect using shaders, if available. + public static string? GetEffectCategory() + where T : unmanaged, ID2D1PixelShader + { + Unsafe.SkipInit(out T shader); + + return shader.EffectCategory; + } + + /// + /// Gets the effect author of the D2D effect using this shader, if available. + /// + /// The type of D2D1 pixel shader to get the effect author for. + /// The effect author of the D2D effect using shaders, if available. + public static string? GetEffectAuthor() + where T : unmanaged, ID2D1PixelShader + { + Unsafe.SkipInit(out T shader); + + return shader.EffectAuthor; + } + /// /// Registers an effect from an input D2D1 pixel shader, by calling ID2D1Factory1::RegisterEffectFromString. /// @@ -74,9 +113,21 @@ public static unsafe class D2D1PixelShaderEffect writer.WriteRaw(GetEffectDisplayName().AsSpan()); writer.WriteRaw(""" '/> - - - + + + """); @@ -314,9 +365,21 @@ public static unsafe class D2D1PixelShaderEffect writer.WriteAsUtf8(GetEffectDisplayName() ?? ""); writer.WriteRaw(""" '/> - - - + + + """u8);