Add D2D1PixelShaderEffect.GetEffectDisplayName<T>() API

このコミットが含まれているのは:
Sergio Pedri committed 2023-09-27 14:04:04 +02:00
1 親 7fc302312d
コミット 23cd90d481
1ファイル変更
+15 -2
+15 -2
ファイルの表示
@@ -31,6 +31,19 @@ public static unsafe class D2D1PixelShaderEffect
return ref shader.EffectId;
}
/// <summary>
/// Gets the effect display name of the D2D effect using this shader.
/// </summary>
/// <typeparam name="T">The type of D2D1 pixel shader to get the effect id for.</typeparam>
/// <returns>The effect display name of the D2D effect using <typeparamref name="T"/> shaders.</returns>
public static string GetEffectDisplayName<T>()
where T : unmanaged, ID2D1PixelShader
{
Unsafe.SkipInit(out T shader);
return shader.EffectDisplayName;
}
/// <summary>
/// Registers an effect from an input D2D1 pixel shader, by calling <c>ID2D1Factory1::RegisterEffectFromString</c>.
/// </summary>
@@ -58,7 +71,7 @@ public static unsafe class D2D1PixelShaderEffect
<Effect>
<Property name='DisplayName' type='string' value='
""");
writer.WriteRaw(typeof(T).FullName!);
writer.WriteRaw(GetEffectDisplayName<T>());
writer.WriteRaw("""
'/>
<Property name='Author' type='string' value='ComputeSharp.D2D1'/>
@@ -298,7 +311,7 @@ public static unsafe class D2D1PixelShaderEffect
<Effect>
<Property name='DisplayName' type='string' value='
"""u8);
writer.WriteAsUtf8(typeof(T).FullName!);
writer.WriteAsUtf8(GetEffectDisplayName<T>());
writer.WriteRaw("""
'/>
<Property name='Author' type='string' value='ComputeSharp.D2D1'/>