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
impl<'arbitrary> Arbitrary<'arbitrary> for HitObjectFunction
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§impl Clone for HitObjectFunction
impl Clone for HitObjectFunction
Source§fn clone(&self) -> HitObjectFunction
fn clone(&self) -> HitObjectFunction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more