mono / VulkanSharp

Open source .NET binding for the Vulkan API
MIT License
538 stars 61 forks source link

WriteDescriptorSet initialization bug? #91

Open ryco117 opened 3 years ago

ryco117 commented 3 years ago

When creating a new WriteDescriptorSet with the following F# initialization, the created object does not have the expected members.

new WriteDescriptorSet (
    DstBinding = 0u,
    DstSet = descriptorSet,
    DescriptorType = DescriptorType.StorageBuffer,
    BufferInfo = [|buffInfo|],
    ImageInfo = Array.empty,
    TexelBufferView = Array.empty)

The object constructed by this code has the following members. Note that most have been set to default values, but not all:

BufferInfo = null
DescriptorCount = 0
DescriptorType = StorageBuffer
DstArrayElement = 0
DstBinding = 0
DstSet = {Vulkan.DescriptorSet}
ImageInfo = null
TexelBufferView = null

Furthermore, if the ImageInfo and TexelBufferView members are removed from the initialization, then the DescriptorCount and BufferInfo members are not overwritten with empty values.

Note: I stumbled across this bug after adding ImageInfo and TexelBufferView members to the initialization as empty arrays to work around issue #81 on my end. I don't think the issues are directly related, although I would like to bring attention to the fact that there are multiple structures which attempt to dispose of null objects and a fix for that would be greatly appreciated.