Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

#2307 fixes #2309

Merged
merged 1 commit into from
Aug 26, 2023
Merged
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
176 changes: 98 additions & 78 deletions vulkano/src/command_buffer/commands/acceleration_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,21 +852,22 @@ where
_ne,
} = info;

let dst_acceleration_structure =
dst_acceleration_structure
.as_ref()
.ok_or(Box::new(ValidationError {
context: "info.dst_acceleration_structure".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let scratch_data = scratch_data.as_ref().ok_or(Box::new(ValidationError {
context: "info.scratch_data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let dst_acceleration_structure = dst_acceleration_structure.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: "info.dst_acceleration_structure".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;
let scratch_data = scratch_data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: "info.scratch_data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

// VUID-vkCmdBuildAccelerationStructuresKHR-mode-04628
// Ensured as long as `BuildAccelerationStructureMode` is exhaustive.
Expand Down Expand Up @@ -997,12 +998,15 @@ where
_ne,
} = triangles_data;

let vertex_data = vertex_data.as_ref().ok_or(Box::new(ValidationError {
context: format!("info.geometries[{}].vertex_data", geometry_index).into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let vertex_data = vertex_data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: format!("info.geometries[{}].vertex_data", geometry_index)
.into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

let &AccelerationStructureBuildRangeInfo {
primitive_count,
Expand Down Expand Up @@ -1253,12 +1257,14 @@ where
_ne,
} = aabbs_data;

let data = data.as_ref().ok_or(Box::new(ValidationError {
context: format!("info.geometries[{}].data", geometry_index).into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let data = data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: format!("info.geometries[{}].data", geometry_index).into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

let &AccelerationStructureBuildRangeInfo {
primitive_count,
Expand Down Expand Up @@ -1372,12 +1378,14 @@ where

let data_buffer = match data {
AccelerationStructureGeometryInstancesDataType::Values(data) => {
let data = data.as_ref().ok_or(Box::new(ValidationError {
context: "info.geometries.data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let data = data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: "info.geometries.data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

if data.device_address().unwrap().get() % 16 != 0 {
return Err(Box::new(ValidationError {
Expand Down Expand Up @@ -1413,12 +1421,14 @@ where
data.buffer()
}
AccelerationStructureGeometryInstancesDataType::Pointers(data) => {
let data = data.as_ref().ok_or(Box::new(ValidationError {
context: "info.geometries.data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let data = data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: "info.geometries.data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

if !data
.buffer()
Expand Down Expand Up @@ -1657,21 +1667,22 @@ where
_ne,
} = info;

let dst_acceleration_structure =
dst_acceleration_structure
.as_ref()
.ok_or(Box::new(ValidationError {
context: "info.dst_acceleration_structure".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let scratch_data = scratch_data.as_ref().ok_or(Box::new(ValidationError {
context: "info.scratch_data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let dst_acceleration_structure = dst_acceleration_structure.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: "info.dst_acceleration_structure".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;
let scratch_data = scratch_data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: "info.scratch_data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

// VUID-vkCmdBuildAccelerationStructuresIndirectKHR-mode-04628
// Ensured as long as `BuildAccelerationStructureMode` is exhaustive.
Expand Down Expand Up @@ -1789,12 +1800,15 @@ where
_ne,
} = triangles_data;

let vertex_data = vertex_data.as_ref().ok_or(Box::new(ValidationError {
context: format!("info.geometries[{}].vertex_data", geometry_index).into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let vertex_data = vertex_data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: format!("info.geometries[{}].vertex_data", geometry_index)
.into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

// VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03795
// unsafe
Expand Down Expand Up @@ -1935,12 +1949,14 @@ where
_ne,
} = aabbs_data;

let data = data.as_ref().ok_or(Box::new(ValidationError {
context: format!("info.geometries[{}].data", geometry_index).into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let data = data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: format!("info.geometries[{}].data", geometry_index).into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

// VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03794
// unsafe
Expand Down Expand Up @@ -1989,12 +2005,14 @@ where

let data_buffer = match data {
AccelerationStructureGeometryInstancesDataType::Values(data) => {
let data = data.as_ref().ok_or(Box::new(ValidationError {
context: "info.geometries.data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let data = data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: "info.geometries.data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

if data.device_address().unwrap().get() % 16 != 0 {
return Err(Box::new(ValidationError {
Expand All @@ -2013,12 +2031,14 @@ where
data.buffer()
}
AccelerationStructureGeometryInstancesDataType::Pointers(data) => {
let data = data.as_ref().ok_or(Box::new(ValidationError {
context: "info.geometries.data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
}))?;
let data = data.as_ref().ok_or_else(|| {
Box::new(ValidationError {
context: "info.geometries.data".into(),
problem: "is `None`".into(),
// vuids?
..Default::default()
})
})?;

if !data
.buffer()
Expand Down