Use explicit fields in interop types to avoid MCG errors
このコミットが含まれているのは:
1 親
a781da271b
コミット
10d53058ed
2ファイル変更
+42
-10
検索条件に一致するファイルはありません
@@ -9,6 +9,27 @@
|
||||
/// </remarks>
|
||||
public readonly struct D2D1InputDescription
|
||||
{
|
||||
/// <summary>
|
||||
/// The index of the resource the description belongs to.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This field and the ones below are explicity used because this type is in the type layout of <see cref="Effects.PixelShaderEffect"/>.
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
private readonly int index;
|
||||
|
||||
/// <summary>
|
||||
/// The type of filter to apply to the input texture.
|
||||
/// </summary>
|
||||
private readonly D2D1Filter filter;
|
||||
|
||||
/// <summary>
|
||||
/// The mip level to retrieve from the upstream transform, if specified.
|
||||
/// </summary>
|
||||
private readonly int levelOfDetailCount;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="D2D1InputDescription"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
@@ -17,23 +38,23 @@ public readonly struct D2D1InputDescription
|
||||
/// <param name="levelOfDetailCount">The mip level to retrieve from the upstream transform, if specified.</param>
|
||||
internal D2D1InputDescription(int index, D2D1Filter filter, int levelOfDetailCount)
|
||||
{
|
||||
Index = index;
|
||||
Filter = filter;
|
||||
LevelOfDetailCount = levelOfDetailCount;
|
||||
this.index = index;
|
||||
this.filter = filter;
|
||||
this.levelOfDetailCount = levelOfDetailCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of the resource the description belongs to.
|
||||
/// </summary>
|
||||
public int Index { get; }
|
||||
public int Index => this.index;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of filter to apply to the input texture.
|
||||
/// </summary>
|
||||
public D2D1Filter Filter { get; }
|
||||
public D2D1Filter Filter => this.filter;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mip level to retrieve from the upstream transform, if specified.
|
||||
/// </summary>
|
||||
public int LevelOfDetailCount { get; }
|
||||
public int LevelOfDetailCount => this.levelOfDetailCount;
|
||||
}
|
||||
@@ -5,6 +5,17 @@
|
||||
/// </summary>
|
||||
public readonly struct D2D1ResourceTextureDescription
|
||||
{
|
||||
/// <summary>
|
||||
/// The index of the resource texture the description belongs to.
|
||||
/// </summary>
|
||||
/// <remarks>See notes in <see cref="D2D1InputDescription"/> for why explicit fields are used here.</remarks>
|
||||
private readonly int index;
|
||||
|
||||
/// <summary>
|
||||
/// The number of dimensions of the resource texture the description belongs to.
|
||||
/// </summary>
|
||||
private readonly int dimensions;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="D2D1ResourceTextureDescription"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
@@ -12,17 +23,17 @@ public readonly struct D2D1ResourceTextureDescription
|
||||
/// <param name="dimensions">The number of dimensions of the resource texture the description belongs to.</param>
|
||||
internal D2D1ResourceTextureDescription(int index, int dimensions)
|
||||
{
|
||||
Index = index;
|
||||
Dimensions = dimensions;
|
||||
this.index = index;
|
||||
this.dimensions = dimensions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of the resource texture the description belongs to.
|
||||
/// </summary>
|
||||
public int Index { get; }
|
||||
public int Index => this.index;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the rank of the resource texture the description belongs to.
|
||||
/// </summary>
|
||||
public int Dimensions { get; }
|
||||
public int Dimensions => this.dimensions;
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする