spirv_std::ray_tracing

Struct 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

Source

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 of cull_mask are used by this instruction - other bits are ignored.
  • ray_origin, ray_tmin, ray_direction, and ray_tmax control the basic parameters of the ray to be traced.
Source

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.

Source

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.

Source

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.

Source

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.

Source

pub unsafe fn get_committed_intersection_type(&self) -> CommittedIntersection

Returns the type of the current candidate intersection.

Source

pub unsafe fn get_ray_t_min(&self) -> f32

Returns the “Ray Tmin” value used by the ray query.

Source

pub unsafe fn get_ray_flags(&self) -> RayFlags

Returns the “Ray Flags” value used by the ray query.

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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.

Source

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.

Source

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.