|
VTK
9.7.20261123
|
#include <vtkWebGPUVolumeBrickPool.h>
Fixed size 3D texture that holds the resident bricks of every volume in a pass.
Volumes are not uploaded whole. They are cut into bricks of BrickSize voxels a side, and the bricks that the rays actually need are kept in a pool of uniform slots. A page table, built by the coordinator, tells the shader which slot holds a given brick, so a volume larger than the pool - or larger than memory - still renders: the pages that are not resident are the ones the pool is asked to bring in next.
Every slot carries a one voxel apron around its brick so that trilinear interpolation inside a brick never needs a neighbouring slot. That is what makes the partitioning invisible: a ray crossing from one brick to the next reads the same values it would have read from one large texture.
Slots are recycled least recently used first, and a slot touched during the frame being built is never taken, so the frame either gets what it asked for or is told the pool is full.
This is a private implementation header; it is not installed.
Definition at line 41 of file vtkWebGPUVolumeBrickPool.h.
Classes | |
| struct | Key |
| Identifies one brick of one volume for as long as the volume keeps offering itself. More... | |
Public Types | |
| enum class | Kind { Byte = 0 , Float = 1 , ByteRGBA = 2 , FloatRGBA = 3 , Mask = 4 , Count = 5 } |
| How a volume's scalars are stored. More... | |
Public Member Functions | |
| void | Configure (vtkWebGPURenderWindow *window, int brickSize, std::size_t budgetBytes, std::size_t wantedSlots, std::uint32_t bytesPerVoxel) |
| Make room for wantedSlots bricks of brickSize voxels a side within budgetBytes. | |
| void | BeginFrame () |
| Start gathering a frame. | |
| void | Upload (Kind kind, std::uint32_t slot, const void *voxels) |
| Fill a slot. | |
| void | Release (const Key &key) |
| Give a slot back, for when the brick it was allocated for could not be fetched after all. | |
| void | Forget (const void *owner) |
| Let go of every slot that owner holds. | |
| void | ReleaseGraphicsResources () |
| WGPUTextureView | GetView (Kind kind) |
| Views of the pool textures. A kind that no volume has used yet is a one voxel placeholder. | |
| bool | IsUsed (Kind kind) const |
| Whether kind has been asked for since the pool was configured. | |
| std::uint32_t | Lookup (const Key &key) |
| Look up a brick, or make room for one. | |
| std::uint32_t | Allocate (const Key &key) |
| Look up a brick, or make room for one. | |
| int | GetBrickSize () const |
| int | GetSlotSize () const |
| const std::uint32_t * | GetSlotGrid () const |
| std::uint32_t | GetCapacity () const |
Static Public Attributes | |
| static constexpr std::uint32_t | InvalidSlot = 0xFFFFFFFFu |
| A page whose slot is this is not resident and must not be sampled. | |
|
strong |
How a volume's scalars are stored.
One pool texture per kind, created on first use. Volumes of more than one component take the four channel kinds, padded where they have fewer.
Definition at line 49 of file vtkWebGPUVolumeBrickPool.h.
| void vtkWebGPUVolumeBrickPool::Configure | ( | vtkWebGPURenderWindow * | window, |
| int | brickSize, | ||
| std::size_t | budgetBytes, | ||
| std::size_t | wantedSlots, | ||
| std::uint32_t | bytesPerVoxel ) |
Make room for wantedSlots bricks of brickSize voxels a side within budgetBytes.
bytesPerVoxel is the widest format the pass will store, so a scene of single component volumes is not sized as four channel ones. The pool only grows, so a settled scene stops rebuilding.
| void vtkWebGPUVolumeBrickPool::BeginFrame | ( | ) |
Start gathering a frame.
Slots touched after this point are safe from eviction until the next call.
| std::uint32_t vtkWebGPUVolumeBrickPool::Lookup | ( | const Key & | key | ) |
Look up a brick, or make room for one.
Lookup touches the slot it finds so the frame being built keeps it. Allocate returns InvalidSlot when every slot is spoken for by this frame, which tells the caller to draw what it has.
| std::uint32_t vtkWebGPUVolumeBrickPool::Allocate | ( | const Key & | key | ) |
Look up a brick, or make room for one.
Lookup touches the slot it finds so the frame being built keeps it. Allocate returns InvalidSlot when every slot is spoken for by this frame, which tells the caller to draw what it has.
| void vtkWebGPUVolumeBrickPool::Upload | ( | Kind | kind, |
| std::uint32_t | slot, | ||
| const void * | voxels ) |
Fill a slot.
voxels must hold GetSlotSize() cubed values, the brick and its apron in x fastest order.
| void vtkWebGPUVolumeBrickPool::Release | ( | const Key & | key | ) |
Give a slot back, for when the brick it was allocated for could not be fetched after all.
| void vtkWebGPUVolumeBrickPool::Forget | ( | const void * | owner | ) |
Let go of every slot that owner holds.
| void vtkWebGPUVolumeBrickPool::ReleaseGraphicsResources | ( | ) |
|
inline |
Geometry of the pool, shared with the shader.
Definition at line 112 of file vtkWebGPUVolumeBrickPool.h.
|
inline |
Geometry of the pool, shared with the shader.
Definition at line 113 of file vtkWebGPUVolumeBrickPool.h.
|
inline |
Geometry of the pool, shared with the shader.
Definition at line 114 of file vtkWebGPUVolumeBrickPool.h.
|
inline |
Geometry of the pool, shared with the shader.
Definition at line 115 of file vtkWebGPUVolumeBrickPool.h.
| WGPUTextureView vtkWebGPUVolumeBrickPool::GetView | ( | Kind | kind | ) |
Views of the pool textures. A kind that no volume has used yet is a one voxel placeholder.
|
inline |
Whether kind has been asked for since the pool was configured.
Definition at line 122 of file vtkWebGPUVolumeBrickPool.h.
|
staticconstexpr |
A page whose slot is this is not resident and must not be sampled.
Definition at line 45 of file vtkWebGPUVolumeBrickPool.h.