Remove [FixedAddressValueType] use

このコミットが含まれているのは:
Sergio Pedri committed 2022-04-24 21:04:32 +02:00
1 親 7576c506e9
コミット 056128054a
2ファイル変更
+21 -14

検索条件に一致するファイルはありません

+13 -10
ファイルの表示
@@ -109,15 +109,18 @@ unsafe partial class D2D1InteropServices
(void*)Marshal.GetFunctionPointerForDelegate(PixelShaderEffect.SetConstantBufferWrapper);
#endif
// Register the effect
((ID2D1Factory1*)d2D1Factory1)->RegisterEffectFromString(
classId: PixelShaderEffect.For<T>.Id,
propertyXml: (ushort*)pXml,
bindings: &d2D1PropertyBinding,
bindingsCount: 1,
effectFactory: PixelShaderEffect.For<T>.Factory).Assert();
fixed (Guid* pGuid = &PixelShaderEffect.For<T>.Id)
{
// Register the effect
((ID2D1Factory1*)d2D1Factory1)->RegisterEffectFromString(
classId: pGuid,
propertyXml: (ushort*)pXml,
bindings: &d2D1PropertyBinding,
bindingsCount: 1,
effectFactory: PixelShaderEffect.For<T>.Factory).Assert();
}
effectId = *PixelShaderEffect.For<T>.Id;
effectId = PixelShaderEffect.For<T>.Id;
}
}
@@ -193,7 +196,7 @@ unsafe partial class D2D1InteropServices
using ArrayPoolBinaryWriter writer = new(ArrayPoolBinaryWriter.DefaultInitialBufferSize);
// Effect id and number of inputs
writer.Write(*PixelShaderEffect.For<T>.Id);
writer.Write(PixelShaderEffect.For<T>.Id);
writer.Write(PixelShaderEffect.For<T>.NumberOfInputs);
// Build the XML text
@@ -246,7 +249,7 @@ unsafe partial class D2D1InteropServices
// Effect factory
writer.Write((nint)PixelShaderEffect.For<T>.Factory);
effectId = *PixelShaderEffect.For<T>.Id;
effectId = PixelShaderEffect.For<T>.Id;
return writer.WrittenSpan.ToArray();
}
+8 -4
ファイルの表示
@@ -79,7 +79,11 @@ internal unsafe partial struct PixelShaderEffect
/// <summary>
/// The <see cref="Guid"/> for the shader.
/// </summary>
[FixedAddressValueType]
/// <remarks>
/// This field could have used <see cref="FixedAddressValueTypeAttribute"/> to reduce some verbosity where it is
/// being used to pass its address to a native API, but the attribute is incompatible with collectible assemblies.
/// Because of that, it can't be used, as this project is explicitly meant to support plugin-like scenarios.
/// </remarks>
private static Guid shaderId;
/// <summary>
@@ -147,12 +151,12 @@ internal unsafe partial struct PixelShaderEffect
}
/// <summary>
/// Gets a pointer to the id of the effect.
/// Gets a reference to the id of the effect.
/// </summary>
public static Guid* Id
public static ref Guid Id
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => (Guid*)Unsafe.AsPointer(ref shaderId);
get => ref shaderId;
}
/// <summary>