Build fails on platforms where enums are signed ints
Building on Windows seems to fail because bindgen uses the i32
for the constants generated from enums whereas on Linux they as u32
. Presumably on Windows the default type for enums is signed? As far as I understand that is a compiler decision.
This is difficult to fix because the Vulkan headers use a mix of enums for the bit values and u32 types for the combined type. For example VkImageAspectFlags
is defined to be VkFlags
which is explicitly always a uint32_t
. But the actual members that you are supposed to fill that type with are VkImageAspectFlagBits
which is an enum and will therefore be int
on Windows. Then in rust if you try to return VK_IMAGE_ASPECT_COLOR_BIT
from a function that has a return type of VkImageAspectFlags
it will complain about the implicit sign conversion.
Maybe the solution is to fill the code with ugly explicit casts.