private void ValidateAndCombineDescriptorInformation(DescriptorInformation myDescriptor, DescriptorInformation value) { if (myDescriptor.ShaderStage != value.ShaderStage) { myDescriptor.ShaderStage |= value.ShaderStage; } if (myDescriptor.myType != value.myType) { throw new Exception("Descriptor Information mismatch detected!"); } if (myDescriptor.DescriptorCount != value.DescriptorCount) { throw new Exception("Descriptor Information mismatch detected!"); } }
/*internal DescriptorSetLayout GetDescriptorLayout() * { * List<DescriptorSetLayoutBinding> myBindings = new List<DescriptorSetLayoutBinding>(); * foreach (var A in myIDsToItems) * { * var Item = new DescriptorSetLayoutBinding(); * Item.DescriptorType = (DescriptorType)A.Value.myType; * Item.StageFlags = this.ShaderStage; * Item.DescriptorCount = A.Value.DescriptorCount; * Item.Binding = A.Value.Binding; * myBindings.Add(Item); * } * var descriptorSetLayoutCreateInfo = new DescriptorSetLayoutCreateInfo * { * Bindings = myBindings.ToArray() * }; * return new DescriptorSetLayout(VulkanRenderer.SelectedLogicalGraphicsDevice, descriptorSetLayoutCreateInfo); * }*/ public void AddDescriptor(string ReferenceName, DescriptorType uniformBuffer, uint Binding, uint DescriptorCount = 1) { if (myIDsToItems.ContainsKey(ReferenceName)) { throw new Exception("Attempted to add two descriptors that had the same name."); } foreach (var A in myIDsToItems) { if (A.Value.Binding == Binding) { throw new Exception("Attempted to add two descriptors that have the same bindings."); } } myIDsToItems[ReferenceName] = new DescriptorInformation(Binding, uniformBuffer, this.ShaderStage, DescriptorCount); myDescriptorTypeCount[(uint)uniformBuffer] += 1; }