Advertisement

CopyDescriptorsSimple & copying between heaps

Started by March 21, 2019 01:43 PM
3 comments, last by LandonJerre 5 years, 10 months ago

Hi

It is possible at all to copy descriptors between _two different_ heaps ? The documentation says so:

Quote

Multiple descriptor heaps can be involved in the copy operation, both as source and destination. The use of descriptor handles as parameters means the copy methods don’t care about which heaps any given descriptor lies in – they are all just memory.

 

First (source) heap is:


    D3D12_DESCRIPTOR_HEAP_DESC HeapDesc;
    HeapDesc.NumDescriptors = 256;
    HeapDesc.Type           = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER;
    HeapDesc.Flags          = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
    HeapDesc.NodeMask       = 0;

and SrcHeap->GetCPUDescriptorHandleForHeapStart() ==> Handle.ptr == 4 (strange, value indeed, I'd expected ptr as in case of GPU handles)

Second (destination) heap is:


    HeapDesc.NumDescriptors = 128;
    HeapDesc.Type           = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER;
    HeapDesc.Flags          = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
    HeapDesc.NodeMask       = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;

and DstHeap->GetCPUDescriptorHandleForHeapStart() ==> Handle.ptr == 9 (strange, value indeed, I'd expected ptr as in case of GPU handles)

and I want to copy elements 5, 6, and 7 from first one to the second one


auto Increment = Device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER); // Return 32

CD3DX12_CPU_DESCRIPTOR_HANDLE Src = CD3DX12_CPU_DESCRIPTOR_HANDLE(SrcHeap->GetCPUDescriptorHandleForHeapStart(), 5, Increment);

CD3DX12_CPU_DESCRIPTOR_HANDLE Dst = CD3DX12_CPU_DESCRIPTOR_HANDLE(DstHeap->GetCPUDescriptorHandleForHeapStart(), 0, Increment);

Device->CopyDescriptorsSimple(3, Dst, Src, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);

and debug layers says:

D3D12 ERROR: ID3D12Device::CopyDescriptors: Source ranges and dest ranges overlap, which results in undefined behavior. [ EXECUTION ERROR #653: COPY_DESCRIPTORS_INVALID_RANGES]

and indeed samplers are not copied to the shader visible descriptors heap ... why ?

I have win10 1809 (x64), latest nvidia drivers and 2080RTX (I do not have any other cards, and device is initialized on 2080RTX)

I'v compilled ModelViewer from DXSamples MiniEngine ... and it spills out that same error from within it's DynamicDescriptorHeap implementation :/

 

 

This is a bug in the D3D12 debug layer. In older versions, the descriptor handles were virtualized (i.e. converted into CPU pointers so they could be easily dereferenced). But on hardware that supports raytracing, this doesn't work, because the descriptor handles can be embedded in GPU-accessible data structures, so the debug layer ha to track them instead of virtualizing them.

When running in this tracking mode, the CopyDescriptors APIs were overlooked as having dependencies on the previous virtualization strategy. This is fixed in insider flights and I believe the plan is to service a fix for this to the current stable release.

Advertisement

OK - thanks !

Indeed I'm experimenting with raycasting and I didn't have this problem on my older hardware (GTX960) - but the copy should work regardless of error ? or if the debug layer is enabled the copy wont work on RTX hardware ? (that would sucks realy :/)

 

You can disable specific debug messages with ID3D12InfoQueue. My "config" for this looks something like this, I also disabled mismatching clear value messages.
 


{
    CComPtr<ID3D12InfoQueue> d3dInfoQueue;
    if (SUCCEEDED(Device->QueryInterface(__uuidof(ID3D12InfoQueue), reinterpret_cast<void**>(&d3dInfoQueue))))
    {
      d3dInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION, true);
      d3dInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, true);
      d3dInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING, true);

      D3D12_MESSAGE_ID blockedIds[] = { D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE, 				
      	D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_MISMATCHINGCLEARVALUE, D3D12_MESSAGE_ID_COPY_DESCRIPTORS_INVALID_RANGES };
      D3D12_INFO_QUEUE_FILTER filter = {};
      filter.DenyList.pIDList = blockedIds;
      filter.DenyList.NumIDs = 3;
      d3dInfoQueue->AddRetrievalFilterEntries(&filter);
      d3dInfoQueue->AddStorageFilterEntries(&filter);
    }
}

 

This topic is closed to new replies.

Advertisement