Switch all GetLease() calls to using declarations

このコミットが含まれているのは:
Sergio Pedri committed 2022-07-31 23:26:12 +02:00
1 親 5100ab471a
コミット 65fe7f53c6
17ファイル変更
+1165 -1229

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

+25 -27
ファイルの表示
@@ -55,39 +55,38 @@ public unsafe abstract class TransferTexture3D<T> : NativeObject, IGraphicsResou
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 (device.GetReferenceTracker().GetLease())
using var _0 = device.GetReferenceTracker().GetLease();
device.ThrowIfDeviceLost();
if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType<T>(), D3D12_FORMAT_SUPPORT1_TEXTURE3D))
{
device.ThrowIfDeviceLost();
UnsupportedTextureTypeException.ThrowForTexture3D<T>();
}
if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType<T>(), D3D12_FORMAT_SUPPORT1_TEXTURE3D))
{
UnsupportedTextureTypeException.ThrowForTexture3D<T>();
}
GraphicsDevice = device;
GraphicsDevice = device;
device.D3D12Device->GetCopyableFootprint(
DXGIFormatHelper.GetForType<T>(),
(uint)width,
(uint)height,
(ushort)depth,
out this.d3D12PlacedSubresourceFootprint,
out _,
out ulong totalSizeInBytes);
device.D3D12Device->GetCopyableFootprint(
DXGIFormatHelper.GetForType<T>(),
(uint)width,
(uint)height,
(ushort)depth,
out this.d3D12PlacedSubresourceFootprint,
out _,
out ulong totalSizeInBytes);
#if NET6_0_OR_GREATER
this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, totalSizeInBytes);
this.d3D12Resource = new ComPtr<ID3D12Resource>(this.allocation.Get()->GetResource());
this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, totalSizeInBytes);
this.d3D12Resource = new ComPtr<ID3D12Resource>(this.allocation.Get()->GetResource());
#else
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, totalSizeInBytes, device.IsCacheCoherentUMA);
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, totalSizeInBytes, device.IsCacheCoherentUMA);
#endif
device.RegisterAllocatedResource();
device.RegisterAllocatedResource();
this.mappedData = (T*)this.d3D12Resource.Get()->Map().Pointer;
this.mappedData = (T*)this.d3D12Resource.Get()->Map().Pointer;
this.d3D12Resource.Get()->SetName(this);
}
this.d3D12Resource.Get()->SetName(this);
}
/// <inheritdoc/>
@@ -124,10 +123,9 @@ public unsafe abstract class TransferTexture3D<T> : NativeObject, IGraphicsResou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
using (this.GetReferenceTracker().GetLease())
{
return new(this.mappedData, Width, Height, Depth, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch);
}
using var _0 = this.GetReferenceTracker().GetLease();
return new(this.mappedData, Width, Height, Depth, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch);
}
}