Added buffer/device validation on loading

このコミットが含まれているのは:
Sergio Pedri committed 2020-11-22 16:48:04 +01:00
1 親 c2a1980596
コミット 2dfd8855f4
4ファイル変更
+84 -13

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

+15
ファイルの表示
@@ -3,6 +3,7 @@ using System.Buffers;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using ComputeSharp.Core.Interop;
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics.Buffers.Enums;
using ComputeSharp.Graphics.Extensions;
using TerraFX.Interop;
@@ -234,5 +235,19 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
{
this.d3D12Resource.Dispose();
}
/// <summary>
/// Throws a <see cref="GraphicsDeviceMismatchException"/> if the target device doesn't match the current one.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void ThrowIfDeviceMismatch(GraphicsDevice device)
{
if (GraphicsDevice != device)
{
void Throw() => throw GraphicsDeviceMismatchException.Create(this, device);
Throw();
}
}
}
}