Osspial / vk-rs

Collection of Rust libraries for the Vulkan API
MIT License
24 stars 4 forks source link

Macros use local types #16

Open TimDiekmann opened 6 years ago

TimDiekmann commented 6 years ago

The macros like vk_make_version! use local types:

macro_rules! vk_make_version {
    ($major: expr, $minor: expr, $patch: expr) => ((($major as uint32_t) << 22) | (($minor as uint32_t) << 12) | $patch as uint32_t)
}

Expected behavior:

#[macro_export]
macro_rules! vk_make_version {
    ($major: expr, $minor: expr, $patch: expr) => ((($major as $crate::uint32_t) << 22) | (($minor as $crate::uint32_t) << 12) | $patch as $crate::uint32_t)
}
Osspial commented 6 years ago

This fix works if the generated bindings are in the crate root, but I don't think it would work in cases where it's not - say, if it's included as a submodule. However, since they're using uint32_t as the number type, I'd say it would be fine to convert them into straight u32s instead.