protected CommandList(ref Descriptor desc, Device device, string label) : base(ref desc, device, label) { Assert.Debug(desc.AllocationPolicy.Type == desc.Type, "Allocation policy allocator type needs to match command list type!"); ActiveAllocator = desc.AllocationPolicy.GetCurrentAllocator(); Assert.Debug(ActiveAllocator.Desc.Type == desc.Type, "Allocator type needs to match command list type!"); Create(); }
public void Dispose() { if (Allocator != null) { Allocator.RemoveRef(); Allocator.Dispose(); Allocator = null; } }
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; }
public void StartRecording() { Assert.Always(!Recording, "CommandList is already in recording state!"); Recording = true; ActiveAllocator = Desc.AllocationPolicy.GetCurrentAllocator(); Assert.Debug(ActiveAllocator.Desc.Type == Desc.Type, "Allocator type needs to match command list type!"); ActiveAllocator.AddRef(); ActiveAllocator.ResetResourceUse(); // Reset redundancy check state. descriptorHeapColor = null; slotsColor = null; descriptorHeapDepthStencil = null; slotDepthStencil = UInt32.MaxValue; StartRecordingImpl(); }