public CpuDescriptorHandle CreateRTV(ID3D12Device5 pDevice, ID3D12Resource pResource, ID3D12DescriptorHeap pHeap, ref uint usedHeapEntries, Format format) { RenderTargetViewDescription desc = new RenderTargetViewDescription(); desc.ViewDimension = RenderTargetViewDimension.Texture2D; desc.Format = format; desc.Texture2D = new Texture2DRenderTargetView(); desc.Texture2D.MipSlice = 0; CpuDescriptorHandle rtvHandle = pHeap.GetCPUDescriptorHandleForHeapStart(); rtvHandle.Ptr += usedHeapEntries * pDevice.GetDescriptorHandleIncrementSize(DescriptorHeapType.RenderTargetView); usedHeapEntries++; pDevice.CreateRenderTargetView(pResource, desc, rtvHandle); return(rtvHandle); }