Graphics project renamed, dependencies adjusted

このコミットが含まれているのは:
Sergio Pedri committed 2019-08-12 02:31:36 +02:00
1 親 de864f2875
コミット 6571390ef3
18ファイル変更
+7 -8

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

+35
ファイルの表示
@@ -0,0 +1,35 @@
using System;
using System.Runtime.CompilerServices;
namespace DirectX12GameEngine.Graphics.Helpers
{
/// <summary>
/// A <see langword="class"/> with some helper methods to copy data between memory areas
/// </summary>
public static class MemoryHelper
{
/// <summary>
/// Copies the content of a <see cref="Span{T}"/> to the area pointed by an input <see cref="IntPtr"/> value
/// </summary>
/// <typeparam name="T">The type of values in the input <see cref="Span{T}"/></typeparam>
/// <param name="source">The source <see cref="Span{T}"/> to read</param>
/// <param name="destination">The <see cref="IntPtr"/> for the destination memory area</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void Copy<T>(Span<T> source, IntPtr destination) where T : unmanaged
{
source.CopyTo(new Span<T>(destination.ToPointer(), source.Length));
}
/// <summary>
/// Copies a memory area pointed by an <see cref="IntPtr"/> value to a target <see cref="Span{T}"/>
/// </summary>
/// <typeparam name="T">The type of values to read</typeparam>
/// <param name="source">The <see cref="IntPtr"/> that indicates the memory area to read from</param>
/// <param name="destination">The destination <see cref="Span{T}"/> to write</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void Copy<T>(IntPtr source, Span<T> destination) where T : unmanaged
{
new Span<T>(source.ToPointer(), destination.Length).CopyTo(destination);
}
}
}