Add D2D1 input description types

このコミットが含まれているのは:
Sergio Pedri committed 2022-05-08 18:40:25 +02:00
1 親 df9454caf2
コミット 54d7cb53e2
8ファイル変更
+190

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

+1
ファイルの表示
@@ -77,6 +77,7 @@
<Compile Include="..\ComputeSharp.D2D1\Interfaces\ID2D1PixelShader.cs" Link="ComputeSharp.D2D1\Interfaces\ID2D1PixelShader.cs" />
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1BytecodeLoader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1BytecodeLoader.cs" />
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1DispatchDataLoader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1DispatchDataLoader.cs" />
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1InputDescriptionsLoader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1InputDescriptionsLoader.cs" />
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1Shader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1Shader.cs" />
<Compile Include="..\ComputeSharp.D2D1\Intrinsics\D2D.cs" Link="ComputeSharp.D2D1\Intrinsics\D2D.cs" />
<Compile Include="..\ComputeSharp.D2D1\Shaders\Exceptions\FxcCompilationException.cs" Link="ComputeSharp.D2D1\Shaders\Exceptions\FxcCompilationException.cs" />
+41
ファイルの表示
@@ -0,0 +1,41 @@
using System;
namespace ComputeSharp.D2D1;
/// <summary>
/// An attribute for a D2D1 shader indicating the description of a given input resource.
/// This attribute is optional, and not using it will cause no description to be declared.
/// </summary>
/// <remarks>
/// <para>This attribute exposes the options that can be set via <c>D2D1_INPUT_DESCRIPTION</c>.</para>
/// <para>For more info, see <see href="https://docs.microsoft.com/windows/win32/api/d2d1effectauthor/ns-d2d1effectauthor-d2d1_input_description"/>.</para>
/// </remarks>
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = true)]
public sealed class D2DInputDescriptionAttribute : Attribute
{
/// <summary>
/// Creates a new instance of the <see cref="D2DInputDescriptionAttribute"/> type with the specified arguments.
/// </summary>
/// <param name="index">The index of the resource to declare the description for.</param>
/// <param name="filter">The type of filter to apply to the input texture.</param>
public D2DInputDescriptionAttribute(int index, D2D1Filter filter)
{
Index = index;
Filter = filter;
}
/// <summary>
/// Gets the index of the resource to declare the description for.
/// </summary>
public int Index { get; }
/// <summary>
/// Gets the type of filter to apply to the input texture.
/// </summary>
public D2D1Filter Filter { get; }
/// <summary>
/// Gets the mip level to retrieve from the upstream transform, if specified.
/// </summary>
public int LevelOfDetail { get; init; }
}
+57
ファイルの表示
@@ -0,0 +1,57 @@
using static TerraFX.Interop.DirectX.D2D1_FILTER;
namespace ComputeSharp.D2D1;
/// <summary>
/// Represents the filtering mode that a transform may select to use on input textures.
/// </summary>
/// <remarks>
/// <para>This type exposes the available values in <see href="https://docs.microsoft.com/windows/win32/api/d2d1effectauthor/ne-d2d1effectauthor-d2d1_filter"/>.</para>
/// </remarks>
public enum D2D1Filter
{
/// <summary>
/// Use point sampling for minification, magnification, and mip-level sampling.
/// </summary>
MinMagMipPoint = (int)D2D1_FILTER_MIN_MAG_MIP_POINT,
/// <summary>
/// Use point sampling for minification and magnification, use linear interpolation for mip-level sampling.
/// </summary>
MinMagPointMipLinear = (int)D2D1_FILTER_MIN_MAG_POINT_MIP_LINEAR,
/// <summary>
/// Use point sampling for minification, use linear interpolation for magnification, use point sampling for mip-level sampling.
/// </summary>
MinPointMagLinearMipPoint = (int)D2D1_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT,
/// <summary>
/// Use point sampling for minification, use linear interpolation for magnification and mip-level sampling.
/// </summary>
MinPointMagMipLinear = (int)D2D1_FILTER_MIN_POINT_MAG_MIP_LINEAR,
/// <summary>
/// Use linear interpolation for minification, use point sampling for magnification and mip-level sampling.
/// </summary>
MinLinearMagMipPoint = (int)D2D1_FILTER_MIN_LINEAR_MAG_MIP_POINT,
/// <summary>
/// Use linear interpolation for minification, use point sampling for magnification, use linear interpolation for mip-level sampling.
/// </summary>
MinLinearMagPointMinLinear = (int)D2D1_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR,
/// <summary>
/// Use linear interpolation for minification and magnification, use point sampling for mip-level sampling.
/// </summary>
MinMagLinearMipPoint = (int)D2D1_FILTER_MIN_MAG_LINEAR_MIP_POINT,
/// <summary>
/// Use linear interpolation for minification, magnification, and mip-level sampling.
/// </summary>
MinMagMipLinear = (int)D2D1_FILTER_MIN_MAG_MIP_LINEAR,
/// <summary>
/// Use anisotropic interpolation for minification, magnification, and mip-level sampling.
/// </summary>
Anisotropic = (int)D2D1_FILTER_ANISOTROPIC
}
+18
ファイルの表示
@@ -0,0 +1,18 @@
using System;
using System.ComponentModel;
namespace ComputeSharp.D2D1.__Internals;
/// <summary>
/// A base <see langword="interface"/> representing a loader for input descriptions in a D2D1 shader.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This interface is not intended to be used directly by user code")]
public interface ID2D1InputDescriptionsLoader
{
/// <summary>
/// Loads the available input descriptions for the shader.
/// </summary>
/// <param name="data">The sequence of serialized input descriptions.</param>
void LoadInputDescriptions(ReadOnlySpan<byte> data);
}
+10
ファイルの表示
@@ -37,6 +37,16 @@ public interface ID2D1Shader
[Obsolete("This method is not intended to be used directly by user code")]
uint GetInputType(uint index);
/// <summary>
/// Loads the input descriptions for the shader, if any.
/// </summary>
/// <typeparam name="TLoader">The type of input descriptions loader being used.</typeparam>
/// <param name="loader">The <typeparamref name="TLoader"/> instance to use to load the input descriptions.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method is not intended to be used directly by user code")]
void LoadInputDescriptions<TLoader>(ref TLoader loader)
where TLoader : struct, ID2D1InputDescriptionsLoader;
/// <summary>
/// Gets the output buffer precision and depth for the shader.
/// </summary>
+41
ファイルの表示
@@ -0,0 +1,41 @@
using System;
namespace ComputeSharp.D2D1.Interop;
/// <summary>
/// A type containing info on a description for a given D2D1 pixel shader input resource.
/// </summary>
/// <remarks>
/// <para>This type exposes the values that can be set via <c>ID2D1RenderInfo::SetInputDescription</c>.</para>
/// <para>For more info, see <see href="https://docs.microsoft.com/windows/win32/api/d2d1effectauthor/nf-d2d1effectauthor-id2d1renderinfo-setinputdescription"/>.</para>
/// </remarks>
public readonly struct D2D1InputDescription
{
/// <summary>
/// Creates a new <see cref="D2D1InputDescription"/> instance with the specified parameters.
/// </summary>
/// <param name="index">The index of the resource the description belongs to.</param>
/// <param name="filter">The type of filter to apply to the input texture.</param>
/// <param name="levelOfDetail">The mip level to retrieve from the upstream transform, if specified.</param>
internal D2D1InputDescription(int index, D2D1Filter filter, int levelOfDetail)
{
Index = index;
Filter = filter;
LevelOfDetail = levelOfDetail;
}
/// <summary>
/// Gets the index of the resource the description belongs to.
/// </summary>
public int Index { get; }
/// <summary>
/// Gets the type of filter to apply to the input texture.
/// </summary>
public D2D1Filter Filter { get; }
/// <summary>
/// Gets the mip level to retrieve from the upstream transform, if specified.
/// </summary>
public int LevelOfDetail { get; }
}
+21
ファイルの表示
@@ -0,0 +1,21 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
namespace TerraFX.Interop.DirectX
{
internal enum D2D1_FILTER : uint
{
D2D1_FILTER_MIN_MAG_MIP_POINT = 0x00,
D2D1_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x01,
D2D1_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x04,
D2D1_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x05,
D2D1_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10,
D2D1_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11,
D2D1_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14,
D2D1_FILTER_MIN_MAG_MIP_LINEAR = 0x15,
D2D1_FILTER_ANISOTROPIC = 0x55,
D2D1_FILTER_FORCE_DWORD = 0xffffffff
}
}
+1
ファイルの表示
@@ -11,6 +11,7 @@
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\DirectX\um\d3d11shader\D3D.cs" Link="DirectX\um\d3d11shader\D3D.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\D2D1_CHANGE_TYPE.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\D2D1_FILTER.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\D2D1_PIXEL_OPTIONS.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\D2D1_PROPERTY_BINDING.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\ID2D1DrawTransform.cs" />