diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs
index 51c7c47a..e7312118 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs
@@ -9,6 +9,27 @@
///
public readonly struct D2D1InputDescription
{
+ ///
+ /// The index of the resource the description belongs to.
+ ///
+ ///
+ /// This field and the ones below are explicity used because this type is in the type layout of .
+ /// Since that type is used in an unmanaged context, MCG will produce a shadow copy to inform the runtime marshaller. Such a shallow copy
+ /// cannot process the type if it has unspeakable names in any of its members, which is the case for the generated fields. As such, this
+ /// type has to use explicit fields here and not readonly autoproperties, or compiling a project using ComputeSharp.D2D1 would fail on UWP.
+ ///
+ private readonly int index;
+
+ ///
+ /// The type of filter to apply to the input texture.
+ ///
+ private readonly D2D1Filter filter;
+
+ ///
+ /// The mip level to retrieve from the upstream transform, if specified.
+ ///
+ private readonly int levelOfDetailCount;
+
///
/// Creates a new instance with the specified parameters.
///
@@ -17,23 +38,23 @@ public readonly struct D2D1InputDescription
/// The mip level to retrieve from the upstream transform, if specified.
internal D2D1InputDescription(int index, D2D1Filter filter, int levelOfDetailCount)
{
- Index = index;
- Filter = filter;
- LevelOfDetailCount = levelOfDetailCount;
+ this.index = index;
+ this.filter = filter;
+ this.levelOfDetailCount = levelOfDetailCount;
}
///
/// Gets the index of the resource the description belongs to.
///
- public int Index { get; }
+ public int Index => this.index;
///
/// Gets the type of filter to apply to the input texture.
///
- public D2D1Filter Filter { get; }
+ public D2D1Filter Filter => this.filter;
///
/// Gets the mip level to retrieve from the upstream transform, if specified.
///
- public int LevelOfDetailCount { get; }
+ public int LevelOfDetailCount => this.levelOfDetailCount;
}
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureDescription.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureDescription.cs
index 43e2d6c7..42f244b5 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureDescription.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureDescription.cs
@@ -5,6 +5,17 @@
///
public readonly struct D2D1ResourceTextureDescription
{
+ ///
+ /// The index of the resource texture the description belongs to.
+ ///
+ /// See notes in for why explicit fields are used here.
+ private readonly int index;
+
+ ///
+ /// The number of dimensions of the resource texture the description belongs to.
+ ///
+ private readonly int dimensions;
+
///
/// Creates a new instance with the specified parameters.
///
@@ -12,17 +23,17 @@ public readonly struct D2D1ResourceTextureDescription
/// The number of dimensions of the resource texture the description belongs to.
internal D2D1ResourceTextureDescription(int index, int dimensions)
{
- Index = index;
- Dimensions = dimensions;
+ this.index = index;
+ this.dimensions = dimensions;
}
///
/// Gets the index of the resource texture the description belongs to.
///
- public int Index { get; }
+ public int Index => this.index;
///
/// Gets the rank of the resource texture the description belongs to.
///
- public int Dimensions { get; }
+ public int Dimensions => this.dimensions;
}