Switched to D3D12MA for all resource allocations

このコミットが含まれているのは:
Sergio Pedri committed 2021-07-12 13:39:48 +02:00
1 親 d0dc1252f0
コミット 862f9e2cdd
12ファイル変更
+140 -369

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

+7 -15
ファイルの表示
@@ -18,6 +18,11 @@ namespace ComputeSharp.Resources
public unsafe abstract class TransferTexture3D<T> : NativeObject
where T : unmanaged
{
/// <summary>
/// The <see cref="D3D12MA_Allocation"/> instance used to retrieve <see cref="d3D12Resource"/>.
/// </summary>
private UniquePtr<D3D12MA_Allocation> allocation;
/// <summary>
/// The <see cref="ID3D12Resource"/> instance currently mapped.
/// </summary>
@@ -33,12 +38,6 @@ namespace ComputeSharp.Resources
/// </summary>
private readonly D3D12_PLACED_SUBRESOURCE_FOOTPRINT d3D12PlacedSubresourceFootprint;
/// <summary>
/// The <see cref="D3D12MA_Allocation"/> instance used to retrieve <see cref="d3D12Resource"/>, if any.
/// </summary>
/// <remarks>This will be <see langword="null"/> if the owning device has <see cref="GraphicsDevice.IsCacheCoherentUMA"/> set.</remarks>
private UniquePtr<D3D12MA_Allocation> allocation;
/// <summary>
/// Creates a new <see cref="TransferTexture3D{T}"/> instance with the specified parameters.
/// </summary>
@@ -72,15 +71,8 @@ namespace ComputeSharp.Resources
out _,
out ulong totalSizeInBytes);
if (device.IsCacheCoherentUMA)
{
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, allocationMode, totalSizeInBytes, true);
}
else
{
this.allocation = device.Allocator->CreateResource(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());
this.mappedData = (T*)this.d3D12Resource.Get()->Map().Pointer;