From 2ca5df4d5116f1a3d3c4e8d24fcedcb2e766ccfa Mon Sep 17 00:00:00 2001 From: galop1n Date: Sun, 14 Aug 2016 15:17:09 -0700 Subject: [PATCH] Fix read back resource creation at capture time. It is a bad practice to initialize a heap property manually and will lead to various failure on various hardware and driver revision The proper way is to call Device12::GetCustomHeapProperties --- renderdoc/driver/d3d12/d3d12_manager.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_manager.cpp b/renderdoc/driver/d3d12/d3d12_manager.cpp index 0a0a7a42a..25b5dbd9e 100644 --- a/renderdoc/driver/d3d12/d3d12_manager.cpp +++ b/renderdoc/driver/d3d12/d3d12_manager.cpp @@ -373,12 +373,8 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res) if(desc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) { - D3D12_HEAP_PROPERTIES heapProps; - heapProps.Type = D3D12_HEAP_TYPE_READBACK; - heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; - heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; - heapProps.CreationNodeMask = 1; - heapProps.VisibleNodeMask = 1; + D3D12_HEAP_PROPERTIES heapProps = + m_Device->GetReal()->GetCustomHeapProperties(1, D3D12_HEAP_TYPE_READBACK); ID3D12Resource *copyDst = NULL; HRESULT hr = m_Device->GetReal()->CreateCommittedResource( @@ -403,12 +399,8 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res) } else { - D3D12_HEAP_PROPERTIES heapProps; - heapProps.Type = D3D12_HEAP_TYPE_READBACK; - heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; - heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; - heapProps.CreationNodeMask = 1; - heapProps.VisibleNodeMask = 1; + D3D12_HEAP_PROPERTIES heapProps = + m_Device->GetReal()->GetCustomHeapProperties(1, D3D12_HEAP_TYPE_READBACK); D3D12_RESOURCE_DESC bufDesc;