|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Optional tape features, listed among a Tape's template arguments: Tape<T, TapeFeature::ExactOffsets>. More...
Classes | |
| struct | ExactOffsets |
| Ray queries trace an Offset or Annular of a primitive with closed-form level sets (or of an affine map of one) exactly, from its level sets (see RayDetail::LevelForm); without it they march it. The level passes through Scale, Translate and Rotate to the primitive, divided by the map's value scale, so an annulus of a scaled mesh is still traced exactly. More... | |
| struct | Tag |
| Base of every feature: a Tape template argument derived from it is a feature, not a primitive type. More... | |
Optional tape features, listed among a Tape's template arguments: Tape<T, TapeFeature::ExactOffsets>.
A feature is code a tape compiles only when its type asks for it. A plain Tape<T> compiles none, so its kernels are not slowed by code it never runs. Without a feature, the tape still computes the same object; the operation the feature serves takes the general path (for a ray query, marching).
Why features exist: a tape's evaluator and ray code are compiled once per tape type, for any expression a tape of that type could hold, and on a device ptxas allocates registers and stack over all the code a kernel can reach, run or not. Reaching the exact-offset code from the ray code, behind a flag no plain tape sets, slowed plain float firstHit kernels by 10-16% (sm_86). So code that only some expressions need, such as a new exact ray form for an operation, is a feature, and a new feature follows these rules:
if constexpr (hasFeature<F>), at every place it is reached from (for ExactOffsets: rayLeaf(), rayMarchedWithin(), traceRay() and rayLeafHit()). A run-time test of a flag alone is not enough: the code behind it is still in every kernel.nm -C -S on Performance/Tape) match the base's, and the performance comparison shows no change in the tape cases.