Add D2DCompileOptionsAttribute type

このコミットが含まれているのは:
Sergio Pedri committed 2022-05-22 01:17:35 +02:00
1 親 dd5e1b6262
コミット a3a0425419
4ファイル変更
+44 -1

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

+2
ファイルの表示
@@ -67,8 +67,10 @@
<Compile Include="..\ComputeSharp.D2D1\Attributes\Enums\D2D1ShaderProfile.cs" Link="ComputeSharp.D2D1\Attributes\Enums\D2D1ShaderProfile.cs" />
<Compile Include="..\ComputeSharp.D2D1\Attributes\Enums\D2D1BufferPrecision.cs" Link="ComputeSharp.D2D1\Attributes\Enums\D2D1BufferPrecision.cs" />
<Compile Include="..\ComputeSharp.D2D1\Attributes\Enums\D2D1ChannelDepth.cs" Link="ComputeSharp.D2D1\Attributes\Enums\D2D1ChannelDepth.cs" />
<Compile Include="..\ComputeSharp.D2D1\Attributes\Enums\D2D1CompileOptions.cs" Link="ComputeSharp.D2D1\Attributes\Enums\D2D1CompileOptions.cs" />
<Compile Include="..\ComputeSharp.D2D1\Attributes\Enums\D2D1Filter.cs" Link="ComputeSharp.D2D1\Attributes\Enums\D2D1Filter.cs" />
<Compile Include="..\ComputeSharp.D2D1\Attributes\Enums\D2D1PixelOptions.cs" Link="ComputeSharp.D2D1\Attributes\Enums\D2D1PixelOptions.cs" />
<Compile Include="..\ComputeSharp.D2D1\Attributes\D2DCompileOptionsAttribute.cs" Link="ComputeSharp.D2D1\Attributes\D2DCompileOptionsAttribute.cs" />
<Compile Include="..\ComputeSharp.D2D1\Attributes\D2DEmbeddedBytecodeAttribute.cs" Link="ComputeSharp.D2D1\Attributes\D2DEmbeddedBytecodeAttribute.cs" />
<Compile Include="..\ComputeSharp.D2D1\Attributes\D2DInputComplexAttribute.cs" Link="ComputeSharp.D2D1\Attributes\D2DInputComplexAttribute.cs" />
<Compile Include="..\ComputeSharp.D2D1\Attributes\D2DInputCountAttribute.cs" Link="ComputeSharp.D2D1\Attributes\D2DInputCountAttribute.cs" />
+40
ファイルの表示
@@ -0,0 +1,40 @@
using System;
namespace ComputeSharp.D2D1;
/// <summary>
/// An attribute that indicates the compile options that should be used when compiling a given D2D1 shader.
/// This applies when the shader is precompiled (through <see cref="D2DEmbeddedBytecodeAttribute"/>) as well.
/// <para>
/// This attribute can be used to annotate shader types as follows:
/// <code>
/// [D2DCompileOptions(D2D1CompileOptions.IeeeStrictness | D2D1CompileOptions.OptimizationLevel3)]
/// struct MyShader : ID2D1PixelShader
/// {
/// }
/// </code>
/// </para>
/// <para>
/// </para>
/// Note that the <see cref="D2D1CompileOptions.PackMatrixRowMajor"/> is always enabled automatically and does not need to be
/// specified. This option is mandatory, as the generated code to load the constant buffer from a shader assumes the layout
/// for matrix types is row major. For the same reason, using <see cref="D2D1CompileOptions.PackMatrixColumnMajor"/> is not
/// allowed, as it would cause the constant buffer retrieved from a shader to be potentially incorrect.
/// </summary>
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
public sealed class D2DCompileOptionsAttribute : Attribute
{
/// <summary>
/// Creates a new <see cref="D2DCompileOptionsAttribute"/> instance with the specified parameters.
/// </summary>
/// <param name="options">The compiler options to use to compile the shader.</param>
public D2DCompileOptionsAttribute(D2D1CompileOptions options)
{
Options = options;
}
/// <summary>
/// Gets the number of threads in each thread group for the X axis
/// </summary>
public D2D1CompileOptions Options { get; }
}
-1
ファイルの表示
@@ -8,7 +8,6 @@ namespace ComputeSharp.D2D1;
/// <para>
/// This attribute can be used to annotate shader types as follows:
/// <code>
/// // A compute shader that is dispatched on a target buffer
/// [D2DEmbeddedBytecode(D2D1ShaderProfile.PixelShader50)]
/// struct MyShader : ID2D1PixelShader
/// {
+2
ファイルの表示
@@ -1,5 +1,7 @@
using System;
#if !SOURCE_GENERATOR
using ComputeSharp.D2D1.Interop;
#endif
using TerraFX.Interop.DirectX;
namespace ComputeSharp.D2D1;