Ported DirectX12GameEngine.Graphics project

このコミットが含まれているのは:
Sergio Pedri committed 2019-08-10 19:57:51 +02:00
1 親 36ef5b38b7
コミット f74dc2374a
33ファイル変更
+2412 -8

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

+54
ファイルの表示
@@ -0,0 +1,54 @@
using System;
using SharpDX.Direct3D12;
namespace DirectX12GameEngine.Graphics
{
public abstract class GraphicsResource : IDisposable
{
protected GraphicsResource()
{
}
protected GraphicsResource(GraphicsDevice device)
{
AttachToGraphicsDevice(device);
}
#nullable disable
public GraphicsDevice GraphicsDevice { get; private set; }
#nullable restore
public IntPtr MappedResource { get; private set; }
#nullable disable
protected internal Resource NativeResource { get; set; }
#nullable restore
protected internal CpuDescriptorHandle NativeCpuDescriptorHandle { get; protected set; }
protected internal GpuDescriptorHandle NativeGpuDescriptorHandle { get; protected set; }
public void AttachToGraphicsDevice(GraphicsDevice device)
{
GraphicsDevice = device;
}
public virtual void Dispose()
{
NativeResource.Dispose();
}
public IntPtr Map(int subresource)
{
IntPtr mappedResource = NativeResource.Map(subresource);
MappedResource = mappedResource;
return mappedResource;
}
public void Unmap(int subresource)
{
NativeResource.Unmap(subresource);
MappedResource = IntPtr.Zero;
}
}
}