diff --git a/.github/workflows/.patches/dawn.diff b/.github/workflows/.patches/dawn.diff index 2606284f2..14ce13b68 100644 --- a/.github/workflows/.patches/dawn.diff +++ b/.github/workflows/.patches/dawn.diff @@ -553,7 +553,7 @@ index 214fa67f8..909e7d810 100644 + "D3D12 create residency manager")); + } + -+ DAWN_TRY(CheckHRESULT(gpgmm::d3d12::ResourceAllocator::CreateAllocator( ++ DAWN_TRY(CheckHRESULT(gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator( + allocatorDesc, mResidencyManager.Get(), &mResourceAllocator), + "D3D12 create resource allocator")); diff --git a/README.md b/README.md index 1f43b01f6..9d0fc4050 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ allocatorDesc.ResourceHeapTier = D3D12_RESOURCE_HEAP_TIER_1; ComPtr residency; // Optional ComPtr allocator; -gpgmm::d3d12::ResourceAllocator::CreateAllocator(desc, &allocator, &residency); +gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator(desc, &allocator, &residency); ``` ```cpp diff --git a/src/fuzzers/D3D12Fuzzer.cpp b/src/fuzzers/D3D12Fuzzer.cpp index fe12de5c3..329c0f0f6 100644 --- a/src/fuzzers/D3D12Fuzzer.cpp +++ b/src/fuzzers/D3D12Fuzzer.cpp @@ -20,7 +20,7 @@ uint64_t UInt8ToUInt64(const uint8_t* src) { return dst; } -HRESULT CreateAllocatorDesc(gpgmm::d3d12::ALLOCATOR_DESC* allocatorDesc) { +HRESULT CreateResourceAllocatorDesc(gpgmm::d3d12::ALLOCATOR_DESC* allocatorDesc) { gpgmm::d3d12::ALLOCATOR_DESC allocatorDescOut = {}; // Populate the device diff --git a/src/fuzzers/D3D12Fuzzer.h b/src/fuzzers/D3D12Fuzzer.h index 6f24ce8e2..c46ccd02d 100644 --- a/src/fuzzers/D3D12Fuzzer.h +++ b/src/fuzzers/D3D12Fuzzer.h @@ -19,7 +19,7 @@ uint64_t UInt8ToUInt64(const uint8_t* src); -HRESULT CreateAllocatorDesc(gpgmm::d3d12::ALLOCATOR_DESC* allocatorDesc); +HRESULT CreateResourceAllocatorDesc(gpgmm::d3d12::ALLOCATOR_DESC* allocatorDesc); D3D12_RESOURCE_DESC CreateBufferDesc(uint64_t width, uint64_t alignment = 0); diff --git a/src/fuzzers/D3D12ResidencyManagerFuzzer.cpp b/src/fuzzers/D3D12ResidencyManagerFuzzer.cpp index 395020ae1..85833b190 100644 --- a/src/fuzzers/D3D12ResidencyManagerFuzzer.cpp +++ b/src/fuzzers/D3D12ResidencyManagerFuzzer.cpp @@ -41,7 +41,7 @@ namespace { extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { gpgmm::d3d12::ALLOCATOR_DESC allocatorDesc = {}; - if (FAILED(CreateAllocatorDesc(&allocatorDesc))) { + if (FAILED(CreateResourceAllocatorDesc(&allocatorDesc))) { return 0; } @@ -72,7 +72,7 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { return 0; } - if (FAILED(gpgmm::d3d12::ResourceAllocator::CreateAllocator( + if (FAILED(gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator( allocatorDesc, gResidencyManager.Get(), &gResourceAllocator))) { return 0; } diff --git a/src/fuzzers/D3D12ResourceAllocatorFuzzer.cpp b/src/fuzzers/D3D12ResourceAllocatorFuzzer.cpp index b1b2a7605..823a08884 100644 --- a/src/fuzzers/D3D12ResourceAllocatorFuzzer.cpp +++ b/src/fuzzers/D3D12ResourceAllocatorFuzzer.cpp @@ -26,12 +26,12 @@ namespace { extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { gpgmm::d3d12::ALLOCATOR_DESC allocatorDesc = {}; - if (FAILED(CreateAllocatorDesc(&allocatorDesc))) { + if (FAILED(CreateResourceAllocatorDesc(&allocatorDesc))) { return 0; } - if (FAILED( - gpgmm::d3d12::ResourceAllocator::CreateAllocator(allocatorDesc, &gResourceAllocator))) { + if (FAILED(gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator(allocatorDesc, + &gResourceAllocator))) { return 0; } diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index 05d72a4d5..f95bbc572 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -362,9 +362,9 @@ namespace gpgmm::d3d12 { } // namespace // static - HRESULT ResourceAllocator::CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor, - ResourceAllocator** ppResourceAllocatorOut, - ResidencyManager** ppResidencyManagerOut) { + HRESULT ResourceAllocator::CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor, + ResourceAllocator** ppResourceAllocatorOut, + ResidencyManager** ppResidencyManagerOut) { if (allocatorDescriptor.Device == nullptr || allocatorDescriptor.Adapter == nullptr) { return E_INVALIDARG; } @@ -391,8 +391,8 @@ namespace gpgmm::d3d12 { } ComPtr resourceAllocator; - ReturnIfFailed( - CreateAllocator(allocatorDescriptor, residencyManager.Get(), &resourceAllocator)); + ReturnIfFailed(CreateResourceAllocator(allocatorDescriptor, residencyManager.Get(), + &resourceAllocator)); if (ppResourceAllocatorOut != nullptr) { *ppResourceAllocatorOut = resourceAllocator.Detach(); @@ -406,9 +406,9 @@ namespace gpgmm::d3d12 { } // static - HRESULT ResourceAllocator::CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor, - ResidencyManager* pResidencyManager, - ResourceAllocator** ppResourceAllocatorOut) { + HRESULT ResourceAllocator::CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor, + ResidencyManager* pResidencyManager, + ResourceAllocator** ppResourceAllocatorOut) { if (allocatorDescriptor.Adapter == nullptr || allocatorDescriptor.Device == nullptr) { return E_INVALIDARG; } diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.h b/src/gpgmm/d3d12/ResourceAllocatorD3D12.h index 7368eeaa1..2ae894042 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.h +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.h @@ -483,7 +483,7 @@ namespace gpgmm::d3d12 { **/ class GPGMM_EXPORT ResourceAllocator final : public MemoryAllocator, public IUnknownImpl { public: - /** \brief Create allocator with residency. + /** \brief Create a resource allocator with residency. Residency requires at-least DXGI version 1.4. @@ -496,11 +496,11 @@ namespace gpgmm::d3d12 { residency manager. If NULL is passed, the allocator will be created without using residency. */ - static HRESULT CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor, - ResourceAllocator** ppResourceAllocatorOut, - ResidencyManager** ppResidencyManagerOut = nullptr); + static HRESULT CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor, + ResourceAllocator** ppResourceAllocatorOut, + ResidencyManager** ppResidencyManagerOut = nullptr); - /** \brief Create allocator using a specified residency manager. + /** \brief Create a resource allocator using a specified residency manager. @param allocatorDescriptor A reference to ALLOCATOR_DESC structure that describes the allocator. @@ -510,9 +510,9 @@ namespace gpgmm::d3d12 { resource allocator. Pass NULL to test if allocator creation would succeed, but not actually create the allocator. */ - static HRESULT CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor, - ResidencyManager* pResidencyManager, - ResourceAllocator** ppResourceAllocatorOut); + static HRESULT CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor, + ResidencyManager* pResidencyManager, + ResourceAllocator** ppResourceAllocatorOut); ~ResourceAllocator() override; diff --git a/src/gpgmm/vk/ResourceAllocatorVk.cpp b/src/gpgmm/vk/ResourceAllocatorVk.cpp index 93b04baa5..c88f7f425 100644 --- a/src/gpgmm/vk/ResourceAllocatorVk.cpp +++ b/src/gpgmm/vk/ResourceAllocatorVk.cpp @@ -31,7 +31,7 @@ namespace gpgmm::vk { VkResult gpCreateResourceAllocator(const GpAllocatorCreateInfo& info, GpResourceAllocator* allocatorOut) { - return GpResourceAllocator_T::CreateAllocator(info, allocatorOut); + return GpResourceAllocator_T::CreateResourceAllocator(info, allocatorOut); } void gpDestroyResourceAllocator(GpResourceAllocator allocator) { @@ -186,8 +186,8 @@ namespace gpgmm::vk { // GpResourceAllocator_T // static - VkResult GpResourceAllocator_T::CreateAllocator(const GpAllocatorCreateInfo& info, - GpResourceAllocator* allocatorOut) { + VkResult GpResourceAllocator_T::CreateResourceAllocator(const GpAllocatorCreateInfo& info, + GpResourceAllocator* allocatorOut) { VulkanFunctions vkFunctions = {}; { VulkanExtensions vkExtensionsRequired = {}; diff --git a/src/gpgmm/vk/ResourceAllocatorVk.h b/src/gpgmm/vk/ResourceAllocatorVk.h index 8a00a470a..d8c4f5f69 100644 --- a/src/gpgmm/vk/ResourceAllocatorVk.h +++ b/src/gpgmm/vk/ResourceAllocatorVk.h @@ -355,8 +355,8 @@ namespace gpgmm::vk { class Caps; struct GpResourceAllocator_T { public: - static VkResult CreateAllocator(const GpAllocatorCreateInfo& info, - GpResourceAllocator* allocatorOut); + static VkResult CreateResourceAllocator(const GpAllocatorCreateInfo& info, + GpResourceAllocator* allocatorOut); VkResult TryAllocateMemory(const VkMemoryRequirements& requirements, const GpResourceAllocationCreateInfo& allocationInfo, diff --git a/src/include/min/gpgmm_d3d12.cpp b/src/include/min/gpgmm_d3d12.cpp index 2c3d2886e..49f6b0cf9 100644 --- a/src/include/min/gpgmm_d3d12.cpp +++ b/src/include/min/gpgmm_d3d12.cpp @@ -211,9 +211,9 @@ namespace gpgmm::d3d12 { // ResourceAllocator // static - HRESULT ResourceAllocator::CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor, - ResourceAllocator** ppResourceAllocatorOut, - ResidencyManager** ppResidencyManagerOut) { + HRESULT ResourceAllocator::CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor, + ResourceAllocator** ppResourceAllocatorOut, + ResidencyManager** ppResidencyManagerOut) { if (allocatorDescriptor.Device == nullptr || allocatorDescriptor.Adapter == nullptr) { return E_INVALIDARG; } @@ -235,8 +235,8 @@ namespace gpgmm::d3d12 { } Microsoft::WRL::ComPtr resourceAllocator; - ReturnIfFailed( - CreateAllocator(allocatorDescriptor, residencyManager.Get(), &resourceAllocator)); + ReturnIfFailed(CreateResourceAllocator(allocatorDescriptor, residencyManager.Get(), + &resourceAllocator)); if (ppResourceAllocatorOut != nullptr) { *ppResourceAllocatorOut = resourceAllocator.Detach(); @@ -250,9 +250,9 @@ namespace gpgmm::d3d12 { } // static - HRESULT ResourceAllocator::CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor, - ResidencyManager* pResidencyManager, - ResourceAllocator** ppResourceAllocatorOut) { + HRESULT ResourceAllocator::CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor, + ResidencyManager* pResidencyManager, + ResourceAllocator** ppResourceAllocatorOut) { if (ppResourceAllocatorOut != nullptr) { *ppResourceAllocatorOut = new ResourceAllocator(allocatorDescriptor, pResidencyManager); } diff --git a/src/include/min/gpgmm_d3d12.h b/src/include/min/gpgmm_d3d12.h index 1a10fa8e8..a40429ad6 100644 --- a/src/include/min/gpgmm_d3d12.h +++ b/src/include/min/gpgmm_d3d12.h @@ -314,13 +314,13 @@ namespace gpgmm::d3d12 { class ResourceAllocator final : public MemoryAllocator, public IUnknownImpl { public: - static HRESULT CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor, - ResourceAllocator** ppResourceAllocatorOut, - ResidencyManager** ppResidencyManagerOut = nullptr); + static HRESULT CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor, + ResourceAllocator** ppResourceAllocatorOut, + ResidencyManager** ppResidencyManagerOut = nullptr); - static HRESULT CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor, - ResidencyManager* pResidencyManager, - ResourceAllocator** ppResourceAllocatorOut); + static HRESULT CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor, + ResidencyManager* pResidencyManager, + ResourceAllocator** ppResourceAllocatorOut); HRESULT CreateResource(const ALLOCATION_DESC& allocationDescriptor, const D3D12_RESOURCE_DESC& resourceDescriptor, diff --git a/src/samples/D3D12Sample.cpp b/src/samples/D3D12Sample.cpp index 0ff655273..e26f00d74 100644 --- a/src/samples/D3D12Sample.cpp +++ b/src/samples/D3D12Sample.cpp @@ -62,7 +62,7 @@ HRESULT Init() { desc.ResourceHeapTier = options.ResourceHeapTier; Microsoft::WRL::ComPtr resourceAllocator; - hr = gpgmm::d3d12::ResourceAllocator::CreateAllocator(desc, &resourceAllocator); + hr = gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator(desc, &resourceAllocator); if (FAILED(hr)) { return hr; } diff --git a/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp b/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp index 8bb84de32..5b68d2226 100644 --- a/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp +++ b/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp @@ -480,7 +480,7 @@ class D3D12EventTraceReplay : public D3D12TestBase, public CaptureReplayTestWith } ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator( + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator( allocatorDescOfProfile, residencyManager.Get(), &resourceAllocator)); ASSERT_TRUE(playbackContext.CreatedAllocatorsToID diff --git a/src/tests/end2end/D3D12ResidencyManagerTests.cpp b/src/tests/end2end/D3D12ResidencyManagerTests.cpp index 0908d2cbe..90bd028a4 100644 --- a/src/tests/end2end/D3D12ResidencyManagerTests.cpp +++ b/src/tests/end2end/D3D12ResidencyManagerTests.cpp @@ -266,8 +266,8 @@ TEST_F(D3D12ResidencyManagerTests, CreateDescriptorHeap) { TEST_F(D3D12ResidencyManagerTests, CreateResidencyList) { ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), - &resourceAllocator, nullptr)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), + &resourceAllocator, nullptr)); ALLOCATION_DESC allocationDesc = {}; allocationDesc.HeapType = D3D12_HEAP_TYPE_DEFAULT; @@ -328,8 +328,8 @@ TEST_F(D3D12ResidencyManagerTests, CreateResidencyManager) { { ComPtr residencyManager; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), - &resourceAllocator, &residencyManager)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator( + CreateBasicAllocatorDesc(), &resourceAllocator, &residencyManager)); EXPECT_NE(resourceAllocator, nullptr); EXPECT_NE(residencyManager, nullptr); } @@ -341,7 +341,7 @@ TEST_F(D3D12ResidencyManagerTests, CreateResidencyManager) { CreateBasicResidencyDesc(kDefaultBudget), &residencyManager)); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator( + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator( CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator)); EXPECT_NE(resourceAllocator, nullptr); EXPECT_NE(residencyManager, nullptr); @@ -355,8 +355,8 @@ TEST_F(D3D12ResidencyManagerTests, CreateResidencyManagerNoLeak) { { ComPtr residencyManager; ComPtr resourceAllocator; - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator, - &residencyManager); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator, + &residencyManager); } // Create allocator with residency, seperately. @@ -366,8 +366,8 @@ TEST_F(D3D12ResidencyManagerTests, CreateResidencyManagerNoLeak) { &residencyManager); ComPtr resourceAllocator; - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), residencyManager.Get(), - &resourceAllocator); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), + residencyManager.Get(), &resourceAllocator); } GPGMM_TEST_MEMORY_LEAK_END(); @@ -382,7 +382,7 @@ TEST_F(D3D12ResidencyManagerTests, OverBudget) { ASSERT_SUCCEEDED(ResidencyManager::CreateResidencyManager(residencyDesc, &residencyManager)); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator( + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator( CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator)); constexpr uint64_t kBufferMemorySize = GPGMM_MB_TO_BYTES(1); @@ -440,7 +440,7 @@ TEST_F(D3D12ResidencyManagerTests, OverBudgetAsync) { ASSERT_SUCCEEDED(ResidencyManager::CreateResidencyManager(residencyDesc, &residencyManager)); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator( + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator( CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator)); constexpr uint64_t kBufferMemorySize = GPGMM_MB_TO_BYTES(1); @@ -487,7 +487,7 @@ TEST_F(D3D12ResidencyManagerTests, OverBudgetDisablesGrowth) { allocatorDesc.MemoryGrowthFactor = 2; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator( + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator( CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator)); std::vector> allocations = {}; @@ -528,7 +528,7 @@ TEST_F(D3D12ResidencyManagerTests, OverBudgetWithLockedHeaps) { ASSERT_SUCCEEDED(ResidencyManager::CreateResidencyManager(residencyDesc, &residencyManager)); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator( + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator( CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator)); constexpr uint64_t kBufferMemorySize = GPGMM_MB_TO_BYTES(1); @@ -577,7 +577,7 @@ TEST_F(D3D12ResidencyManagerTests, ExecuteCommandListOverBudget) { CreateBasicResidencyDesc(kDefaultBudget), &residencyManager)); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator( + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator( CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator)); constexpr uint64_t kBufferMemorySize = GPGMM_MB_TO_BYTES(1); diff --git a/src/tests/end2end/D3D12ResourceAllocatorTests.cpp b/src/tests/end2end/D3D12ResourceAllocatorTests.cpp index 74e352f2a..6b3c22797 100644 --- a/src/tests/end2end/D3D12ResourceAllocatorTests.cpp +++ b/src/tests/end2end/D3D12ResourceAllocatorTests.cpp @@ -76,11 +76,11 @@ class D3D12ResourceAllocatorTests : public D3D12TestBase, public ::testing::Test } }; -TEST_F(D3D12ResourceAllocatorTests, CreateAllocator) { +TEST_F(D3D12ResourceAllocatorTests, CreateResourceAllocator) { // Creating an invalid allocator should always fail. { ComPtr resourceAllocator; - EXPECT_FAILED(ResourceAllocator::CreateAllocator({}, &resourceAllocator)); + EXPECT_FAILED(ResourceAllocator::CreateResourceAllocator({}, &resourceAllocator)); EXPECT_EQ(resourceAllocator, nullptr); } @@ -90,7 +90,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateAllocator) { desc.Device = nullptr; ComPtr resourceAllocator; - EXPECT_FAILED(ResourceAllocator::CreateAllocator(desc, &resourceAllocator)); + EXPECT_FAILED(ResourceAllocator::CreateResourceAllocator(desc, &resourceAllocator)); EXPECT_EQ(resourceAllocator, nullptr); } @@ -102,12 +102,13 @@ TEST_F(D3D12ResourceAllocatorTests, CreateAllocator) { static_cast(D3D12_RESOURCE_HEAP_TIER_2 + 1); ComPtr resourceAllocator; - EXPECT_FAILED(ResourceAllocator::CreateAllocator(desc, &resourceAllocator)); + EXPECT_FAILED(ResourceAllocator::CreateResourceAllocator(desc, &resourceAllocator)); EXPECT_EQ(resourceAllocator, nullptr); } // Creating a NULL allocator should always succeed. - EXPECT_SUCCEEDED(ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), nullptr)); + EXPECT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), nullptr)); // Creating an allocator without an adapter should always fail. { @@ -115,15 +116,15 @@ TEST_F(D3D12ResourceAllocatorTests, CreateAllocator) { desc.Adapter = nullptr; ComPtr resourceAllocator; - EXPECT_FAILED(ResourceAllocator::CreateAllocator(desc, &resourceAllocator)); + EXPECT_FAILED(ResourceAllocator::CreateResourceAllocator(desc, &resourceAllocator)); EXPECT_EQ(resourceAllocator, nullptr); } // Creating a new allocator using the defaults should always succeed. { ComPtr resourceAllocator; - EXPECT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + EXPECT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), + &resourceAllocator)); EXPECT_NE(resourceAllocator, nullptr); } @@ -135,16 +136,16 @@ TEST_F(D3D12ResourceAllocatorTests, CreateAllocator) { desc.MaxResourceHeapSize = kBufferOf4MBAllocationSize / 2; ComPtr resourceAllocator; - EXPECT_FAILED(ResourceAllocator::CreateAllocator(desc, &resourceAllocator)); + EXPECT_FAILED(ResourceAllocator::CreateResourceAllocator(desc, &resourceAllocator)); EXPECT_EQ(resourceAllocator, nullptr); } } -TEST_F(D3D12ResourceAllocatorTests, CreateAllocatorNoLeak) { +TEST_F(D3D12ResourceAllocatorTests, CreateResourceAllocatorNoLeak) { GPGMM_TEST_MEMORY_LEAK_START(); { ComPtr resourceAllocator; - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator); } GPGMM_TEST_MEMORY_LEAK_END(); } @@ -153,7 +154,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferNoLeak) { GPGMM_TEST_MEMORY_LEAK_START(); { ComPtr resourceAllocator; - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator); for (auto& bufferAllocationExpectation : GenerateBufferAllocations()) { ComPtr allocation; resourceAllocator->CreateResource( @@ -177,7 +178,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferAndTextureInSameHeap) { GPGMM_SKIP_TEST_IF(allocatorDesc.ResourceHeapTier < D3D12_RESOURCE_HEAP_TIER_2); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(allocatorDesc, &resourceAllocator)); // Create memory for buffer in Heap A. { @@ -209,7 +210,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferAndTextureInSeperateHeap) { allocatorDesc.PreferredResourceHeapSize = kBufferOf4MBAllocationSize; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(allocatorDesc, &resourceAllocator)); // Create memory for buffer in Heap A. { @@ -242,7 +243,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferAndTextureInSeperateHeap) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferOversized) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); constexpr uint64_t kOversizedBuffer = GPGMM_GB_TO_BYTES(32); @@ -269,7 +270,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferSubAllocated) { newAllocatorDesc.SubAllocationAlgorithm = ALLOCATOR_ALGORITHM_BUDDY_SYSTEM; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); for (auto& alloc : GenerateBufferAllocations()) { @@ -288,7 +290,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferSubAllocated) { newAllocatorDesc.PoolAlgorithm = ALLOCATOR_ALGORITHM_FIXED_POOL; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); for (auto& alloc : GenerateBufferAllocations()) { @@ -307,7 +310,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferSubAllocated) { newAllocatorDesc.PoolAlgorithm = ALLOCATOR_ALGORITHM_SEGMENTED_POOL; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); for (auto& alloc : GenerateBufferAllocations()) { @@ -325,7 +329,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferSubAllocated) { newAllocatorDesc.SubAllocationAlgorithm = ALLOCATOR_ALGORITHM_SLAB; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); for (auto& alloc : GenerateBufferAllocations()) { @@ -344,7 +349,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferSubAllocated) { newAllocatorDesc.PoolAlgorithm = ALLOCATOR_ALGORITHM_FIXED_POOL; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); for (auto& alloc : GenerateBufferAllocations()) { @@ -363,7 +369,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferSubAllocated) { newAllocatorDesc.PoolAlgorithm = ALLOCATOR_ALGORITHM_SEGMENTED_POOL; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); for (auto& alloc : GenerateBufferAllocations()) { @@ -381,7 +388,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferSubAllocated) { newAllocatorDesc.Flags |= ALLOCATOR_FLAG_ALWAYS_COMMITED; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); for (auto& alloc : GenerateBufferAllocations()) { @@ -399,7 +407,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferSubAllocated) { newAllocatorDesc.SubAllocationAlgorithm = ALLOCATOR_ALGORITHM_DEDICATED; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); for (auto& alloc : GenerateBufferAllocations()) { @@ -422,7 +431,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithPreferredHeapSize) { newAllocatorDesc.PreferredResourceHeapSize = GPGMM_MB_TO_BYTES(12); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ComPtr allocation; @@ -441,7 +451,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithPreferredHeapSize) { newAllocatorDesc.PreferredResourceHeapSize = GPGMM_MB_TO_BYTES(12); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ComPtr allocation; @@ -460,7 +471,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithPreferredHeapSize) { newAllocatorDesc.PreferredResourceHeapSize = GPGMM_MB_TO_BYTES(12); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(newAllocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(newAllocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ComPtr allocation; @@ -477,7 +489,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithPreferredHeapSize) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferManyDeallocateAtEnd) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC allocationDesc = {}; @@ -503,7 +515,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferManyDeallocateAtEnd) { TEST_F(D3D12ResourceAllocatorTests, CreateBuffer) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); // Creating a resource without allocation should still succeed. @@ -659,7 +671,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBuffer) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferLeaked) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ComPtr allocation; @@ -676,7 +688,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferUMA) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ASSERT_SUCCEEDED( @@ -710,7 +722,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferDisableCustomHeaps) { allocatorDesc.Flags |= ALLOCATOR_FLAG_DISABLE_CUSTOM_HEAPS; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(allocatorDesc, &resourceAllocator)); { ComPtr allocation; @@ -756,7 +768,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferDisableCustomHeaps) { TEST_F(D3D12ResourceAllocatorTests, CreateSmallTexture) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); // DXGI_FORMAT_R8G8B8A8_UNORM @@ -778,7 +790,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateSmallTexture) { TEST_F(D3D12ResourceAllocatorTests, CreateMultisampledTexture) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); // DXGI_FORMAT_R8G8B8A8_UNORM @@ -804,7 +816,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateMultisampledTexture) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferImported) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); // Importing a non-existent buffer should always fail. @@ -833,7 +845,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferImported) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferInvalid) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); // Garbage buffer descriptor should always fail. @@ -851,7 +863,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferAlwaysCommitted) { desc.Flags = ALLOCATOR_FLAG_ALWAYS_COMMITED; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(desc, &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(desc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC allocationDesc = {}; @@ -880,7 +892,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferAlwaysCommitted) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferNeverAllocate) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); // Check we can't reuse memory if CreateResource was never called previously. @@ -918,7 +930,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferNeverAllocate) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithin) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC baseAllocationDesc = {}; @@ -1076,7 +1088,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithin) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithinMany) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC allocationDesc = {}; @@ -1191,7 +1203,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithinMany) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferNeverSubAllocated) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); constexpr uint64_t bufferSize = kBufferOf4MBAllocationSize / 2; @@ -1214,7 +1226,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferNeverPooled) { allocatorDesc.Flags |= ALLOCATOR_FLAG_ALWAYS_ON_DEMAND; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(allocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC baseAllocationDesc = {}; @@ -1271,7 +1283,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferPooled) { ALLOCATOR_DESC allocatorDesc = CreateBasicAllocatorDesc(); ComPtr poolAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &poolAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(allocatorDesc, &poolAllocator)); ASSERT_NE(poolAllocator, nullptr); // Only standalone allocations can be pool-allocated. @@ -1362,7 +1374,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferPooled) { ALLOCATOR_DESC desc = CreateBasicAllocatorDesc(); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(desc, &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(desc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ComPtr allocation; @@ -1380,8 +1392,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferGetInfo) { // Calculate info for a single standalone allocation. { ComPtr resourceAllocator; - ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), + &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC standaloneAllocationDesc = {}; @@ -1405,7 +1417,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferGetInfo) { ALLOCATOR_DESC allocatorDesc = CreateBasicAllocatorDesc(); ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(allocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC standaloneAllocationDesc = {}; @@ -1438,8 +1451,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferGetInfo) { // Calculate info for two sub-allocations. { ComPtr resourceAllocator; - ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), + &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC subAllocationDesc = {}; @@ -1480,8 +1493,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferGetInfo) { // Calculate info for two sub-allocations within the same resource. { ComPtr resourceAllocator; - ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), + &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC allocationWithinDesc = {}; @@ -1522,7 +1535,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateTexturePooled) { ComPtr poolAllocator; { ALLOCATOR_DESC allocatorDesc = CreateBasicAllocatorDesc(); - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &poolAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(allocatorDesc, &poolAllocator)); ASSERT_NE(poolAllocator, nullptr); } @@ -1573,7 +1586,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithLimitedFragmentation) { // By default, buffer should be sub-allocated. { ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(allocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ComPtr allocation; @@ -1587,7 +1601,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithLimitedFragmentation) { // Force standalone buffer creation. { ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(allocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC standaloneAllocationDesc = baseAllocationDesc; @@ -1606,7 +1621,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithLimitedFragmentation) { allocatorDesc.Flags |= ALLOCATOR_FLAG_ALWAYS_COMMITED; ComPtr commitedAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &commitedAllocator)); + ASSERT_SUCCEEDED( + ResourceAllocator::CreateResourceAllocator(allocatorDesc, &commitedAllocator)); ASSERT_NE(commitedAllocator, nullptr); ComPtr allocation; @@ -1626,7 +1642,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferManyPrefetch) { allocatorDesc.Flags ^= ALLOCATOR_FLAG_DISABLE_MEMORY_PREFETCH; ComPtr resourceAllocator; - ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(allocatorDesc, &resourceAllocator)); + ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(allocatorDesc, &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); constexpr uint64_t kNumOfBuffers = 1000u; @@ -1654,7 +1670,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferManyPrefetch) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferManyThreaded) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC allocationDesc = {}; @@ -1683,7 +1699,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferManyThreaded) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithinManyThreaded) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC allocationDesc = {}; @@ -1713,13 +1729,13 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithinManyThreaded) { } TEST_F(D3D12ResourceAllocatorTests, CreateBufferCacheSize) { - // Since we cannot determine which resource sizes will be cached upon CreateAllocator, skip the - // test. + // Since we cannot determine which resource sizes will be cached upon CreateResourceAllocator, + // skip the test. GPGMM_SKIP_TEST_IF(IsSizeCacheEnabled()); ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); // First request is always a cache miss. @@ -1815,7 +1831,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferCacheSize) { TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithPadding) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); constexpr uint64_t kBufferSize = GPGMM_MB_TO_BYTES(1); @@ -1845,7 +1861,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithPadding) { TEST_F(D3D12ResourceAllocatorTests, CreateTextureWithPadding) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); ALLOCATION_DESC allocationDesc = {}; @@ -1872,7 +1888,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateTextureWithPadding) { TEST_F(D3D12ResourceAllocatorTests, AllocatorFeatures) { ComPtr resourceAllocator; ASSERT_SUCCEEDED( - ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); + ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator)); ASSERT_NE(resourceAllocator, nullptr); // Request information with invalid data size. diff --git a/src/tests/end2end/VKResourceAllocatorTests.cpp b/src/tests/end2end/VKResourceAllocatorTests.cpp index 4da19e8c2..5cc3aa311 100644 --- a/src/tests/end2end/VKResourceAllocatorTests.cpp +++ b/src/tests/end2end/VKResourceAllocatorTests.cpp @@ -32,7 +32,7 @@ class VKResourceAllocatorTests : public VKTestBase, public ::testing::Test { } }; -TEST_F(VKResourceAllocatorTests, CreateAllocator) { +TEST_F(VKResourceAllocatorTests, CreateResourceAllocator) { GpResourceAllocator resourceAllocator; ASSERT_SUCCESS(gpCreateResourceAllocator(CreateBasicAllocatorInfo(), &resourceAllocator)); gpDestroyResourceAllocator(resourceAllocator);