Merge pull request #26 from rayferric/master

Add option to build as shared library
diff --git a/README.md b/README.md
index eed957e..572958e 100644
--- a/README.md
+++ b/README.md
@@ -107,3 +107,4 @@
 # See also
 
 - **[Vulkan Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/)** - equivalent library for Vulkan. License: MIT.
+- **[TerraFX.Interop.D3D12MemoryAllocator](https://github.com/terrafx/terrafx.interop.d3d12memoryallocator)** - interop bindings for this library for C#, as used by [TerraFX](https://github.com/terrafx/terrafx). License: MIT.
diff --git a/src/Tests.cpp b/src/Tests.cpp
index 4447df3..bd7a669 100644
--- a/src/Tests.cpp
+++ b/src/Tests.cpp
@@ -712,6 +712,37 @@
     }

 }

 

+static void TestCustomPool_Committed(const TestContext& ctx)

+{

+    wprintf(L"Test custom pool committed\n");

+

+    const UINT64 BUFFER_SIZE = 32;

+

+    D3D12MA::POOL_DESC poolDesc = {};

+    poolDesc.HeapProperties.Type = D3D12_HEAP_TYPE_DEFAULT;

+    poolDesc.HeapFlags = D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS;

+

+    ComPtr<D3D12MA::Pool> pool;

+    CHECK_HR( ctx.allocator->CreatePool(&poolDesc, &pool) );

+

+    D3D12MA::ALLOCATION_DESC allocDesc = {};

+    allocDesc.CustomPool = pool.Get();

+    allocDesc.Flags = D3D12MA::ALLOCATION_FLAG_COMMITTED;

+

+    D3D12_RESOURCE_DESC resDesc;

+    FillResourceDescForBuffer(resDesc, BUFFER_SIZE);

+

+    ComPtr<D3D12MA::Allocation> alloc;

+    CHECK_HR( ctx.allocator->CreateResource(&allocDesc, &resDesc,

+        D3D12_RESOURCE_STATE_COMMON,

+        NULL, // pOptimizedClearValue

+        &alloc,

+        IID_NULL, NULL) ); // riidResource, ppvResource

+    CHECK_BOOL(alloc->GetHeap() == NULL);

+    CHECK_BOOL(alloc->GetResource() != NULL);

+    CHECK_BOOL(alloc->GetOffset() == 0);

+}

+

 static HRESULT TestCustomHeap(const TestContext& ctx, const D3D12_HEAP_PROPERTIES& heapProps)

 {

     D3D12MA::Stats globalStatsBeg = {};

@@ -1566,6 +1597,7 @@
     TestOtherComInterface(ctx);

     TestCustomPools(ctx);

     TestCustomPool_MinAllocationAlignment(ctx);

+    TestCustomPool_Committed(ctx);

     TestCustomHeaps(ctx);

     TestStandardCustomCommittedPlaced(ctx);

     TestAliasingMemory(ctx);