public CommandListSingleAllocationPolicy(CommandListType type, Device device) { var allocatorDesc = new CommandAllocator.Descriptor() { Type = type }; Allocator = device.Create(ref allocatorDesc); Allocator.AddRef(); }
public CommandListInFlightFrameAllocationPolicy(CommandListType type, SwapChain swapChain) { var allocatorDesc = new CommandAllocator.Descriptor() { Type = type }; PerInflightFrameAllocators = new CommandAllocator[swapChain.Desc.MaxFramesInFlight]; for (int i = 0; i < swapChain.Desc.MaxFramesInFlight; ++i) { PerInflightFrameAllocators[i] = swapChain.Device.Create(ref allocatorDesc); PerInflightFrameAllocators[i].AddRef(); } swapChain.OnBeginFrame += SetActiveAllocator; swapChain.AddRef(); // Swap chain is not allowed to die earlier than this object. this.swapChain = swapChain; }