Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/gpgmm_d3d12.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/JSONSerializerD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
8 changes: 4 additions & 4 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ namespace {
static_cast<D3D12_HEAP_TYPE>(allocationDescJson["HeapType"].asInt());
allocationDesc.ExtraRequiredHeapFlags =
static_cast<D3D12_HEAP_FLAGS>(allocationDescJson["ExtraRequiredHeapFlags"].asInt());
allocationDesc.RequireResourceHeapPadding =
allocationDescJson["RequireResourceHeapPadding"].asUInt64();
allocationDesc.ExtraRequiredResourcePadding =
allocationDescJson["ExtraRequiredResourcePadding"].asUInt64();
return allocationDesc;
}

Expand Down
8 changes: 4 additions & 4 deletions src/tests/end2end/D3D12ResourceAllocatorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1895,15 +1895,15 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithPadding) {
allocationDesc, CreateBasicBufferDesc(kBufferSize), D3D12_RESOURCE_STATE_GENERIC_READ,
nullptr, &allocationWithoutPadding));

allocationDesc.RequireResourceHeapPadding = 63;
allocationDesc.ExtraRequiredResourcePadding = 63;
ComPtr<IResourceAllocation> allocationWithPadding;
ASSERT_SUCCEEDED(resourceAllocator->CreateResource(
allocationDesc, CreateBasicBufferDesc(kBufferSize), D3D12_RESOURCE_STATE_GENERIC_READ,
nullptr, &allocationWithPadding));

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);
Expand All @@ -1924,15 +1924,15 @@ 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<IResourceAllocation> allocationWithPadding;
ASSERT_SUCCEEDED(resourceAllocator->CreateResource(
allocationDesc, CreateBasicTextureDesc(DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1),
D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, &allocationWithPadding));

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);
Expand Down