mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 06:45:13 +00:00
Add a RayQuery::confirm_intersection function (#822)
This commit is contained in:
parent
edd0a67392
commit
da7c3ed71f
@ -290,7 +290,7 @@ impl RayQuery {
|
||||
/// Terminates further execution of a ray query; further calls to
|
||||
/// [`Self::proceed`] will return `false`. The value returned by any prior
|
||||
/// execution of [`Self::proceed`] with the same ray query object must have
|
||||
/// been true. Refer to the client API specification for more details.
|
||||
/// been true.
|
||||
#[spirv_std_macros::gpu_only]
|
||||
#[doc(alias = "OpRayQueryTerminateKHR")]
|
||||
#[inline]
|
||||
@ -298,6 +298,20 @@ impl RayQuery {
|
||||
asm!("OpRayQueryTerminateKHR {}", in(reg) self)
|
||||
}
|
||||
|
||||
/// Confirms a triangle intersection to be included in the determination
|
||||
/// of the closest hit for a ray query.
|
||||
///
|
||||
/// [`Self::proceed()`] must have been called on this object, and it must
|
||||
/// have returned true. The current intersection candidate must have a
|
||||
/// [`Self::get_candidate_intersection_type()`] of
|
||||
/// [`CandidateIntersection::Triangle`].
|
||||
#[spirv_std_macros::gpu_only]
|
||||
#[doc(alias = "OpRayQueryConfirmIntersectionKHR")]
|
||||
#[inline]
|
||||
pub unsafe fn confirm_intersection(&self) {
|
||||
asm!("OpRayQueryConfirmIntersectionKHR {}", in(reg) self)
|
||||
}
|
||||
|
||||
/// Returns the type of the current candidate intersection.
|
||||
///
|
||||
/// [`Self::proceed()`] must have been called on this object, and it must have returned true.
|
||||
|
@ -10,5 +10,6 @@ pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStruct
|
||||
spirv_std::ray_query!(let mut handle);
|
||||
handle.initialize(accel, RayFlags::NONE, 0, Vec3::ZERO, 0.0, Vec3::ZERO, 0.0);
|
||||
assert!(handle.proceed());
|
||||
handle.confirm_intersection();
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ pub fn main(#[spirv(descriptor_set = 0, binding = 0)] accel: &AccelerationStruct
|
||||
unsafe {
|
||||
spirv_std::ray_query!(let mut handle);
|
||||
handle.initialize(accel, RayFlags::NONE, 0, Vec3::ZERO, 0.0, Vec3::ZERO, 0.0);
|
||||
assert!(handle.proceed());
|
||||
handle.terminate();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user