Skip to content

Commit

Permalink
vk: definition: Turn host/device AS handle into type safe union
Browse files Browse the repository at this point in the history
Co-authored-by: Marijn Suijten <marijn@traverseresearch.nl>
  • Loading branch information
DBouma and MarijnS95 committed Nov 24, 2020
1 parent 6bf3119 commit b216931
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ash/src/vk/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45232,11 +45232,17 @@ pub struct TransformMatrixKHR {
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union AccelerationStructureReferenceKHR {
pub device_handle: DeviceAddress,
pub host_handle: AccelerationStructureKHR,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct AccelerationStructureInstanceKHR {
pub transform: TransformMatrixKHR,
pub instance_custom_index_and_mask: u32,
pub instance_shader_binding_table_record_offset_and_flags: u32,
pub acceleration_structure_reference: u64,
pub acceleration_structure_reference: AccelerationStructureReferenceKHR,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
Expand Down
8 changes: 7 additions & 1 deletion generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1982,13 +1982,19 @@ pub fn generate_struct(

if &_struct.name == "VkAccelerationStructureInstanceKHR" {
return quote! {
#[repr(C)]
#[derive(Copy, Clone)]
pub union AccelerationStructureReferenceKHR {
pub device_handle: DeviceAddress,
pub host_handle: AccelerationStructureKHR,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct AccelerationStructureInstanceKHR {
pub transform: TransformMatrixKHR,
pub instance_custom_index_and_mask: u32,
pub instance_shader_binding_table_record_offset_and_flags: u32,
pub acceleration_structure_reference: u64,
pub acceleration_structure_reference: AccelerationStructureReferenceKHR,
}
};
}
Expand Down

0 comments on commit b216931

Please sign in to comment.