Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/vma/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct PoolOptions<'a> {
impl<'a> PoolOptions<'a> {
pub fn push_next<T>(mut self, next: &'a mut impl vk::Cast<Target = T>) -> Self
where
T: vk::ExtendsMemoryAllocateInfo,
T: vk::Extends<vk::MemoryAllocateInfo>,
{
self.next = vk::merge(self.next, NonNull::from(next).cast());
self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ pub trait HasBuilder<'b> {
}
}

/// A Vulkan struct that can be used to extend `T`
pub unsafe trait Extends<T: InputChainStruct> {}

/// Adds a base pointer chain with a new non-empty pointer chain.
#[doc(hidden)]
pub fn merge(base: *mut c_void, next: NonNull<BaseOutStructure>) -> *mut c_void {
Expand Down Expand Up @@ -175,9 +178,7 @@ private fun Registry.generateExtends(struct: Structure): String {
}

return """
/// A Vulkan struct that can be used to extend a [`${struct.name}`].
pub unsafe trait Extends${struct.name}: fmt::Debug { }
${extends.joinToString("\n") { "unsafe impl Extends${struct.name} for $it { }" }}
${extends.joinToString("\n") { "unsafe impl Extends<${struct.name}> for $it { }" }}
"""
}

Expand Down Expand Up @@ -296,7 +297,7 @@ private fun Registry.generateNextMethod(struct: Structure): String {
#[inline]
pub fn push_next<T>(mut self, next: &'b mut impl Cast<Target = T>) -> Self
where
T: Extends${struct.name}
T: Extends<${struct.name}>
{
self.next = merge(self.next as *mut c_void, NonNull::from(next).cast());
self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ fun Registry.indexEntities(): String {
val versionCommands = mutableMapOf<Identifier, String>()
val extensionCommands = mutableMapOf<Identifier, String>()

// Add builder structs and extends traits.
// Add builder structs.

for (struct in structs.values) {
val builder = "${struct.name}Builder"
entities.addEntity("vk::$builder", "/vk/struct.$builder.html")
if (getStructExtensions().containsKey(struct.name)) {
val extends = "Extends${struct.name}"
entities.addEntity("vk::$extends", "/vk/trait.$extends.html")
}
}

// Add version traits.
Expand Down
Loading
Loading