Ejemplo n.º 1
0
        public CommandListSingleAllocationPolicy(CommandListType type, Device device)
        {
            var allocatorDesc = new CommandAllocator.Descriptor()
            {
                Type = type
            };

            Allocator = device.Create(ref allocatorDesc);
            Allocator.AddRef();
        }
Ejemplo n.º 2
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;
        }