2

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.

yosmo78
  • 489
  • 4
  • 13
  • 2
    In general most of D3D's limits are in base 2. Additionally, almost unilaterally, any alignment value (D3D or otherwise) will always be a simple of power 2. – vandench May 31 '22 at 13:45

1 Answers1

6

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 )
Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81