Minor code tweaks

このコミットが含まれているのは:
Sergio Pedri committed 2021-01-05 20:40:18 +01:00
1 親 d088fae2e5
コミット 8658cd85e8
3ファイル変更
+3 -23

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

+1 -1
ファイルの表示
@@ -75,7 +75,7 @@ namespace ComputeSharp.Graphics.Commands
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly ID3D12CommandList** GetD3D12CommandListAddressOf()
{
return this.d3D12GraphicsCommandList.Upcast<ID3D12GraphicsCommandList, ID3D12CommandList>().GetAddressOf();
return (ID3D12CommandList**)this.d3D12GraphicsCommandList.GetAddressOf();
}
/// <summary>
+1 -21
ファイルの表示
@@ -7,7 +7,7 @@ namespace ComputeSharp.Core.Extensions
/// <summary>
/// Helper methods for working with the <see cref="ComPtr{T}"/> type.
/// </summary>
public static class ComPtrExtensions
internal static class ComPtrExtensions
{
/// <summary>
/// Reinterprets the current <see cref="ComPtr{T}"/> instance as one of type <see cref="IUnknown"/>.
@@ -59,25 +59,5 @@ namespace ComputeSharp.Core.Extensions
return copy;
}
/// <summary>
/// Upcasts the current <see cref="ComPtr{T}"/> instance as a base type.
/// </summary>
/// <typeparam name="T">The type of the current <see cref="ComPtr{T}"/> instance.</typeparam>
/// <typeparam name="U">The type to cast the input instance to.</typeparam>
/// <param name="ptr">The input <see cref="ComPtr{T}"/> instance to upcast.</param>
/// <returns>A <see cref="ComPtr{T}"/> instance of type <typeparamref name="U"/>.</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<U> Upcast<T, U>(this in ComPtr<T> ptr)
where T : unmanaged
where U : unmanaged
{
return ref Unsafe.As<ComPtr<T>, ComPtr<U>>(ref Unsafe.AsRef(in ptr));
}
}
}
+1 -1
ファイルの表示
@@ -81,7 +81,7 @@ namespace ComputeSharp.Shaders.Translation
fixed (char* optimization = "-O3")
{
DxcCompiler.Get()->Compile(
dxcBlobEncoding.Upcast<IDxcBlobEncoding, IDxcBlob>().Get(),
(IDxcBlob*)dxcBlobEncoding.Get(),
(ushort*)shaderName,
(ushort*)entryPoint,
(ushort*)shaderProfile,