Example #1
0
        VkDescriptorSet CreateDescriptorSet(VkDevice device, VkDescriptorSetLayout descriptorSetLayout)
        {
            VkDescriptorPool descriptorPool;
            {
                // this pool can allocate one uniform descriptor.
                var info = new VkDescriptorPoolCreateInfo {
                    sType = VkStructureType.DescriptorPoolCreateInfo
                };
                var size = new VkDescriptorPoolSize(VkDescriptorType.UniformBuffer, 1);
                info.poolSizes = size;
                info.maxSets   = 1;
                vkAPI.vkCreateDescriptorPool(device, &info, null, &descriptorPool).Check();
                info.Free();
            }
            VkDescriptorSet descriptorSet;

            {
                var info = new VkDescriptorSetAllocateInfo {
                    sType = VkStructureType.DescriptorSetAllocateInfo
                };
                info.setLayouts     = descriptorSetLayout;
                info.descriptorPool = descriptorPool;
                vkAPI.vkAllocateDescriptorSets(device, &info, &descriptorSet).Check();
                info.Free();
            }

            return(descriptorSet);
        }