@@ -215,6 +215,7 @@ static const D3D12_HEAP_FLAGS RESOURCE_CLASS_HEAP_FLAGS =
215215static const D3D12_RESIDENCY_PRIORITY D3D12_RESIDENCY_PRIORITY_NONE = D3D12_RESIDENCY_PRIORITY(0 );
216216
217217static const D3D12_HEAP_TYPE D3D12_HEAP_TYPE_GPU_UPLOAD_COPY = (D3D12_HEAP_TYPE)5 ;
218+ static const D3D12_RESOURCE_FLAGS D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENT_COPY = (D3D12_RESOURCE_FLAGS)0x400 ;
218219
219220#ifndef _D3D12MA_ENUM_DECLARATIONS
220221
@@ -816,11 +817,9 @@ static bool ValidateAllocateMemoryParameters(
816817 return pAllocDesc &&
817818 pAllocInfo &&
818819 ppAllocation &&
819- (pAllocInfo->Alignment == 0 ||
820- pAllocInfo->Alignment == D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT ||
821- pAllocInfo->Alignment == D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT) &&
822- pAllocInfo->SizeInBytes != 0 &&
823- pAllocInfo->SizeInBytes % (64ull * 1024 ) == 0 ;
820+ IsPow2 (pAllocInfo->Alignment ) &&
821+ pAllocInfo->SizeInBytes > 0 &&
822+ pAllocInfo->SizeInBytes % 4 == 0 ;
824823}
825824
826825#endif // _D3D12MA_FUNCTIONS
@@ -7849,6 +7848,7 @@ HRESULT AllocatorPimpl::GetResourceAllocationInfo(
78497848
78507849#if D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT
78517850 if (inOutResourceDesc.Alignment == 0 &&
7851+ (inOutResourceDesc.Flags & D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENT_COPY) == 0 &&
78527852 (inOutResourceDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE1D ||
78537853 inOutResourceDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D ||
78547854 inOutResourceDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D) &&
@@ -9878,7 +9878,7 @@ HRESULT Allocator::AllocateMemory(
98789878 return E_INVALIDARG;
98799879 }
98809880 D3D12MA_DEBUG_GLOBAL_MUTEX_LOCK
9881- return m_Pimpl->AllocateMemory (pAllocDesc, pAllocInfo, ppAllocation);
9881+ return m_Pimpl->AllocateMemory (pAllocDesc, pAllocInfo, ppAllocation);
98829882}
98839883
98849884HRESULT Allocator::CreateAliasingResource (
0 commit comments