Here is my code snip:
ID3D12DescriptorHeap* DescHeaps[] = { SRVHeapCache.GetDescriptorHeap() };// I want to bind Different RTV to this heap cache between Draw Calls
CommandList->SetDescriptorHeaps(1, DescHeaps);
CommandList->SetGraphicsRootSignature(RootSignature.Get());
CommandList->SetGraphicsRootConstantBufferView(2, PerPassConstants.GetResource()->GetGPUVirtualAddress());
CommandList->SetGraphicsRootConstantBufferView(1, PerObjectConstants.GetResource()->GetGPUVirtualAddress());
CommandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
for (auto Actor : TheScene.Actors)
{
CommandList->SetGraphicsRootDescriptorTable(0, SRVHeapCache.GetGPUHandleStart());
Actor->Draw(D3dDevice.Get(), CommandList.Get(), SRVHeapCache.GetDescriptorHeap());
}
And in Actor's Draw, I use CopyDescriptorsSimple:
Device->CopyDescriptorsSimple(1, hDescriptor, Mgr->Textures[DiffTextureID].Texture.GetCPUHandle(), D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
But this doesn't work. The content of HeapCache seems to never change in the runtime.