So after watching the dx12 binding videos and reading through some docs, I'm not 100% sure if I understood correctly how to manage my heaps.
Let me explain what I wan't to achieve in my application: During the initialisation, I'll be filling two heaps, one holding Samplers and the other one holding SRV, CBV and UAV. Those heaps will contain all the resources the application will be using during its life time.
Now starts the interesting part. To build the Root Signatures, I'll be using for the most part Root Descriptor Tables.
As we know, a table will hold ranges, a range being a base shader slot, number of descriptors and other settings. Let me show you and example:
Root Parameters
0 - root_table
1 - root_table
0 root_table
CBV b1
CBV b6
SRV t0
SRV t2
1 root_table
Sampler s1
Sampler s4
As shown in the example, there can be ranges that are non sequential (for example b0,b1,b2 and b3) but, during command list recording, we can only do:
ID3D12DescriptorHeaps* heaps[2] = {mCbvSrvUavHeap,mSamplerHeap};
mCmdList->SetDescriptorHeaps(2,heaps);
mCmdList->SetGraphicsRootDescriptorTable(0, mCbvSrvUavHeapGpuHanleStart);
mCmdList->SetGraphicsRootDescriptorTable(1, mSamplerHandleHanleStart);
That means that we will need to have the descriptors properly ordered in mCbvSrvUavHeap and mSamplerHeap.
For example:
mCbvSrvUavHeap
CBV
CBV
SRV
SRV
Here is where the problem is for me. As I initially said, I'll be creating two big heaps with all the resource for the application, but, I cannot set those heaps to the command list as they will have other descriptors that won't be used!
How can I handle this? Do I need to make a new Heap containing only the descriptors I will be using?
Hope I explained it well!