Update namespaces in ComputeSharp.D3D12MemoryAllocator
このコミットが含まれているのは:
1 親
e69cb04880
コミット
0d786ebe66
6ファイル変更
+41
-31
検索条件に一致するファイルはありません
@@ -2,7 +2,7 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using ComputeSharp.D3D12MemoryAllocator.Interop;
|
||||
using TerraFX.Interop.Windows;
|
||||
using ComputeSharp.Win32;
|
||||
|
||||
namespace ComputeSharp.D3D12MemoryAllocator;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
using static TerraFX.Interop.DirectX.D3D12_CPU_PAGE_PROPERTY;
|
||||
using static TerraFX.Interop.DirectX.D3D12_HEAP_TYPE;
|
||||
using static TerraFX.Interop.DirectX.D3D12_MEMORY_POOL;
|
||||
using ComputeSharp.Win32;
|
||||
using static ComputeSharp.Win32.D3D12_CPU_PAGE_PROPERTY;
|
||||
using static ComputeSharp.Win32.D3D12_HEAP_TYPE;
|
||||
using static ComputeSharp.Win32.D3D12_MEMORY_POOL;
|
||||
using D3D12MA_Allocator = TerraFX.Interop.DirectX.D3D12MA_Allocator;
|
||||
using D3D12MA_Pool = TerraFX.Interop.DirectX.D3D12MA_Pool;
|
||||
using D3D12MA_POOL_DESC = TerraFX.Interop.DirectX.D3D12MA_POOL_DESC;
|
||||
|
||||
namespace ComputeSharp.D3D12MemoryAllocator.Extensions;
|
||||
|
||||
@@ -24,11 +26,11 @@ internal static unsafe class AllocatorExtensions
|
||||
D3D12MA_POOL_DESC poolDesc = default;
|
||||
poolDesc.HeapProperties.CreationNodeMask = 1;
|
||||
poolDesc.HeapProperties.VisibleNodeMask = 1;
|
||||
poolDesc.HeapProperties.Type = D3D12_HEAP_TYPE_CUSTOM;
|
||||
poolDesc.HeapProperties.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_WRITE_BACK;
|
||||
poolDesc.HeapProperties.MemoryPoolPreference = D3D12_MEMORY_POOL_L0;
|
||||
poolDesc.HeapProperties.Type = (TerraFX.Interop.DirectX.D3D12_HEAP_TYPE)D3D12_HEAP_TYPE_CUSTOM;
|
||||
poolDesc.HeapProperties.CPUPageProperty = (TerraFX.Interop.DirectX.D3D12_CPU_PAGE_PROPERTY)D3D12_CPU_PAGE_PROPERTY_WRITE_BACK;
|
||||
poolDesc.HeapProperties.MemoryPoolPreference = (TerraFX.Interop.DirectX.D3D12_MEMORY_POOL)D3D12_MEMORY_POOL_L0;
|
||||
|
||||
allocator.CreatePool(&poolDesc, pool.GetAddressOf()).Assert();
|
||||
((HRESULT)(int)allocator.CreatePool(&poolDesc, pool.GetAddressOf())).Assert();
|
||||
|
||||
return pool.Move();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using ComputeSharp.Win32;
|
||||
using D3D12MA_Allocator = TerraFX.Interop.DirectX.D3D12MA_Allocator;
|
||||
using D3D12MA_ALLOCATOR_DESC = TerraFX.Interop.DirectX.D3D12MA_ALLOCATOR_DESC;
|
||||
using D3D12MemAlloc = TerraFX.Interop.DirectX.D3D12MemAlloc;
|
||||
|
||||
namespace ComputeSharp.Graphics.Extensions;
|
||||
namespace ComputeSharp.D3D12MemoryAllocator.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> with extensions for the <see cref="ID3D12Device"/> type.
|
||||
@@ -21,10 +23,10 @@ internal static unsafe class ID3D12DeviceExtensions
|
||||
using ComPtr<D3D12MA_Allocator> allocator = default;
|
||||
|
||||
D3D12MA_ALLOCATOR_DESC allocatorDesc = default;
|
||||
allocatorDesc.pDevice = (ID3D12Device*)Unsafe.AsPointer(ref d3D12Device);
|
||||
allocatorDesc.pAdapter = dxgiAdapter;
|
||||
allocatorDesc.pDevice = (TerraFX.Interop.DirectX.ID3D12Device*)Unsafe.AsPointer(ref d3D12Device);
|
||||
allocatorDesc.pAdapter = (TerraFX.Interop.DirectX.IDXGIAdapter*)dxgiAdapter;
|
||||
|
||||
D3D12MemAlloc.D3D12MA_CreateAllocator(&allocatorDesc, allocator.GetAddressOf()).Assert();
|
||||
((HRESULT)(int)D3D12MemAlloc.D3D12MA_CreateAllocator(&allocatorDesc, allocator.GetAddressOf())).Assert();
|
||||
|
||||
return allocator.Move();
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using ComputeSharp.Interop.Allocation;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
using ComputeSharp.Win32;
|
||||
using D3D12MA_Allocation = TerraFX.Interop.DirectX.D3D12MA_Allocation;
|
||||
|
||||
namespace ComputeSharp.D3D12MemoryAllocator.Interop;
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@ using System.Threading;
|
||||
using ComputeSharp.D3D12MemoryAllocator.Extensions;
|
||||
using ComputeSharp.Graphics.Extensions;
|
||||
using ComputeSharp.Interop.Allocation;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
using static TerraFX.Interop.DirectX.D3D12_FEATURE;
|
||||
using ComputeSharp.Win32;
|
||||
using static ComputeSharp.Win32.D3D12_FEATURE;
|
||||
using D3D12MA_Allocator = TerraFX.Interop.DirectX.D3D12MA_Allocator;
|
||||
using D3D12MA_Pool = TerraFX.Interop.DirectX.D3D12MA_Pool;
|
||||
|
||||
namespace ComputeSharp.D3D12MemoryAllocator.Interop;
|
||||
|
||||
|
||||
@@ -3,9 +3,12 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using ComputeSharp.Interop.Allocation;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
using static TerraFX.Interop.DirectX.D3D12MA_ALLOCATION_FLAGS;
|
||||
using ComputeSharp.Win32;
|
||||
using D3D12MA_Allocation = TerraFX.Interop.DirectX.D3D12MA_Allocation;
|
||||
using D3D12MA_ALLOCATION_DESC = TerraFX.Interop.DirectX.D3D12MA_ALLOCATION_DESC;
|
||||
using D3D12MA_ALLOCATION_FLAGS = TerraFX.Interop.DirectX.D3D12MA_ALLOCATION_FLAGS;
|
||||
using D3D12MA_Allocator = TerraFX.Interop.DirectX.D3D12MA_Allocator;
|
||||
using D3D12MA_Pool = TerraFX.Interop.DirectX.D3D12MA_Pool;
|
||||
|
||||
namespace ComputeSharp.D3D12MemoryAllocator.Interop;
|
||||
|
||||
@@ -180,10 +183,12 @@ internal unsafe struct ID3D12MemoryAllocatorImpl
|
||||
BOOL clearAllocation,
|
||||
ID3D12Allocation** allocation)
|
||||
{
|
||||
D3D12MA_ALLOCATION_FLAGS allocationFlags = clearAllocation ? D3D12MA_ALLOCATION_FLAG_COMMITTED : D3D12MA_ALLOCATION_FLAG_NONE;
|
||||
D3D12MA_ALLOCATION_FLAGS allocationFlags = clearAllocation ?
|
||||
D3D12MA_ALLOCATION_FLAGS.D3D12MA_ALLOCATION_FLAG_COMMITTED :
|
||||
D3D12MA_ALLOCATION_FLAGS.D3D12MA_ALLOCATION_FLAG_NONE;
|
||||
|
||||
D3D12MA_ALLOCATION_DESC allocationDesc = default;
|
||||
allocationDesc.HeapType = heapType;
|
||||
allocationDesc.HeapType = (TerraFX.Interop.DirectX.D3D12_HEAP_TYPE)heapType;
|
||||
allocationDesc.Flags = allocationFlags;
|
||||
allocationDesc.CustomPool = @this->pool;
|
||||
|
||||
@@ -191,16 +196,16 @@ internal unsafe struct ID3D12MemoryAllocatorImpl
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = default;
|
||||
|
||||
// Invoke D3D12MA and create an allocation and resource
|
||||
HRESULT hresult = @this->allocator->CreateResource(
|
||||
TerraFX.Interop.Windows.HRESULT hresult = @this->allocator->CreateResource(
|
||||
pAllocDesc: &allocationDesc,
|
||||
pResourceDesc: resourceDescription,
|
||||
InitialResourceState: resourceStates,
|
||||
pResourceDesc: (TerraFX.Interop.DirectX.D3D12_RESOURCE_DESC*)resourceDescription,
|
||||
InitialResourceState: (TerraFX.Interop.DirectX.D3D12_RESOURCE_STATES)resourceStates,
|
||||
pOptimizedClearValue: null,
|
||||
ppAllocation: d3D12MA_allocation.GetAddressOf(),
|
||||
riidResource: Windows.__uuidof<ID3D12Resource>(),
|
||||
ppvResource: (void**)d3D12Resource.GetAddressOf());
|
||||
|
||||
if (!Windows.SUCCEEDED(hresult))
|
||||
if (!TerraFX.Interop.Windows.Windows.SUCCEEDED(hresult))
|
||||
{
|
||||
return hresult;
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする