|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Where a pool-resident descriptor resolves its offsets, and the rules for moving it. More...
#include <EBGeometry_Pool.hpp>

Public Member Functions | |
| void * | base () const noexcept |
| The base address the descriptor's offsets resolve against. | |
| bool | isAttachedTo (const Pool &a_pool) const noexcept |
| Whether this location follows the given pool. | |
| void | attach (const Pool &a_pool, const char *a_who) noexcept |
| Start following a pool, as the descriptor's first reservation from it does. | |
| PoolLocation | rebasedOnto (const Pool &a_pool, uint64_t a_endByte, const char *a_who) const noexcept |
| The location of the same arrays in another pool of the same mirror chain. | |
Public Attributes | |
| const PoolControl * | m_control = nullptr |
| Control block of the pool the descriptor follows; null for a snapshot or when unset. | |
| void * | m_base = nullptr |
| Base address captured by a snapshot; null otherwise. | |
| bool | m_hostAccessible = false |
| Whether host code may dereference a snapshot's base (managed or mapped memory). | |
Where a pool-resident descriptor resolves its offsets, and the rules for moving it.
Every pool-resident handle (EBGeometry::DCEL::MeshT, EBGeometry::BVH::PackedBVH, and the classes built on them) holds one PoolLocation through its PoolHandle base, and delegates attaching, resolving and rebasing to it. It is in one of three states, decided by its value:
m_control is set. base() reads the pool's current base through the control block on every call, so a pool that grows and moves its block is invisible to the descriptor. Only host code can follow a pool.m_control is null and m_base holds the base of a frozen, device-accessible pool, captured by rebasedOnto(). This is what a kernel receives. If that memory is also host-accessible (managed or mapped memory), m_hostAccessible is set and host code may use the snapshot too.A descriptor changes location only through rebasedView(), which calls rebasedOnto(). Only handles hold a location (see PoolHandle): a descriptor stored inside another object's pool – a TriMeshSDF held in the primitive array of a EBGeometry::BVHUnion, for instance – is stored as its layout, and the outer handle pairs it with its own location.
|
inlinenoexcept |
Start following a pool, as the descriptor's first reservation from it does.
Aborts, in every build, if the location already follows a different pool: all of a descriptor's arrays resolve against one base, so they must come from one pool.
| [in] | a_pool | Pool to follow. |
| [in] | a_who | Name of the descriptor class, for the message. |
|
inlinenoexcept |
The base address the descriptor's offsets resolve against.
On the host, the followed pool's current base, or a snapshot's base if host code may use it. On a device, the snapshot's base: a location that still follows a host pool means a host descriptor was copied into a kernel without rebasedView(), which EBGEOMETRY_EXPECT catches.
|
inlinenoexcept |
Whether this location follows the given pool.
| [in] | a_pool | Pool to compare with. |
a_pool's control block.
|
inlinenoexcept |
The location of the same arrays in another pool of the same mirror chain.
The descriptor must follow a pool (not be a snapshot or unset), a_pool must belong to the same mirror chain – the pool itself, one of its mirrors, or a mirror of a mirror – and the descriptor's arrays must fit inside it. Each is checked in every build. A device-accessible a_pool, which must be frozen so its base cannot move, gives a snapshot; a host pool gives a location that follows it.
| [in] | a_pool | Pool to resolve against. |
| [in] | a_endByte | First byte past the descriptor's last array. |
| [in] | a_who | Name of the descriptor class, for the messages. |