Skip to content

Commit

Permalink
generate struct aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmusgo committed Apr 23, 2024
1 parent f58fb45 commit 39fd073
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,14 @@ impl Parser {
} else {
quote! { #[derive(Copy, Clone, Debug, Default, PartialEq)] }
};
let aliases = self.struct_aliases.iter().map(|(alias, alias_to)| {
if alias_to == name {
let alias_ident = xr_ty_name(alias);
quote! { pub type #alias_ident = #ident; }
} else {
quote! {}
}
});
quote! {
#[repr(C)]
#derives
Expand All @@ -1124,6 +1132,7 @@ impl Parser {
#(#members)*
}
#ty
#(#aliases)*
}
});

Expand Down
4 changes: 4 additions & 0 deletions sys/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5780,6 +5780,7 @@ pub struct GraphicsBindingVulkanKHR {
impl GraphicsBindingVulkanKHR {
pub const TYPE: StructureType = StructureType::GRAPHICS_BINDING_VULKAN_KHR;
}
pub type GraphicsBindingVulkan2KHR = GraphicsBindingVulkanKHR;
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[doc = "See [XrSessionCreateInfo](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSessionCreateInfo)"]
Expand Down Expand Up @@ -5898,6 +5899,7 @@ impl SwapchainImageVulkanKHR {
x
}
}
pub type SwapchainImageVulkan2KHR = SwapchainImageVulkanKHR;
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[doc = "See [XrSwapchainImageD3D11KHR](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSwapchainImageD3D11KHR) - defined by [XR_KHR_D3D11_enable](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_KHR_D3D11_enable)"]
Expand Down Expand Up @@ -6917,6 +6919,7 @@ impl GraphicsRequirementsVulkanKHR {
x
}
}
pub type GraphicsRequirementsVulkan2KHR = GraphicsRequirementsVulkanKHR;
#[repr(C)]
#[derive(Copy, Clone)]
#[doc = "See [XrGraphicsRequirementsD3D11KHR](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrGraphicsRequirementsD3D11KHR) - defined by [XR_KHR_D3D11_enable](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_KHR_D3D11_enable)"]
Expand Down Expand Up @@ -10322,6 +10325,7 @@ impl DevicePcmSampleRateStateFB {
x
}
}
pub type DevicePcmSampleRateGetInfoFB = DevicePcmSampleRateStateFB;
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[doc = "See [XrSpaceUserCreateInfoFB](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrSpaceUserCreateInfoFB) - defined by [XR_FB_spatial_entity_user](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_FB_spatial_entity_user)"]
Expand Down
2 changes: 0 additions & 2 deletions sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ impl<T> std::ops::IndexMut<HandJointEXT> for [T] {
}
}

type DevicePcmSampleRateGetInfoFB = DevicePcmSampleRateStateFB;

// Magic Leap
#[derive(Copy, Clone, Debug)]
#[repr(C)]
Expand Down

0 comments on commit 39fd073

Please sign in to comment.