Struct spirv_std::ray_tracing::RayQuery
source · #[repr(C)]pub struct RayQuery { /* private fields */ }
Expand description
A ray query type which is an opaque object representing a ray traversal.
Implementations§
source§impl RayQuery
impl RayQuery
sourcepub unsafe fn initialize(
&mut self,
acceleration_structure: &AccelerationStructure,
ray_flags: RayFlags,
cull_mask: u32,
ray_origin: impl Vector<f32, 3>,
ray_tmin: f32,
ray_direction: impl Vector<f32, 3>,
ray_tmax: f32
)
pub unsafe fn initialize( &mut self, acceleration_structure: &AccelerationStructure, ray_flags: RayFlags, cull_mask: u32, ray_origin: impl Vector<f32, 3>, ray_tmin: f32, ray_direction: impl Vector<f32, 3>, ray_tmax: f32 )
Initialize a ray query object, defining parameters of traversal. After this
call, a new ray trace can be performed with Self::proceed
. Any
previous traversal state stored in the object is lost.
ray_query
is a pointer to the ray query to initialize.acceleration_structure
is the descriptor for the acceleration structure to trace into.ray_flags
contains one or more of the Ray Flag values.cull_mask
is the mask to test against the instance mask. Only the 8 least-significant bits ofcull_mask
are used by this instruction - other bits are ignored.ray_origin
,ray_tmin
,ray_direction
, andray_tmax
control the basic parameters of the ray to be traced.
sourcepub unsafe fn proceed(&self) -> bool
pub unsafe fn proceed(&self) -> bool
Allow traversal to proceed. Returns true
if traversal is incomplete,
and false
when it has completed. A previous call to Self::proceed
with the same ray query object must not have already returned false
.
sourcepub unsafe fn terminate(&self)
pub unsafe fn terminate(&self)
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.
sourcepub unsafe fn confirm_intersection(&self)
pub unsafe fn confirm_intersection(&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
.
sourcepub unsafe fn get_candidate_intersection_type(&self) -> CandidateIntersection
pub unsafe fn get_candidate_intersection_type(&self) -> CandidateIntersection
Returns the type of the current candidate intersection.
Self::proceed()
must have been called on this object, and it must have returned true.
sourcepub unsafe fn get_committed_intersection_type(&self) -> CommittedIntersection
pub unsafe fn get_committed_intersection_type(&self) -> CommittedIntersection
Returns the type of the current candidate intersection.
sourcepub unsafe fn get_ray_t_min(&self) -> f32
pub unsafe fn get_ray_t_min(&self) -> f32
Returns the “Ray Tmin” value used by the ray query.
sourcepub unsafe fn get_ray_flags(&self) -> RayFlags
pub unsafe fn get_ray_flags(&self) -> RayFlags
Returns the “Ray Flags” value used by the ray query.
sourcepub unsafe fn get_candidate_intersection_t(&self) -> f32
pub unsafe fn get_candidate_intersection_t(&self) -> f32
Gets the “T” value for the current or previous intersection considered in 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
.
sourcepub unsafe fn get_committed_intersection_t(&self) -> f32
pub unsafe fn get_committed_intersection_t(&self) -> f32
Gets the “T” value for the current or previous intersection considered in a ray query.
There must be a current committed intersection.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_candidate_intersection_instance_custom_index(&self) -> u32
pub unsafe fn get_candidate_intersection_instance_custom_index(&self) -> u32
Gets the custom index of the instance for the current intersection considered in a ray query.
Self::proceed()
must have been called on this object, and it must have returned true.
sourcepub unsafe fn get_committed_intersection_instance_custom_index(&self) -> u32
pub unsafe fn get_committed_intersection_instance_custom_index(&self) -> u32
Gets the custom index of the instance for the current intersection considered in a ray query.
There must be a current committed intersection.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_candidate_intersection_instance_id(&self) -> u32
pub unsafe fn get_candidate_intersection_instance_id(&self) -> u32
Gets the id of the instance for the current intersection considered in a ray query.
Self::proceed()
must have been called on this object, and it must have returned true.
sourcepub unsafe fn get_committed_intersection_instance_id(&self) -> u32
pub unsafe fn get_committed_intersection_instance_id(&self) -> u32
Gets the id of the instance for the current intersection considered in a ray query.
There must be a current committed intersection.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_candidate_intersection_shader_binding_table_record_offset(
&self
) -> u32
pub unsafe fn get_candidate_intersection_shader_binding_table_record_offset( &self ) -> u32
Gets the shader binding table record offset for the current intersection considered in a ray query.
Self::proceed()
must have been called on this object, and it must have returned true.
sourcepub unsafe fn get_committed_intersection_shader_binding_table_record_offset(
&self
) -> u32
pub unsafe fn get_committed_intersection_shader_binding_table_record_offset( &self ) -> u32
Gets the shader binding table record offset for the current intersection considered in a ray query.
There must be a current committed intersection.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_candidate_intersection_geometry_index(&self) -> u32
pub unsafe fn get_candidate_intersection_geometry_index(&self) -> u32
Gets the geometry index for the current intersection considered in a ray query.
Self::proceed()
must have been called on this object, and it must have returned true.
sourcepub unsafe fn get_committed_intersection_geometry_index(&self) -> u32
pub unsafe fn get_committed_intersection_geometry_index(&self) -> u32
Gets the geometry index for the current intersection considered in a ray query.
There must be a current committed intersection.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_candidate_intersection_primitive_index(&self) -> u32
pub unsafe fn get_candidate_intersection_primitive_index(&self) -> u32
Gets the primitive index for the current intersection considered in a ray query.
Self::proceed()
must have been called on this object, and it must have returned true.
sourcepub unsafe fn get_committed_intersection_primitive_index(&self) -> u32
pub unsafe fn get_committed_intersection_primitive_index(&self) -> u32
Gets the primitive index for the current intersection considered in a ray query.
There must be a current committed intersection.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_candidate_intersection_barycentrics<V: Vector<f32, 2>>(
&self
) -> V
pub unsafe fn get_candidate_intersection_barycentrics<V: Vector<f32, 2>>( &self ) -> V
Gets the second and third barycentric coordinates of the current intersection considered in a ray query against the primitive it hit.
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
.
sourcepub unsafe fn get_committed_intersection_barycentrics<V: Vector<f32, 2>>(
&self
) -> V
pub unsafe fn get_committed_intersection_barycentrics<V: Vector<f32, 2>>( &self ) -> V
Gets the second and third barycentric coordinates of the current intersection considered in a ray query against the primitive it hit.
There must be a current committed intersection. Its
Self::get_committed_intersection_type()
must be CommittedIntersection::Triangle
.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_candidate_intersection_front_face(&self) -> bool
pub unsafe fn get_candidate_intersection_front_face(&self) -> bool
Returns whether the current intersection considered in a ray query was with
the front face (true
) or back face (false
) of a primitive.
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
.
sourcepub unsafe fn get_committed_intersection_front_face(&self) -> bool
pub unsafe fn get_committed_intersection_front_face(&self) -> bool
Returns whether the current intersection considered in a ray query was with
the front face (true
) or back face (false
) of a primitive.
There must be a current committed intersection. Its
Self::get_committed_intersection_type()
must be CommittedIntersection::Triangle
.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_intersection_candidate_aabb_opaque(&self) -> bool
pub unsafe fn get_intersection_candidate_aabb_opaque(&self) -> bool
Returns whether a candidate intersection considered in a ray query was with an opaque AABB (Axis Aligned Bounding Box) or not.
sourcepub unsafe fn get_candidate_intersection_object_ray_direction<V: Vector<f32, 3>>(
&self
) -> V
pub unsafe fn get_candidate_intersection_object_ray_direction<V: Vector<f32, 3>>( &self ) -> V
Gets the object-space ray direction for the current intersection considered in a ray query.
Self::proceed()
must have been called on this object, and it must have returned true.
sourcepub unsafe fn get_committed_intersection_object_ray_direction<V: Vector<f32, 3>>(
&self
) -> V
pub unsafe fn get_committed_intersection_object_ray_direction<V: Vector<f32, 3>>( &self ) -> V
Gets the object-space ray direction for the current intersection considered in a ray query.
There must be a current committed intersection.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_candidate_intersection_object_ray_origin<V: Vector<f32, 3>>(
&self
) -> V
pub unsafe fn get_candidate_intersection_object_ray_origin<V: Vector<f32, 3>>( &self ) -> V
Gets the object-space ray origin for the current intersection considered in a ray query.
Self::proceed()
must have been called on this object, and it must have returned true.
sourcepub unsafe fn get_committed_intersection_object_ray_origin<V: Vector<f32, 3>>(
&self
) -> V
pub unsafe fn get_committed_intersection_object_ray_origin<V: Vector<f32, 3>>( &self ) -> V
Gets the object-space ray origin for the current intersection considered in a ray query.
There must be a current committed intersection.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128
sourcepub unsafe fn get_world_ray_direction<V: Vector<f32, 3>>(&self) -> V
pub unsafe fn get_world_ray_direction<V: Vector<f32, 3>>(&self) -> V
Gets the world-space direction for the ray traced in a ray query.
sourcepub unsafe fn get_world_ray_origin<V: Vector<f32, 3>>(&self) -> V
pub unsafe fn get_world_ray_origin<V: Vector<f32, 3>>(&self) -> V
Gets the world-space origin for the ray traced in a ray query.
sourcepub unsafe fn get_candidate_intersection_object_to_world<V: Vector<f32, 3>>(
&self
) -> [V; 4]
pub unsafe fn get_candidate_intersection_object_to_world<V: Vector<f32, 3>>( &self ) -> [V; 4]
Gets a matrix that transforms values to world-space from the object-space of the current intersection considered in a ray query.
Self::proceed()
must have been called on this object, and it must have returned true.
sourcepub unsafe fn get_committed_intersection_object_to_world<V: Vector<f32, 3>>(
&self
) -> [V; 4]
pub unsafe fn get_committed_intersection_object_to_world<V: Vector<f32, 3>>( &self ) -> [V; 4]
Gets a matrix that transforms values to world-space from the object-space of the current intersection considered in a ray query.
There must be a current committed intersection.
TODO: Improve docs. Can’t right now due to https://github.com/KhronosGroup/SPIRV-Registry/issues/128