0

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

 1 year ago
source link: https://devblogs.microsoft.com/directx/updates-in-directx-headers-repo/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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

IMG-20220520-WA0136-96x96.jpg

Roland Shum

January 6th, 20233 0

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)
//
#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!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK