I finally started tackling a proper management of the views in my DX12 project.
So far I implemented a ring buffer to manage a big offline and online descriptor heap to which I copy descriptors in a contiguous way as required by my resource binding (I already have plan to improve on the ring buffer idea to manage fragmentation a little better as I don't want to copy descriptors on every draw call if they are already copied contiguously from a previous call). This concept has been well explained by @Hodgman in this comment :
For SRV / UAV I have no problem so far, everything work just as I understood the concept.
For CBV I apparently cannot reference them with a descriptor table in the root signature.
The debug layer report an error saying that a descriptor table is invalid for a CBV root signature parameter even if my root signature was indeed created as a CBV descriptor table at this location so until this question is clear to me I moved all my CBV directly in a root descriptor which seem to be the only option left.
The reported error is this one : D3D12 ERROR: CGraphicsCommandList::SetGraphicsRootDescriptorTable: The currently set root signature declares parameter [0] with type CBV, so it is invalid to set a descriptor table here. [ EXECUTION ERROR #708: SET_DESCRIPTOR_TABLE_INVALID]
Now as I noticed, binding a CBV as root descriptor don't even require the CBV to be in a descriptor heap and you don't even need to call ID3D12Device::CreateConstantBufferView at all. You simply pass the GPU virtual address of the resource to ID3D12GraphicsCommandList::SetGraphicsRootConstantBufferView and it all work without complaining.
I'm a bit confused because from how I understand it so far a descriptor heap should only be used when you are going to work with descriptor tables.
Why would the type D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV even exist and allow CBVs in it if CBVs can only be referenced as a root descriptor? I'm also wondering why the ID3D12Device::CreateConstantBufferView call exists at all in that case.
There's obviously few details that I didn't catch. Could someone enlighten me on this.
Thanks