Add D2DOutputBuffer attribute and types
このコミットが含まれているのは:
1 親
a9640501cd
コミット
f8b05d070c
10ファイル変更
+130
-19
検索条件に一致するファイルはありません
@@ -64,7 +64,7 @@
|
||||
<Compile Include="..\ComputeSharp\Shaders\Dispatching\__Internals\ArrayPoolStringBuilder.cs" Link="ComputeSharp\Shaders\Dispatching\__Internals\ArrayPoolStringBuilder.cs" />
|
||||
|
||||
<!-- ComputeSharp.D2D1 APIs -->
|
||||
<Compile Include="..\ComputeSharp.D2D1\Attributes\Profiles\D2D1ShaderProfile.cs" Link="ComputeSharp.D2D1\Attributes\Profiles\D2D1ShaderProfile.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Attributes\Enums\D2D1ShaderProfile.cs" Link="ComputeSharp.D2D1\Attributes\Enums\D2D1ShaderProfile.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" />
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
#if !SOURCE_GENERATOR
|
||||
using ComputeSharp.D2D1.Helpers;
|
||||
#endif
|
||||
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
@@ -32,17 +29,7 @@ public sealed class D2DEmbeddedBytecodeAttribute : Attribute
|
||||
/// <param name="shaderProfile">The target shader profile to use to compile the shader.</param>
|
||||
public D2DEmbeddedBytecodeAttribute(D2D1ShaderProfile shaderProfile)
|
||||
{
|
||||
#if !SOURCE_GENERATOR
|
||||
ShaderProfile = shaderProfile switch
|
||||
{
|
||||
D2D1ShaderProfile.PixelShader40 or
|
||||
D2D1ShaderProfile.PixelShader40Level91 or
|
||||
D2D1ShaderProfile.PixelShader40Level93 or
|
||||
D2D1ShaderProfile.PixelShader41 or
|
||||
D2D1ShaderProfile.PixelShader50 => shaderProfile,
|
||||
_ => ThrowHelper.ThrowArgumentException<D2D1ShaderProfile>(nameof(shaderProfile), "Invalid shader profile value.")
|
||||
};
|
||||
#endif
|
||||
ShaderProfile = shaderProfile;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,7 +8,8 @@ namespace ComputeSharp.D2D1;
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This attribute directly maps to <c>#define D2D_INPUT<N>_COMPLEX</c>.</para>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/direct2d/hlsl-helpers"/>.</para></remarks>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/direct2d/hlsl-helpers"/>.</para>
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = true)]
|
||||
public sealed class D2DInputComplexAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ namespace ComputeSharp.D2D1;
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This attribute directly maps to <c>#define D2D_INPUT_COUNT <N></c>.</para>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/direct2d/hlsl-helpers"/>.</para></remarks>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/direct2d/hlsl-helpers"/>.</para>
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
|
||||
public sealed class D2DInputCountAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ namespace ComputeSharp.D2D1;
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This attribute directly maps to <c>#define D2D_INPUT<N>_SIMPLE</c>.</para>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/direct2d/hlsl-helpers"/>.</para></remarks>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/direct2d/hlsl-helpers"/>.</para>
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = true)]
|
||||
public sealed class D2DInputSimpleAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// An attribute for a D2D1 shader with a description on the resulting output buffer.
|
||||
/// Using this attribute is optional when defining a D2D1 shader.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/direct2d/precision-and-clipping-in-effect-graphs"/>.
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
|
||||
public sealed class D2DOutputBufferAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="D2DOutputBufferAttribute"/> type with the specified arguments.
|
||||
/// </summary>
|
||||
/// <param name="bufferPrecision">The buffer precision for the resulting output buffer.</param>
|
||||
public D2DOutputBufferAttribute(D2D1BufferPrecision bufferPrecision)
|
||||
{
|
||||
BufferPrecision = bufferPrecision;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="D2DOutputBufferAttribute"/> type with the specified arguments.
|
||||
/// </summary>
|
||||
/// <param name="channelDepth">The channel depth for the resulting output buffer.</param>
|
||||
public D2DOutputBufferAttribute(D2D1ChannelDepth channelDepth)
|
||||
{
|
||||
ChannelDepth = channelDepth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="D2DOutputBufferAttribute"/> type with the specified arguments.
|
||||
/// </summary>
|
||||
/// <param name="bufferPrecision">The buffer precision for the resulting output buffer.</param>
|
||||
/// <param name="channelDepth">The channel depth for the resulting output buffer.</param>
|
||||
public D2DOutputBufferAttribute(D2D1BufferPrecision bufferPrecision, D2D1ChannelDepth channelDepth)
|
||||
{
|
||||
BufferPrecision = bufferPrecision;
|
||||
ChannelDepth = channelDepth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the buffer precision for the resulting output buffer.
|
||||
/// </summary>
|
||||
public D2D1BufferPrecision BufferPrecision { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the channel depth for the resulting output buffer.
|
||||
/// </summary>
|
||||
public D2D1ChannelDepth ChannelDepth { get; }
|
||||
}
|
||||
@@ -9,7 +9,8 @@ namespace ComputeSharp.D2D1;
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This attribute directly maps to <c>#define D2D_REQUIRES_SCENE_POSITION</c>.</para>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/direct2d/hlsl-helpers"/>.</para></remarks>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/direct2d/hlsl-helpers"/>.</para>
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
|
||||
public sealed class D2DRequiresScenePositionAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the bit depth to use in the imaging pipeline in Direct2D to produce the result of a D2D1 shader.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This type exposes the available values in <see href="https://docs.microsoft.com/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_buffer_precision"/>.</para>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/windows/win32/direct2d/precision-and-clipping-in-effect-graphs"/>.</para>
|
||||
/// </remarks>
|
||||
public enum D2D1BufferPrecision
|
||||
{
|
||||
/// <summary>
|
||||
/// The buffer precision is not specified.
|
||||
/// </summary>
|
||||
Unknown,
|
||||
|
||||
/// <summary>
|
||||
/// The buffer precision uses 8-bit normalized integer values per channel.
|
||||
/// </summary>
|
||||
Int8Normalized,
|
||||
|
||||
/// <summary>
|
||||
/// The buffer precision uses 8-bit normalized integer values per channel with standard RGB data.
|
||||
/// </summary>
|
||||
Int8NormalizedSRGB,
|
||||
|
||||
/// <summary>
|
||||
/// The buffer precision uses 16-bit normalized integer values per channel.
|
||||
/// </summary>
|
||||
Int16Normalized,
|
||||
|
||||
/// <summary>
|
||||
/// The buffer precision uses 16-bit float values per channel.
|
||||
/// </summary>
|
||||
Float16,
|
||||
|
||||
/// <summary>
|
||||
/// The buffer precision uses 32-bit float values per channel.
|
||||
/// </summary>
|
||||
Float32
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the channel depth of a stage in a Direct2D rendering pipeline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This type exposes the available values in <see href="https://docs.microsoft.com/windows/win32/api/d2d1effectauthor/ne-d2d1effectauthor-d2d1_channel_depth"/>.</para>
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/windows/win32/direct2d/precision-and-clipping-in-effect-graphs"/>.</para>
|
||||
/// </remarks>
|
||||
public enum D2D1ChannelDepth
|
||||
{
|
||||
/// <summary>
|
||||
/// The channel depth is the default, and it will be inherited by the inputs.
|
||||
/// </summary>
|
||||
Default,
|
||||
|
||||
/// <summary>
|
||||
/// The channel depth is 1.
|
||||
/// </summary>
|
||||
One,
|
||||
|
||||
/// <summary>
|
||||
/// The channel depth is 4.
|
||||
/// </summary>
|
||||
Four
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする