Exemplo n.º 1
0
        protected SwapChain(ref Descriptor desc, Device device, string label) : base(ref desc, device, label)
        {
            Assert.Debug(desc.MaxFramesInFlight > 0, "Invalid in-flight framecount!");
            Assert.Debug(desc.BufferCount > 0, "Invalid backbuffer count!");
            Assert.Debug(desc.AssociatedGraphicsQueue != null, "No graphics queue passed!");
            Assert.Debug(desc.AssociatedGraphicsQueue.Desc.Type == CommandListType.Graphics, "Passed command queue needs to be a graphics queue!");

            var fenceDesc = new Fence.Descriptor {
                InitialValue = 0
            };

            FrameFence = device.Create(ref fenceDesc);
            FrameFence.AddRef();

            Create();

            BackbufferResources = new Resource[desc.BufferCount];
            var resourceDesc = new Resource.Descriptor
            {
                Type          = Resource.Descriptor.Types.Backbuffer,
                DataDimension = Dimension.Texture2D
            };

            for (uint i = 0; i < BackbufferResources.Length; ++i)
            {
                BackbufferResources[i] = device.Create(ref resourceDesc, "Backbuffer");
                BackbufferResources[i].CreateFromSwapChain(this, i);
            }
        }
Exemplo n.º 2
0
 public abstract Resource Create(ref Resource.Descriptor desc, string label = "<unnamed resource>");