diff --git a/src/ComputeSharp.D2D1.UI/ComputeSharp.D2D1.UI.projitems b/src/ComputeSharp.D2D1.UI/ComputeSharp.D2D1.UI.projitems
index 16149cbc..d83501cc 100644
--- a/src/ComputeSharp.D2D1.UI/ComputeSharp.D2D1.UI.projitems
+++ b/src/ComputeSharp.D2D1.UI/ComputeSharp.D2D1.UI.projitems
@@ -37,8 +37,6 @@
-
-
diff --git a/src/ComputeSharp.D2D1.UI/Loaders/D2D1ImmutableArrayResourceTextureDescriptionsLoader.cs b/src/ComputeSharp.D2D1.UI/Loaders/D2D1ImmutableArrayResourceTextureDescriptionsLoader.cs
deleted file mode 100644
index 86ba37e6..00000000
--- a/src/ComputeSharp.D2D1.UI/Loaders/D2D1ImmutableArrayResourceTextureDescriptionsLoader.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Collections.Immutable;
-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;
-
-///
-/// A resource texture index array loader for D2D1 pixel shaders.
-///
-internal struct D2D1ImmutableArrayResourceTextureDescriptionsLoader : ID2D1ResourceTextureDescriptionsLoader
-{
- ///
- /// The array of indices for resource textures for the current effect.
- ///
- private ImmutableArray indices;
-
- ///
- /// Gets the resulting array of indices for resource textures for the current effect.
- ///
- /// An array of indices for resource textures for the current effect.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public readonly ImmutableArray GetResultingIndices()
- {
- return this.indices;
- }
-
- ///
- void ID2D1ResourceTextureDescriptionsLoader.LoadResourceTextureDescriptions(ReadOnlySpan data)
- {
- if (data.IsEmpty)
- {
- this.indices = ImmutableArray.Empty;
- }
- else
- {
- ReadOnlySpan descriptions = MemoryMarshal.Cast(data);
-
- int[] indices = new int[descriptions.Length];
-
- for (int i = 0; i < descriptions.Length; i++)
- {
- indices[i] = descriptions[i].Index;
- }
-
- this.indices = Unsafe.As>(ref indices);
- }
- }
-}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1.UI/Loaders/D2D1IndexBitmaskResourceTextureDescriptionsLoader.cs b/src/ComputeSharp.D2D1.UI/Loaders/D2D1IndexBitmaskResourceTextureDescriptionsLoader.cs
deleted file mode 100644
index 354f6980..00000000
--- a/src/ComputeSharp.D2D1.UI/Loaders/D2D1IndexBitmaskResourceTextureDescriptionsLoader.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-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;
-
-///
-/// A resource texture index bitmask loader for D2D1 pixel shaders.
-///
-internal struct D2D1IndexBitmaskResourceTextureDescriptionsLoader : ID2D1ResourceTextureDescriptionsLoader
-{
- ///
- /// The bitmask of indices for resource textures in the target shader.
- ///
- private int indexBitmask;
-
- ///
- /// Gets the resulting bitmask of indices for resource textures in the target shader.
- ///
- /// A bitmask of indices for resource textures in the target shader.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public readonly int GetResultingIndexBitmask()
- {
- return this.indexBitmask;
- }
-
- ///
- void ID2D1ResourceTextureDescriptionsLoader.LoadResourceTextureDescriptions(ReadOnlySpan data)
- {
- int indexBitmask = 0;
-
- foreach (ref readonly D2D1ResourceTextureDescription description in MemoryMarshal.Cast(data))
- {
- indexBitmask |= 1 << description.Index;
- }
-
- this.indexBitmask = indexBitmask;
- }
-}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs
index 1a1630ad..8a7cd163 100644
--- a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs
+++ b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs
@@ -5,7 +5,6 @@ using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using ComputeSharp.D2D1.Interop;
-using ComputeSharp.D2D1.Shaders.Loaders;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Buffers;
using ComputeSharp.D2D1.Uwp.Collections;
@@ -233,13 +232,16 @@ partial class PixelShaderEffect
/// The bitmask of indices for resource textures in the target shader.
private static int GetIndexBitmask()
{
- D2D1IndexBitmaskResourceTextureDescriptionsLoader bitmaskLoader = default;
-
Unsafe.SkipInit(out T shader);
- shader.LoadResourceTextureDescriptions(ref bitmaskLoader);
+ int indexBitmask = 0;
- return bitmaskLoader.GetResultingIndexBitmask();
+ foreach (ref readonly D2D1ResourceTextureDescription description in shader.ResourceTextureDescriptions.Span)
+ {
+ indexBitmask |= 1 << description.Index;
+ }
+
+ return indexBitmask;
}
///
@@ -248,13 +250,24 @@ partial class PixelShaderEffect
/// The collection of valid indices for the current effect.
private static ImmutableArray GetIndices()
{
- D2D1ImmutableArrayResourceTextureDescriptionsLoader indicesLoader = default;
-
Unsafe.SkipInit(out T shader);
- shader.LoadResourceTextureDescriptions(ref indicesLoader);
+ ReadOnlySpan descriptions = shader.ResourceTextureDescriptions.Span;
- return indicesLoader.GetResultingIndices();
+ // Skip the array allocation if there are no resource texture descriptions
+ if (descriptions.IsEmpty)
+ {
+ return ImmutableArray.Empty;
+ }
+
+ int[] indices = new int[descriptions.Length];
+
+ for (int i = 0; i < descriptions.Length; i++)
+ {
+ indices[i] = descriptions[i].Index;
+ }
+
+ return Unsafe.As>(ref indices);
}
}
}
\ No newline at end of file