Add D2D1PixelShader.GetResourceTextureDescriptions API

このコミットが含まれているのは:
Sergio Pedri committed 2022-08-08 15:45:44 +02:00
1 親 9199e0c6b9
コミット a854aead17
4ファイル変更
+55 -2

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

+1
ファイルの表示
@@ -82,6 +82,7 @@
<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\ID2D1ResourceTextureDescriptionsLoader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1ResourceTextureDescriptionsLoader.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" />
+17
ファイルの表示
@@ -214,6 +214,23 @@ public static class D2D1PixelShader
return inputDescriptionsLoader.GetResultingInputDescriptions();
}
/// <summary>
/// Gets the available resource texture descriptions for a D2D1 pixel shader.
/// </summary>
/// <typeparam name="T">The type of D2D1 pixel shader to get the resource texture descriptions for.</typeparam>
/// <returns>A <see cref="ReadOnlyMemory{T}"/> with the available resource texture descriptions for the shader.</returns>
public static ReadOnlyMemory<D2D1ResourceTextureDescription> GetResourceTextureDescriptions<T>()
where T : unmanaged, ID2D1PixelShader
{
D2D1ByteArrayResourceTextureDescriptionsLoader resourceTextureDescriptionsLoader = default;
Unsafe.SkipInit(out T shader);
shader.LoadResourceTextureDescriptions(ref resourceTextureDescriptionsLoader);
return resourceTextureDescriptionsLoader.GetResultingResourceTextureDescriptions();
}
/// <summary>
/// Gets the buffer precision for the output buffer of a D2D1 pixel shader.
/// </summary>
+1 -2
ファイルの表示
@@ -3,7 +3,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.D2D1.__Internals;
using ComputeSharp.D2D1.Interop;
using TerraFX.Interop.DirectX;
#pragma warning disable CS0618
@@ -15,7 +14,7 @@ namespace ComputeSharp.D2D1.Shaders.Loaders;
internal struct D2D1ByteArrayInputDescriptionsLoader : ID2D1InputDescriptionsLoader
{
/// <summary>
/// The <see cref="ID2D1DrawInfo"/> object in use.
/// The resulting <see cref="D2D1InputDescription"/> array.
/// </summary>
private D2D1InputDescription[]? inputDescriptions;
@@ -0,0 +1,36 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.D2D1.__Internals;
using ComputeSharp.D2D1.Interop;
#pragma warning disable CS0618
namespace ComputeSharp.D2D1.Shaders.Loaders;
/// <summary>
/// A resource texture descriptions loader for D2D1 pixel shaders.
/// </summary>
internal struct D2D1ByteArrayResourceTextureDescriptionsLoader : ID2D1ResourceTextureDescriptionsLoader
{
/// <summary>
/// The resulting <see cref="D2D1ResourceTextureDescription"/> array.
/// </summary>
private D2D1ResourceTextureDescription[]? resourceTextureDescriptions;
/// <summary>
/// Gets the resulting resource texture descriptions.
/// </summary>
/// <returns>A <see cref="D2D1ResourceTextureDescription"/> array with the available resource texture descriptions.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public D2D1ResourceTextureDescription[] GetResultingResourceTextureDescriptions()
{
return this.resourceTextureDescriptions!;
}
/// <inheritdoc/>
void ID2D1ResourceTextureDescriptionsLoader.LoadResourceTextureDescriptions(ReadOnlySpan<byte> data)
{
this.resourceTextureDescriptions = MemoryMarshal.Cast<byte, D2D1ResourceTextureDescription>(data).ToArray();
}
}