Advertisement

Root parameter decriptor table with a mix of range types

Started by October 11, 2017 09:47 AM
6 comments, last by galop1n 7 years, 4 months ago

Hello!

Is it possible to mix ranges of samplers and ranges of SRVs and ranges of UAVs in one root parameter descriptor table? Like so:


D3D12_DESCRIPTOR_RANGE ranges[3];
D3D12_ROOT_PARAMETER param;
param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
param.DescriptorTable.NumDescriptorRanges = 3;
param.DescriptorTable.pDescriptorRanges = ranges;

range[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
..
range[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
..
range[2].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER;
..

I wonder especially about CopyDescriptors, that will need to copy a range of D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER and a range of D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV.

Thanks if anyone knows (while I try it :))

.P

Aaaaaand I think I have my answer:

Quote

The D3D12_ROOT_DESCRIPTOR_TABLE structure declares the layout of a descriptor table as a collection of descriptor ranges that appear one after the other in a descriptor heap. Samplers are not allowed in the same descriptor table as CBV/UAV/SRVs.

 

Advertisement

IIRC samplers are on there own heap thats why you can't do it.

-potential energy is easily made kinetic-

While I'm here, I'm wondering about what exactly is CopyDesciptors doing (CopyDescriptorsSimple is... simple).

Can the number of destination and source ranges be different? E.g. is it good for gathering scattered descriptors before the draw? Like copy 10 scattered SRVs into 1 contiguous range and 5 scattered UAVs into another contiguous range? The documentation doesn't say anything.

Also, are we allowed to copy/write descriptors into a GPU visible descriptor heap from CPU (or GPU) directly, i.e. without CopyDescriptors? The descriptor heap has a CPU virtual address (pointer), the size of the descriptor is known...

Yes, CopyDescriptors can do arbitrary scatter/gather. The only requirement is that the total number of descriptors specified in the source ranges and dest ranges must be equal. How they're divided among the ranges is unimportant.

You can write into GPU-visible descriptor heaps at will, either via creates or copies, but cannot copy out of them.

Awesome, that's what I hoped :)

Advertisement

Do not perform the copy in the back of D3D tho, some hardware may need extra processing. An example is the sampler state, the border colors are not inline but indexed in a shared table on AMD.

This topic is closed to new replies.

Advertisement