From 5fb59defcbaefcdb5ed6b76089783e5aa2f53b43 Mon Sep 17 00:00:00 2001 From: Denis Rutkov Date: Wed, 27 Feb 2019 11:16:53 +0000 Subject: [PATCH] Fix reading initial state for upload heap buffers. --- renderdoc/driver/d3d12/d3d12_initstate.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_initstate.cpp b/renderdoc/driver/d3d12/d3d12_initstate.cpp index 0b0197c58..c04a960eb 100644 --- a/renderdoc/driver/d3d12/d3d12_initstate.cpp +++ b/renderdoc/driver/d3d12/d3d12_initstate.cpp @@ -79,10 +79,6 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res) SetInitialContents(GetResID(r), D3D12InitialContents(D3D12InitialContents::MapDirect)); return true; } - else if(heapProps.Type == D3D12_HEAP_TYPE_UPLOAD) - { - return true; - } heapProps.Type = D3D12_HEAP_TYPE_READBACK; heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; @@ -104,7 +100,9 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res) RDCASSERT(states.size() == 1); D3D12_RESOURCE_BARRIER barrier; - const bool needsTransition = (states[0] & D3D12_RESOURCE_STATE_COPY_SOURCE) == 0; + const bool isUploadHeap = (heapProps.Type == D3D12_HEAP_TYPE_UPLOAD); + const bool needsTransition = + !isUploadHeap && ((states[0] & D3D12_RESOURCE_STATE_COPY_SOURCE) == 0); if(needsTransition) {