using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers.Abstract;
using TerraFX.Interop;
namespace ComputeSharp.__Internals
{
///
/// A helper class with some proxy methods to expose to generated code in external projects.
///
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This type is not intended to be used directly by user code")]
public static class GraphicsResourceHelper
{
///
/// Validates the given buffer for usage with a specified device, and retrieves its GPU descriptor handle.
///
/// The input instance to check.
/// The target instance in use.
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method is not intended to be called directly by user code")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ulong ValidateAndGetGpuDescriptorHandle(Buffer buffer, GraphicsDevice device)
where T : unmanaged
{
buffer.ThrowIfDisposed();
buffer.ThrowIfDeviceMismatch(device);
return Unsafe.As(ref Unsafe.AsRef(in buffer.D3D12GpuDescriptorHandle));
}
///
/// Validates the given buffer for usage with a specified device, and retrieves its GPU descriptor handle.
///
/// The input instance to check.
/// The target instance in use.
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method is not intended to be called directly by user code")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ulong ValidateAndGetGpuDescriptorHandle(Texture2D buffer, GraphicsDevice device)
where T : unmanaged
{
buffer.ThrowIfDisposed();
buffer.ThrowIfDeviceMismatch(device);
return Unsafe.As(ref Unsafe.AsRef(in buffer.D3D12GpuDescriptorHandle));
}
///
/// Validates the given buffer for usage with a specified device, and retrieves its GPU descriptor handle.
///
/// The input instance to check.
/// The target instance in use.
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method is not intended to be called directly by user code")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ulong ValidateAndGetGpuDescriptorHandle(Texture3D buffer, GraphicsDevice device)
where T : unmanaged
{
buffer.ThrowIfDisposed();
buffer.ThrowIfDeviceMismatch(device);
return Unsafe.As(ref Unsafe.AsRef(in buffer.D3D12GpuDescriptorHandle));
}
}
}