mono / VulkanSharp

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

Compiler Error CS0029: Could not implicit convert to uint #92

Open rafal1137 opened 3 years ago

rafal1137 commented 3 years ago

I started to writing a renderer using your bindings. I have run into weird anomaly.

Error CS0029: Could not convert implicit Vulkan.DeviceQueueCreateInfo[] to uint

Snipped of the code:

            var _queueInfo = new DeviceQueueCreateInfo { QueueFamilyIndex = _queueFamilyUsedIndex, QueuePriorities = new float[] { 1.0f } };
            var _deviceInfo = new DeviceCreateInfo
            {
                EnabledExtensionNames = new string[] { "VK_KHR_swapchain" },
                QueueCreateInfoCount = new DeviceQueueCreateInfo[] { _queueInfo }
            };

It points me to this line:

QueueCreateInfoCount = new DeviceQueueCreateInfo[] { _queueInfo }
rafal1137 commented 3 years ago

Someone pointed me to use another method of this class also did notified me about C# being strongly typed language. And this has been solved in this code:

            var _deviceInfo = new DeviceCreateInfo
            {
                EnabledExtensionNames = new string[] { "VK_KHR_swapchain" },
                QueueCreateInfos = new DeviceQueueCreateInfo[]
            {
                new DeviceQueueCreateInfo
                {
                    QueueFamilyIndex = _queueFamilyUsedIndex,
                    QueuePriorities = new float[] { 1.0f }
                }
            }
        };

Fix worth of an RP