Graphics project renamed, dependencies adjusted

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

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

+70
ファイルの表示
@@ -0,0 +1,70 @@
using System;
using SharpDX.Direct3D12;
namespace DirectX12GameEngine.Graphics.Buffers.Abstract
{
/// <summary>
/// An abstract <see langword="class"/> that represents a graphics resource object
/// </summary>
public abstract class GraphicsResource : IDisposable
{
/// <summary>
/// Creates a new <see cref="GraphicsResource"/> instance with the specified parameters
/// </summary>
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance</param>
protected GraphicsResource(GraphicsDevice device)
{
GraphicsDevice = device;
}
/// <summary>
/// Gets the <see cref="GraphicsDevice"/> associated with the current instance
/// </summary>
public GraphicsDevice GraphicsDevice { get; }
/// <summary>
/// Gets the <see cref="IntPtr"/> associated to the currently mapped resource
/// </summary>
public IntPtr MappedResource { get; private set; }
/// <summary>
/// Gets the <see cref="Resource"/> object currently mapped
/// </summary>
protected internal Resource? NativeResource { get; set; }
/// <summary>
/// Gets the <see cref="CpuDescriptorHandle"/> instance for the current resource
/// </summary>
protected internal CpuDescriptorHandle NativeCpuDescriptorHandle { get; protected set; }
/// <summary>
/// Gets the <see cref="GpuDescriptorHandle"/> instance for the current resource
/// </summary>
protected internal GpuDescriptorHandle NativeGpuDescriptorHandle { get; protected set; }
/// <summary>
/// Maps the current resource to a specified subresource
/// </summary>
/// <param name="subresource">The index of the target subresource to map</param>
/// <returns>An <see cref="IntPtr"/> for the newly mapped resource</returns>
public IntPtr Map(int subresource)
{
IntPtr mappedResource = NativeResource?.Map(subresource) ?? throw new InvalidOperationException("Missing resource");
MappedResource = mappedResource;
return mappedResource;
}
/// <summary>
/// Unmaps a subresource specified by a given index
/// </summary>
/// <param name="subresource">The index of the subresource to unmap</param>
public void Unmap(int subresource)
{
NativeResource?.Unmap(subresource);
MappedResource = IntPtr.Zero;
}
/// <inheritdoc/>
public virtual void Dispose() => NativeResource?.Dispose();
}
}