Merge pull request #92 from Cyres/boolean-type
Change type of `TRUE` and `FALSE` to `Bool32`
This commit is contained in:
commit
a1f79e102d
|
@ -13432,8 +13432,8 @@ pub const REMAINING_MIP_LEVELS: u32 = !0;
|
||||||
pub const REMAINING_ARRAY_LAYERS: u32 = !0;
|
pub const REMAINING_ARRAY_LAYERS: u32 = !0;
|
||||||
pub const WHOLE_SIZE: u64 = !0;
|
pub const WHOLE_SIZE: u64 = !0;
|
||||||
pub const ATTACHMENT_UNUSED: u32 = !0;
|
pub const ATTACHMENT_UNUSED: u32 = !0;
|
||||||
pub const TRUE: usize = 1;
|
pub const TRUE: Bool32 = 1;
|
||||||
pub const FALSE: usize = 0;
|
pub const FALSE: Bool32 = 0;
|
||||||
pub const QUEUE_FAMILY_IGNORED: u32 = !0;
|
pub const QUEUE_FAMILY_IGNORED: u32 = !0;
|
||||||
pub const QUEUE_FAMILY_EXTERNAL: u32 = !0 - 1;
|
pub const QUEUE_FAMILY_EXTERNAL: u32 = !0 - 1;
|
||||||
pub const QUEUE_FAMILY_FOREIGN_EXT: u32 = !0 - 2;
|
pub const QUEUE_FAMILY_FOREIGN_EXT: u32 = !0 - 2;
|
||||||
|
|
|
@ -24,6 +24,7 @@ pub enum CType {
|
||||||
U32,
|
U32,
|
||||||
U64,
|
U64,
|
||||||
Float,
|
Float,
|
||||||
|
Bool32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CType {
|
impl CType {
|
||||||
|
@ -33,6 +34,7 @@ impl CType {
|
||||||
CType::U32 => Term::intern("u32"),
|
CType::U32 => Term::intern("u32"),
|
||||||
CType::U64 => Term::intern("u64"),
|
CType::U64 => Term::intern("u64"),
|
||||||
CType::Float => Term::intern("f32"),
|
CType::Float => Term::intern("f32"),
|
||||||
|
CType::Bool32 => Term::intern("Bool32"),
|
||||||
};
|
};
|
||||||
quote!{#term}
|
quote!{#term}
|
||||||
}
|
}
|
||||||
|
@ -1399,7 +1401,12 @@ pub fn generate_constant<'a>(
|
||||||
let name = constant_name(&constant.name);
|
let name = constant_name(&constant.name);
|
||||||
let ident = Ident::from(name.as_str());
|
let ident = Ident::from(name.as_str());
|
||||||
let value = c.to_tokens();
|
let value = c.to_tokens();
|
||||||
let ty = c.ty().to_tokens();
|
let ty = if name == "TRUE" || name == "FALSE" {
|
||||||
|
CType::Bool32
|
||||||
|
} else {
|
||||||
|
c.ty()
|
||||||
|
};
|
||||||
|
let ty = ty.to_tokens();
|
||||||
quote!{
|
quote!{
|
||||||
pub const #ident: #ty = #value;
|
pub const #ident: #ty = #value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue