Refactor code to remove public NativeObject

このコミットが含まれているのは:
Sergio Pedri committed 2022-10-21 03:57:05 -07:00
1 親 2e9da5cf85
コミット 27ca08cf2f
38ファイル変更
+975 -389

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

+13 -4
ファイルの表示
@@ -9,15 +9,22 @@ using TerraFX.Interop.Windows;
using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1;
using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType;
#pragma warning disable CA1063
namespace ComputeSharp.Resources;
/// <summary>
/// A <see langword="class"/> representing a typed 3D texture stored on on CPU memory, that can be used to transfer data to/from the GPU.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
public abstract unsafe class TransferTexture3D<T> : NativeObject, IGraphicsResource
public abstract unsafe partial class TransferTexture3D<T> : IReferenceTrackedObject, IGraphicsResource
where T : unmanaged
{
/// <summary>
/// The <see cref="ReferenceTracker"/> value for the current instance.
/// </summary>
private ReferenceTracker referenceTracker;
#if NET6_0_OR_GREATER
/// <summary>
/// The <see cref="D3D12MA_Allocation"/> instance used to retrieve <see cref="d3D12Resource"/>.
@@ -51,11 +58,13 @@ public abstract unsafe class TransferTexture3D<T> : NativeObject, IGraphicsResou
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
private protected TransferTexture3D(GraphicsDevice device, int width, int height, int depth, ResourceType resourceType, AllocationMode allocationMode)
{
this.referenceTracker = new ReferenceTracker(this);
Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION);
Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION);
Guard.IsBetweenOrEqualTo(depth, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION);
using Lease _0 = device.GetReferenceTrackingLease();
using ReferenceTracker.Lease _0 = device.GetReferenceTracker().GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
@@ -123,14 +132,14 @@ public abstract unsafe class TransferTexture3D<T> : NativeObject, IGraphicsResou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
using Lease _0 = this.GetReferenceTrackingLease();
using ReferenceTracker.Lease _0 = GetReferenceTracker().GetReferenceTrackingLease();
return new(this.mappedData, Width, Height, Depth, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch);
}
}
/// <inheritdoc/>
private protected sealed override void OnDispose()
void IReferenceTrackedObject.DangerousRelease()
{
this.d3D12Resource.Dispose();
#if NET6_0_OR_GREATER