diff --git a/include/gpgmm_d3d12.h b/include/gpgmm_d3d12.h index d9bf3a2bf..b4bce1c21 100644 --- a/include/gpgmm_d3d12.h +++ b/include/gpgmm_d3d12.h @@ -1183,10 +1183,10 @@ namespace gpgmm::d3d12 { ALLOCATOR_FEATURE_RESOURCE_ALLOCATION_SUPPORT, }; - /** \struct RESOURCE_ALLOCATOR_STATS - Additional information about the resource allocator usage. + /** \struct ALLOCATOR_STATS + Additional information about allocator usage. */ - struct RESOURCE_ALLOCATOR_STATS { + struct ALLOCATOR_STATS { /** \brief Number of used sub-allocated blocks within the same memory. */ uint32_t UsedBlockCount; @@ -1313,13 +1313,13 @@ namespace gpgmm::d3d12 { UsedMemoryUsage. Or the percent of recycled memory is equal to FreeMemoryUsage / (UsedMemoryUsage + FreeMemoryUsage) * 100%. - @param pResourceAllocatorStats A pointer to a RESOURCE_ALLOCATOR_STATS structure or NULL if + @param pResourceAllocatorStats A pointer to a ALLOCATOR_STATS structure or NULL if statistics information should only be gathered for recording. \return Returns S_OK if successful. Returns S_FALSE if statistics information was only gathered for recording. */ - virtual HRESULT QueryStats(RESOURCE_ALLOCATOR_STATS * pResourceAllocatorStats) = 0; + virtual HRESULT QueryStats(ALLOCATOR_STATS * pResourceAllocatorStats) = 0; /** \brief Gets information about the features that are supported by the resource allocator. diff --git a/src/fuzzers/D3D12ResidencyManagerFuzzer.cpp b/src/fuzzers/D3D12ResidencyManagerFuzzer.cpp index be24671e8..bbc166a29 100644 --- a/src/fuzzers/D3D12ResidencyManagerFuzzer.cpp +++ b/src/fuzzers/D3D12ResidencyManagerFuzzer.cpp @@ -40,9 +40,9 @@ namespace { : 0; } - gpgmm::d3d12::RESOURCE_ALLOCATOR_STATS GetStats( + gpgmm::d3d12::ALLOCATOR_STATS GetStats( ComPtr resourceAllocator) { - gpgmm::d3d12::RESOURCE_ALLOCATOR_STATS stats = {}; + gpgmm::d3d12::ALLOCATOR_STATS stats = {}; resourceAllocator->QueryStats(&stats); return stats; } diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index 4f71cfafe..39283d861 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -1133,7 +1133,7 @@ namespace gpgmm::d3d12 { // If over-budget, only free memory is considered available. // TODO: Consider optimizing GetStatsInternal(). if (currentVideoInfo->CurrentUsage + request.SizeInBytes > currentVideoInfo->Budget) { - RESOURCE_ALLOCATOR_STATS allocationStats = {}; + ALLOCATOR_STATS allocationStats = {}; GPGMM_RETURN_IF_FAILED(QueryStatsInternal(&allocationStats)); request.AvailableForAllocation = allocationStats.FreeHeapUsage; @@ -1513,13 +1513,12 @@ namespace gpgmm::d3d12 { return S_OK; } - HRESULT ResourceAllocator::QueryStats(RESOURCE_ALLOCATOR_STATS* pResourceAllocatorStats) { + HRESULT ResourceAllocator::QueryStats(ALLOCATOR_STATS* pResourceAllocatorStats) { std::lock_guard lock(mMutex); return QueryStatsInternal(pResourceAllocatorStats); } - HRESULT ResourceAllocator::QueryStatsInternal( - RESOURCE_ALLOCATOR_STATS* pResourceAllocatorStats) { + HRESULT ResourceAllocator::QueryStatsInternal(ALLOCATOR_STATS* pResourceAllocatorStats) { GPGMM_TRACE_EVENT_DURATION(TraceEventCategory::kDefault, "ResourceAllocator.QueryStats"); // ResourceAllocator itself could call CreateCommittedResource directly. diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.h b/src/gpgmm/d3d12/ResourceAllocatorD3D12.h index 02b652069..87d447f98 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.h +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.h @@ -63,7 +63,7 @@ namespace gpgmm::d3d12 { ID3D12Resource* pCommittedResource, IResourceAllocation** ppResourceAllocationOut) override; HRESULT ReleaseResourceHeaps(uint64_t bytesToRelease, uint64_t* pBytesReleased) override; - HRESULT QueryStats(RESOURCE_ALLOCATOR_STATS* pResourceAllocatorStats) override; + HRESULT QueryStats(ALLOCATOR_STATS* pResourceAllocatorStats) override; HRESULT CheckFeatureSupport(ALLOCATOR_FEATURE feature, void* pFeatureSupportData, uint32_t featureSupportDataSize) const override; @@ -148,7 +148,7 @@ namespace gpgmm::d3d12 { // MemoryAllocator interface void DeallocateMemory(std::unique_ptr allocation) override; - HRESULT QueryStatsInternal(RESOURCE_ALLOCATOR_STATS* pResourceAllocatorStats); + HRESULT QueryStatsInternal(ALLOCATOR_STATS* pResourceAllocatorStats); ID3D12Device* mDevice = nullptr; ComPtr mResidencyManager; diff --git a/src/mvi/gpgmm_d3d12.cpp b/src/mvi/gpgmm_d3d12.cpp index cb382b69a..28eafb73b 100644 --- a/src/mvi/gpgmm_d3d12.cpp +++ b/src/mvi/gpgmm_d3d12.cpp @@ -399,7 +399,7 @@ namespace gpgmm::d3d12 { return E_NOTIMPL; } - HRESULT ResourceAllocator::QueryStats(RESOURCE_ALLOCATOR_STATS* pResourceAllocatorStats) { + HRESULT ResourceAllocator::QueryStats(ALLOCATOR_STATS* pResourceAllocatorStats) { return E_NOTIMPL; } diff --git a/src/mvi/gpgmm_d3d12.h b/src/mvi/gpgmm_d3d12.h index de4057e07..249659346 100644 --- a/src/mvi/gpgmm_d3d12.h +++ b/src/mvi/gpgmm_d3d12.h @@ -230,7 +230,7 @@ namespace gpgmm::d3d12 { ID3D12Resource* pCommittedResource, IResourceAllocation** ppResourceAllocationOut) override; HRESULT ReleaseResourceHeaps(uint64_t bytesToRelease, uint64_t* pBytesReleased) override; - HRESULT QueryStats(RESOURCE_ALLOCATOR_STATS* pResourceAllocatorStats) override; + HRESULT QueryStats(ALLOCATOR_STATS* pResourceAllocatorStats) override; HRESULT CheckFeatureSupport(ALLOCATOR_FEATURE feature, void* pFeatureSupportData, uint32_t featureSupportDataSize) const override; diff --git a/src/tests/D3D12Test.cpp b/src/tests/D3D12Test.cpp index 2540e02b5..2bc609c1b 100644 --- a/src/tests/D3D12Test.cpp +++ b/src/tests/D3D12Test.cpp @@ -48,8 +48,8 @@ namespace gpgmm::d3d12 { return unknown->Release(); } - RESOURCE_ALLOCATOR_STATS GetStats(ComPtr resourceAllocator) { - RESOURCE_ALLOCATOR_STATS stats = {}; + ALLOCATOR_STATS GetStats(ComPtr resourceAllocator) { + ALLOCATOR_STATS stats = {}; resourceAllocator->QueryStats(&stats); return stats; } diff --git a/src/tests/D3D12Test.h b/src/tests/D3D12Test.h index 1b9e4e6d6..4ffbc39dc 100644 --- a/src/tests/D3D12Test.h +++ b/src/tests/D3D12Test.h @@ -44,7 +44,7 @@ namespace gpgmm::d3d12 { D3D12_MESSAGE_SEVERITY GetMessageSeverity(MessageSeverity MessageSeverity); long GetRefCount(IUnknown* unknown); - RESOURCE_ALLOCATOR_STATS GetStats(ComPtr resourceAllocator); + ALLOCATOR_STATS GetStats(ComPtr resourceAllocator); RESIDENCY_MANAGER_STATS GetStats(ComPtr residencyManager); class D3D12TestBase : public GPGMMTestBase { diff --git a/src/tests/end2end/D3D12ResourceAllocatorTests.cpp b/src/tests/end2end/D3D12ResourceAllocatorTests.cpp index 6e5229377..1d32d44cf 100644 --- a/src/tests/end2end/D3D12ResourceAllocatorTests.cpp +++ b/src/tests/end2end/D3D12ResourceAllocatorTests.cpp @@ -1505,7 +1505,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferStats) { ASSERT_NE(firstAllocation, nullptr); EXPECT_EQ(firstAllocation->GetInfo().Method, ALLOCATION_METHOD_STANDALONE); - RESOURCE_ALLOCATOR_STATS stats = GetStats(resourceAllocator); + ALLOCATOR_STATS stats = GetStats(resourceAllocator); EXPECT_EQ(stats.UsedHeapCount, 1u); EXPECT_EQ(stats.UsedHeapUsage, kBufferOf4MBAllocationSize); } @@ -1530,7 +1530,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferStats) { ASSERT_NE(firstAllocation, nullptr); EXPECT_EQ(firstAllocation->GetInfo().Method, ALLOCATION_METHOD_STANDALONE); - RESOURCE_ALLOCATOR_STATS stats = GetStats(resourceAllocator); + ALLOCATOR_STATS stats = GetStats(resourceAllocator); EXPECT_EQ(stats.UsedHeapCount, 1u); EXPECT_EQ(stats.UsedHeapUsage, kBufferOf4MBAllocationSize); @@ -1568,7 +1568,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferStats) { // TODO: Consider testing counts by allocator type. GPGMM_SKIP_TEST_IF(firstAllocation->GetInfo().Method != ALLOCATION_METHOD_SUBALLOCATED); - RESOURCE_ALLOCATOR_STATS stats = GetStats(resourceAllocator); + ALLOCATOR_STATS stats = GetStats(resourceAllocator); EXPECT_EQ(stats.UsedHeapCount, 1u); EXPECT_GE(stats.UsedHeapUsage, stats.UsedBlockUsage); EXPECT_EQ(stats.UsedBlockCount, 1u); @@ -1608,7 +1608,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferStats) { ASSERT_NE(firstAllocation, nullptr); EXPECT_EQ(firstAllocation->GetInfo().Method, ALLOCATION_METHOD_SUBALLOCATED_WITHIN); - RESOURCE_ALLOCATOR_STATS stats = GetStats(resourceAllocator); + ALLOCATOR_STATS stats = GetStats(resourceAllocator); EXPECT_EQ(stats.UsedHeapCount, 1u); EXPECT_EQ(stats.UsedHeapUsage, 64u * 1024u); EXPECT_EQ(stats.UsedBlockCount, 1u);