Remove ComPtr<T>.AsIUnknown extension
このコミットが含まれているのは:
1 親
e89433da46
コミット
9dae753625
3ファイル変更
+6
-27
検索条件に一致するファイルはありません
@@ -8,27 +8,6 @@ namespace ComputeSharp.Core.Extensions;
|
||||
/// </summary>
|
||||
internal static class ComPtrExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Reinterprets the current <see cref="ComPtr{T}"/> instance as one of type <see cref="IUnknown"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the current <see cref="ComPtr{T}"/> instance.</typeparam>
|
||||
/// <param name="ptr">The input <see cref="ComPtr{T}"/> instance to upcast.</param>
|
||||
/// <returns>A <see cref="ComPtr{T}"/> instance of type <see cref="IUnknown"/>.</returns>
|
||||
/// <remarks>
|
||||
/// This method is meant to be used in a chained expression and it does not increment the reference
|
||||
/// count for the input pointer. Do not expose the return value of this extension to consumers.
|
||||
/// </remarks>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe ref readonly ComPtr<IUnknown> AsIUnknown<T>(this in ComPtr<T> ptr)
|
||||
#if NET6_0_OR_GREATER
|
||||
where T : unmanaged, IUnknown.Interface
|
||||
#else
|
||||
where T : unmanaged
|
||||
#endif
|
||||
{
|
||||
return ref Unsafe.As<ComPtr<T>, ComPtr<IUnknown>>(ref Unsafe.AsRef(in ptr));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the current <see cref="ComPtr{T}"/> instance and resets it without releasing the reference.
|
||||
/// </summary>
|
||||
|
||||
@@ -137,7 +137,7 @@ partial class DeviceHelper
|
||||
dxgiAdapter1.Get()->GetDesc1(&dxgiDescription1).Assert();
|
||||
|
||||
HRESULT createDeviceResult = DirectX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
(IUnknown*)dxgiAdapter1.Get(),
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
Windows.__uuidof<ID3D12Device>(),
|
||||
null);
|
||||
@@ -148,7 +148,7 @@ partial class DeviceHelper
|
||||
using ComPtr<ID3D12Device> d3D12Device = default;
|
||||
|
||||
DirectX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
(IUnknown*)dxgiAdapter1.Get(),
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
Windows.__uuidof<ID3D12Device>(),
|
||||
(void**)d3D12Device.GetAddressOf()).Assert();
|
||||
@@ -178,7 +178,7 @@ partial class DeviceHelper
|
||||
}
|
||||
|
||||
HRESULT createDeviceResult = DirectX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
(IUnknown*)dxgiAdapter1.Get(),
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
Windows.__uuidof<ID3D12Device>(),
|
||||
null);
|
||||
@@ -189,7 +189,7 @@ partial class DeviceHelper
|
||||
using ComPtr<ID3D12Device> d3D12Device = default;
|
||||
|
||||
DirectX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
(IUnknown*)dxgiAdapter1.Get(),
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
Windows.__uuidof<ID3D12Device>(),
|
||||
(void**)d3D12Device.GetAddressOf()).Assert();
|
||||
|
||||
@@ -98,7 +98,7 @@ internal static partial class DeviceHelper
|
||||
// 3) The call fails for other reasons. In this case the adapter is simply skipped.
|
||||
// This might be the case if an adapter doesn't support the requested feature level.
|
||||
HRESULT createDeviceResult = DirectX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
(IUnknown*)dxgiAdapter1.Get(),
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
Windows.__uuidof<ID3D12Device>(),
|
||||
(void**)d3D12DeviceCandidate.GetAddressOf());
|
||||
@@ -142,7 +142,7 @@ internal static partial class DeviceHelper
|
||||
using ComPtr<ID3D12Device> d3D12DeviceCandidate = default;
|
||||
|
||||
HRESULT createDeviceResult = DirectX.D3D12CreateDevice(
|
||||
dxgiAdapter1.AsIUnknown().Get(),
|
||||
(IUnknown*)dxgiAdapter1.Get(),
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
Windows.__uuidof<ID3D12Device>(),
|
||||
(void**)d3D12DeviceCandidate.GetAddressOf());
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする