Minor code tweaks

このコミットが含まれているのは:
Sergio Pedri committed 2020-11-25 16:25:00 +01:00
1 親 65941ea4f8
コミット 5def7d1a00
3ファイル変更
+21 -3

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

+18
ファイルの表示
@@ -9,6 +9,24 @@ namespace ComputeSharp.Core.Extensions
/// </summary>
public 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>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe ref readonly ComPtr<IUnknown> AsIUnknown<T>(this in ComPtr<T> ptr)
where T : unmanaged
{
return ref Unsafe.As<ComPtr<T>, ComPtr<IUnknown>>(ref Unsafe.AsRef(in ptr));
}
/// <summary>
/// Gets the address of the current <see cref="ComPtr{T}"/> instance as a raw <see langword="void"/> double pointer.
/// </summary>
+2 -2
ファイルの表示
@@ -123,7 +123,7 @@ namespace ComputeSharp.Graphics.Helpers
if (dxgiDescription1.DedicatedVideoMemory == 0) continue;
HRESULT createDeviceResult = FX.D3D12CreateDevice(
dxgiAdapter1.Upcast<IDXGIAdapter1, IUnknown>().Get(),
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_12_0,
FX.__uuidof<ID3D12Device>(),
null);
@@ -134,7 +134,7 @@ namespace ComputeSharp.Graphics.Helpers
using ComPtr<ID3D12Device> d3d12device = default;
FX.D3D12CreateDevice(
dxgiAdapter1.Upcast<IDXGIAdapter1, IUnknown>().Get(),
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_12_0,
FX.__uuidof<ID3D12Device>(),
d3d12device.GetVoidAddressOf()).Assert();
+1 -1
ファイルの表示
@@ -94,7 +94,7 @@ namespace ComputeSharp.Graphics.Helpers
if (dxgiDescription1->DedicatedVideoMemory == 0) continue;
HRESULT createDeviceResult = FX.D3D12CreateDevice(
dxgiAdapter1.Upcast<IDXGIAdapter1, IUnknown>().Get(),
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_12_0,
FX.__uuidof<ID3D12Device>(),
(void**)d3d12device);