OpenVDB 14.0.0
Loading...
Searching...
No Matches
nanovdb::detail Namespace Reference

Classes

struct  BufferDeclaresDeviceDual
 Detects a BufferTraits specialization that still declares the hasDeviceDual member removed in NanoVDB 14.0, so GridHandle can reject it instead of parsing the device-only grids as an empty host buffer. More...
struct  BufferDeclaresDeviceDual< BufferT, std::void_t< decltype(BufferTraits< BufferT >::hasDeviceDual)> >
struct  LayoutCopy
 Wraps a byte-for-byte copy of a handle's buffer in a handle with that handle's layout. The layout already passed a header parse or GridHandle::adopt when the source was made, so it is not checked again. This also carries grids at unaligned offsets, which the constructors accept and GridHandle::adopt rejects. Used by cuda::copyTo. More...

Functions

template<typename BufferT>
BufferT createHostStorage (uint64_t bytes, const BufferT &pool)
 Allocates bytes of host-readable storage for a GridHandle: through BufferT::create for buffers that provide it, and through pool's resource for a host-accessible single-space buffer (e.g. a pinned-resource cuda::Buffer). The braced third argument selects the uninitialized-storage constructor without naming its tag type, so this header stays CUDA-free.
template<typename BufferT>
BufferT createHostStorage (uint64_t bytes, const BufferT *pool)
 Pointer-taking form for callers whose pool is optional: a null pool default-constructs the buffer type as the prototype, which for a single-space buffer means a default-constructed resource.
void validateGridLayout (const std::vector< GridHandleMetaData > &meta, uint64_t bytes)
 Checks that meta describes grids laid out back to back from offset zero inside bytes of storage, each starting at a multiple of NANOVDB_DATA_ALIGNMENT and naming a grid type below GridType::End. This is all the validation a handle adopting caller-supplied metadata performs: no header is read. No grids at all is accepted only over an empty buffer (an empty handle).
void parseHostGridChain (const GridData *head, uint64_t bytes, std::vector< GridHandleMetaData > &meta)
 Validates the grid chain in bytes of host-readable memory headed by head and fills meta with one entry per grid: every header must be valid, carry its expected index and the chain's total count, and fit inside the buffer, so a truncated buffer or a forged header is rejected before its metadata is trusted. This is the host counterpart of the device-side chain parse. Like it, this does not require grid offsets to be aligned, unlike GridHandle::adopt.

Function Documentation

◆ createHostStorage() [1/2]

template<typename BufferT>
BufferT createHostStorage ( uint64_t bytes,
const BufferT & pool )
inline

Allocates bytes of host-readable storage for a GridHandle: through BufferT::create for buffers that provide it, and through pool's resource for a host-accessible single-space buffer (e.g. a pinned-resource cuda::Buffer). The braced third argument selects the uninitialized-storage constructor without naming its tag type, so this header stays CUDA-free.

◆ createHostStorage() [2/2]

template<typename BufferT>
BufferT createHostStorage ( uint64_t bytes,
const BufferT * pool )
inline

Pointer-taking form for callers whose pool is optional: a null pool default-constructs the buffer type as the prototype, which for a single-space buffer means a default-constructed resource.

◆ parseHostGridChain()

void parseHostGridChain ( const GridData * head,
uint64_t bytes,
std::vector< GridHandleMetaData > & meta )
inline

Validates the grid chain in bytes of host-readable memory headed by head and fills meta with one entry per grid: every header must be valid, carry its expected index and the chain's total count, and fit inside the buffer, so a truncated buffer or a forged header is rejected before its metadata is trusted. This is the host counterpart of the device-side chain parse. Like it, this does not require grid offsets to be aligned, unlike GridHandle::adopt.

◆ validateGridLayout()

void validateGridLayout ( const std::vector< GridHandleMetaData > & meta,
uint64_t bytes )
inline

Checks that meta describes grids laid out back to back from offset zero inside bytes of storage, each starting at a multiple of NANOVDB_DATA_ALIGNMENT and naming a grid type below GridType::End. This is all the validation a handle adopting caller-supplied metadata performs: no header is read. No grids at all is accepted only over an empty buffer (an empty handle).