Jump to content
  • Advertisement
ADDMX

DX12 CopyDescriptorsSimple & copying between heaps

Recommended Posts

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 :/

 

 

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites

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 :/)

 

Share this post


Link to post
Share on other sites

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);
    }
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!