void FD3D12CommandContext::RHIBeginFrame()
{
	check(IsDefaultContext());
	RHIPrivateBeginFrame();

	FD3D12Device* Device = GetParentDevice();
	FD3D12GlobalOnlineHeap& SamplerHeap = Device->GetGlobalSamplerHeap();
	const uint32 NumContexts = Device->GetNumContexts();

	if (SamplerHeap.DescriptorTablesDirty())
	{
		//Rearrange the set for better look-up performance
		SamplerHeap.GetUniqueDescriptorTables().Compact();
	}

	for (uint32 i = 0; i < NumContexts; ++i)
	{
		Device->GetCommandContext(i).StateCache.GetDescriptorCache()->BeginFrame();
	}

	Device->GetGlobalSamplerHeap().ToggleDescriptorTablesDirtyFlag(false);

	UniformBufferBeginFrame();
	OwningRHI.GPUProfilingData.BeginFrame(&OwningRHI);
}