Rename internal interfaces and update all signatures
このコミットが含まれているのは:
1 親
2dcde8748e
コミット
85fd44d863
20ファイル変更
+140
-183
検索条件に一致するファイルはありません
@@ -78,8 +78,8 @@
|
||||
<Compile Include="..\ComputeSharp.D2D1\Extensions\ComPtrExtensions.cs" Link="ComputeSharp.D2D1\Extensions\ComPtrExtensions.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Extensions\HRESULTExtensions.cs" Link="ComputeSharp.D2D1\Extensions\HRESULTExtensions.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\ID2D1PixelShader.cs" Link="ComputeSharp.D2D1\Interfaces\ID2D1PixelShader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1DispatchDataLoader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1DispatchDataLoader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1Shader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1Shader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\Descriptors\ID2D1ConstantBufferLoader.cs" Link="ComputeSharp.D2D1\Interfaces\Descriptors\ID2D1ConstantBufferLoader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\Descriptors\ID2D1PixelShaderDescriptor{T}.cs" Link="ComputeSharp.D2D1\Interfaces\Descriptors\ID2D1PixelShaderDescriptor{T}.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" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Shaders\Interop\D2D1InputDescription.cs" Link="ComputeSharp.D2D1\Shaders\Interop\D2D1InputDescription.cs" />
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace ComputeSharp.D2D1.Descriptors;
|
||||
|
||||
/// <summary>
|
||||
/// A type representing a data loader for the constant buffer of a D2D1 shader.
|
||||
/// </summary>
|
||||
public interface ID2D1ConstantBufferLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads the constant buffer of a D2D1 shader.
|
||||
/// </summary>
|
||||
/// <param name="data">The constant buffer for the D2D1 shader.</param>
|
||||
void LoadConstantBuffer(ReadOnlySpan<byte> data);
|
||||
}
|
||||
+38
-66
@@ -1,21 +1,22 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using ComputeSharp.D2D1.Interop;
|
||||
|
||||
namespace ComputeSharp.D2D1.__Internals;
|
||||
namespace ComputeSharp.D2D1.Descriptors;
|
||||
|
||||
/// <summary>
|
||||
/// A base <see langword="interface"/> representing a given shader that can be dispatched.
|
||||
/// An interface for a descriptor for a given D2D1 pixel shader.
|
||||
/// Descriptors contain metadata associated to D2D1 pixel shaders,
|
||||
/// with all information needed to run them and create effects.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This interface is not intended to be used directly by user code")]
|
||||
public interface ID2D1Shader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader being described.</typeparam>
|
||||
public interface ID2D1PixelShaderDescriptor<T>
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the effect id of the D2D effect using this shader.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This only applies to effects created from <see cref="Interop.D2D1PixelShaderEffect"/>.
|
||||
/// This only applies to effects created from <see cref="D2D1PixelShaderEffect"/>.
|
||||
/// </remarks>
|
||||
ref readonly Guid EffectId { get; }
|
||||
|
||||
@@ -23,7 +24,7 @@ public interface ID2D1Shader
|
||||
/// Gets the display name of the D2D effect using this shader, if specified.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This only applies to effects created from <see cref="Interop.D2D1PixelShaderEffect"/>.
|
||||
/// This only applies to effects created from <see cref="D2D1PixelShaderEffect"/>.
|
||||
/// </remarks>
|
||||
string? EffectDisplayName { get; }
|
||||
|
||||
@@ -31,7 +32,7 @@ public interface ID2D1Shader
|
||||
/// Gets the description of the D2D effect using this shader, if specified.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This only applies to effects created from <see cref="Interop.D2D1PixelShaderEffect"/>.
|
||||
/// This only applies to effects created from <see cref="D2D1PixelShaderEffect"/>.
|
||||
/// </remarks>
|
||||
string? EffectDescription { get; }
|
||||
|
||||
@@ -39,7 +40,7 @@ public interface ID2D1Shader
|
||||
/// Gets the category of the D2D effect using this shader, if specified.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This only applies to effects created from <see cref="Interop.D2D1PixelShaderEffect"/>.
|
||||
/// This only applies to effects created from <see cref="D2D1PixelShaderEffect"/>.
|
||||
/// </remarks>
|
||||
string? EffectCategory { get; }
|
||||
|
||||
@@ -47,107 +48,61 @@ public interface ID2D1Shader
|
||||
/// Gets the author of the D2D effect using this shader, if specified.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This only applies to effects created from <see cref="Interop.D2D1PixelShaderEffect"/>.
|
||||
/// This only applies to effects created from <see cref="D2D1PixelShaderEffect"/>.
|
||||
/// </remarks>
|
||||
string? EffectAuthor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the current shader from a buffer with the serialized dispatch data.
|
||||
/// </summary>
|
||||
/// <param name="data">The input buffer with the serialized dispatch data.</param>
|
||||
/// <remarks>The input buffer must be retrieved from <see cref="LoadDispatchData"/>.</remarks>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be called directly by user code")]
|
||||
void InitializeFromDispatchData(ReadOnlySpan<byte> data);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the pixel options for the current shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
D2D1PixelOptions PixelOptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size in bytes of the constant buffer for the current shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
int ConstantBufferSize { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of inputs for the current shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
int InputCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of resource textures for the current shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
int ResourceTextureCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the input types for the current shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
ReadOnlyMemory<D2D1PixelShaderInputType> InputTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the input descriptions for the current shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
ReadOnlyMemory<D2D1InputDescription> InputDescriptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the resource texture descriptions for the shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
ReadOnlyMemory<D2D1ResourceTextureDescription> ResourceTextureDescriptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the pixel options for the current shader.
|
||||
/// </summary>
|
||||
D2D1PixelOptions PixelOptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the buffer precision for the shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
D2D1BufferPrecision BufferPrecision { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the channel depth for the shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
D2D1ChannelDepth ChannelDepth { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads the dispatch data for the shader.
|
||||
/// </summary>
|
||||
/// <typeparam name="TLoader">The type of data loader being used.</typeparam>
|
||||
/// <param name="loader">The <typeparamref name="TLoader"/> instance to use to load the data.</param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be called directly by user code")]
|
||||
void LoadDispatchData<TLoader>(ref TLoader loader)
|
||||
where TLoader : struct, ID2D1DispatchDataLoader;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HLSL source code for the current shader instance.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be called directly by user code")]
|
||||
string HlslSource { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the shader profile for the current shader.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This shader profile is either explicitly set by users, or the default one for D2D1 shaders.
|
||||
/// </remarks>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
D2D1ShaderProfile ShaderProfile { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -156,17 +111,34 @@ public interface ID2D1Shader
|
||||
/// <remarks>
|
||||
/// This compile options are either explicitly set by users, or the default one for D2D1 shaders.
|
||||
/// </remarks>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
D2D1CompileOptions CompileOptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HLSL source code for the current shader instance.
|
||||
/// </summary>
|
||||
string HlslSource { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HLSL bytecode for the current shader, if available.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If no precompiled HLSL bytecode is available, the returned <see cref="ReadOnlyMemory{T}"/> instance will be empty.
|
||||
/// </remarks>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
ReadOnlyMemory<byte> HlslBytecode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <typeparamref name="T"/> shader instance from a constant buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The input constant buffer to read.</param>
|
||||
/// <remarks>The input buffer must be retrieved from <see cref="LoadConstantBuffer"/>.</remarks>
|
||||
T CreateFromConstantBuffer(ReadOnlySpan<byte> buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Loads the constant buffer of a given input shader.
|
||||
/// </summary>
|
||||
/// <typeparam name="TLoader">The type of data loader being used.</typeparam>
|
||||
/// <param name="shader">The input shader to load the constant buffer for.</param>
|
||||
/// <param name="loader">The <typeparamref name="TLoader"/> instance to use to load the constant buffer.</param>
|
||||
void LoadConstantBuffer<TLoader>(in T shader, ref TLoader loader)
|
||||
where TLoader : struct, ID2D1ConstantBufferLoader;
|
||||
}
|
||||
@@ -1,13 +1,9 @@
|
||||
using ComputeSharp.D2D1.__Internals;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// An <see langword="interface"/> representing a D2D1 pixel shader.
|
||||
/// </summary>
|
||||
public interface ID2D1PixelShader : ID2D1Shader
|
||||
public interface ID2D1PixelShader
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes the current pixel shader.
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ComputeSharp.D2D1.__Internals;
|
||||
|
||||
/// <summary>
|
||||
/// A base <see langword="interface"/> representing a data loader for a D2D1 shader being dispatched.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This interface is not intended to be used directly by user code")]
|
||||
public interface ID2D1DispatchDataLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads the captured values used by the D2D1 shader to be dispatched.
|
||||
/// </summary>
|
||||
/// <param name="data">The sequence of serialized captured values.</param>
|
||||
void LoadConstantBuffer(ReadOnlySpan<byte> data);
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Extensions;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
|
||||
using ComputeSharp.D2D1.Shaders.Loaders;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Interop;
|
||||
|
||||
/// <summary>
|
||||
@@ -13,7 +12,7 @@ namespace ComputeSharp.D2D1.Interop;
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of shader the transform will interact with.</typeparam>
|
||||
public readonly unsafe ref struct D2D1DrawInfoUpdateContext<T>
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="ID2D1DrawInfoUpdateContext"/> instance associated with the current object.
|
||||
@@ -48,7 +47,7 @@ public readonly unsafe ref struct D2D1DrawInfoUpdateContext<T>
|
||||
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
shader.InitializeFromDispatchData(buffer);
|
||||
shader = shader.CreateFromConstantBuffer(buffer);
|
||||
|
||||
ArrayPool<byte>.Shared.Return(buffer);
|
||||
|
||||
@@ -61,8 +60,8 @@ public readonly unsafe ref struct D2D1DrawInfoUpdateContext<T>
|
||||
/// <param name="shader">The <typeparamref name="T"/> instance to be used in the associated effect.</param>
|
||||
public void SetConstantBuffer(in T shader)
|
||||
{
|
||||
D2D1DrawInfoUpdateContextDispatchDataLoader dataLoader = new(this.d2D1DrawInfoUpdateContext);
|
||||
D2D1DrawInfoUpdateContextConstantBufferLoader dataLoader = new(this.d2D1DrawInfoUpdateContext);
|
||||
|
||||
Unsafe.AsRef(in shader).LoadDispatchData(ref dataLoader);
|
||||
Unsafe.AsRef(in shader).LoadConstantBuffer(in shader, ref dataLoader);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Shaders.Loaders;
|
||||
using ComputeSharp.D2D1.Shaders.Translation;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Interop;
|
||||
|
||||
/// <summary>
|
||||
@@ -27,7 +26,7 @@ public static class D2D1PixelShader
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static ReadOnlyMemory<byte> LoadBytecode<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -58,7 +57,7 @@ public static class D2D1PixelShader
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static ReadOnlyMemory<byte> LoadBytecode<T>(out D2D1ShaderProfile shaderProfile, out D2D1CompileOptions compileOptions)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
return LoadOrCompileBytecode<T>(null, null, out shaderProfile, out compileOptions);
|
||||
}
|
||||
@@ -84,7 +83,7 @@ public static class D2D1PixelShader
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static ReadOnlyMemory<byte> LoadBytecode<T>(D2D1ShaderProfile shaderProfile)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
return LoadOrCompileBytecode<T>(shaderProfile, null, out _, out _);
|
||||
}
|
||||
@@ -111,7 +110,7 @@ public static class D2D1PixelShader
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static ReadOnlyMemory<byte> LoadBytecode<T>(D2D1ShaderProfile shaderProfile, out D2D1CompileOptions compileOptions)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
return LoadOrCompileBytecode<T>(shaderProfile, null, out _, out compileOptions);
|
||||
}
|
||||
@@ -140,7 +139,7 @@ public static class D2D1PixelShader
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static ReadOnlyMemory<byte> LoadBytecode<T>(D2D1CompileOptions compileOptions)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
default(ArgumentException).ThrowIf((compileOptions & D2D1CompileOptions.PackMatrixColumnMajor) != 0, nameof(compileOptions));
|
||||
|
||||
@@ -172,7 +171,7 @@ public static class D2D1PixelShader
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static ReadOnlyMemory<byte> LoadBytecode<T>(D2D1CompileOptions compileOptions, out D2D1ShaderProfile shaderProfile)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
default(ArgumentException).ThrowIf((compileOptions & D2D1CompileOptions.PackMatrixColumnMajor) != 0, nameof(compileOptions));
|
||||
|
||||
@@ -195,7 +194,7 @@ public static class D2D1PixelShader
|
||||
/// If the shader was compiled at runtime, the returned <see cref="ReadOnlyMemory{T}"/> instance will wrap a <see cref="byte"/> array with the bytecode.
|
||||
/// </remarks>
|
||||
public static ReadOnlyMemory<byte> LoadBytecode<T>(D2D1ShaderProfile shaderProfile, D2D1CompileOptions compileOptions)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
default(ArgumentException).ThrowIf((compileOptions & D2D1CompileOptions.PackMatrixColumnMajor) != 0, nameof(compileOptions));
|
||||
|
||||
@@ -217,7 +216,7 @@ public static class D2D1PixelShader
|
||||
D2D1CompileOptions? requestedCompileOptions,
|
||||
out D2D1ShaderProfile effectiveShaderProfile,
|
||||
out D2D1CompileOptions effectiveCompileOptions)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -250,7 +249,7 @@ public static class D2D1PixelShader
|
||||
D2D1CompileOptions? requestedCompileOptions,
|
||||
out D2D1ShaderProfile effectiveShaderProfile,
|
||||
out D2D1CompileOptions effectiveCompileOptions)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -275,7 +274,7 @@ public static class D2D1PixelShader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the pixel options for.</typeparam>
|
||||
/// <returns>The pixel options for the D2D1 pixel shader of type <typeparamref name="T"/>.</returns>
|
||||
public static D2D1PixelOptions GetPixelOptions<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -288,7 +287,7 @@ public static class D2D1PixelShader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the input count for.</typeparam>
|
||||
/// <returns>The number of inputs for the D2D1 pixel shader of type <typeparamref name="T"/>.</returns>
|
||||
public static int GetInputCount<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -301,7 +300,7 @@ public static class D2D1PixelShader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the resource texture count for.</typeparam>
|
||||
/// <returns>The number of resource texture for the D2D1 pixel shader of type <typeparamref name="T"/>.</returns>
|
||||
public static int GetResourceTextureCount<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -314,7 +313,7 @@ public static class D2D1PixelShader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the input types for.</typeparam>
|
||||
/// <returns>The input types of the target D2D1 pixel shader.</returns>
|
||||
public static ReadOnlyMemory<D2D1PixelShaderInputType> GetInputTypes<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -327,7 +326,7 @@ public static class D2D1PixelShader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the input descriptions for.</typeparam>
|
||||
/// <returns>A <see cref="ReadOnlyMemory{T}"/> with the available input descriptions for the shader.</returns>
|
||||
public static ReadOnlyMemory<D2D1InputDescription> GetInputDescriptions<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -340,7 +339,7 @@ public static class D2D1PixelShader
|
||||
/// <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
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -353,7 +352,7 @@ public static class D2D1PixelShader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the output buffer precision for.</typeparam>
|
||||
/// <returns>The output buffer precision for the D2D1 pixel shader of type <typeparamref name="T"/>.</returns>
|
||||
public static D2D1BufferPrecision GetOutputBufferPrecision<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -366,7 +365,7 @@ public static class D2D1PixelShader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the output buffer channel depth for.</typeparam>
|
||||
/// <returns>The output buffer channel depth for the D2D1 pixel shader of type <typeparamref name="T"/>.</returns>
|
||||
public static D2D1ChannelDepth GetOutputBufferChannelDepth<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -383,11 +382,11 @@ public static class D2D1PixelShader
|
||||
/// This method will allocate a buffer every time it is invoked.
|
||||
/// For a zero-allocation alternative, use <see cref="SetConstantBufferForD2D1DrawInfo"/>.</remarks>
|
||||
public static ReadOnlyMemory<byte> GetConstantBuffer<T>(in T shader)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
D2D1ByteArrayDispatchDataLoader dataLoader = default;
|
||||
D2D1ByteArrayConstantBufferLoader dataLoader = default;
|
||||
|
||||
Unsafe.AsRef(in shader).LoadDispatchData(ref dataLoader);
|
||||
Unsafe.AsRef(in shader).LoadConstantBuffer(in shader, ref dataLoader);
|
||||
|
||||
return dataLoader.GetResultingDispatchData();
|
||||
}
|
||||
@@ -398,7 +397,7 @@ public static class D2D1PixelShader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to retrieve info for.</typeparam>
|
||||
/// <returns>The size of the constant buffer for a D2D1 pixel shader of type <typeparamref name="T"/>.</returns>
|
||||
public static int GetConstantBufferSize<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -414,7 +413,7 @@ public static class D2D1PixelShader
|
||||
/// <returns>The number of bytes written into <paramref name="span"/>.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown if <paramref name="span"/> is not large enough to contain the constant buffer.</exception>
|
||||
public static int GetConstantBuffer<T>(in T shader, Span<byte> span)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
if (!TryGetConstantBuffer(in shader, span, out int writtenBytes))
|
||||
{
|
||||
@@ -433,13 +432,13 @@ public static class D2D1PixelShader
|
||||
/// <param name="bytesWritten">The number of bytes written into <paramref name="span"/>.</param>
|
||||
/// <returns>Whether or not the constant buffer was retrieved successfully.</returns>
|
||||
public static unsafe bool TryGetConstantBuffer<T>(in T shader, Span<byte> span, out int bytesWritten)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
fixed (byte* buffer = span)
|
||||
{
|
||||
D2D1ByteBufferDispatchDataLoader dataLoader = new(buffer, span.Length);
|
||||
D2D1ByteBufferConstantBufferLoader dataLoader = new(buffer, span.Length);
|
||||
|
||||
Unsafe.AsRef(in shader).LoadDispatchData(ref dataLoader);
|
||||
Unsafe.AsRef(in shader).LoadConstantBuffer(in shader, ref dataLoader);
|
||||
|
||||
return dataLoader.TryGetWrittenBytes(out bytesWritten);
|
||||
}
|
||||
@@ -454,12 +453,12 @@ public static class D2D1PixelShader
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="d2D1DrawInfo"/> is <see langword="null"/>.</exception>
|
||||
/// <remarks>For more info, see <see href="https://docs.microsoft.com/windows/win32/api/d2d1effectauthor/nf-d2d1effectauthor-id2d1drawinfo-setpixelshaderconstantbuffer"/>.</remarks>
|
||||
public static unsafe void SetConstantBufferForD2D1DrawInfo<T>(void* d2D1DrawInfo, in T shader)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(d2D1DrawInfo);
|
||||
|
||||
D2D1DrawInfoDispatchDataLoader dataLoader = new((ID2D1DrawInfo*)d2D1DrawInfo);
|
||||
D2D1DrawInfoConstantBufferLoader dataLoader = new((ID2D1DrawInfo*)d2D1DrawInfo);
|
||||
|
||||
Unsafe.AsRef(in shader).LoadDispatchData(ref dataLoader);
|
||||
Unsafe.AsRef(in shader).LoadConstantBuffer(in shader, ref dataLoader);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Extensions;
|
||||
using ComputeSharp.D2D1.Interop.Effects;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Buffers;
|
||||
@@ -9,8 +10,6 @@ using ComputeSharp.D2D1.Shaders.Loaders;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Interop;
|
||||
|
||||
/// <summary>
|
||||
@@ -24,7 +23,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the effect id for.</typeparam>
|
||||
/// <returns>The effect id of the D2D effect using <typeparamref name="T"/> shaders.</returns>
|
||||
public static ref readonly Guid GetEffectId<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -37,7 +36,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the effect display name for.</typeparam>
|
||||
/// <returns>The effect display name of the D2D effect using <typeparamref name="T"/> shaders, if available.</returns>
|
||||
public static string? GetEffectDisplayName<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -50,7 +49,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the effect description for.</typeparam>
|
||||
/// <returns>The effect description of the D2D effect using <typeparamref name="T"/> shaders, if available.</returns>
|
||||
public static string? GetEffectDescription<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -63,7 +62,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the effect category for.</typeparam>
|
||||
/// <returns>The effect category of the D2D effect using <typeparamref name="T"/> shaders, if available.</returns>
|
||||
public static string? GetEffectCategory<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -76,7 +75,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader to get the effect author for.</typeparam>
|
||||
/// <returns>The effect author of the D2D effect using <typeparamref name="T"/> shaders, if available.</returns>
|
||||
public static string? GetEffectAuthor<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
@@ -96,7 +95,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1factory1-registereffectfromstring"/>.</para>
|
||||
/// </remarks>
|
||||
public static void RegisterForD2D1Factory1<T>(void* d2D1Factory1, out Guid effectId)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(d2D1Factory1);
|
||||
|
||||
@@ -345,7 +344,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// <para>For more info, see <see href="https://docs.microsoft.com/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1factory1-registereffectfromstring"/>.</para>
|
||||
/// </remarks>
|
||||
public static ReadOnlyMemory<byte> GetRegistrationBlob<T>(out Guid effectId)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
ArrayPoolBufferWriter<byte> writer = new(ArrayPoolBinaryWriter.DefaultInitialBufferSize);
|
||||
|
||||
@@ -560,7 +559,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// </exception>
|
||||
/// <remarks>For more info, see <see href="https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createeffect"/>.</remarks>
|
||||
public static void CreateFromD2D1DeviceContext<T>(void* d2D1DeviceContext, void** d2D1Effect)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(d2D1DeviceContext);
|
||||
default(ArgumentNullException).ThrowIfNull(d2D1Effect);
|
||||
@@ -582,13 +581,13 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="d2D1Effect"/> is <see langword="null"/>.</exception>
|
||||
/// <remarks>For more info, see <see href="https://docs.microsoft.com/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvalue(uint32_d2d1_property_type_constbyte_uint32)"/>.</remarks>
|
||||
public static void SetConstantBufferForD2D1Effect<T>(void* d2D1Effect, in T shader)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(d2D1Effect);
|
||||
|
||||
D2D1EffectDispatchDataLoader dataLoader = new((ID2D1Effect*)d2D1Effect);
|
||||
D2D1EffectConstantBufferLoader dataLoader = new((ID2D1Effect*)d2D1Effect);
|
||||
|
||||
Unsafe.AsRef(in shader).LoadDispatchData(ref dataLoader);
|
||||
Unsafe.AsRef(in shader).LoadConstantBuffer(in shader, ref dataLoader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -662,7 +661,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="d2D1Effect"/> or <paramref name="transformMapper"/> are <see langword="null"/>.</exception>
|
||||
/// <remarks>For more info, see <see href="https://docs.microsoft.com/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvalue(uint32_d2d1_property_type_constbyte_uint32)"/>.</remarks>
|
||||
public static void SetTransformMapperForD2D1Effect<T>(void* d2D1Effect, D2D1TransformMapper<T> transformMapper)
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(d2D1Effect);
|
||||
default(ArgumentNullException).ThrowIfNull(transformMapper);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Extensions;
|
||||
using ComputeSharp.D2D1.Shaders.Translation;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Interop;
|
||||
|
||||
/// <summary>
|
||||
@@ -28,7 +27,7 @@ public static class D2D1ReflectionServices
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static unsafe D2D1ShaderInfo GetShaderInfo<T>()
|
||||
where T : struct, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Factories;
|
||||
|
||||
namespace ComputeSharp.D2D1.Interop;
|
||||
@@ -9,7 +10,7 @@ namespace ComputeSharp.D2D1.Interop;
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader associated to the transform mapper.</typeparam>
|
||||
public static class D2D1TransformMapperFactory<T>
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an <see cref="D2D1TransformMapper{T}"/> instance for an inflate transform.
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Interop.Effects;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
|
||||
using TerraFX.Interop.Windows;
|
||||
@@ -94,7 +95,7 @@ namespace ComputeSharp.D2D1.Interop;
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public abstract unsafe class D2D1TransformMapper<T> : ICustomQueryInterface, ID2D1TransformMapperInterop
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="D2D1TransformMapperImpl"/> object wrapped by the current instance.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
#if !NET6_0_OR_GREATER
|
||||
@@ -27,7 +28,7 @@ internal unsafe partial struct PixelShaderEffect
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of shader.</typeparam>
|
||||
public sealed class For<T>
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="FactoryDelegate"/> wrapper for the shader factory.
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Interop;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Helpers;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Factories.Abstract;
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader associated to the transform mapper.</typeparam>
|
||||
/// <typeparam name="TParameters">The type of parameters that the transform mapper will use.</typeparam>
|
||||
internal abstract class D2D1TransformMapper<T, TParameters> : D2D1TransformMapper<T>
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
where TParameters : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Interop;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Factories.Abstract;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Helpers;
|
||||
@@ -80,7 +81,7 @@ file static class D2D1AffineTransformMapper
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader associated to the transform mapper.</typeparam>
|
||||
internal abstract class D2D1AffineTransformMapper<T> : D2D1TransformMapper<T, Matrix3x2>
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
protected sealed override void TransformInputToOutput(in Matrix3x2 parameters, ref Rectangle64 rectangle)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Interop;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Factories.Abstract;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Helpers;
|
||||
@@ -9,7 +10,7 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Factories;
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader associated to the transform mapper.</typeparam>
|
||||
internal abstract class D2D1InflateTransformMapper<T> : D2D1TransformMapper<T, (int Left, int Top, int Right, int Bottom)>
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
protected sealed override void TransformInputToOutput(in (int Left, int Top, int Right, int Bottom) parameters, ref Rectangle64 rectangle)
|
||||
|
||||
+3
-5
@@ -1,16 +1,14 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.D2D1.__Internals;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using TerraFX.Interop.DirectX;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Shaders.Loaders;
|
||||
|
||||
/// <summary>
|
||||
/// A data loader for D2D1 pixel shaders dispatched via <see cref="ID2D1DrawInfo"/>.
|
||||
/// </summary>
|
||||
internal struct D2D1ByteArrayDispatchDataLoader : ID2D1DispatchDataLoader
|
||||
internal struct D2D1ByteArrayConstantBufferLoader : ID2D1ConstantBufferLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// The resulting array with the constant buffer to use.
|
||||
@@ -28,7 +26,7 @@ internal struct D2D1ByteArrayDispatchDataLoader : ID2D1DispatchDataLoader
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
{
|
||||
this.data = data.ToArray();
|
||||
}
|
||||
+5
-7
@@ -1,16 +1,14 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.D2D1.__Internals;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using TerraFX.Interop.DirectX;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Shaders.Loaders;
|
||||
|
||||
/// <summary>
|
||||
/// A data loader for D2D1 pixel shaders dispatched via <see cref="ID2D1DrawInfo"/>.
|
||||
/// </summary>
|
||||
internal unsafe struct D2D1ByteBufferDispatchDataLoader : ID2D1DispatchDataLoader
|
||||
internal unsafe struct D2D1ByteBufferConstantBufferLoader : ID2D1ConstantBufferLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// The target buffer to write data to.
|
||||
@@ -28,12 +26,12 @@ internal unsafe struct D2D1ByteBufferDispatchDataLoader : ID2D1DispatchDataLoade
|
||||
private int writtenBytes;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="D2D1ByteBufferDispatchDataLoader"/> instance.
|
||||
/// Creates a new <see cref="D2D1ByteBufferConstantBufferLoader"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The target buffer to write data to.</param>
|
||||
/// <param name="length">The length of the buffer pointed to by <see cref="buffer"/>.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal D2D1ByteBufferDispatchDataLoader(byte* buffer, int length)
|
||||
internal D2D1ByteBufferConstantBufferLoader(byte* buffer, int length)
|
||||
{
|
||||
this.buffer = buffer;
|
||||
this.length = length;
|
||||
@@ -65,7 +63,7 @@ internal unsafe struct D2D1ByteBufferDispatchDataLoader : ID2D1DispatchDataLoade
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
{
|
||||
if (data.TryCopyTo(new Span<byte>(this.buffer, this.length)))
|
||||
{
|
||||
+5
-7
@@ -1,18 +1,16 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.D2D1.__Internals;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Extensions;
|
||||
using TerraFX.Interop.DirectX;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Shaders.Loaders;
|
||||
|
||||
/// <summary>
|
||||
/// A data loader for D2D1 pixel shaders dispatched via <see cref="ID2D1DrawInfo"/>.
|
||||
/// </summary>
|
||||
internal readonly unsafe struct D2D1DrawInfoDispatchDataLoader : ID2D1DispatchDataLoader
|
||||
internal readonly unsafe struct D2D1DrawInfoConstantBufferLoader : ID2D1ConstantBufferLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="ID2D1DrawInfo"/> object in use.
|
||||
@@ -20,17 +18,17 @@ internal readonly unsafe struct D2D1DrawInfoDispatchDataLoader : ID2D1DispatchDa
|
||||
private readonly ID2D1DrawInfo* d2D1DrawInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="D2D1DrawInfoDispatchDataLoader"/> instance.
|
||||
/// Creates a new <see cref="D2D1DrawInfoConstantBufferLoader"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="d2D1DrawInfo">The <see cref="ID2D1DrawInfo"/> object to use.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal D2D1DrawInfoDispatchDataLoader(ID2D1DrawInfo* d2D1DrawInfo)
|
||||
internal D2D1DrawInfoConstantBufferLoader(ID2D1DrawInfo* d2D1DrawInfo)
|
||||
{
|
||||
this.d2D1DrawInfo = d2D1DrawInfo;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
{
|
||||
this.d2D1DrawInfo->SetPixelShaderConstantBuffer(
|
||||
buffer: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)),
|
||||
+5
-7
@@ -1,18 +1,16 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.D2D1.__Internals;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Extensions;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Shaders.Loaders;
|
||||
|
||||
/// <summary>
|
||||
/// A data loader for D2D1 pixel shaders to be passed onto an <see cref="ID2D1DrawInfoUpdateContext"/> object.
|
||||
/// </summary>
|
||||
internal readonly unsafe struct D2D1DrawInfoUpdateContextDispatchDataLoader : ID2D1DispatchDataLoader
|
||||
internal readonly unsafe struct D2D1DrawInfoUpdateContextConstantBufferLoader : ID2D1ConstantBufferLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="ID2D1DrawInfoUpdateContext"/> object in use.
|
||||
@@ -20,17 +18,17 @@ internal readonly unsafe struct D2D1DrawInfoUpdateContextDispatchDataLoader : ID
|
||||
private readonly ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="D2D1DrawInfoUpdateContextDispatchDataLoader"/> instance.
|
||||
/// Creates a new <see cref="D2D1DrawInfoUpdateContextConstantBufferLoader"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="d2D1DrawInfoUpdateContext">The <see cref="ID2D1DrawInfoUpdateContext"/> object to use.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal D2D1DrawInfoUpdateContextDispatchDataLoader(ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext)
|
||||
internal D2D1DrawInfoUpdateContextConstantBufferLoader(ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext)
|
||||
{
|
||||
this.d2D1DrawInfoUpdateContext = d2D1DrawInfoUpdateContext;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
{
|
||||
this.d2D1DrawInfoUpdateContext->SetConstantBuffer(
|
||||
buffer: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)),
|
||||
+5
-7
@@ -1,18 +1,16 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.D2D1.__Internals;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Extensions;
|
||||
using TerraFX.Interop.DirectX;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Shaders.Loaders;
|
||||
|
||||
/// <summary>
|
||||
/// A data loader for D2D1 pixel shaders dispatched via <see cref="ID2D1Effect"/>.
|
||||
/// </summary>
|
||||
internal readonly unsafe struct D2D1EffectDispatchDataLoader : ID2D1DispatchDataLoader
|
||||
internal readonly unsafe struct D2D1EffectConstantBufferLoader : ID2D1ConstantBufferLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="ID2D1Effect"/> object in use.
|
||||
@@ -20,17 +18,17 @@ internal readonly unsafe struct D2D1EffectDispatchDataLoader : ID2D1DispatchData
|
||||
private readonly ID2D1Effect* d2D1Effect;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="D2D1EffectDispatchDataLoader"/> instance.
|
||||
/// Creates a new <see cref="D2D1EffectConstantBufferLoader"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="d2D1Effect">The <see cref="ID2D1Effect"/> object to use.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal D2D1EffectDispatchDataLoader(ID2D1Effect* d2D1Effect)
|
||||
internal D2D1EffectConstantBufferLoader(ID2D1Effect* d2D1Effect)
|
||||
{
|
||||
this.d2D1Effect = d2D1Effect;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan<byte> data)
|
||||
{
|
||||
if (data.IsEmpty)
|
||||
{
|
||||
新しいイシューから参照
ユーザーをブロックする