Return D2DERR_WRONG_FACTORY for wrong device in factory

このコミットが含まれているのは:
Sergio Pedri committed 2023-04-26 17:12:49 +02:00
1 親 bb8a7b4cf0
コミット d4c4586369
3ファイル変更
+16 -5

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

+1 -1
ファイルの表示
@@ -124,7 +124,7 @@ unsafe partial class PixelShaderEffect<T>
{
*wrapper = null;
return E.E_INVALIDARG;
return D2DERR.D2DERR_WRONG_FACTORY;
}
}
+5 -2
ファイルの表示
@@ -7,12 +7,15 @@ namespace TerraFX.Interop.DirectX;
internal static partial class D2DERR
{
[NativeTypeName("#define D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES _HRESULT_TYPEDEF_(0x88990026L)")]
public const int D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES = unchecked((int)(0x88990026));
[NativeTypeName("#define D2DERR_WRONG_FACTORY _HRESULT_TYPEDEF_(0x88990012L)")]
public const int D2DERR_WRONG_FACTORY = unchecked((int)(0x88990012));
[NativeTypeName("#define D2DERR_CYCLIC_GRAPH _HRESULT_TYPEDEF_(0x88990020L)")]
public const int D2DERR_CYCLIC_GRAPH = unchecked((int)(0x88990020));
[NativeTypeName("#define D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES _HRESULT_TYPEDEF_(0x88990026L)")]
public const int D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES = unchecked((int)(0x88990026));
[NativeTypeName("#define D2DERR_EFFECT_IS_NOT_REGISTERED _HRESULT_TYPEDEF_(0x88990028L)")]
public const int D2DERR_EFFECT_IS_NOT_REGISTERED = unchecked((int)(0x88990028));
}
+10 -2
ファイルの表示
@@ -428,7 +428,6 @@ public partial class PixelShaderEffectTests
}
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public unsafe void Interop_WrapperFactoryDetectsMismatchedDevices()
{
using PixelShaderEffect<ShaderWith0Inputs> effect = new();
@@ -443,7 +442,16 @@ public partial class PixelShaderEffectTests
Win2DHelper.GetD2DImage(effect, canvasDevice2, d2D1Image2.GetAddressOf());
// The factory should detect we're passing an incompatible device for the resource
_ = Win2DHelper.GetOrCreate(d2D1Image1.Get(), canvasDevice2);
try
{
_ = Win2DHelper.GetOrCreate(d2D1Image1.Get(), canvasDevice2);
Assert.Fail();
}
catch (Exception e)
{
Assert.AreEqual(e.HResult, D2DERR.D2DERR_WRONG_FACTORY);
}
}
[D2DInputCount(0)]