From 54bf9180431ede1752b763ead5415f489d7e27d5 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 1 Jul 2023 14:31:12 +0200 Subject: [PATCH] Add D3D12MemoryAllocatorFactory type --- .../D3D12MemoryAllocatorFactory.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/ComputeSharp.D3D12MemoryAllocator/D3D12MemoryAllocatorFactory.cs diff --git a/src/ComputeSharp.D3D12MemoryAllocator/D3D12MemoryAllocatorFactory.cs b/src/ComputeSharp.D3D12MemoryAllocator/D3D12MemoryAllocatorFactory.cs new file mode 100644 index 00000000..7c95646d --- /dev/null +++ b/src/ComputeSharp.D3D12MemoryAllocator/D3D12MemoryAllocatorFactory.cs @@ -0,0 +1,26 @@ +using ComputeSharp.Core.Extensions; +using ComputeSharp.D3D12MemoryAllocator.Interop; + +namespace ComputeSharp.D3D12MemoryAllocator; + +/// +/// The entry point to obtain ID3D12MemoryAllocatorFactory instances using D3D12MA. +/// +public static unsafe class D3D12MemoryAllocatorFactory +{ + /// + /// Creates a new ID3D12MemoryAllocatorFactory instance for D3D12MA. + /// + /// The resulting ID3D12MemoryAllocatorFactory instance for D3D12MA. + /// + /// This method should only be used to provide an argument for . + /// + public static void* CreateInstance() + { + ID3D12MemoryAllocatorFactoryImpl* allocatorFactory = null; + + ID3D12MemoryAllocatorFactoryImpl.Factory(&allocatorFactory).Assert(); + + return allocatorFactory; + } +}