Minor tweaks and improvements to D2D1ResourceTextureManager
このコミットが含まれているのは:
1 親
3c2de6c285
コミット
bc90c87837
3ファイル変更
+27
-6
検索条件に一致するファイルはありません
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using ComputeSharp.D2D1.Extensions;
|
||||
using ComputeSharp.D2D1.Helpers;
|
||||
@@ -602,9 +601,7 @@ public static unsafe class D2D1PixelShaderEffect
|
||||
|
||||
using ComPtr<ID2D1ResourceTextureManager> resourceTextureManager2 = default;
|
||||
|
||||
Guid uuidOfResourceTextureManager = ID2D1ResourceTextureManager.Guid;
|
||||
|
||||
_ = ((ICustomQueryInterface)resourceTextureManager).GetInterface(ref uuidOfResourceTextureManager, out *(IntPtr*)resourceTextureManager2.GetAddressOf());
|
||||
resourceTextureManager.GetD2D1ResourceTextureManager(resourceTextureManager2.GetAddressOf());
|
||||
|
||||
((ID2D1Effect*)d2D1Effect)->SetValue(
|
||||
index: D2D1PixelShaderEffectProperty.ResourceTextureManager0 + (uint)index,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers;
|
||||
using TerraFX.Interop.DirectX;
|
||||
@@ -251,6 +252,8 @@ public sealed unsafe class D2D1ResourceTextureManager : ICustomQueryInterface
|
||||
extents.Length != extendModes.Length ||
|
||||
(data.Length > 0 && strides.Length != extents.Length - 1))
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
Marshal.ThrowExceptionForHR(E.E_INVALIDARG);
|
||||
}
|
||||
|
||||
@@ -289,7 +292,10 @@ public sealed unsafe class D2D1ResourceTextureManager : ICustomQueryInterface
|
||||
/// </summary>
|
||||
~D2D1ResourceTextureManager()
|
||||
{
|
||||
this.d2D1ResourceManagerImpl->Release();
|
||||
if (this.d2D1ResourceManagerImpl is not null)
|
||||
{
|
||||
this.d2D1ResourceManagerImpl->Release();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -330,10 +336,26 @@ public sealed unsafe class D2D1ResourceTextureManager : ICustomQueryInterface
|
||||
data: pData,
|
||||
dataCount: (uint)data.Length);
|
||||
|
||||
GC.KeepAlive(this);
|
||||
|
||||
Marshal.ThrowExceptionForHR(hresult);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying <see cref="ID2D1ResourceTextureManager"/> object.
|
||||
/// </summary>
|
||||
/// <param name="resourceTextureManager">The underlying <see cref="ID2D1ResourceTextureManager"/> object.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal void GetD2D1ResourceTextureManager(ID2D1ResourceTextureManager** resourceTextureManager)
|
||||
{
|
||||
_ = this.d2D1ResourceManagerImpl->AddRef();
|
||||
|
||||
*resourceTextureManager = (ID2D1ResourceTextureManager*)this.d2D1ResourceManagerImpl;
|
||||
|
||||
GC.KeepAlive(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
CustomQueryInterfaceResult ICustomQueryInterface.GetInterface(ref Guid iid, out IntPtr ppv)
|
||||
{
|
||||
@@ -342,6 +364,8 @@ public sealed unsafe class D2D1ResourceTextureManager : ICustomQueryInterface
|
||||
{
|
||||
int hresult = this.d2D1ResourceManagerImpl->QueryInterface(pIid, (void**)pPpv);
|
||||
|
||||
GC.KeepAlive(this);
|
||||
|
||||
return hresult switch
|
||||
{
|
||||
S.S_OK => CustomQueryInterfaceResult.Handled,
|
||||
|
||||
+1
-1
@@ -214,7 +214,7 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IUnknown.AddRef"/>
|
||||
private uint AddRef()
|
||||
public uint AddRef()
|
||||
{
|
||||
return (uint)Interlocked.Increment(ref this.referenceCount);
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする