Skip to content

Commit 07f1e1e

Browse files
committed
Loosened restriction on alignment and size in ValidateAllocateMemoryParameters
1 parent cea8c63 commit 07f1e1e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/D3D12MemAlloc.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,9 @@ static bool ValidateAllocateMemoryParameters(
817817
return pAllocDesc &&
818818
pAllocInfo &&
819819
ppAllocation &&
820-
(pAllocInfo->Alignment == 0 ||
821-
pAllocInfo->Alignment == D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT ||
822-
pAllocInfo->Alignment == D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT) &&
823-
pAllocInfo->SizeInBytes != 0 &&
824-
pAllocInfo->SizeInBytes % (64ull * 1024) == 0;
820+
IsPow2(pAllocInfo->Alignment) &&
821+
pAllocInfo->SizeInBytes > 0 &&
822+
pAllocInfo->SizeInBytes % 4 == 0;
825823
}
826824

827825
#endif // _D3D12MA_FUNCTIONS
@@ -9880,7 +9878,7 @@ HRESULT Allocator::AllocateMemory(
98809878
return E_INVALIDARG;
98819879
}
98829880
D3D12MA_DEBUG_GLOBAL_MUTEX_LOCK
9883-
return m_Pimpl->AllocateMemory(pAllocDesc, pAllocInfo, ppAllocation);
9881+
return m_Pimpl->AllocateMemory(pAllocDesc, pAllocInfo, ppAllocation);
98849882
}
98859883

98869884
HRESULT Allocator::CreateAliasingResource(

0 commit comments

Comments
 (0)