diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
index 9f52daa2..8240a9ff 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
@@ -78,8 +78,8 @@
-
-
+
+
diff --git a/src/ComputeSharp.D2D1/Interfaces/Descriptors/ID2D1ConstantBufferLoader.cs b/src/ComputeSharp.D2D1/Interfaces/Descriptors/ID2D1ConstantBufferLoader.cs
new file mode 100644
index 00000000..1f318330
--- /dev/null
+++ b/src/ComputeSharp.D2D1/Interfaces/Descriptors/ID2D1ConstantBufferLoader.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace ComputeSharp.D2D1.Descriptors;
+
+///
+/// A type representing a data loader for the constant buffer of a D2D1 shader.
+///
+public interface ID2D1ConstantBufferLoader
+{
+ ///
+ /// Loads the constant buffer of a D2D1 shader.
+ ///
+ /// The constant buffer for the D2D1 shader.
+ void LoadConstantBuffer(ReadOnlySpan data);
+}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs b/src/ComputeSharp.D2D1/Interfaces/Descriptors/ID2D1PixelShaderDescriptor{T}.cs
similarity index 53%
rename from src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
rename to src/ComputeSharp.D2D1/Interfaces/Descriptors/ID2D1PixelShaderDescriptor{T}.cs
index 4fb00ab4..ac06889c 100644
--- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
+++ b/src/ComputeSharp.D2D1/Interfaces/Descriptors/ID2D1PixelShaderDescriptor{T}.cs
@@ -1,21 +1,22 @@
using System;
-using System.ComponentModel;
using ComputeSharp.D2D1.Interop;
-namespace ComputeSharp.D2D1.__Internals;
+namespace ComputeSharp.D2D1.Descriptors;
///
-/// A base 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.
///
-[EditorBrowsable(EditorBrowsableState.Never)]
-[Obsolete("This interface is not intended to be used directly by user code")]
-public interface ID2D1Shader
+/// The type of D2D1 pixel shader being described.
+public interface ID2D1PixelShaderDescriptor
+ where T : unmanaged, ID2D1PixelShader
{
///
/// Gets the effect id of the D2D effect using this shader.
///
///
- /// This only applies to effects created from .
+ /// This only applies to effects created from .
///
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.
///
///
- /// This only applies to effects created from .
+ /// This only applies to effects created from .
///
string? EffectDisplayName { get; }
@@ -31,7 +32,7 @@ public interface ID2D1Shader
/// Gets the description of the D2D effect using this shader, if specified.
///
///
- /// This only applies to effects created from .
+ /// This only applies to effects created from .
///
string? EffectDescription { get; }
@@ -39,7 +40,7 @@ public interface ID2D1Shader
/// Gets the category of the D2D effect using this shader, if specified.
///
///
- /// This only applies to effects created from .
+ /// This only applies to effects created from .
///
string? EffectCategory { get; }
@@ -47,107 +48,61 @@ public interface ID2D1Shader
/// Gets the author of the D2D effect using this shader, if specified.
///
///
- /// This only applies to effects created from .
+ /// This only applies to effects created from .
///
string? EffectAuthor { get; }
- ///
- /// Initializes the current shader from a buffer with the serialized dispatch data.
- ///
- /// The input buffer with the serialized dispatch data.
- /// The input buffer must be retrieved from .
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be called directly by user code")]
- void InitializeFromDispatchData(ReadOnlySpan data);
-
- ///
- /// Gets the pixel options for the current shader.
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
- D2D1PixelOptions PixelOptions { get; }
-
///
/// Gets the size in bytes of the constant buffer for the current shader.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
int ConstantBufferSize { get; }
///
/// Gets the number of inputs for the current shader.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
int InputCount { get; }
///
/// Gets the number of resource textures for the current shader.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
int ResourceTextureCount { get; }
///
/// Gets the input types for the current shader.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
ReadOnlyMemory InputTypes { get; }
///
/// Gets the input descriptions for the current shader.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
ReadOnlyMemory InputDescriptions { get; }
///
/// Gets the resource texture descriptions for the shader.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
ReadOnlyMemory ResourceTextureDescriptions { get; }
+ ///
+ /// Gets the pixel options for the current shader.
+ ///
+ D2D1PixelOptions PixelOptions { get; }
+
///
/// Gets the buffer precision for the shader.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
D2D1BufferPrecision BufferPrecision { get; }
///
/// Gets the channel depth for the shader.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
D2D1ChannelDepth ChannelDepth { get; }
- ///
- /// Loads the dispatch data for the shader.
- ///
- /// The type of data loader being used.
- /// The instance to use to load the data.
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be called directly by user code")]
- void LoadDispatchData(ref TLoader loader)
- where TLoader : struct, ID2D1DispatchDataLoader;
-
- ///
- /// Gets the HLSL source code for the current shader instance.
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be called directly by user code")]
- string HlslSource { get; }
-
///
/// Gets the shader profile for the current shader.
///
///
/// This shader profile is either explicitly set by users, or the default one for D2D1 shaders.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
D2D1ShaderProfile ShaderProfile { get; }
///
@@ -156,17 +111,34 @@ public interface ID2D1Shader
///
/// This compile options are either explicitly set by users, or the default one for D2D1 shaders.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
D2D1CompileOptions CompileOptions { get; }
+ ///
+ /// Gets the HLSL source code for the current shader instance.
+ ///
+ string HlslSource { get; }
+
///
/// Gets the HLSL bytecode for the current shader, if available.
///
///
/// If no precompiled HLSL bytecode is available, the returned instance will be empty.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
ReadOnlyMemory HlslBytecode { get; }
+
+ ///
+ /// Creates a new shader instance from a constant buffer.
+ ///
+ /// The input constant buffer to read.
+ /// The input buffer must be retrieved from .
+ T CreateFromConstantBuffer(ReadOnlySpan buffer);
+
+ ///
+ /// Loads the constant buffer of a given input shader.
+ ///
+ /// The type of data loader being used.
+ /// The input shader to load the constant buffer for.
+ /// The instance to use to load the constant buffer.
+ void LoadConstantBuffer(in T shader, ref TLoader loader)
+ where TLoader : struct, ID2D1ConstantBufferLoader;
}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1/Interfaces/ID2D1PixelShader.cs b/src/ComputeSharp.D2D1/Interfaces/ID2D1PixelShader.cs
index c327733f..1a6e91a0 100644
--- a/src/ComputeSharp.D2D1/Interfaces/ID2D1PixelShader.cs
+++ b/src/ComputeSharp.D2D1/Interfaces/ID2D1PixelShader.cs
@@ -1,13 +1,9 @@
-using ComputeSharp.D2D1.__Internals;
-
-#pragma warning disable CS0618
-
namespace ComputeSharp.D2D1;
///
/// An representing a D2D1 pixel shader.
///
-public interface ID2D1PixelShader : ID2D1Shader
+public interface ID2D1PixelShader
{
///
/// Executes the current pixel shader.
diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1DispatchDataLoader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1DispatchDataLoader.cs
deleted file mode 100644
index d380bf7d..00000000
--- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1DispatchDataLoader.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.ComponentModel;
-
-namespace ComputeSharp.D2D1.__Internals;
-
-///
-/// A base representing a data loader for a D2D1 shader being dispatched.
-///
-[EditorBrowsable(EditorBrowsableState.Never)]
-[Obsolete("This interface is not intended to be used directly by user code")]
-public interface ID2D1DispatchDataLoader
-{
- ///
- /// Loads the captured values used by the D2D1 shader to be dispatched.
- ///
- /// The sequence of serialized captured values.
- void LoadConstantBuffer(ReadOnlySpan data);
-}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1DrawInfoUpdateContext{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1DrawInfoUpdateContext{T}.cs
index e725eaa1..a0064dae 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1DrawInfoUpdateContext{T}.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1DrawInfoUpdateContext{T}.cs
@@ -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;
///
@@ -13,7 +12,7 @@ namespace ComputeSharp.D2D1.Interop;
///
/// The type of shader the transform will interact with.
public readonly unsafe ref struct D2D1DrawInfoUpdateContext
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
///
/// The instance associated with the current object.
@@ -48,7 +47,7 @@ public readonly unsafe ref struct D2D1DrawInfoUpdateContext
Unsafe.SkipInit(out T shader);
- shader.InitializeFromDispatchData(buffer);
+ shader = shader.CreateFromConstantBuffer(buffer);
ArrayPool.Shared.Return(buffer);
@@ -61,8 +60,8 @@ public readonly unsafe ref struct D2D1DrawInfoUpdateContext
/// The instance to be used in the associated effect.
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);
}
}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
index 20cbbcce..2122a91d 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
@@ -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;
///
@@ -27,7 +26,7 @@ public static class D2D1PixelShader
///
///
public static ReadOnlyMemory LoadBytecode()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -58,7 +57,7 @@ public static class D2D1PixelShader
///
///
public static ReadOnlyMemory LoadBytecode(out D2D1ShaderProfile shaderProfile, out D2D1CompileOptions compileOptions)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
return LoadOrCompileBytecode(null, null, out shaderProfile, out compileOptions);
}
@@ -84,7 +83,7 @@ public static class D2D1PixelShader
///
///
public static ReadOnlyMemory LoadBytecode(D2D1ShaderProfile shaderProfile)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
return LoadOrCompileBytecode(shaderProfile, null, out _, out _);
}
@@ -111,7 +110,7 @@ public static class D2D1PixelShader
///
///
public static ReadOnlyMemory LoadBytecode(D2D1ShaderProfile shaderProfile, out D2D1CompileOptions compileOptions)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
return LoadOrCompileBytecode(shaderProfile, null, out _, out compileOptions);
}
@@ -140,7 +139,7 @@ public static class D2D1PixelShader
///
///
public static ReadOnlyMemory LoadBytecode(D2D1CompileOptions compileOptions)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
default(ArgumentException).ThrowIf((compileOptions & D2D1CompileOptions.PackMatrixColumnMajor) != 0, nameof(compileOptions));
@@ -172,7 +171,7 @@ public static class D2D1PixelShader
///
///
public static ReadOnlyMemory LoadBytecode(D2D1CompileOptions compileOptions, out D2D1ShaderProfile shaderProfile)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
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 instance will wrap a array with the bytecode.
///
public static ReadOnlyMemory LoadBytecode(D2D1ShaderProfile shaderProfile, D2D1CompileOptions compileOptions)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
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
{
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
{
Unsafe.SkipInit(out T shader);
@@ -275,7 +274,7 @@ public static class D2D1PixelShader
/// The type of D2D1 pixel shader to get the pixel options for.
/// The pixel options for the D2D1 pixel shader of type .
public static D2D1PixelOptions GetPixelOptions()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -288,7 +287,7 @@ public static class D2D1PixelShader
/// The type of D2D1 pixel shader to get the input count for.
/// The number of inputs for the D2D1 pixel shader of type .
public static int GetInputCount()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -301,7 +300,7 @@ public static class D2D1PixelShader
/// The type of D2D1 pixel shader to get the resource texture count for.
/// The number of resource texture for the D2D1 pixel shader of type .
public static int GetResourceTextureCount()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -314,7 +313,7 @@ public static class D2D1PixelShader
/// The type of D2D1 pixel shader to get the input types for.
/// The input types of the target D2D1 pixel shader.
public static ReadOnlyMemory GetInputTypes()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -327,7 +326,7 @@ public static class D2D1PixelShader
/// The type of D2D1 pixel shader to get the input descriptions for.
/// A with the available input descriptions for the shader.
public static ReadOnlyMemory GetInputDescriptions()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -340,7 +339,7 @@ public static class D2D1PixelShader
/// The type of D2D1 pixel shader to get the resource texture descriptions for.
/// A with the available resource texture descriptions for the shader.
public static ReadOnlyMemory GetResourceTextureDescriptions()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -353,7 +352,7 @@ public static class D2D1PixelShader
/// The type of D2D1 pixel shader to get the output buffer precision for.
/// The output buffer precision for the D2D1 pixel shader of type .
public static D2D1BufferPrecision GetOutputBufferPrecision()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -366,7 +365,7 @@ public static class D2D1PixelShader
/// The type of D2D1 pixel shader to get the output buffer channel depth for.
/// The output buffer channel depth for the D2D1 pixel shader of type .
public static D2D1ChannelDepth GetOutputBufferChannelDepth()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
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 .
public static ReadOnlyMemory GetConstantBuffer(in T shader)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
- 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
/// The type of D2D1 pixel shader to retrieve info for.
/// The size of the constant buffer for a D2D1 pixel shader of type .
public static int GetConstantBufferSize()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -414,7 +413,7 @@ public static class D2D1PixelShader
/// The number of bytes written into .
/// Thrown if is not large enough to contain the constant buffer.
public static int GetConstantBuffer(in T shader, Span span)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
if (!TryGetConstantBuffer(in shader, span, out int writtenBytes))
{
@@ -433,13 +432,13 @@ public static class D2D1PixelShader
/// The number of bytes written into .
/// Whether or not the constant buffer was retrieved successfully.
public static unsafe bool TryGetConstantBuffer(in T shader, Span span, out int bytesWritten)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
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
/// Thrown if is .
/// For more info, see .
public static unsafe void SetConstantBufferForD2D1DrawInfo(void* d2D1DrawInfo, in T shader)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
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);
}
}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs
index add62e86..71ac7af4 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs
@@ -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;
///
@@ -24,7 +23,7 @@ public static unsafe class D2D1PixelShaderEffect
/// The type of D2D1 pixel shader to get the effect id for.
/// The effect id of the D2D effect using shaders.
public static ref readonly Guid GetEffectId()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -37,7 +36,7 @@ public static unsafe class D2D1PixelShaderEffect
/// The type of D2D1 pixel shader to get the effect display name for.
/// The effect display name of the D2D effect using shaders, if available.
public static string? GetEffectDisplayName()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -50,7 +49,7 @@ public static unsafe class D2D1PixelShaderEffect
/// The type of D2D1 pixel shader to get the effect description for.
/// The effect description of the D2D effect using shaders, if available.
public static string? GetEffectDescription()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -63,7 +62,7 @@ public static unsafe class D2D1PixelShaderEffect
/// The type of D2D1 pixel shader to get the effect category for.
/// The effect category of the D2D effect using shaders, if available.
public static string? GetEffectCategory()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -76,7 +75,7 @@ public static unsafe class D2D1PixelShaderEffect
/// The type of D2D1 pixel shader to get the effect author for.
/// The effect author of the D2D effect using shaders, if available.
public static string? GetEffectAuthor()
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
@@ -96,7 +95,7 @@ public static unsafe class D2D1PixelShaderEffect
/// For more info, see .
///
public static void RegisterForD2D1Factory1(void* d2D1Factory1, out Guid effectId)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
default(ArgumentNullException).ThrowIfNull(d2D1Factory1);
@@ -345,7 +344,7 @@ public static unsafe class D2D1PixelShaderEffect
/// For more info, see .
///
public static ReadOnlyMemory GetRegistrationBlob(out Guid effectId)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
ArrayPoolBufferWriter writer = new(ArrayPoolBinaryWriter.DefaultInitialBufferSize);
@@ -560,7 +559,7 @@ public static unsafe class D2D1PixelShaderEffect
///
/// For more info, see .
public static void CreateFromD2D1DeviceContext(void* d2D1DeviceContext, void** d2D1Effect)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
default(ArgumentNullException).ThrowIfNull(d2D1DeviceContext);
default(ArgumentNullException).ThrowIfNull(d2D1Effect);
@@ -582,13 +581,13 @@ public static unsafe class D2D1PixelShaderEffect
/// Thrown if is .
/// For more info, see .
public static void SetConstantBufferForD2D1Effect(void* d2D1Effect, in T shader)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
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);
}
///
@@ -662,7 +661,7 @@ public static unsafe class D2D1PixelShaderEffect
/// Thrown if or are .
/// For more info, see .
public static void SetTransformMapperForD2D1Effect(void* d2D1Effect, D2D1TransformMapper transformMapper)
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
default(ArgumentNullException).ThrowIfNull(d2D1Effect);
default(ArgumentNullException).ThrowIfNull(transformMapper);
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs
index 8be0483b..2141af17 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs
@@ -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;
///
@@ -28,7 +27,7 @@ public static class D2D1ReflectionServices
///
///
public static unsafe D2D1ShaderInfo GetShaderInfo()
- where T : struct, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
Unsafe.SkipInit(out T shader);
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs
index 1e065117..aeef84c0 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs
@@ -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;
///
/// The type of D2D1 pixel shader associated to the transform mapper.
public static class D2D1TransformMapperFactory
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
///
/// Creates an instance for an inflate transform.
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.cs
index 21db7412..524fcda4 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.cs
@@ -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;
///
///
public abstract unsafe class D2D1TransformMapper : ICustomQueryInterface, ID2D1TransformMapperInterop
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
///
/// The object wrapped by the current instance.
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs
index 133025da..d9eba121 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs
@@ -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
///
/// The type of shader.
public sealed class For
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
///
/// The wrapper for the shader factory.
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T, TParameters}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T,TParameters}.cs
similarity index 97%
rename from src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T, TParameters}.cs
rename to src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T,TParameters}.cs
index 774f063c..34fcf9ba 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T, TParameters}.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T,TParameters}.cs
@@ -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;
/// The type of D2D1 pixel shader associated to the transform mapper.
/// The type of parameters that the transform mapper will use.
internal abstract class D2D1TransformMapper : D2D1TransformMapper
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
where TParameters : unmanaged
{
///
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapper{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapper{T}.cs
index a87f958d..33c15902 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapper{T}.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapper{T}.cs
@@ -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
///
/// The type of D2D1 pixel shader associated to the transform mapper.
internal abstract class D2D1AffineTransformMapper : D2D1TransformMapper
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
///
protected sealed override void TransformInputToOutput(in Matrix3x2 parameters, ref Rectangle64 rectangle)
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapper{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapper{T}.cs
index c01e4591..ba955962 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapper{T}.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapper{T}.cs
@@ -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;
///
/// The type of D2D1 pixel shader associated to the transform mapper.
internal abstract class D2D1InflateTransformMapper : D2D1TransformMapper
- where T : unmanaged, ID2D1PixelShader
+ where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor
{
///
protected sealed override void TransformInputToOutput(in (int Left, int Top, int Right, int Bottom) parameters, ref Rectangle64 rectangle)
diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayConstantBufferLoader.cs
similarity index 78%
rename from src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayDispatchDataLoader.cs
rename to src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayConstantBufferLoader.cs
index b3cc46f4..95f820c4 100644
--- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayDispatchDataLoader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayConstantBufferLoader.cs
@@ -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;
///
/// A data loader for D2D1 pixel shaders dispatched via .
///
-internal struct D2D1ByteArrayDispatchDataLoader : ID2D1DispatchDataLoader
+internal struct D2D1ByteArrayConstantBufferLoader : ID2D1ConstantBufferLoader
{
///
/// The resulting array with the constant buffer to use.
@@ -28,7 +26,7 @@ internal struct D2D1ByteArrayDispatchDataLoader : ID2D1DispatchDataLoader
}
///
- void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan data)
+ void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan data)
{
this.data = data.ToArray();
}
diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferConstantBufferLoader.cs
similarity index 84%
rename from src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferDispatchDataLoader.cs
rename to src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferConstantBufferLoader.cs
index 087ac7da..0225b6cd 100644
--- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferDispatchDataLoader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferConstantBufferLoader.cs
@@ -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;
///
/// A data loader for D2D1 pixel shaders dispatched via .
///
-internal unsafe struct D2D1ByteBufferDispatchDataLoader : ID2D1DispatchDataLoader
+internal unsafe struct D2D1ByteBufferConstantBufferLoader : ID2D1ConstantBufferLoader
{
///
/// The target buffer to write data to.
@@ -28,12 +26,12 @@ internal unsafe struct D2D1ByteBufferDispatchDataLoader : ID2D1DispatchDataLoade
private int writtenBytes;
///
- /// Creates a new instance.
+ /// Creates a new instance.
///
/// The target buffer to write data to.
/// The length of the buffer pointed to by .
[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
}
///
- void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan data)
+ void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan data)
{
if (data.TryCopyTo(new Span(this.buffer, this.length)))
{
diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoConstantBufferLoader.cs
similarity index 70%
rename from src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoDispatchDataLoader.cs
rename to src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoConstantBufferLoader.cs
index 88bf71d0..49fc96d1 100644
--- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoDispatchDataLoader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoConstantBufferLoader.cs
@@ -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;
///
/// A data loader for D2D1 pixel shaders dispatched via .
///
-internal readonly unsafe struct D2D1DrawInfoDispatchDataLoader : ID2D1DispatchDataLoader
+internal readonly unsafe struct D2D1DrawInfoConstantBufferLoader : ID2D1ConstantBufferLoader
{
///
/// The object in use.
@@ -20,17 +18,17 @@ internal readonly unsafe struct D2D1DrawInfoDispatchDataLoader : ID2D1DispatchDa
private readonly ID2D1DrawInfo* d2D1DrawInfo;
///
- /// Creates a new instance.
+ /// Creates a new instance.
///
/// The object to use.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal D2D1DrawInfoDispatchDataLoader(ID2D1DrawInfo* d2D1DrawInfo)
+ internal D2D1DrawInfoConstantBufferLoader(ID2D1DrawInfo* d2D1DrawInfo)
{
this.d2D1DrawInfo = d2D1DrawInfo;
}
///
- void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan data)
+ void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan data)
{
this.d2D1DrawInfo->SetPixelShaderConstantBuffer(
buffer: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)),
diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoUpdateContextDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoUpdateContextConstantBufferLoader.cs
similarity index 70%
rename from src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoUpdateContextDispatchDataLoader.cs
rename to src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoUpdateContextConstantBufferLoader.cs
index 74a3690d..7a746016 100644
--- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoUpdateContextDispatchDataLoader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoUpdateContextConstantBufferLoader.cs
@@ -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;
///
/// A data loader for D2D1 pixel shaders to be passed onto an object.
///
-internal readonly unsafe struct D2D1DrawInfoUpdateContextDispatchDataLoader : ID2D1DispatchDataLoader
+internal readonly unsafe struct D2D1DrawInfoUpdateContextConstantBufferLoader : ID2D1ConstantBufferLoader
{
///
/// The object in use.
@@ -20,17 +18,17 @@ internal readonly unsafe struct D2D1DrawInfoUpdateContextDispatchDataLoader : ID
private readonly ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext;
///
- /// Creates a new instance.
+ /// Creates a new instance.
///
/// The object to use.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal D2D1DrawInfoUpdateContextDispatchDataLoader(ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext)
+ internal D2D1DrawInfoUpdateContextConstantBufferLoader(ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext)
{
this.d2D1DrawInfoUpdateContext = d2D1DrawInfoUpdateContext;
}
///
- void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan data)
+ void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan data)
{
this.d2D1DrawInfoUpdateContext->SetConstantBuffer(
buffer: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)),
diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectConstantBufferLoader.cs
similarity index 73%
rename from src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectDispatchDataLoader.cs
rename to src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectConstantBufferLoader.cs
index 0f8c809f..267c4747 100644
--- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectDispatchDataLoader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectConstantBufferLoader.cs
@@ -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;
///
/// A data loader for D2D1 pixel shaders dispatched via .
///
-internal readonly unsafe struct D2D1EffectDispatchDataLoader : ID2D1DispatchDataLoader
+internal readonly unsafe struct D2D1EffectConstantBufferLoader : ID2D1ConstantBufferLoader
{
///
/// The object in use.
@@ -20,17 +18,17 @@ internal readonly unsafe struct D2D1EffectDispatchDataLoader : ID2D1DispatchData
private readonly ID2D1Effect* d2D1Effect;
///
- /// Creates a new instance.
+ /// Creates a new instance.
///
/// The object to use.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal D2D1EffectDispatchDataLoader(ID2D1Effect* d2D1Effect)
+ internal D2D1EffectConstantBufferLoader(ID2D1Effect* d2D1Effect)
{
this.d2D1Effect = d2D1Effect;
}
///
- void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan data)
+ void ID2D1ConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan data)
{
if (data.IsEmpty)
{