yosmo78
yosmo78

Reputation: 619

D3D12 CreateHeap alignment, Does MSDN use 1024 or 1000 for its definition of KB

I am trying to use CreateHeap and PlacedResources in DirectX12. However for CreateHeap it requires a D3D12_HEAP_DESC where it says "applications should pass SizeInBytes (a field of the D3D12_HEAP_DESC) values which are multiples of the effective Alignment". And then they go to show an alignment D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT #defined as 64KB., where is says 64KB is the alignment.

Does Microsoft DirectX12 use 65536 Bytes as its definition of 64KB or 64000 Bytes (so basically is 1024 or 1000 bytes the definition of KB for microsoft)? I don't want to waste any bytes and I don't know where I can find the definition for these types of units for microsoft. As Wikipedia shows 1024 KB as the legacy unit of KiloByte, so is microsoft standards up to date is the question.

Upvotes: 2

Views: 207

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41057

The "Kibi" .vs "Kilo" difference for the SI units is an important one, particularly for fixed-storage sizes. That said, in programming specifications "KB" almost always means "1024 bytes".

If you look in the d3d12.h header, you will see that the value of D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT is base-2:

#define D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT      ( 65536 )

Upvotes: 6

Related Questions