From 4aff488d523c0241582b7c184bf0c5f78190cc5f Mon Sep 17 00:00:00 2001 From: "Bernhart, Bryan" Date: Fri, 4 Aug 2023 15:32:41 -0700 Subject: [PATCH] Rename RequireResourceHeapPadding to ExtraRequiredResourcePadding. --- include/gpgmm_d3d12.h | 2 +- src/gpgmm/d3d12/JSONSerializerD3D12.cpp | 2 +- src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp | 8 ++++---- src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp | 4 ++-- src/tests/end2end/D3D12ResourceAllocatorTests.cpp | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/gpgmm_d3d12.h b/include/gpgmm_d3d12.h index 0dd61533..8658f520 100644 --- a/include/gpgmm_d3d12.h +++ b/include/gpgmm_d3d12.h @@ -1161,7 +1161,7 @@ namespace gpgmm::d3d12 { Optional parameter. No extra padding is applied by default. */ - UINT64 RequireResourceHeapPadding; + UINT64 ExtraRequiredResourcePadding; /** \brief Associates a name with the given allocation. diff --git a/src/gpgmm/d3d12/JSONSerializerD3D12.cpp b/src/gpgmm/d3d12/JSONSerializerD3D12.cpp index 6d09433a..cfcfa991 100644 --- a/src/gpgmm/d3d12/JSONSerializerD3D12.cpp +++ b/src/gpgmm/d3d12/JSONSerializerD3D12.cpp @@ -63,7 +63,7 @@ namespace gpgmm::d3d12 { dict.AddItem("Flags", desc.Flags); dict.AddItem("HeapType", desc.HeapType); dict.AddItem("ExtraRequiredHeapFlags", desc.ExtraRequiredHeapFlags); - dict.AddItem("RequireResourceHeapPadding", desc.RequireResourceHeapPadding); + dict.AddItem("ExtraRequiredResourcePadding", desc.ExtraRequiredResourcePadding); if (desc.DebugName != nullptr) { dict.AddItem("DebugName", WCharToUTF8(desc.DebugName)); } diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index f7951b59..1d11cd88 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -1087,7 +1087,7 @@ namespace gpgmm::d3d12 { const bool isMSAA = resourceDescriptor.SampleDesc.Count > 1; - const bool requiresPadding = allocationDescriptor.RequireResourceHeapPadding > 0; + const bool requiresPadding = allocationDescriptor.ExtraRequiredResourcePadding > 0; // Attempt to allocate using the most effective allocator.; MemoryAllocatorBase* allocator = nullptr; @@ -1111,11 +1111,11 @@ namespace gpgmm::d3d12 { // Apply extra padding to the resource heap size, if specified. // Padding can only be applied to standalone non-committed resources. if (GPGMM_UNLIKELY(requiresPadding)) { - request.SizeInBytes += allocationDescriptor.RequireResourceHeapPadding; + request.SizeInBytes += allocationDescriptor.ExtraRequiredResourcePadding; if (!neverSubAllocate) { WarnLog(this, MessageId::kInvalidArgument) << "Sub-allocation was enabled but has no effect when padding is requested: " - << allocationDescriptor.RequireResourceHeapPadding << " bytes."; + << allocationDescriptor.ExtraRequiredResourcePadding << " bytes."; neverSubAllocate = true; } } @@ -1414,7 +1414,7 @@ namespace gpgmm::d3d12 { return E_INVALIDARG; } - if (allocationDescriptor.RequireResourceHeapPadding > 0) { + if (allocationDescriptor.ExtraRequiredResourcePadding > 0) { ErrorLog(MessageId::kInvalidArgument) << "Unable to import a resource when using allocation flags which modify memory."; return E_INVALIDARG; diff --git a/src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp b/src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp index 8e4afea1..5ac45dae 100644 --- a/src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp +++ b/src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp @@ -43,8 +43,8 @@ namespace { static_cast(allocationDescJson["HeapType"].asInt()); allocationDesc.ExtraRequiredHeapFlags = static_cast(allocationDescJson["ExtraRequiredHeapFlags"].asInt()); - allocationDesc.RequireResourceHeapPadding = - allocationDescJson["RequireResourceHeapPadding"].asUInt64(); + allocationDesc.ExtraRequiredResourcePadding = + allocationDescJson["ExtraRequiredResourcePadding"].asUInt64(); return allocationDesc; } diff --git a/src/tests/end2end/D3D12ResourceAllocatorTests.cpp b/src/tests/end2end/D3D12ResourceAllocatorTests.cpp index 9cf9dff0..fc7da8b1 100644 --- a/src/tests/end2end/D3D12ResourceAllocatorTests.cpp +++ b/src/tests/end2end/D3D12ResourceAllocatorTests.cpp @@ -1895,7 +1895,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithPadding) { allocationDesc, CreateBasicBufferDesc(kBufferSize), D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, &allocationWithoutPadding)); - allocationDesc.RequireResourceHeapPadding = 63; + allocationDesc.ExtraRequiredResourcePadding = 63; ComPtr allocationWithPadding; ASSERT_SUCCEEDED(resourceAllocator->CreateResource( allocationDesc, CreateBasicBufferDesc(kBufferSize), D3D12_RESOURCE_STATE_GENERIC_READ, @@ -1903,7 +1903,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithPadding) { EXPECT_GE(allocationWithPadding->GetInfo().SizeInBytes - allocationWithoutPadding->GetInfo().SizeInBytes, - allocationDesc.RequireResourceHeapPadding); + allocationDesc.ExtraRequiredResourcePadding); // Padded resources are only supported for standalone allocations. EXPECT_EQ(allocationWithPadding->GetInfo().Type, ALLOCATION_TYPE_STANDALONE); @@ -1924,7 +1924,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateTextureWithPadding) { allocationDesc, CreateBasicTextureDesc(DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1), D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, &allocationWithoutPadding)); - allocationDesc.RequireResourceHeapPadding = 63; + allocationDesc.ExtraRequiredResourcePadding = 63; ComPtr allocationWithPadding; ASSERT_SUCCEEDED(resourceAllocator->CreateResource( allocationDesc, CreateBasicTextureDesc(DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1), @@ -1932,7 +1932,7 @@ TEST_F(D3D12ResourceAllocatorTests, CreateTextureWithPadding) { EXPECT_GE(allocationWithPadding->GetInfo().SizeInBytes - allocationWithoutPadding->GetInfo().SizeInBytes, - allocationDesc.RequireResourceHeapPadding); + allocationDesc.ExtraRequiredResourcePadding); // Padded resources are only supported for standalone allocations. EXPECT_EQ(allocationWithPadding->GetInfo().Type, ALLOCATION_TYPE_STANDALONE);