Skip to main content

HitObjectFunction

Enum HitObjectFunction 

Source
pub enum HitObjectFunction {
    TraceRay {
        acceleration_structure: Handle<Expression>,
        descriptor: Handle<Expression>,
        payload: Handle<Expression>,
    },
    RecordMiss {
        descriptor: Handle<Expression>,
    },
    RecordFromQuery {
        query: Handle<Expression>,
    },
    RecordEmpty,
    ExecuteShader {
        payload: Handle<Expression>,
    },
    Reorder {
        hint: Option<ReorderHint>,
    },
}
Expand description

An operation that a HitObject statement applies to its hit_object operand.

Variants§

§

TraceRay

Trace a ray, recording the result in the hit object without executing any closest hit or miss shaders.

Fields

§acceleration_structure: Handle<Expression>

The acceleration structure within which this ray should search for hits.

The expression must be an AccelerationStructure.

§descriptor: Handle<Expression>

A struct of detailed parameters for the ray.

This expression should have the struct type given in SpecialTypes::ray_desc. This is available in the WGSL front end as the RayDesc type.

§payload: Handle<Expression>

A pointer in the ray_payload or incoming_ray_payload address spaces.

§

RecordMiss

Record a miss in the hit object, without tracing a ray.

The cull_mask of the descriptor is ignored, and the miss index is always zero.

Fields

§descriptor: Handle<Expression>

A struct of detailed parameters describing the recorded ray.

This expression should have the struct type given in SpecialTypes::ray_desc. This is available in the WGSL front end as the RayDesc type.

§

RecordFromQuery

Record the committed intersection of a ray query in the hit object.

If the ray query’s committed intersection is a hit, the hit object records that hit. The shader binding table record used for a hit is chosen exactly as a TraceRay would choose it: the shader binding table offset and stride are zero, so the hit group is the intersected instance’s shader binding table record offset. For a triangle hit, the hit kind and barycentric attributes come from the ray query. Ray queries carry no hit kind or attributes for procedural (AABB) hits, so those are recorded with zeroed attributes and an unspecified hit kind. As a result, a HitObjectQuery::Intersection of such a hit can report it as a triangle hit, with an incorrect front_face and barycentrics.

If the ray query has no committed intersection, the hit object records a miss along the ray the query was initialized with, with a miss index of zero, exactly as a TraceRay that missed would have.

If the ray query has not finished traversal, the hit object is recorded as empty instead. A RayQueryFunction::Terminate does not finish traversal.

Fields

§query: Handle<Expression>

The ray query whose committed intersection should be recorded.

Like Statement::RayQuery::query, this must be a LocalVariable expression whose type is TypeInner::RayQuery.

§

RecordEmpty

Record that the hit object is empty: neither a hit nor a miss.

An empty hit object does not run any shader when passed to ExecuteShader.

§

ExecuteShader

Execute the closest hit or miss shader recorded in the hit object.

Fields

§payload: Handle<Expression>

A pointer in the ray_payload or incoming_ray_payload address spaces.

§

Reorder

Reorder invocations by the contents of the hit object, optionally combined with a user-supplied hint.

Only valid in the RayGeneration stage.

Fields

§hint: Option<ReorderHint>

An extra user hint to reorder by, in addition to the hit object.

Trait Implementations§

Source§

impl<'arbitrary> Arbitrary<'arbitrary> for HitObjectFunction

Source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl Clone for HitObjectFunction

Source§

fn clone(&self) -> HitObjectFunction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HitObjectFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for HitObjectFunction

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HitObjectFunction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for HitObjectFunction

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,