generator: Keep deprecated MIRROR_CLAMP_TO_EDGE_KHR alias

Somehow this stuck along when we removed all the other deprecated
aliases, because the comment annotation didn't match up with what was
normally used (but we did write a special `#[deprecated = ..]`
annotation based on `"Alias"`).  Now that this all has been normalized
in `vk.xml` behind a standardized `deprecated="reason"` attribute we
have to go out of our way to keep this constant alias alive.
This commit is contained in:
Marijn Suijten 2023-03-13 21:43:07 +01:00
parent e7cfe26dcb
commit edfd3b9f8f
No known key found for this signature in database
GPG key ID: 449FC1DE031665DA
2 changed files with 17 additions and 3 deletions

View file

@ -1538,6 +1538,8 @@ impl KhrSamplerMirrorClampToEdgeFn {
impl SamplerAddressMode {
#[doc = "Note that this defines what was previously a core enum, and so uses the 'value' attribute rather than 'offset', and does not have a suffix. This is a special case, and should not be repeated"]
pub const MIRROR_CLAMP_TO_EDGE: Self = Self(4);
#[deprecated = "Introduced for consistency with extension suffixing rules"]
pub const MIRROR_CLAMP_TO_EDGE_KHR: Self = Self::MIRROR_CLAMP_TO_EDGE;
}
impl ImgFilterCubicFn {
#[inline]

View file

@ -1112,7 +1112,10 @@ pub fn generate_extension_constants<'a>(
continue;
}
if enum_.deprecated.is_some() {
if enum_.deprecated.is_some()
// TODO: Remove deprecated alias on next breaking release
&& enum_.name != "VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE_KHR"
{
continue;
}
@ -1460,10 +1463,19 @@ pub fn bitflags_impl_block(
) -> TokenStream {
let variants = constants
.iter()
.filter(|constant| !constant.is_deprecated())
.filter(|constant| {
!constant.is_deprecated()
// TODO: Remove deprecated alias on next breaking release
|| constant.variant_ident(enum_name) == "MIRROR_CLAMP_TO_EDGE_KHR"
})
.map(|constant| {
let variant_ident = constant.variant_ident(enum_name);
let notation = constant.doc_attribute();
let notation = if variant_ident == "MIRROR_CLAMP_TO_EDGE_KHR" {
let comment = constant.formatted_notation();
Some(quote!(#[deprecated = #comment]))
} else {
constant.doc_attribute()
};
let constant = constant.constant(enum_name);
let value = if let Constant::Alias(_) = &constant {
quote!(#constant)