// Copyright 2020 GFX developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms.
/// Options that determine the data contained in an intersection result. /// /// See <https://developer.apple.com/documentation/metalperformanceshaders/mpsintersectiondatatype> pubenum MPSIntersectionDataType {
Distance = 0,
DistancePrimitiveIndex = 1,
DistancePrimitiveIndexCoordinates = 2,
DistancePrimitiveIndexInstanceIndex = 3,
DistancePrimitiveIndexInstanceIndexCoordinates = 4,
}
/// See <https://developer.apple.com/documentation/metalperformanceshaders/mpsintersectiontype> pubenum MPSIntersectionType { /// Find the closest intersection to the ray's origin along the ray direction. /// This is potentially slower than `Any` but is well suited to primary visibility rays.
Nearest = 0, /// Find any intersection along the ray direction. This is potentially faster than `Nearest` and /// is well suited to shadow and occlusion rays.
Any = 1,
}
/// See <https://developer.apple.com/documentation/metalperformanceshaders/mpsraymaskoperator> pubenum MPSRayMaskOperator { /// Accept the intersection if `(primitive mask & ray mask) != 0`.
And = 0, /// Accept the intersection if `~(primitive mask & ray mask) != 0`.
NotAnd = 1, /// Accept the intersection if `(primitive mask | ray mask) != 0`.
Or = 2, /// Accept the intersection if `~(primitive mask | ray mask) != 0`.
NotOr = 3, /// Accept the intersection if `(primitive mask ^ ray mask) != 0`. /// Note that this is equivalent to the "!=" operator.
Xor = 4, /// Accept the intersection if `~(primitive mask ^ ray mask) != 0`. /// Note that this is equivalent to the "==" operator.
NotXor = 5, /// Accept the intersection if `(primitive mask < ray mask) != 0`.
LessThan = 6, /// Accept the intersection if `(primitive mask <= ray mask) != 0`.
LessThanOrEqualTo = 7, /// Accept the intersection if `(primitive mask > ray mask) != 0`.
GreaterThan = 8, /// Accept the intersection if `(primitive mask >= ray mask) != 0`.
GreaterThanOrEqualTo = 9,
}
/// See <https://developer.apple.com/documentation/metalperformanceshaders/mpstriangleintersectiontesttype> pubenum MPSTriangleIntersectionTestType { /// Use the default ray/triangle intersection test
Default = 0, /// Use a watertight ray/triangle intersection test which avoids gaps along shared triangle edges. /// Shared vertices may still have gaps. /// This intersection test may be slower than `Default`.
Watertight = 1,
}
bitflags::bitflags! { /// See <https://developer.apple.com/documentation/metalperformanceshaders/mpsaccelerationstructureusage> #[allow(non_upper_case_globals)] #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] pubstruct MPSAccelerationStructureUsage: NSUInteger { /// No usage options specified const None = 0; /// Option that enables support for refitting the acceleration structure after it has been built. const Refit = 1; /// Option indicating that the acceleration structure will be rebuilt frequently. const FrequentRebuild = 2; const PreferGPUBuild = 4; const PreferCPUBuild = 8;
}
}
/// A common bit for all floating point data types. const MPSDataTypeFloatBit: isize = 0x10000000; const MPSDataTypeSignedBit: isize = 0x20000000; const MPSDataTypeNormalizedBit: isize = 0x40000000;
/// Represents a 3D ray with an origin, a direction, and an intersection distance range from the origin. /// /// See <https://developer.apple.com/documentation/metalperformanceshaders/mpsrayoriginmindistancedirectionmaxdistance> #[repr(C)] pubstruct MPSRayOriginMinDistanceDirectionMaxDistance { /// Ray origin. The intersection test will be skipped if the origin contains NaNs or infinities. pub origin: MPSPackedFloat3, /// Minimum intersection distance from the origin along the ray direction. /// The intersection test will be skipped if the minimum distance is equal to positive infinity or NaN. pub min_distance: f32, /// Ray direction. Does not need to be normalized. The intersection test will be skipped if /// the direction has length zero or contains NaNs or infinities. pub direction: MPSPackedFloat3, /// Maximum intersection distance from the origin along the ray direction. May be infinite. /// The intersection test will be skipped if the maximum distance is less than zero, NaN, or /// less than the minimum intersection distance. pub max_distance: f32,
}
/// Intersection result which contains the distance from the ray origin to the intersection point, /// the index of the intersected primitive, and the first two barycentric coordinates of the intersection point. /// /// See <https://developer.apple.com/documentation/metalperformanceshaders/mpsintersectiondistanceprimitiveindexcoordinates> #[repr(C)] pubstruct MPSIntersectionDistancePrimitiveIndexCoordinates { /// Distance from the ray origin to the intersection point along the ray direction vector such /// that `intersection = ray.origin + ray.direction * distance`. /// Is negative if there is no intersection. If the intersection type is `MPSIntersectionTypeAny`, /// is a positive value for a hit or a negative value for a miss. pub distance: f32, /// Index of the intersected primitive. Undefined if the ray does not intersect a primitive or /// if the intersection type is `MPSIntersectionTypeAny`. pub primitive_index: u32, /// The first two barycentric coordinates `U` and `V` of the intersection point. /// The third coordinate `W = 1 - U - V`. Undefined if the ray does not intersect a primitive or /// if the intersection type is `MPSIntersectionTypeAny`. pub coordinates: [f32; 2],
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-06-18)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.