Updates in d3dx12.h: Nuget Packaging, Header Bloat Reduction, and D3DX12GetCopyableFootprints

Roland Shum

Hey everyone, we recently updated our d3dx12.h file! Previously, users were required to head to DirectX-Headers repo to grab the nice d3dx12.h helper files. The recent Agility SDK 1.608.2 release bundles this repo with the Nuget packages! There are no differences between the two packages.

 

Header Bloat Reduction

 

Next, users of the DirectX-Headers repo may notice that d3dx12.h no longer contains 5500 lines of code (hooray)! Previously, users would include all 5500 lines of code despite being only interested in one function d3dx12.h provides. Today, developers can potentially reduce compile times by choosing to include from a set of more focused d3dx12_<foo>.h headers

However, if you were happy with how things were, you could still include d3dx12.h, which is the equivalent of including all 28 files. We hope this change makes life easier for our users when determining which features to use and cut bloat from d3dx12.h.

Before

// d3dx12.h
struct CD3DX12_DEFAULT {};
extern const DECLSPEC_SELECTANY CD3DX12_DEFAULT D3D12_DEFAULT;
//----------------------------------------------------------------------------------------
struct CD3DX12_RECT : public D3D12_RECT
{

};

//---------------------------------------------------------------------------------------
struct CD3DX12_VIEWPORT : public D3D12_VIEWPORT
//
// More code below..
// (5500 lines, to be precise)
//

Now

#include "d3d12.h"

#if defined( __cplusplus )

#include "d3dx12_barriers.h"
#include "d3dx12_core.h"
#include "d3dx12_default.h"
#include "d3dx12_pipeline_state_stream.h"
#include "d3dx12_render_pass.h"
#include "d3dx12_resource_helpers.h"
#include "d3dx12_root_signature.h"
#include "d3dx12_property_format_table.h"

#ifndef D3DX12_NO_STATE_OBJECT_HELPERS
#include "d3dx12_state_object.h"
#endif // !D3DX12_NO_STATE_OBJECT_HELPERS

#ifndef D3DX12_NO_CHECK_FEATURE_SUPPORT_CLASS
#include "d3dx12_check_feature_support.h"
#endif // !D3DX12_NO_CHECK_FEATURE_SUPPORT_CLASS
#endif // defined( __cplusplus )
#endif //__D3DX12_H__
// eof

 

Please use the headers with the latest Agility SDK release.

 

D3DX12GetCopyableFootprints

 

We have also open-sourced ID3D12Device::GetCopyableFootprints under d3dx12_resource_helpers.h. We hope this open-sourced version clarifies the calculations behind a resource’s size. However, we still recommend using ID3D12Device::GetCopyableFootprints as it has more comprehensive error checking built into the debug layer, whereas the open-sourced version D3DX12GetCopyableFootprints makes the assumption all inputs are correct.

In addition, we have open-sourced the format layout tables. These require linking a .cpp file / static library to use. The files are src/D3DPropertyFormatTable.cpp and include/directx/D3DPropertyFormatTable.h.

As always, we appreciate everyone’s feedback on DirectX 12!

3 comments

Discussion is closed. Login to edit/delete existing comments.

  • Jeremy Ong 0

    Thanks for the update! FYI the links to GitHub at the bottom appear to be broken.

    *edit: thanks for fixing it!*

  • Ana William 0

    Thanks for the update!

  • Edy Kusnandar 0

    thanks information please check my web

Feedback usabilla icon