Add D2DPixelShaderSourceAttribute type
このコミットが含まれているのは:
1 親
69aa180054
コミット
06e5a61af7
3ファイル変更
+52
-2
検索条件に一致するファイルはありません
@@ -26,7 +26,7 @@ namespace ComputeSharp.D2D1;
|
||||
/// This attribute can also be added to a whole assembly, and will be used by default if not overridden by a shader type.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Assembly | AttributeTargets.Method, AllowMultiple = false)]
|
||||
public sealed class D2DCompileOptionsAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace ComputeSharp.D2D1;
|
||||
/// This attribute can also be added to a whole assembly, and will be used by default if not overridden by a shader type.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Assembly | AttributeTargets.Method, AllowMultiple = false)]
|
||||
public sealed class D2DEmbeddedBytecodeAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// An attribute that indicates that a given D2D1 shader should be precompiled at build time and embedded
|
||||
/// directly into the containing assembly as static bytecode, to be retrieved as a <see cref="ReadOnlySpan{T}"/>.
|
||||
/// <para>
|
||||
/// This attribute can be used to annotate methods as follows:
|
||||
/// <code>
|
||||
/// [D2DPixelShaderSource("""
|
||||
/// #define D2D_INPUT_COUNT 1
|
||||
/// #define D2D_INPUT0_SIMPLE
|
||||
///
|
||||
/// #include ""d2d1effecthelpers.hlsli""
|
||||
///
|
||||
/// D2D_PS_ENTRY(PSMain)
|
||||
/// {
|
||||
/// float4 color = D2DGetInput(0);
|
||||
/// float3 rgb = saturate(1.0 - color.rgb);
|
||||
/// return float4(rgb, 1);
|
||||
/// }
|
||||
/// """")]
|
||||
/// static partial ReadOnlySpan<byte> GetBytecode();
|
||||
/// </code>
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Methods can also be annotated with <see cref="D2DEmbeddedBytecodeAttribute"/> and <see cref="D2DCompileOptionsAttribute"/>
|
||||
/// to further customize the shader profile to use when compiling the HLSL source, and the compile options to use.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
|
||||
public sealed class D2DPixelShaderSourceAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="D2DPixelShaderSourceAttribute"/> type with the specified arguments.
|
||||
/// </summary>
|
||||
/// <param name="hlslSource">The number of texture inputs for the shader.</param>
|
||||
public D2DPixelShaderSourceAttribute(string hlslSource)
|
||||
{
|
||||
HlslSource = hlslSource;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of texture inputs for the shader.
|
||||
/// </summary>
|
||||
public string HlslSource { get; }
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする