Make InteropServices APIs thread safe
このコミットが含まれているのは:
1 親
65fe7f53c6
コミット
84ebe36975
2ファイル変更
+43
-1
検索条件に一致するファイルはありません
@@ -30,9 +30,12 @@ public static unsafe class InteropServices
|
||||
/// <param name="device">The input <see cref="GraphicsDevice"/> instance in use.</param>
|
||||
/// <param name="riid">A reference to the interface identifier (IID) of the device interface being queried for.</param>
|
||||
/// <param name="ppvObject">The address of a pointer to an interface with the IID specified in <paramref name="riid"/>.</param>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="device"/> instance has been disposed.</exception>
|
||||
/// <exception cref="Win32Exception">Thrown if the <c>IUnknown::QueryInterface</c> call doesn't return <c>S_OK</c>.</exception>
|
||||
public static void GetID3D12Device(GraphicsDevice device, Guid* riid, void** ppvObject)
|
||||
{
|
||||
using var _0 = device.GetReferenceTracker().GetLease();
|
||||
|
||||
device.D3D12Device->QueryInterface(riid, ppvObject).Assert();
|
||||
}
|
||||
|
||||
@@ -44,10 +47,13 @@ public static unsafe class InteropServices
|
||||
/// <param name="buffer">The input <see cref="Buffer{T}"/> instance in use.</param>
|
||||
/// <param name="riid">A reference to the interface identifier (IID) of the resource interface being queried for.</param>
|
||||
/// <param name="ppvObject">The address of a pointer to an interface with the IID specified in <paramref name="riid"/>.</param>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="buffer"/> instance has been disposed.</exception>
|
||||
/// <exception cref="Win32Exception">Thrown if the <c>IUnknown::QueryInterface</c> call doesn't return <c>S_OK</c>.</exception>
|
||||
public static void GetID3D12Resource<T>(Buffer<T> buffer, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = buffer.GetReferenceTracker().GetLease();
|
||||
|
||||
buffer.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
|
||||
}
|
||||
|
||||
@@ -59,10 +65,13 @@ public static unsafe class InteropServices
|
||||
/// <param name="texture">The input <see cref="Texture2D{T}"/> instance in use.</param>
|
||||
/// <param name="riid">A reference to the interface identifier (IID) of the resource interface being queried for.</param>
|
||||
/// <param name="ppvObject">The address of a pointer to an interface with the IID specified in <paramref name="riid"/>.</param>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="texture"/> instance has been disposed.</exception>
|
||||
/// <exception cref="Win32Exception">Thrown if the <c>IUnknown::QueryInterface</c> call doesn't return <c>S_OK</c>.</exception>
|
||||
public static void GetID3D12Resource<T>(Texture2D<T> texture, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = texture.GetReferenceTracker().GetLease();
|
||||
|
||||
texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
|
||||
}
|
||||
|
||||
@@ -74,10 +83,13 @@ public static unsafe class InteropServices
|
||||
/// <param name="texture">The input <see cref="Texture3D{T}"/> instance in use.</param>
|
||||
/// <param name="riid">A reference to the interface identifier (IID) of the resource interface being queried for.</param>
|
||||
/// <param name="ppvObject">The address of a pointer to an interface with the IID specified in <paramref name="riid"/>.</param>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="texture"/> instance has been disposed.</exception>
|
||||
/// <exception cref="Win32Exception">Thrown if the <c>IUnknown::QueryInterface</c> call doesn't return <c>S_OK</c>.</exception>
|
||||
public static void GetID3D12Resource<T>(Texture3D<T> texture, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = texture.GetReferenceTracker().GetLease();
|
||||
|
||||
texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
|
||||
}
|
||||
|
||||
@@ -89,10 +101,13 @@ public static unsafe class InteropServices
|
||||
/// <param name="buffer">The input <see cref="TransferBuffer{T}"/> instance in use.</param>
|
||||
/// <param name="riid">A reference to the interface identifier (IID) of the resource interface being queried for.</param>
|
||||
/// <param name="ppvObject">The address of a pointer to an interface with the IID specified in <paramref name="riid"/>.</param>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="buffer"/> instance has been disposed.</exception>
|
||||
/// <exception cref="Win32Exception">Thrown if the <c>IUnknown::QueryInterface</c> call doesn't return <c>S_OK</c>.</exception>
|
||||
public static void GetID3D12Resource<T>(TransferBuffer<T> buffer, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = buffer.GetReferenceTracker().GetLease();
|
||||
|
||||
buffer.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
|
||||
}
|
||||
|
||||
@@ -104,10 +119,13 @@ public static unsafe class InteropServices
|
||||
/// <param name="texture">The input <see cref="TransferTexture2D{T}"/> instance in use.</param>
|
||||
/// <param name="riid">A reference to the interface identifier (IID) of the resource interface being queried for.</param>
|
||||
/// <param name="ppvObject">The address of a pointer to an interface with the IID specified in <paramref name="riid"/>.</param>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="texture"/> instance has been disposed.</exception>
|
||||
/// <exception cref="Win32Exception">Thrown if the <c>IUnknown::QueryInterface</c> call doesn't return <c>S_OK</c>.</exception>
|
||||
public static void GetID3D12Resource<T>(TransferTexture2D<T> texture, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = texture.GetReferenceTracker().GetLease();
|
||||
|
||||
texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
|
||||
}
|
||||
|
||||
@@ -119,10 +137,13 @@ public static unsafe class InteropServices
|
||||
/// <param name="texture">The input <see cref="TransferTexture3D{T}"/> instance in use.</param>
|
||||
/// <param name="riid">A reference to the interface identifier (IID) of the resource interface being queried for.</param>
|
||||
/// <param name="ppvObject">The address of a pointer to an interface with the IID specified in <paramref name="riid"/>.</param>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="texture"/> instance has been disposed.</exception>
|
||||
/// <exception cref="Win32Exception">Thrown if the <c>IUnknown::QueryInterface</c> call doesn't return <c>S_OK</c>.</exception>
|
||||
public static void GetID3D12Resource<T>(TransferTexture3D<T> texture, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = texture.GetReferenceTracker().GetLease();
|
||||
|
||||
texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
|
||||
}
|
||||
|
||||
@@ -137,8 +158,11 @@ public static unsafe class InteropServices
|
||||
/// <c>S_OK</c> if the interface is supported, and <c>E_NOINTERFACE</c> otherwise.
|
||||
/// If ppvObject (the address) is nullptr, then this method returns <c>E_POINTER</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="device"/> instance has been disposed.</exception>
|
||||
public static int TryGetID3D12Device(GraphicsDevice device, Guid* riid, void** ppvObject)
|
||||
{
|
||||
using var _0 = device.GetReferenceTracker().GetLease();
|
||||
|
||||
return device.D3D12Device->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
@@ -154,9 +178,12 @@ public static unsafe class InteropServices
|
||||
/// <c>S_OK</c> if the interface is supported, and <c>E_NOINTERFACE</c> otherwise.
|
||||
/// If ppvObject (the address) is nullptr, then this method returns <c>E_POINTER</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="buffer"/> instance has been disposed.</exception>
|
||||
public static int TryGetID3D12Resource<T>(Buffer<T> buffer, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = buffer.GetReferenceTracker().GetLease();
|
||||
|
||||
return buffer.D3D12Resource->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
@@ -172,9 +199,12 @@ public static unsafe class InteropServices
|
||||
/// <c>S_OK</c> if the interface is supported, and <c>E_NOINTERFACE</c> otherwise.
|
||||
/// If ppvObject (the address) is nullptr, then this method returns <c>E_POINTER</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="texture"/> instance has been disposed.</exception>
|
||||
public static int TryGetID3D12Resource<T>(Texture2D<T> texture, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = texture.GetReferenceTracker().GetLease();
|
||||
|
||||
return texture.D3D12Resource->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
@@ -190,9 +220,12 @@ public static unsafe class InteropServices
|
||||
/// <c>S_OK</c> if the interface is supported, and <c>E_NOINTERFACE</c> otherwise.
|
||||
/// If ppvObject (the address) is nullptr, then this method returns <c>E_POINTER</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="texture"/> instance has been disposed.</exception>
|
||||
public static int TryGetID3D12Resource<T>(Texture3D<T> texture, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = texture.GetReferenceTracker().GetLease();
|
||||
|
||||
return texture.D3D12Resource->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
@@ -208,9 +241,12 @@ public static unsafe class InteropServices
|
||||
/// <c>S_OK</c> if the interface is supported, and <c>E_NOINTERFACE</c> otherwise.
|
||||
/// If ppvObject (the address) is nullptr, then this method returns <c>E_POINTER</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="buffer"/> instance has been disposed.</exception>
|
||||
public static int TryGetID3D12Resource<T>(TransferBuffer<T> buffer, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = buffer.GetReferenceTracker().GetLease();
|
||||
|
||||
return buffer.D3D12Resource->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
@@ -226,9 +262,12 @@ public static unsafe class InteropServices
|
||||
/// <c>S_OK</c> if the interface is supported, and <c>E_NOINTERFACE</c> otherwise.
|
||||
/// If ppvObject (the address) is nullptr, then this method returns <c>E_POINTER</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="texture"/> instance has been disposed.</exception>
|
||||
public static int TryGetID3D12Resource<T>(TransferTexture2D<T> texture, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = texture.GetReferenceTracker().GetLease();
|
||||
|
||||
return texture.D3D12Resource->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
@@ -244,9 +283,12 @@ public static unsafe class InteropServices
|
||||
/// <c>S_OK</c> if the interface is supported, and <c>E_NOINTERFACE</c> otherwise.
|
||||
/// If ppvObject (the address) is nullptr, then this method returns <c>E_POINTER</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="texture"/> instance has been disposed.</exception>
|
||||
public static int TryGetID3D12Resource<T>(TransferTexture3D<T> texture, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = texture.GetReferenceTracker().GetLease();
|
||||
|
||||
return texture.D3D12Resource->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public abstract class NativeObject : IDisposable, ReferenceTracker.ITrackedObjec
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="NativeObject"/> instance.
|
||||
/// </summary>
|
||||
internal NativeObject()
|
||||
private protected NativeObject()
|
||||
{
|
||||
this.referenceTracker = new ReferenceTracker(this);
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする