示例#1
0
        public void AllocateSetsAndFreeSets()
        {
            var layoutCreateInfo = new DescriptorSetLayoutCreateInfo(
                new DescriptorSetLayoutBinding(0, DescriptorType.StorageBuffer, 1));
            var poolCreateInfo = new DescriptorPoolCreateInfo(
                1,
                new[] { new DescriptorPoolSize(DescriptorType.StorageBuffer, 1) },
                DescriptorPoolCreateFlags.FreeDescriptorSet);

            using (DescriptorSetLayout layout = Device.CreateDescriptorSetLayout(layoutCreateInfo))
                using (DescriptorPool pool = Device.CreateDescriptorPool(poolCreateInfo))
                {
                    using (pool.AllocateSets(new DescriptorSetAllocateInfo(1, layout))[0]) { }
                    DescriptorSet set = pool.AllocateSets(new DescriptorSetAllocateInfo(1, layout))[0];
                    pool.FreeSets(set);
                }
        }