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 May 6, 2023
1 parent 1374996 commit b5daee5
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 112 deletions.
30 changes: 9 additions & 21 deletions ash/src/vk/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17852,13 +17852,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 @@ -17901,13 +17897,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 @@ -18295,13 +18287,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 b5daee5

Please sign in to comment.