Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 public void Dispose()
 {
     if (Allocator != null)
     {
         Allocator.RemoveRef();
         Allocator.Dispose();
         Allocator = null;
     }
 }
Esempio n. 3
0
        public CommandListSingleAllocationPolicy(CommandListType type, Device device)
        {
            var allocatorDesc = new CommandAllocator.Descriptor()
            {
                Type = type
            };

            Allocator = device.Create(ref allocatorDesc);
            Allocator.AddRef();
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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();
        }