Skip to content

Commit

Permalink
generator: Remove aliases from const_debugs
Browse files Browse the repository at this point in the history
These already have a match against the name they're aliasing, and some
of the aliases are "deprecated" (since they're just typo fixups for
backwards compatibility).
  • Loading branch information
MarijnS95 committed Apr 17, 2021
1 parent 426f81f commit ed8f401
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
14 changes: 0 additions & 14 deletions ash/src/vk/const_debugs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ impl fmt::Debug for ColorSpaceKHR {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let name = match *self {
Self::SRGB_NONLINEAR => Some("SRGB_NONLINEAR"),
Self::COLORSPACE_SRGB_NONLINEAR => Some("COLORSPACE_SRGB_NONLINEAR"),
Self::DISPLAY_P3_NONLINEAR_EXT => Some("DISPLAY_P3_NONLINEAR_EXT"),
Self::EXTENDED_SRGB_LINEAR_EXT => Some("EXTENDED_SRGB_LINEAR_EXT"),
Self::DISPLAY_P3_LINEAR_EXT => Some("DISPLAY_P3_LINEAR_EXT"),
Expand Down Expand Up @@ -830,11 +829,9 @@ impl fmt::Debug for DebugReportObjectTypeEXT {
Self::SURFACE_KHR => Some("SURFACE_KHR"),
Self::SWAPCHAIN_KHR => Some("SWAPCHAIN_KHR"),
Self::DEBUG_REPORT_CALLBACK_EXT => Some("DEBUG_REPORT_CALLBACK_EXT"),
Self::DEBUG_REPORT => Some("DEBUG_REPORT"),
Self::DISPLAY_KHR => Some("DISPLAY_KHR"),
Self::DISPLAY_MODE_KHR => Some("DISPLAY_MODE_KHR"),
Self::VALIDATION_CACHE_EXT => Some("VALIDATION_CACHE_EXT"),
Self::VALIDATION_CACHE => Some("VALIDATION_CACHE"),
Self::SAMPLER_YCBCR_CONVERSION => Some("SAMPLER_YCBCR_CONVERSION"),
Self::DESCRIPTOR_UPDATE_TEMPLATE => Some("DESCRIPTOR_UPDATE_TEMPLATE"),
Self::ACCELERATION_STRUCTURE_KHR => Some("ACCELERATION_STRUCTURE_KHR"),
Expand Down Expand Up @@ -1381,10 +1378,6 @@ impl fmt::Debug for ExternalSemaphoreHandleTypeFlags {
ExternalSemaphoreHandleTypeFlags::D3D12_FENCE.0,
"D3D12_FENCE",
),
(
ExternalSemaphoreHandleTypeFlags::D3D11_FENCE.0,
"D3D11_FENCE",
),
(ExternalSemaphoreHandleTypeFlags::SYNC_FD.0, "SYNC_FD"),
(
ExternalSemaphoreHandleTypeFlags::RESERVED_5_NV.0,
Expand Down Expand Up @@ -2386,9 +2379,6 @@ impl fmt::Debug for PerformanceCounterScopeKHR {
Self::COMMAND_BUFFER => Some("COMMAND_BUFFER"),
Self::RENDER_PASS => Some("RENDER_PASS"),
Self::COMMAND => Some("COMMAND"),
Self::QUERY_SCOPE_COMMAND_BUFFER => Some("QUERY_SCOPE_COMMAND_BUFFER"),
Self::QUERY_SCOPE_RENDER_PASS => Some("QUERY_SCOPE_RENDER_PASS"),
Self::QUERY_SCOPE_COMMAND => Some("QUERY_SCOPE_COMMAND"),
_ => None,
};
if let Some(x) = name {
Expand Down Expand Up @@ -3503,10 +3493,6 @@ impl fmt::Debug for StencilFaceFlags {
(StencilFaceFlags::FRONT.0, "FRONT"),
(StencilFaceFlags::BACK.0, "BACK"),
(StencilFaceFlags::FRONT_AND_BACK.0, "FRONT_AND_BACK"),
(
StencilFaceFlags::STENCIL_FRONT_AND_BACK.0,
"STENCIL_FRONT_AND_BACK",
),
];
debug_flags(f, KNOWN, self.0)
}
Expand Down
8 changes: 7 additions & 1 deletion generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ pub trait ConstantExt {
fn constant(&self, enum_name: &str) -> Constant;
fn variant_ident(&self, enum_name: &str) -> Ident;
fn notation(&self) -> Option<&str>;
fn is_alias(&self) -> bool {
false
}
}

impl ConstantExt for vkxml::ExtensionEnum {
Expand All @@ -430,6 +433,9 @@ impl ConstantExt for vk_parse::Enum {
fn notation(&self) -> Option<&str> {
self.comment.as_deref()
}
fn is_alias(&self) -> bool {
matches!(self.spec, vk_parse::EnumSpec::Alias { .. })
}
}

impl ConstantExt for vkxml::Constant {
Expand Down Expand Up @@ -1430,7 +1436,7 @@ pub fn generate_enum<'a>(
const_cache.insert(constant.name.as_str());
values.push(ConstantMatchInfo {
ident: constant.variant_ident(name),
is_alias: false,
is_alias: constant.is_alias(),
});
}
const_values.insert(ident.clone(), values);
Expand Down

0 comments on commit ed8f401

Please sign in to comment.