microsoft / DirectXTK12

The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
https://walbourn.github.io/directx-tool-kit-for-directx-12/
MIT License
1.45k stars 371 forks source link

Fix of CaptureTexture for Reserved and MultiSample resources #91

Closed drinkertea closed 3 years ago

drinkertea commented 3 years ago

Fix of reserved resources extraction.

It is unable to call GetHeapProperties for reserved resources. But such info required only for READBACK resources optimization, capture code should not fail for reserved resources in this case.

D3D12 ERROR: ID3D12Resource2::ID3D12Resource::GetHeapProperties: GetHeapProperties can not be called on a resource created with the CreateReservedResource API. [ RESOURCE_MANIPULATION ERROR #901: GETHEAPPROPERTIES_INVALIDRESOURCE]

Fix of multisample resources extraction.

Invalid desc for resolved resource copied from the original multisample resource with Alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT, which fails creation call.

walbourn commented 3 years ago

Per Microsoft Docs: ID3D12Resource::GetHeapProperties:

This method only works on placed and committed resources, not on reserved resources. If the resource was created as reserved, E_INVALIDARG is returned. The pages could be mapped to none, one, or more heaps.