Skip to content

Commit

Permalink
Generate templated builder setters for fields taking an objecttype
Browse files Browse the repository at this point in the history
We already do this for hand-written extension functions but can now also
implement it for setters since `vk_parse` fields are available within
the builder generator code: when a field refers to another field for
setting its `objecttype`, that `VkObjectType` field setter is omitted
and instead assigned when the object is set, based on a type generic
that implements the `Handle` trait instead of an untyped `u64`.
  • Loading branch information
MarijnS95 committed Mar 27, 2023
1 parent a9fbc71 commit 649c749
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 110 deletions.
30 changes: 9 additions & 21 deletions ash/src/vk/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17841,13 +17841,9 @@ unsafe impl<'a> TaggedStructure for DebugUtilsObjectNameInfoEXT<'a> {
unsafe impl ExtendsPipelineShaderStageCreateInfo for DebugUtilsObjectNameInfoEXT<'_> {}
impl<'a> DebugUtilsObjectNameInfoEXT<'a> {
#[inline]
pub fn object_type(mut self, object_type: ObjectType) -> Self {
self.object_type = object_type;
self
}
#[inline]
pub fn object_handle(mut self, object_handle: u64) -> Self {
self.object_handle = object_handle;
pub fn object_handle<T: Handle>(mut self, object_handle: T) -> Self {
self.object_handle = object_handle.as_raw();
self.object_type = T::TYPE;
self
}
#[inline]
Expand Down Expand Up @@ -17890,13 +17886,9 @@ unsafe impl<'a> TaggedStructure for DebugUtilsObjectTagInfoEXT<'a> {
}
impl<'a> DebugUtilsObjectTagInfoEXT<'a> {
#[inline]
pub fn object_type(mut self, object_type: ObjectType) -> Self {
self.object_type = object_type;
self
}
#[inline]
pub fn object_handle(mut self, object_handle: u64) -> Self {
self.object_handle = object_handle;
pub fn object_handle<T: Handle>(mut self, object_handle: T) -> Self {
self.object_handle = object_handle.as_raw();
self.object_type = T::TYPE;
self
}
#[inline]
Expand Down Expand Up @@ -18284,13 +18276,9 @@ impl<'a> DeviceMemoryReportCallbackDataEXT<'a> {
self
}
#[inline]
pub fn object_type(mut self, object_type: ObjectType) -> Self {
self.object_type = object_type;
self
}
#[inline]
pub fn object_handle(mut self, object_handle: u64) -> Self {
self.object_handle = object_handle;
pub fn object_handle<T: Handle>(mut self, object_handle: T) -> Self {
self.object_handle = object_handle.as_raw();
self.object_type = T::TYPE;
self
}
#[inline]
Expand Down
Loading

0 comments on commit 649c749

Please sign in to comment.