@pmndrs/vdb 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (570) hide show
  1. package/CHANGELOG.md +727 -0
  2. package/LICENSE +21 -0
  3. package/README.md +496 -2
  4. package/THIRD_PARTY_NOTICES.md +315 -0
  5. package/dist/core/compute/atlas.d.ts +102 -0
  6. package/dist/core/compute/atlas.js +103 -0
  7. package/dist/core/compute/atlas.js.map +1 -0
  8. package/dist/core/compute/index.d.ts +13 -0
  9. package/dist/core/compute/index.js +9 -0
  10. package/dist/core/compute/index.js.map +1 -0
  11. package/dist/core/compute/majorant-build.d.ts +45 -0
  12. package/dist/core/compute/majorant-build.js +193 -0
  13. package/dist/core/compute/majorant-build.js.map +1 -0
  14. package/dist/core/compute/multi-scale.d.ts +155 -0
  15. package/dist/core/compute/multi-scale.js +684 -0
  16. package/dist/core/compute/multi-scale.js.map +1 -0
  17. package/dist/core/compute/pyramid.d.ts +120 -0
  18. package/dist/core/compute/pyramid.js +468 -0
  19. package/dist/core/compute/pyramid.js.map +1 -0
  20. package/dist/core/compute/shared.d.ts +116 -0
  21. package/dist/core/compute/shared.js +211 -0
  22. package/dist/core/compute/shared.js.map +1 -0
  23. package/dist/core/compute/stats.d.ts +78 -0
  24. package/dist/core/compute/stats.js +193 -0
  25. package/dist/core/compute/stats.js.map +1 -0
  26. package/dist/core/compute/value-transform.d.ts +30 -0
  27. package/dist/core/compute/value-transform.js +64 -0
  28. package/dist/core/compute/value-transform.js.map +1 -0
  29. package/dist/core/errors.d.ts +21 -0
  30. package/dist/core/errors.js +17 -0
  31. package/dist/core/errors.js.map +1 -0
  32. package/dist/core/frame/emission.d.ts +85 -0
  33. package/dist/core/frame/emission.js +422 -0
  34. package/dist/core/frame/emission.js.map +1 -0
  35. package/dist/core/frame/environment.d.ts +47 -0
  36. package/dist/core/frame/environment.js +178 -0
  37. package/dist/core/frame/environment.js.map +1 -0
  38. package/dist/core/frame/index.d.ts +39 -0
  39. package/dist/core/frame/index.js +27 -0
  40. package/dist/core/frame/index.js.map +1 -0
  41. package/dist/core/frame/kernels.d.ts +115 -0
  42. package/dist/core/frame/kernels.js +496 -0
  43. package/dist/core/frame/kernels.js.map +1 -0
  44. package/dist/core/frame/limits.d.ts +67 -0
  45. package/dist/core/frame/limits.js +109 -0
  46. package/dist/core/frame/limits.js.map +1 -0
  47. package/dist/core/frame/phase.d.ts +17 -0
  48. package/dist/core/frame/phase.js +53 -0
  49. package/dist/core/frame/phase.js.map +1 -0
  50. package/dist/core/frame/pipelines.d.ts +49 -0
  51. package/dist/core/frame/pipelines.js +147 -0
  52. package/dist/core/frame/pipelines.js.map +1 -0
  53. package/dist/core/frame/renderer.d.ts +122 -0
  54. package/dist/core/frame/renderer.js +1712 -0
  55. package/dist/core/frame/renderer.js.map +1 -0
  56. package/dist/core/frame/resources.d.ts +71 -0
  57. package/dist/core/frame/resources.js +100 -0
  58. package/dist/core/frame/resources.js.map +1 -0
  59. package/dist/core/frame/scattering.d.ts +97 -0
  60. package/dist/core/frame/scattering.js +332 -0
  61. package/dist/core/frame/scattering.js.map +1 -0
  62. package/dist/core/frame/settings.d.ts +243 -0
  63. package/dist/core/frame/settings.js +67 -0
  64. package/dist/core/frame/settings.js.map +1 -0
  65. package/dist/core/frame/shadows.d.ts +55 -0
  66. package/dist/core/frame/shadows.js +460 -0
  67. package/dist/core/frame/shadows.js.map +1 -0
  68. package/dist/core/frame/types.d.ts +415 -0
  69. package/dist/core/frame/types.js +49 -0
  70. package/dist/core/frame/types.js.map +1 -0
  71. package/dist/core/frame/uniforms.d.ts +105 -0
  72. package/dist/core/frame/uniforms.js +276 -0
  73. package/dist/core/frame/uniforms.js.map +1 -0
  74. package/dist/core/frame/wgsl/chunks.d.ts +4 -0
  75. package/dist/core/frame/wgsl/chunks.js +728 -0
  76. package/dist/core/frame/wgsl/chunks.js.map +1 -0
  77. package/dist/core/frame/wgsl/emission.d.ts +82 -0
  78. package/dist/core/frame/wgsl/emission.js +353 -0
  79. package/dist/core/frame/wgsl/emission.js.map +1 -0
  80. package/dist/core/frame/wgsl/environment.d.ts +42 -0
  81. package/dist/core/frame/wgsl/environment.js +711 -0
  82. package/dist/core/frame/wgsl/environment.js.map +1 -0
  83. package/dist/core/frame/wgsl/gather.d.ts +55 -0
  84. package/dist/core/frame/wgsl/gather.js +850 -0
  85. package/dist/core/frame/wgsl/gather.js.map +1 -0
  86. package/dist/core/frame/wgsl/integrate.d.ts +78 -0
  87. package/dist/core/frame/wgsl/integrate.js +213 -0
  88. package/dist/core/frame/wgsl/integrate.js.map +1 -0
  89. package/dist/core/frame/wgsl/lighting.d.ts +103 -0
  90. package/dist/core/frame/wgsl/lighting.js +1636 -0
  91. package/dist/core/frame/wgsl/lighting.js.map +1 -0
  92. package/dist/core/frame/wgsl/occluders.d.ts +20 -0
  93. package/dist/core/frame/wgsl/occluders.js +95 -0
  94. package/dist/core/frame/wgsl/occluders.js.map +1 -0
  95. package/dist/core/frame/wgsl/resolve.d.ts +19 -0
  96. package/dist/core/frame/wgsl/resolve.js +205 -0
  97. package/dist/core/frame/wgsl/resolve.js.map +1 -0
  98. package/dist/core/frame/wgsl/shadows.d.ts +35 -0
  99. package/dist/core/frame/wgsl/shadows.js +328 -0
  100. package/dist/core/frame/wgsl/shadows.js.map +1 -0
  101. package/dist/core/half.d.ts +11 -0
  102. package/dist/core/half.js +22 -0
  103. package/dist/core/half.js.map +1 -0
  104. package/dist/core/index.d.ts +52 -0
  105. package/dist/core/index.js +46 -0
  106. package/dist/core/index.js.map +1 -0
  107. package/dist/core/internal.d.ts +31 -0
  108. package/dist/core/internal.js +32 -0
  109. package/dist/core/internal.js.map +1 -0
  110. package/dist/core/pool/affine.d.ts +34 -0
  111. package/dist/core/pool/affine.js +100 -0
  112. package/dist/core/pool/affine.js.map +1 -0
  113. package/dist/core/pool/allocator.d.ts +32 -0
  114. package/dist/core/pool/allocator.js +81 -0
  115. package/dist/core/pool/allocator.js.map +1 -0
  116. package/dist/core/pool/image-header.d.ts +93 -0
  117. package/dist/core/pool/image-header.js +194 -0
  118. package/dist/core/pool/image-header.js.map +1 -0
  119. package/dist/core/pool/layout.d.ts +198 -0
  120. package/dist/core/pool/layout.js +316 -0
  121. package/dist/core/pool/layout.js.map +1 -0
  122. package/dist/core/pool/limits.d.ts +41 -0
  123. package/dist/core/pool/limits.js +80 -0
  124. package/dist/core/pool/limits.js.map +1 -0
  125. package/dist/core/pool/pool.d.ts +384 -0
  126. package/dist/core/pool/pool.js +1184 -0
  127. package/dist/core/pool/pool.js.map +1 -0
  128. package/dist/core/reference/index.d.ts +6 -0
  129. package/dist/core/reference/index.js +7 -0
  130. package/dist/core/reference/index.js.map +1 -0
  131. package/dist/core/reference/renderer.d.ts +105 -0
  132. package/dist/core/reference/renderer.js +474 -0
  133. package/dist/core/reference/renderer.js.map +1 -0
  134. package/dist/core/reference/wgsl.d.ts +65 -0
  135. package/dist/core/reference/wgsl.js +803 -0
  136. package/dist/core/reference/wgsl.js.map +1 -0
  137. package/dist/core/sequence.d.ts +347 -0
  138. package/dist/core/sequence.js +548 -0
  139. package/dist/core/sequence.js.map +1 -0
  140. package/dist/core/source/brick-cache.d.ts +165 -0
  141. package/dist/core/source/brick-cache.js +627 -0
  142. package/dist/core/source/brick-cache.js.map +1 -0
  143. package/dist/core/source/dense-fill.d.ts +53 -0
  144. package/dist/core/source/dense-fill.js +377 -0
  145. package/dist/core/source/dense-fill.js.map +1 -0
  146. package/dist/core/source/dense.d.ts +50 -0
  147. package/dist/core/source/dense.js +384 -0
  148. package/dist/core/source/dense.js.map +1 -0
  149. package/dist/core/source/sparse-wgsl.d.ts +92 -0
  150. package/dist/core/source/sparse-wgsl.js +481 -0
  151. package/dist/core/source/sparse-wgsl.js.map +1 -0
  152. package/dist/core/source/sparse.d.ts +192 -0
  153. package/dist/core/source/sparse.js +762 -0
  154. package/dist/core/source/sparse.js.map +1 -0
  155. package/dist/core/source/types.d.ts +120 -0
  156. package/dist/core/source/types.js +9 -0
  157. package/dist/core/source/types.js.map +1 -0
  158. package/dist/core/surface/index.d.ts +10 -0
  159. package/dist/core/surface/index.js +9 -0
  160. package/dist/core/surface/index.js.map +1 -0
  161. package/dist/core/surface/level-set-pass.d.ts +140 -0
  162. package/dist/core/surface/level-set-pass.js +291 -0
  163. package/dist/core/surface/level-set-pass.js.map +1 -0
  164. package/dist/core/surface/level-set-wgsl.d.ts +46 -0
  165. package/dist/core/surface/level-set-wgsl.js +99 -0
  166. package/dist/core/surface/level-set-wgsl.js.map +1 -0
  167. package/dist/core/surface/points.d.ts +109 -0
  168. package/dist/core/surface/points.js +226 -0
  169. package/dist/core/surface/points.js.map +1 -0
  170. package/dist/core/types.d.ts +37 -0
  171. package/dist/core/types.js +32 -0
  172. package/dist/core/types.js.map +1 -0
  173. package/dist/core/wgsl/api.d.ts +65 -0
  174. package/dist/core/wgsl/api.js +546 -0
  175. package/dist/core/wgsl/api.js.map +1 -0
  176. package/dist/core/wgsl/generate.d.ts +90 -0
  177. package/dist/core/wgsl/generate.js +678 -0
  178. package/dist/core/wgsl/generate.js.map +1 -0
  179. package/dist/core/wgsl/lean.d.ts +50 -0
  180. package/dist/core/wgsl/lean.js +327 -0
  181. package/dist/core/wgsl/lean.js.map +1 -0
  182. package/dist/core/wgsl/level-set.d.ts +58 -0
  183. package/dist/core/wgsl/level-set.js +200 -0
  184. package/dist/core/wgsl/level-set.js.map +1 -0
  185. package/dist/core/wgsl/majorant.d.ts +62 -0
  186. package/dist/core/wgsl/majorant.js +381 -0
  187. package/dist/core/wgsl/majorant.js.map +1 -0
  188. package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
  189. package/dist/core/wgsl/pnanovdb.chunks.generated.js +333 -0
  190. package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -0
  191. package/dist/core/wgsl/reserved.d.ts +9 -0
  192. package/dist/core/wgsl/reserved.js +26 -0
  193. package/dist/core/wgsl/reserved.js.map +1 -0
  194. package/dist/core/wgsl/types.d.ts +198 -0
  195. package/dist/core/wgsl/types.js +2 -0
  196. package/dist/core/wgsl/types.js.map +1 -0
  197. package/dist/three/coarse-first.d.ts +207 -0
  198. package/dist/three/coarse-first.js +205 -0
  199. package/dist/three/coarse-first.js.map +1 -0
  200. package/dist/three/compute.d.ts +73 -0
  201. package/dist/three/compute.js +66 -0
  202. package/dist/three/compute.js.map +1 -0
  203. package/dist/three/device.d.ts +66 -0
  204. package/dist/three/device.js +62 -0
  205. package/dist/three/device.js.map +1 -0
  206. package/dist/three/frame/core-environment.d.ts +38 -0
  207. package/dist/three/frame/core-environment.js +154 -0
  208. package/dist/three/frame/core-environment.js.map +1 -0
  209. package/dist/three/frame/core-integrate-material.d.ts +34 -0
  210. package/dist/three/frame/core-integrate-material.js +162 -0
  211. package/dist/three/frame/core-integrate-material.js.map +1 -0
  212. package/dist/three/frame/core-occluders.d.ts +53 -0
  213. package/dist/three/frame/core-occluders.js +193 -0
  214. package/dist/three/frame/core-occluders.js.map +1 -0
  215. package/dist/three/frame/core-structs.d.ts +34 -0
  216. package/dist/three/frame/core-structs.js +61 -0
  217. package/dist/three/frame/core-structs.js.map +1 -0
  218. package/dist/three/frame/core-textures.d.ts +41 -0
  219. package/dist/three/frame/core-textures.js +114 -0
  220. package/dist/three/frame/core-textures.js.map +1 -0
  221. package/dist/three/frame/emission-light.d.ts +117 -0
  222. package/dist/three/frame/emission-light.js +276 -0
  223. package/dist/three/frame/emission-light.js.map +1 -0
  224. package/dist/three/frame/index.d.ts +19 -0
  225. package/dist/three/frame/index.js +15 -0
  226. package/dist/three/frame/index.js.map +1 -0
  227. package/dist/three/frame/medium.d.ts +33 -0
  228. package/dist/three/frame/medium.js +29 -0
  229. package/dist/three/frame/medium.js.map +1 -0
  230. package/dist/three/frame/renderer.d.ts +97 -0
  231. package/dist/three/frame/renderer.js +480 -0
  232. package/dist/three/frame/renderer.js.map +1 -0
  233. package/dist/three/frame/spectrum.d.ts +4 -0
  234. package/dist/three/frame/spectrum.js +15 -0
  235. package/dist/three/frame/spectrum.js.map +1 -0
  236. package/dist/three/frame/three-internals.d.ts +60 -0
  237. package/dist/three/frame/three-internals.js +152 -0
  238. package/dist/three/frame/three-internals.js.map +1 -0
  239. package/dist/three/frame/volume-shadows.d.ts +139 -0
  240. package/dist/three/frame/volume-shadows.js +403 -0
  241. package/dist/three/frame/volume-shadows.js.map +1 -0
  242. package/dist/three/frame/volume.d.ts +230 -0
  243. package/dist/three/frame/volume.js +268 -0
  244. package/dist/three/frame/volume.js.map +1 -0
  245. package/dist/three/grid-node.d.ts +229 -0
  246. package/dist/three/grid-node.js +545 -0
  247. package/dist/three/grid-node.js.map +1 -0
  248. package/dist/three/index.d.ts +52 -0
  249. package/dist/three/index.js +58 -0
  250. package/dist/three/index.js.map +1 -0
  251. package/dist/three/internal.d.ts +20 -0
  252. package/dist/three/internal.js +18 -0
  253. package/dist/three/internal.js.map +1 -0
  254. package/dist/three/level-set-material.d.ts +185 -0
  255. package/dist/three/level-set-material.js +241 -0
  256. package/dist/three/level-set-material.js.map +1 -0
  257. package/dist/three/level-set-physical-material.d.ts +154 -0
  258. package/dist/three/level-set-physical-material.js +253 -0
  259. package/dist/three/level-set-physical-material.js.map +1 -0
  260. package/dist/three/level-set-velocity.d.ts +94 -0
  261. package/dist/three/level-set-velocity.js +208 -0
  262. package/dist/three/level-set-velocity.js.map +1 -0
  263. package/dist/three/material.d.ts +324 -0
  264. package/dist/three/material.js +502 -0
  265. package/dist/three/material.js.map +1 -0
  266. package/dist/three/points.d.ts +140 -0
  267. package/dist/three/points.js +261 -0
  268. package/dist/three/points.js.map +1 -0
  269. package/dist/three/sparse-source.d.ts +165 -0
  270. package/dist/three/sparse-source.js +405 -0
  271. package/dist/three/sparse-source.js.map +1 -0
  272. package/dist/three/volume-source.d.ts +22 -0
  273. package/dist/three/volume-source.js +110 -0
  274. package/dist/three/volume-source.js.map +1 -0
  275. package/dist/tools/cpu/brick-atlas.d.ts +36 -0
  276. package/dist/tools/cpu/brick-atlas.js +129 -0
  277. package/dist/tools/cpu/brick-atlas.js.map +1 -0
  278. package/dist/tools/cpu/compute.d.ts +116 -0
  279. package/dist/tools/cpu/compute.js +239 -0
  280. package/dist/tools/cpu/compute.js.map +1 -0
  281. package/dist/tools/cpu/lean-reads.d.ts +81 -0
  282. package/dist/tools/cpu/lean-reads.js +262 -0
  283. package/dist/tools/cpu/lean-reads.js.map +1 -0
  284. package/dist/tools/cpu/level-set.d.ts +111 -0
  285. package/dist/tools/cpu/level-set.js +313 -0
  286. package/dist/tools/cpu/level-set.js.map +1 -0
  287. package/dist/tools/cpu/majorant.d.ts +265 -0
  288. package/dist/tools/cpu/majorant.js +541 -0
  289. package/dist/tools/cpu/majorant.js.map +1 -0
  290. package/dist/tools/cpu/march.d.ts +297 -0
  291. package/dist/tools/cpu/march.js +726 -0
  292. package/dist/tools/cpu/march.js.map +1 -0
  293. package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
  294. package/dist/tools/cpu/mesh-decimate.js +1225 -0
  295. package/dist/tools/cpu/mesh-decimate.js.map +1 -0
  296. package/dist/tools/cpu/points.d.ts +29 -0
  297. package/dist/tools/cpu/points.js +38 -0
  298. package/dist/tools/cpu/points.js.map +1 -0
  299. package/dist/tools/cpu/probe-coords.d.ts +70 -0
  300. package/dist/tools/cpu/probe-coords.js +116 -0
  301. package/dist/tools/cpu/probe-coords.js.map +1 -0
  302. package/dist/tools/cpu/read-value.d.ts +44 -0
  303. package/dist/tools/cpu/read-value.js +351 -0
  304. package/dist/tools/cpu/read-value.js.map +1 -0
  305. package/dist/tools/cpu/sample-trilinear.d.ts +43 -0
  306. package/dist/tools/cpu/sample-trilinear.js +168 -0
  307. package/dist/tools/cpu/sample-trilinear.js.map +1 -0
  308. package/dist/tools/cpu/stride-tables.d.ts +56 -0
  309. package/dist/tools/cpu/stride-tables.generated.d.ts +1059 -0
  310. package/dist/tools/cpu/stride-tables.generated.js +1267 -0
  311. package/dist/tools/cpu/stride-tables.generated.js.map +1 -0
  312. package/dist/tools/cpu/stride-tables.js +78 -0
  313. package/dist/tools/cpu/stride-tables.js.map +1 -0
  314. package/dist/tools/cpu/surface-nets.d.ts +90 -0
  315. package/dist/tools/cpu/surface-nets.js +597 -0
  316. package/dist/tools/cpu/surface-nets.js.map +1 -0
  317. package/dist/tools/errors.d.ts +66 -0
  318. package/dist/tools/errors.js +67 -0
  319. package/dist/tools/errors.js.map +1 -0
  320. package/dist/tools/frame/ambient.d.ts +98 -0
  321. package/dist/tools/frame/ambient.js +274 -0
  322. package/dist/tools/frame/ambient.js.map +1 -0
  323. package/dist/tools/frame/blackbody.d.ts +57 -0
  324. package/dist/tools/frame/blackbody.js +151 -0
  325. package/dist/tools/frame/blackbody.js.map +1 -0
  326. package/dist/tools/frame/brick-cache.d.ts +165 -0
  327. package/dist/tools/frame/brick-cache.js +326 -0
  328. package/dist/tools/frame/brick-cache.js.map +1 -0
  329. package/dist/tools/frame/emission.d.ts +137 -0
  330. package/dist/tools/frame/emission.js +290 -0
  331. package/dist/tools/frame/emission.js.map +1 -0
  332. package/dist/tools/frame/environment-gpu.d.ts +111 -0
  333. package/dist/tools/frame/environment-gpu.js +280 -0
  334. package/dist/tools/frame/environment-gpu.js.map +1 -0
  335. package/dist/tools/frame/environment.d.ts +106 -0
  336. package/dist/tools/frame/environment.js +272 -0
  337. package/dist/tools/frame/environment.js.map +1 -0
  338. package/dist/tools/frame/froxel.d.ts +58 -0
  339. package/dist/tools/frame/froxel.js +115 -0
  340. package/dist/tools/frame/froxel.js.map +1 -0
  341. package/dist/tools/frame/grid.d.ts +392 -0
  342. package/dist/tools/frame/grid.js +802 -0
  343. package/dist/tools/frame/grid.js.map +1 -0
  344. package/dist/tools/frame/index.d.ts +150 -0
  345. package/dist/tools/frame/index.js +389 -0
  346. package/dist/tools/frame/index.js.map +1 -0
  347. package/dist/tools/frame/medium.d.ts +77 -0
  348. package/dist/tools/frame/medium.js +101 -0
  349. package/dist/tools/frame/medium.js.map +1 -0
  350. package/dist/tools/frame/mie-table.d.ts +6 -0
  351. package/dist/tools/frame/mie-table.js +16 -0
  352. package/dist/tools/frame/mie-table.js.map +1 -0
  353. package/dist/tools/frame/mie.d.ts +63 -0
  354. package/dist/tools/frame/mie.js +194 -0
  355. package/dist/tools/frame/mie.js.map +1 -0
  356. package/dist/tools/frame/mlp-nn.d.ts +36 -0
  357. package/dist/tools/frame/mlp-nn.js +159 -0
  358. package/dist/tools/frame/mlp-nn.js.map +1 -0
  359. package/dist/tools/frame/mlp-tza.d.ts +29 -0
  360. package/dist/tools/frame/mlp-tza.js +186 -0
  361. package/dist/tools/frame/mlp-tza.js.map +1 -0
  362. package/dist/tools/frame/mlp.d.ts +183 -0
  363. package/dist/tools/frame/mlp.js +434 -0
  364. package/dist/tools/frame/mlp.js.map +1 -0
  365. package/dist/tools/frame/ms-exit.d.ts +42 -0
  366. package/dist/tools/frame/ms-exit.js +90 -0
  367. package/dist/tools/frame/ms-exit.js.map +1 -0
  368. package/dist/tools/frame/multi-scale.d.ts +152 -0
  369. package/dist/tools/frame/multi-scale.js +302 -0
  370. package/dist/tools/frame/multi-scale.js.map +1 -0
  371. package/dist/tools/frame/neural-weights.d.ts +10 -0
  372. package/dist/tools/frame/neural-weights.js +244 -0
  373. package/dist/tools/frame/neural-weights.js.map +1 -0
  374. package/dist/tools/frame/neural.d.ts +80 -0
  375. package/dist/tools/frame/neural.js +150 -0
  376. package/dist/tools/frame/neural.js.map +1 -0
  377. package/dist/tools/frame/occluders.d.ts +51 -0
  378. package/dist/tools/frame/occluders.js +72 -0
  379. package/dist/tools/frame/occluders.js.map +1 -0
  380. package/dist/tools/frame/pyramid-layout.d.ts +55 -0
  381. package/dist/tools/frame/pyramid-layout.js +100 -0
  382. package/dist/tools/frame/pyramid-layout.js.map +1 -0
  383. package/dist/tools/frame/shadows.d.ts +190 -0
  384. package/dist/tools/frame/shadows.js +468 -0
  385. package/dist/tools/frame/shadows.js.map +1 -0
  386. package/dist/tools/frame/sparse.d.ts +147 -0
  387. package/dist/tools/frame/sparse.js +432 -0
  388. package/dist/tools/frame/sparse.js.map +1 -0
  389. package/dist/tools/frame/spectral-stack.d.ts +159 -0
  390. package/dist/tools/frame/spectral-stack.js +391 -0
  391. package/dist/tools/frame/spectral-stack.js.map +1 -0
  392. package/dist/tools/frame/spectral.d.ts +222 -0
  393. package/dist/tools/frame/spectral.js +572 -0
  394. package/dist/tools/frame/spectral.js.map +1 -0
  395. package/dist/tools/frame/stack.d.ts +115 -0
  396. package/dist/tools/frame/stack.js +290 -0
  397. package/dist/tools/frame/stack.js.map +1 -0
  398. package/dist/tools/frame/view.d.ts +131 -0
  399. package/dist/tools/frame/view.js +337 -0
  400. package/dist/tools/frame/view.js.map +1 -0
  401. package/dist/tools/index.d.ts +157 -0
  402. package/dist/tools/index.js +132 -0
  403. package/dist/tools/index.js.map +1 -0
  404. package/dist/tools/internal.d.ts +87 -0
  405. package/dist/tools/internal.js +85 -0
  406. package/dist/tools/internal.js.map +1 -0
  407. package/dist/tools/nanovdb/build-from-vdb.d.ts +59 -0
  408. package/dist/tools/nanovdb/build-from-vdb.js +100 -0
  409. package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
  410. package/dist/tools/nanovdb/bytes.d.ts +233 -0
  411. package/dist/tools/nanovdb/bytes.js +388 -0
  412. package/dist/tools/nanovdb/bytes.js.map +1 -0
  413. package/dist/tools/nanovdb/coarse-first.d.ts +78 -0
  414. package/dist/tools/nanovdb/coarse-first.js +92 -0
  415. package/dist/tools/nanovdb/coarse-first.js.map +1 -0
  416. package/dist/tools/nanovdb/half.d.ts +22 -0
  417. package/dist/tools/nanovdb/half.js +73 -0
  418. package/dist/tools/nanovdb/half.js.map +1 -0
  419. package/dist/tools/nanovdb/index.d.ts +34 -0
  420. package/dist/tools/nanovdb/index.js +25 -0
  421. package/dist/tools/nanovdb/index.js.map +1 -0
  422. package/dist/tools/nanovdb/inspect.d.ts +33 -0
  423. package/dist/tools/nanovdb/inspect.js +70 -0
  424. package/dist/tools/nanovdb/inspect.js.map +1 -0
  425. package/dist/tools/nanovdb/leaf-codec.d.ts +119 -0
  426. package/dist/tools/nanovdb/leaf-codec.js +356 -0
  427. package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
  428. package/dist/tools/nanovdb/quantize.d.ts +72 -0
  429. package/dist/tools/nanovdb/quantize.js +329 -0
  430. package/dist/tools/nanovdb/quantize.js.map +1 -0
  431. package/dist/tools/nanovdb/resample.d.ts +177 -0
  432. package/dist/tools/nanovdb/resample.js +692 -0
  433. package/dist/tools/nanovdb/resample.js.map +1 -0
  434. package/dist/tools/nanovdb/serialize.d.ts +176 -0
  435. package/dist/tools/nanovdb/serialize.js +439 -0
  436. package/dist/tools/nanovdb/serialize.js.map +1 -0
  437. package/dist/tools/nanovdb/stats.d.ts +87 -0
  438. package/dist/tools/nanovdb/stats.js +225 -0
  439. package/dist/tools/nanovdb/stats.js.map +1 -0
  440. package/dist/tools/nanovdb/transform.d.ts +30 -0
  441. package/dist/tools/nanovdb/transform.js +94 -0
  442. package/dist/tools/nanovdb/transform.js.map +1 -0
  443. package/dist/tools/nanovdb/tree.d.ts +186 -0
  444. package/dist/tools/nanovdb/tree.js +530 -0
  445. package/dist/tools/nanovdb/tree.js.map +1 -0
  446. package/dist/tools/nanovdb/write-nvdb.d.ts +74 -0
  447. package/dist/tools/nanovdb/write-nvdb.js +290 -0
  448. package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
  449. package/dist/tools/nvdb-file.d.ts +265 -0
  450. package/dist/tools/nvdb-file.js +763 -0
  451. package/dist/tools/nvdb-file.js.map +1 -0
  452. package/dist/tools/nvdb-stream.d.ts +154 -0
  453. package/dist/tools/nvdb-stream.js +409 -0
  454. package/dist/tools/nvdb-stream.js.map +1 -0
  455. package/dist/tools/reference/analytic.d.ts +41 -0
  456. package/dist/tools/reference/analytic.js +95 -0
  457. package/dist/tools/reference/analytic.js.map +1 -0
  458. package/dist/tools/reference/environment.d.ts +62 -0
  459. package/dist/tools/reference/environment.js +154 -0
  460. package/dist/tools/reference/environment.js.map +1 -0
  461. package/dist/tools/reference/index.d.ts +12 -0
  462. package/dist/tools/reference/index.js +13 -0
  463. package/dist/tools/reference/index.js.map +1 -0
  464. package/dist/tools/reference/media.d.ts +14 -0
  465. package/dist/tools/reference/media.js +30 -0
  466. package/dist/tools/reference/media.js.map +1 -0
  467. package/dist/tools/reference/rng.d.ts +20 -0
  468. package/dist/tools/reference/rng.js +30 -0
  469. package/dist/tools/reference/rng.js.map +1 -0
  470. package/dist/tools/reference/scene.d.ts +312 -0
  471. package/dist/tools/reference/scene.js +169 -0
  472. package/dist/tools/reference/scene.js.map +1 -0
  473. package/dist/tools/reference/tables.d.ts +98 -0
  474. package/dist/tools/reference/tables.js +264 -0
  475. package/dist/tools/reference/tables.js.map +1 -0
  476. package/dist/tools/reference/trace.d.ts +160 -0
  477. package/dist/tools/reference/trace.js +497 -0
  478. package/dist/tools/reference/trace.js.map +1 -0
  479. package/dist/tools/vdb/bit-utils.d.ts +20 -0
  480. package/dist/tools/vdb/bit-utils.js +42 -0
  481. package/dist/tools/vdb/bit-utils.js.map +1 -0
  482. package/dist/tools/vdb/blosc-write.d.ts +43 -0
  483. package/dist/tools/vdb/blosc-write.js +197 -0
  484. package/dist/tools/vdb/blosc-write.js.map +1 -0
  485. package/dist/tools/vdb/blosc.d.ts +86 -0
  486. package/dist/tools/vdb/blosc.js +287 -0
  487. package/dist/tools/vdb/blosc.js.map +1 -0
  488. package/dist/tools/vdb/blosclz.d.ts +33 -0
  489. package/dist/tools/vdb/blosclz.js +112 -0
  490. package/dist/tools/vdb/blosclz.js.map +1 -0
  491. package/dist/tools/vdb/byte-reader.d.ts +50 -0
  492. package/dist/tools/vdb/byte-reader.js +161 -0
  493. package/dist/tools/vdb/byte-reader.js.map +1 -0
  494. package/dist/tools/vdb/compression.d.ts +81 -0
  495. package/dist/tools/vdb/compression.js +260 -0
  496. package/dist/tools/vdb/compression.js.map +1 -0
  497. package/dist/tools/vdb/errors.d.ts +10 -0
  498. package/dist/tools/vdb/errors.js +11 -0
  499. package/dist/tools/vdb/errors.js.map +1 -0
  500. package/dist/tools/vdb/grid.d.ts +37 -0
  501. package/dist/tools/vdb/grid.js +153 -0
  502. package/dist/tools/vdb/grid.js.map +1 -0
  503. package/dist/tools/vdb/half-float.d.ts +9 -0
  504. package/dist/tools/vdb/half-float.js +24 -0
  505. package/dist/tools/vdb/half-float.js.map +1 -0
  506. package/dist/tools/vdb/index.d.ts +4 -0
  507. package/dist/tools/vdb/index.js +3 -0
  508. package/dist/tools/vdb/index.js.map +1 -0
  509. package/dist/tools/vdb/inflate.d.ts +24 -0
  510. package/dist/tools/vdb/inflate.js +334 -0
  511. package/dist/tools/vdb/inflate.js.map +1 -0
  512. package/dist/tools/vdb/lz4.d.ts +30 -0
  513. package/dist/tools/vdb/lz4.js +228 -0
  514. package/dist/tools/vdb/lz4.js.map +1 -0
  515. package/dist/tools/vdb/metadata.d.ts +17 -0
  516. package/dist/tools/vdb/metadata.js +72 -0
  517. package/dist/tools/vdb/metadata.js.map +1 -0
  518. package/dist/tools/vdb/parse.d.ts +47 -0
  519. package/dist/tools/vdb/parse.js +241 -0
  520. package/dist/tools/vdb/parse.js.map +1 -0
  521. package/dist/tools/vdb/point-render-data.d.ts +79 -0
  522. package/dist/tools/vdb/point-render-data.js +137 -0
  523. package/dist/tools/vdb/point-render-data.js.map +1 -0
  524. package/dist/tools/vdb/points.d.ts +186 -0
  525. package/dist/tools/vdb/points.js +835 -0
  526. package/dist/tools/vdb/points.js.map +1 -0
  527. package/dist/tools/vdb/transform.d.ts +23 -0
  528. package/dist/tools/vdb/transform.js +54 -0
  529. package/dist/tools/vdb/transform.js.map +1 -0
  530. package/dist/tools/vdb/tree.d.ts +111 -0
  531. package/dist/tools/vdb/tree.js +228 -0
  532. package/dist/tools/vdb/tree.js.map +1 -0
  533. package/dist/tools/vdb/types.d.ts +195 -0
  534. package/dist/tools/vdb/types.js +3 -0
  535. package/dist/tools/vdb/types.js.map +1 -0
  536. package/dist/tools/wvdb/bake.d.ts +145 -0
  537. package/dist/tools/wvdb/bake.js +361 -0
  538. package/dist/tools/wvdb/bake.js.map +1 -0
  539. package/dist/tools/wvdb/dense.d.ts +191 -0
  540. package/dist/tools/wvdb/dense.js +368 -0
  541. package/dist/tools/wvdb/dense.js.map +1 -0
  542. package/dist/tools/wvdb/format.d.ts +220 -0
  543. package/dist/tools/wvdb/format.js +306 -0
  544. package/dist/tools/wvdb/format.js.map +1 -0
  545. package/dist/tools/wvdb/index.d.ts +14 -0
  546. package/dist/tools/wvdb/index.js +15 -0
  547. package/dist/tools/wvdb/index.js.map +1 -0
  548. package/dist/tools/wvdb/level-set.d.ts +56 -0
  549. package/dist/tools/wvdb/level-set.js +153 -0
  550. package/dist/tools/wvdb/level-set.js.map +1 -0
  551. package/dist/tools/wvdb/nanovdb.d.ts +59 -0
  552. package/dist/tools/wvdb/nanovdb.js +64 -0
  553. package/dist/tools/wvdb/nanovdb.js.map +1 -0
  554. package/dist/tools/wvdb/partial.d.ts +74 -0
  555. package/dist/tools/wvdb/partial.js +233 -0
  556. package/dist/tools/wvdb/partial.js.map +1 -0
  557. package/dist/tools/wvdb/read.d.ts +336 -0
  558. package/dist/tools/wvdb/read.js +766 -0
  559. package/dist/tools/wvdb/read.js.map +1 -0
  560. package/dist/tools/wvdb/sha256.d.ts +7 -0
  561. package/dist/tools/wvdb/sha256.js +76 -0
  562. package/dist/tools/wvdb/sha256.js.map +1 -0
  563. package/dist/tools/wvdb/write.d.ts +149 -0
  564. package/dist/tools/wvdb/write.js +403 -0
  565. package/dist/tools/wvdb/write.js.map +1 -0
  566. package/package.json +83 -4
  567. package/vendor/LICENSE +201 -0
  568. package/vendor/NOTICE +19 -0
  569. package/vendor/VENDOR.md +100 -0
  570. package/vendor/pnanovdb.wgsl +1577 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool.js","sourceRoot":"","sources":["../../../src/core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,IAAI,CAAC;YAC5B,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;YAChD,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;YAChD,YAAY,EAAE,CAAC,CAAC,YAAY;YAC5B,YAAY,EAAE,CAAC,CAAC,YAAY;YAC5B,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YAC3B,cAAc,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;YACrC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SACrC,CAAC;IACJ,CAAC;CACF","sourcesContent":["/**\n * `VDBGridPool`: many NanoVDB grids in one `GPUBuffer` behind a grid table\n * (docs/dev/design/K1-core.md §1, §4; D8, D10).\n *\n * Model: CPU calls (`add`, `replace`, `remove`, `setTransform`, `setMajorant`,\n * `buildMajorant`) stage changes and return at once; `update(encoder)` applies them\n * (and records the staged GPU majorant builds, P1.15). Growth and\n * compaction happen only in `update`, by a new buffer plus copies of the ranges\n * that were resident before that update; `version` bumps then (and when a\n * failed growth rolls back to the previous buffer).\n *\n * Lifecycle (docs/archive/handoffs/K1.md, \"K1.3 pool lifecycle\"):\n * - A request that could never fit under the byte limit throws `VDB_POOL_LIMIT`\n * at staging, with the pool unchanged.\n * - Growth allocates inside `out-of-memory` and `validation` error scopes. The\n * pool switches to the new buffer at once (update is synchronous) but keeps\n * the old one alive until the scopes resolve; on an error it rolls back to the\n * old buffer and reports through `settled()` / `lastError`.\n * - A retired buffer is destroyed once its growth is confirmed, two `update`s\n * have passed, and `queue.onSubmittedWorkDone()` asked at that point resolves.\n */\n\nimport { VDBError } from \"../errors.js\";\nimport { brickMajorantLayout, type VDBBrickMajorant, type VDBBrickMajorantOptions } from \"../../tools/cpu/majorant.js\";\nimport { VDBToolsError } from \"../../tools/errors.js\";\nimport {\n MAJORANT_BUILD_MAX_LOG2,\n MAJORANT_BUILD_PARAMS_BYTES,\n majorantBuildPipeline,\n packMajorantBuild,\n} from \"../compute/majorant-build.js\";\nimport { applyAffine, composeGridAffines, type GridAffines } from \"./affine.js\";\nimport { RangeAllocator, type AllocatedRange } from \"./allocator.js\";\nimport type { VDBGridTypeName, VDBSlot } from \"../types.js\";\nimport { gridClassName, readImageHeader, type VDBImageHeader } from \"./image-header.js\";\nimport {\n VDB_GPU_LAYOUT_VERSION,\n VDB_MAJORANT_HEADER_BYTES,\n VDB_POOL_HEADER_WORDS,\n VDB_POOL_RECORD_WORDS,\n align32,\n dataStartOffset,\n encodeHeader,\n encodeMajorantRange,\n encodeRecord,\n recordByteOffset,\n type VDBGridRecord,\n type VDBVec3,\n} from \"./layout.js\";\nimport {\n BUFFER_USAGE,\n POOL_BUFFER_USAGE,\n deviceByteLimit,\n floor32,\n requiredLimits,\n unsupportedReason,\n watchDevice,\n} from \"./limits.js\";\n\n/**\n * A dense grid of upper (and optionally lower) bounds over a grid's index space, one f32 per brick of\n * `2^brickLog2` voxels per side, x fastest (§5.1). Built by `tools` (`vdbBrickMajorant`); the pool only\n * stores it (one declaration, shared with `@pmndrs/vdb/tools`, D32).\n */\nexport type { VDBBrickMajorant, VDBBrickMajorantOptions } from \"../../tools/cpu/majorant.js\";\n\n/** A 4x4 column-major object-to-world matrix (three's `Matrix4.elements`), or `null` for the file's map. */\nexport type VDBTransformInput = Float32Array | Float64Array | readonly number[] | null;\n\n/** Options for {@link VDBGridPool.create}. */\nexport interface VDBGridPoolOptions {\n /** Initial buffer bytes (default 1 MiB); the first `update` grows it to fit. */\n initialBytes?: number;\n /** Initial table capacity in grids (default 16); the table doubles through the growth path. */\n maxGrids?: number;\n /** Upper bound on the buffer size (default: the device limit). */\n maxBytes?: number;\n /** Debug label for the buffers the pool creates. */\n label?: string;\n /** Extra `GPUBufferUsage` flags ORed into `STORAGE | COPY_DST | COPY_SRC`. */\n usage?: number;\n /**\n * A host-owned buffer to use instead. It must have `STORAGE | COPY_DST`\n * usage. The pool never destroys it and never grows it: when it is full,\n * `add`/`replace`/`setMajorant` throw `VDB_POOL_FULL`.\n */\n buffer?: GPUBuffer;\n}\n\n/** Options for {@link VDBGridPool.add}. */\nexport interface VDBAddOptions {\n /** Bytes to reserve for the image (at least its size), so later `replace` calls fit in place. */\n capacity?: number;\n /** Instance transform (see {@link VDBGridPool.setTransform}). */\n transform?: VDBTransformInput;\n /** Brick-majorant bounds for this grid (see {@link VDBGridPool.setMajorant}). */\n majorant?: VDBBrickMajorant;\n /**\n * Global bound of the grid's values (record word 35): what `vdbMajorantGlobal(g)` returns and the `'global'`\n * majorant walk uses. Default `max(root max, background)` when the image has statistics, else +Infinity\n * (see {@link VDBGridPool.setValueMax}, which also changes it later).\n */\n valueMax?: number;\n /** Free-form label, reported by `info`. */\n label?: string;\n}\n\n/** What {@link VDBGridPool.info} reports about one grid. */\nexport interface VDBGridInfo {\n /** The grid's pool id. */\n id: number;\n /** The grid's value type (a NanoVDB grid type name). */\n type: VDBGridTypeName;\n /** NanoVDB `GridType` id. */\n gridTypeId: number;\n /** NanoVDB `GridClass` name, e.g. `\"FogVolume\"`. */\n gridClass: string;\n /** NanoVDB `GridClass` id. */\n gridClassId: number;\n /** Grid name from the image header. */\n name: string;\n /** The `label` given to `add`, if any. */\n label: string | undefined;\n /** Size of the grid image in bytes. */\n imageBytes: number;\n /** Bytes reserved for the image (≥ `imageBytes`, 32 B multiple). */\n capacity: number;\n /** Byte offset of the image in the pool, or `null` until an `update` places it. */\n imageOffset: number | null;\n /** True once the image bytes are on the GPU (after the `update` that wrote them). */\n resident: boolean;\n /**\n * The pool {@link VDBGridPool.revision} at this grid's last `add` or `replace`: changes exactly\n * when the image's contents may have (not on `setTransform` / `setMajorant`). Data derived from the\n * image (a coarse pyramid, K3.2a) rebuilds when it moves; ids reused after `remove` get a new one.\n */\n imageRevision: number;\n /** True when the image carries node statistics (min/max/average/deviation). */\n hasStats: boolean;\n /** True when brick-majorant bounds are set for this grid. */\n hasBrickMajorant: boolean;\n /** Byte offset of the majorant data in the pool, or `null` when none is placed. */\n majorantOffset: number | null;\n /** Brick counts of the majorant per axis, or `null` when none. */\n majorantDims: VDBVec3 | null;\n /** Index position of the majorant's cell 0 (P1.3), or `null` when none. */\n majorantOrigin: VDBVec3 | null;\n /** True when the majorant carries lower bounds (the module's `minima` reads them). */\n majorantMinima: boolean;\n /**\n * True when the pool builds the majorant itself ({@link VDBGridPool.buildMajorant}, P1.15: a compute pass that\n * follows the image) rather than holding data the host set (`add(image, { majorant })`, `setMajorant`).\n */\n majorantBuilt: boolean;\n /** True when an instance transform (`setTransform`) is set. */\n instanceTransform: boolean;\n /** The tree's background value. */\n background: number;\n /**\n * Global bound of the grid's values (record word 35): the host's (`add`'s `valueMax`, `setValueMax`), else\n * `max(rootMax, background)`, else +Infinity for an image without statistics.\n */\n valueMax: number;\n /**\n * The root node's min/max statistics as stored in the image (f32). Meaningful\n * only when `hasStats`; without stats they are whatever the file holds\n * (usually 0). `gridStats` and `decodeToAtlas` use them as their range.\n */\n rootMin: number;\n /** Root max statistic; see `rootMin`. */\n rootMax: number;\n /**\n * The root node's average statistic: the mean of the grid's active values (f32), or NaN for an image without\n * one. `VDBVolumeMaterial` (`@pmndrs/vdb/three`) sizes its default density by it.\n */\n rootAverage: number;\n /** Voxel size per axis in the grid's own world units (before the instance transform). */\n voxelSize: VDBVec3;\n /** Inclusive index-space box of the active voxels. */\n indexBBox: { min: VDBVec3; max: VDBVec3 };\n /** World-space AABB of the index bbox's voxels (max corner + 1 voxel), through the record's f64 transform. */\n worldBBox: { min: VDBVec3; max: VDBVec3 };\n /** f64 affines before f32 rounding, 3x4 row-major. */\n worldToIndex: Float64Array;\n /** Index-to-world affine, 3x4 row-major, f64. */\n indexToWorld: Float64Array;\n}\n\n/** A sub-allocated range plus its GPU state. */\ninterface RangeState {\n range: AllocatedRange | null;\n /** The GPU holds this range's current bytes at `range.offset`. */\n resident: boolean;\n}\n\ninterface MajorantState extends RangeState {\n brickLog2: number;\n dims: VDBVec3;\n origin: VDBVec3;\n minima: boolean;\n bytes: number;\n pending: Float32Array | null;\n /** The data last written, kept while a growth is unconfirmed so a rollback can stage it again. */\n retained: Float32Array | null;\n /** Built on the GPU (`buildMajorant`, P1.15) rather than written from CPU data; `null` for CPU data. */\n gpu: GpuMajorantBuild | null;\n}\n\n/** A GPU-built brick majorant (P1.15): the options it was built with and whether the range needs a (re)build. */\ninterface GpuMajorantBuild {\n options: VDBBrickMajorantOptions;\n zero: boolean;\n pathtracer: boolean;\n resolution: VDBVec3;\n /** The current buffer's range does not hold this build yet: the next `update` records it. */\n stale: boolean;\n}\n\ninterface GridState {\n header: VDBImageHeader;\n label: string | undefined;\n capacity: number;\n image: RangeState;\n pendingImage: Uint32Array | null;\n /** The image last written, kept while a growth is unconfirmed so a rollback can stage it again. */\n retainedImage: Uint32Array | null;\n /** +1 per `replace`: tells a rollback whether the old buffer still holds this grid's current image. */\n imageSerial: number;\n /** The pool `revision` of this grid's last `add` / `replace` (K3.2a: derived data rebuilds on a change). */\n imageRevision: number;\n transform: Float64Array | null;\n affines: GridAffines;\n valueMaxOverride: number | undefined;\n majorant: MajorantState | null;\n}\n\n/** What the buffer a growth copied from holds for one grid (clean, resident ranges only). */\ninterface GridSnapshot {\n imageSerial: number;\n image: AllocatedRange | null;\n majorant: MajorantState | null;\n majorantRange: AllocatedRange | null;\n}\n\n/** A growth whose allocation the device hasn't confirmed yet. */\ninterface Growth {\n /** The buffer copied from; kept alive until this growth is confirmed or rolled back. */\n from: GPUBuffer;\n to: GPUBuffer;\n /** Table capacity of `from`. */\n capacity: number;\n /** `update` count when it happened. */\n update: number;\n snapshot: Map<GridState, GridSnapshot>;\n /** Settles in growth order; resolves to the rollback error, or `null` when confirmed or voided. */\n done: Promise<VDBError | null>;\n}\n\n/** A replaced buffer (or a GPU majorant build's parameters) awaiting destruction. */\ninterface Retired {\n buffer: GPUBuffer;\n /** A build's uniform parameters (not counted in `retiredBytes`). */\n params?: boolean;\n /** `update` count of the growth that replaced it. */\n since: number;\n /** `onSubmittedWorkDone` has been requested for it. */\n waiting: boolean;\n}\n\n/** Updates a retired buffer must outlive before the pool asks the queue about it (one update of slack to submit). */\nconst RETIRE_AFTER_UPDATES = 2;\n\nconst DEFAULT_INITIAL_BYTES = 1 << 20;\nconst DEFAULT_MAX_GRIDS = 16;\n\nfunction badOption(message: string): never {\n throw new VDBError(\"VDB_BAD_OPTION\", message);\n}\n\nfunction checkCount(name: string, value: unknown, min: number): number {\n if (typeof value !== \"number\" || !Number.isInteger(value) || value < min) {\n badOption(`${name} must be an integer ≥ ${min}, got ${String(value)}.`);\n }\n return value;\n}\n\nfunction copyTransform(m: VDBTransformInput | undefined): Float64Array | null {\n if (m === null || m === undefined) return null;\n return Float64Array.from(m);\n}\n\n/**\n * Checks a brick majorant and packs its range (P1.3: header, upper bounds, optional lower bounds;\n * `encodeMajorantRange`). Without `origin` the cells start at the grid's `indexBBoxMin - 1`.\n */\nfunction validateMajorant(m: VDBBrickMajorant, header: VDBImageHeader): MajorantState {\n if (typeof m !== \"object\" || m === null) badOption(\"majorant must be { brickLog2, dims, data } or null.\");\n checkCount(\"majorant.brickLog2\", m.brickLog2, 0);\n if (m.brickLog2 > 10) badOption(`majorant.brickLog2 is ${m.brickLog2}; bricks larger than 1024 voxels aren't supported.`);\n if (!Array.isArray(m.dims) && !ArrayBuffer.isView(m.dims)) badOption(\"majorant.dims must be [x, y, z].\");\n if (m.dims.length !== 3) badOption(`majorant.dims must have 3 entries, got ${m.dims.length}.`);\n const dims: VDBVec3 = [m.dims[0], m.dims[1], m.dims[2]];\n dims.forEach((d, k) => checkCount(`majorant.dims[${k}]`, d, 1));\n if (!(m.data instanceof Float32Array)) badOption(\"majorant.data must be a Float32Array.\");\n const cells = dims[0] * dims[1] * dims[2];\n if (m.data.length !== cells) {\n badOption(`majorant.data has ${m.data.length} values; dims ${dims.join(\"x\")} need ${cells}. Rebuild the majorant.`);\n }\n if (m.minima !== undefined) {\n if (!(m.minima instanceof Float32Array)) badOption(\"majorant.minima must be a Float32Array (or absent).\");\n if (m.minima.length !== cells) badOption(`majorant.minima has ${m.minima.length} values; dims ${dims.join(\"x\")} need ${cells}. Rebuild the majorant.`);\n }\n let origin: VDBVec3;\n if (m.origin === undefined) {\n const lo = header.indexBBoxMin;\n origin = [lo[0] - 1, lo[1] - 1, lo[2] - 1];\n } else {\n if ((!Array.isArray(m.origin) && !ArrayBuffer.isView(m.origin)) || m.origin.length !== 3) badOption(\"majorant.origin must be [x, y, z].\");\n origin = [m.origin[0], m.origin[1], m.origin[2]];\n origin.forEach((v, k) => {\n if (!Number.isInteger(v) || v < -(2 ** 31) || v >= 2 ** 31) badOption(`majorant.origin[${k}] must be a 32-bit integer, got ${String(v)}.`);\n });\n }\n const minima = m.minima !== undefined;\n const bytes = VDB_MAJORANT_HEADER_BYTES + cells * 4 * (minima ? 2 : 1);\n if (bytes > 2 ** 32 - 32) badOption(`majorant needs ${bytes} bytes; the pool addresses ranges with 32 bits.`);\n const pending = encodeMajorantRange({ origin, dims, data: m.data, minima: m.minima });\n return { brickLog2: m.brickLog2, dims, origin, minima, bytes, pending, retained: null, range: null, resident: false, gpu: null };\n}\n\n/**\n * Lays out a GPU-built brick majorant for `header` (P1.15): the CPU twin's layout (`brickMajorantLayout`, so origin and\n * dims equal `tools` `vdbBrickMajorant`'s), no data; `update` records the build.\n */\nfunction gpuMajorant(options: VDBBrickMajorantOptions, header: VDBImageHeader): MajorantState {\n let layout: ReturnType<typeof brickMajorantLayout>;\n try {\n layout = brickMajorantLayout(header.indexBBoxMin, header.indexBBoxMax, options);\n } catch (e) {\n if (e instanceof VDBToolsError) badOption(`buildMajorant: ${e.message.replace(/^.*?vdbBrickMajorant: /, \"\")}`);\n throw e;\n }\n if (layout.brickLog2 > MAJORANT_BUILD_MAX_LOG2) {\n badOption(\n `buildMajorant: brickLog2 ${layout.brickLog2} is over the GPU builder's ${MAJORANT_BUILD_MAX_LOG2} (one workgroup reads (B + 1)³ taps per cell). ` +\n \"Build it on the CPU (tools vdbBrickMajorant) and pass it to setMajorant.\",\n );\n }\n const minima = options.minima === true;\n const cells = layout.dims[0] * layout.dims[1] * layout.dims[2];\n const bytes = VDB_MAJORANT_HEADER_BYTES + cells * 4 * (minima ? 2 : 1);\n if (bytes > 2 ** 32 - 32) badOption(`buildMajorant: the majorant needs ${bytes} bytes; the pool addresses ranges with 32 bits.`);\n const gpu: GpuMajorantBuild = {\n options: { ...options },\n zero: layout.zero,\n pathtracer: layout.align === \"pathtracer\",\n resolution: layout.resolution,\n stale: true,\n };\n return {\n brickLog2: layout.brickLog2,\n dims: layout.dims,\n origin: layout.origin,\n minima,\n bytes,\n pending: null,\n retained: null,\n range: null,\n resident: false,\n gpu,\n };\n}\n\n/**\n * `queue.writeBuffer` for any typed array. The WebGPU typings want an\n * `ArrayBuffer`-backed view; callers' arrays are typed `ArrayBufferLike`, and\n * writeBuffer copies the bytes either way.\n */\nfunction write(queue: GPUQueue, buffer: GPUBuffer, offset: number, data: Uint32Array | Float32Array): void {\n queue.writeBuffer(buffer, offset, data as Uint32Array<ArrayBuffer>);\n}\n\nfunction checkValueMax(v: number | undefined, what = \"valueMax must be a number\"): number | undefined {\n if (v === undefined) return undefined;\n if (typeof v !== \"number\" || Number.isNaN(v)) badOption(`${what}, got ${String(v)}.`);\n return v;\n}\n\n/**\n * Many NanoVDB grids in one storage buffer, bound at one slot (D10). The pool\n * takes the host's `GPUDevice`, records into the host's encoder, and frees only\n * what it allocated (D8).\n *\n * Images passed to `add`/`replace` are held by reference (not copied) until the\n * next `update` writes them, and after that while a growth is unconfirmed\n * (until `settled()` resolves); don't mutate them before then.\n */\nexport class VDBGridPool {\n /** The device the pool allocates on. */\n readonly device: GPUDevice;\n\n #buffer: GPUBuffer;\n #ownsBuffer: boolean;\n #retired: Retired[] = [];\n #growths: Growth[] = [];\n #updates = 0;\n #lastError: VDBError | null = null;\n #version = 0;\n #revision = 0;\n #capacity: number;\n #limit: number;\n #label: string;\n #usage: number;\n #grids: (GridState | undefined)[] = [];\n #alloc: RangeAllocator;\n #dirtyRecords = new Set<number>();\n #headerDirty = true;\n #disposed = false;\n\n /**\n * Use {@link VDBGridPool.create}.\n *\n * @param device The host's device.\n * @param buffer The pool buffer.\n * @param owns True when the pool created `buffer` and frees it.\n * @param capacity Grid table capacity in grids.\n * @param limit Upper bound on the buffer size in bytes.\n * @param label Debug label of the buffers.\n * @param usage Extra `GPUBufferUsage` flags of the buffer.\n */\n private constructor(device: GPUDevice, buffer: GPUBuffer, owns: boolean, capacity: number, limit: number, label: string, usage: number) {\n this.device = device;\n this.#buffer = buffer;\n this.#ownsBuffer = owns;\n this.#capacity = capacity;\n this.#limit = limit;\n this.#label = label;\n this.#usage = usage;\n this.#alloc = new RangeAllocator(dataStartOffset(capacity), buffer.size);\n }\n\n /**\n * Creates a pool on `device`. Throws `VDB_UNSUPPORTED_DEVICE` (see\n * {@link unsupportedReason}) or `VDB_BAD_OPTION`. The returned pool is\n * bindable at once (an empty table).\n *\n * @param device The host's `GPUDevice`.\n * @param options Initial size, table capacity, limits, label, usage and an optional host buffer.\n */\n static async create(device: GPUDevice, options: VDBGridPoolOptions = {}): Promise<VDBGridPool> {\n const reason = unsupportedReason(device);\n if (reason !== null) throw new VDBError(\"VDB_UNSUPPORTED_DEVICE\", reason);\n watchDevice(device);\n\n const capacity = checkCount(\"maxGrids\", options.maxGrids ?? DEFAULT_MAX_GRIDS, 1);\n const usage = checkCount(\"usage\", options.usage ?? 0, 0);\n const label = options.label ?? \"vdb pool\";\n const deviceLimit = deviceByteLimit(device);\n let limit = deviceLimit;\n if (options.maxBytes !== undefined) limit = Math.min(limit, floor32(checkCount(\"maxBytes\", options.maxBytes, 1)));\n const tableEnd = dataStartOffset(capacity);\n\n let pool: VDBGridPool;\n if (options.buffer !== undefined) {\n if (options.initialBytes !== undefined) badOption(\"initialBytes and buffer are exclusive; the host buffer's size is the pool size.\");\n const host = options.buffer;\n const need = BUFFER_USAGE.STORAGE | BUFFER_USAGE.COPY_DST;\n if ((host.usage & need) !== need) {\n badOption(\"The host buffer needs GPUBufferUsage.STORAGE | COPY_DST. Create it with those flags.\");\n }\n if (host.size % 4 !== 0) badOption(`The host buffer is ${host.size} bytes; storage buffers must be a multiple of 4.`);\n if (host.size > deviceLimit) {\n badOption(\n `The host buffer is ${host.size} bytes; this device binds at most ${deviceLimit}. ` +\n `Use a smaller buffer or request the device with VDBGridPool.requiredLimits(adapter).`,\n );\n }\n if (host.size < tableEnd) {\n badOption(`The host buffer is ${host.size} bytes; a ${capacity}-grid table needs ${tableEnd}. Lower maxGrids or enlarge it.`);\n }\n pool = new VDBGridPool(device, host, false, capacity, floor32(host.size), label, usage);\n // A host buffer may hold old data: clear the header and table.\n pool.#writeTable();\n } else {\n if (tableEnd > limit) {\n badOption(`A ${capacity}-grid table needs ${tableEnd} bytes; the pool limit is ${limit}. Lower maxGrids.`);\n }\n const initial = checkCount(\"initialBytes\", options.initialBytes ?? DEFAULT_INITIAL_BYTES, 1);\n const size = Math.min(limit, Math.max(align32(initial), tableEnd));\n device.pushErrorScope(\"out-of-memory\");\n const buffer = device.createBuffer({ label: `${label} (v0)`, size, usage: POOL_BUFFER_USAGE | usage });\n const oom = await device.popErrorScope();\n if (oom) {\n buffer.destroy();\n throw new VDBError(\"VDB_POOL_LIMIT\", `The device could not allocate ${size} bytes (${oom.message}). Lower initialBytes.`);\n }\n pool = new VDBGridPool(device, buffer, true, capacity, limit, label, usage);\n pool.#writeHeader();\n }\n return pool;\n }\n\n /** True when `device` can hold a pool. */\n static isSupported(device: GPUDevice): boolean {\n return unsupportedReason(device) === null;\n }\n\n /** Why `device` can't hold a pool, or `null`. */\n static unsupportedReason(device: GPUDevice): string | null {\n return unsupportedReason(device);\n }\n\n /** Limits for `adapter.requestDevice({ requiredLimits })` so the pool can grow to the adapter's maxima. */\n static requiredLimits(adapter: GPUAdapter): Record<string, number> {\n return requiredLimits(adapter);\n }\n\n /**\n * The pool's buffer. Replaced by a growth in `update`, or by the rollback of\n * a growth whose allocation failed (asynchronously; see `settled`); `version`\n * changes each time.\n */\n get buffer(): GPUBuffer {\n return this.#buffer;\n }\n\n /**\n * +1 whenever `buffer` changes object: rebuild bind groups. Monotonic: a\n * failed growth's rollback to the previous buffer is a new version too.\n *\n * Read it after `update(encoder)`: call `update(encoder)` before building\n * or reusing bind groups this frame. A bind group built before `update()`\n * keeps the previous (still-alive) buffer and silently misses new grids.\n */\n get version(): number {\n return this.#version;\n }\n\n /** +1 on every content change (add, replace, remove, setTransform, setValueMax, setMajorant, buildMajorant). */\n get revision(): number {\n return this.#revision;\n }\n\n /** {@link VDB_GPU_LAYOUT_VERSION}. */\n get layoutVersion(): number {\n return VDB_GPU_LAYOUT_VERSION;\n }\n\n /** Size of `buffer` in bytes. */\n get byteLength(): number {\n return this.#buffer.size;\n }\n\n /** Allocation high-water mark in bytes (header word 6). */\n get usedBytes(): number {\n return this.#alloc.highWater;\n }\n\n /** Bytes in replaced buffers still alive: awaiting growth confirmation or the queue (see `update`). */\n get retiredBytes(): number {\n let n = 0;\n for (const r of this.#retired) if (!r.params) n += r.buffer.size;\n for (const g of this.#growths) n += g.from.size;\n return n;\n }\n\n /**\n * The error from the last growth whose allocation failed (`VDB_POOL_LIMIT`;\n * the pool rolled back to its previous buffer), or `null`. Cleared when a\n * later growth is confirmed.\n */\n get lastError(): VDBError | null {\n return this.#lastError;\n }\n\n /**\n * Resolves once every growth started so far is confirmed by the device;\n * rejects with the `VDB_POOL_LIMIT` error if one failed and the pool rolled\n * back (see {@link lastError}). Resolves at once when no growth is pending.\n */\n settled(): Promise<void> {\n this.#checkAlive();\n return Promise.all(this.#growths.map((g) => g.done)).then((errors) => {\n const error = errors.find((e) => e !== null);\n if (error) throw error;\n });\n }\n\n /** Records in the grid table. */\n get gridCapacity(): number {\n return this.#capacity;\n }\n\n /** Highest live id + 1 (header word 3). */\n get gridCount(): number {\n for (let id = this.#grids.length - 1; id >= 0; id--) if (this.#grids[id]) return id + 1;\n return 0;\n }\n\n /**\n * Grid types of the live grids now, for `vdbCheckModule` and\n * `vdbModuleWgsl({ types })`. It does not know about grids the host adds\n * later: generate the module for every type the host may add (see `add`).\n */\n get types(): ReadonlySet<VDBGridTypeName> {\n const out = new Set<VDBGridTypeName>();\n for (const g of this.#grids) if (g) out.add(g.header.gridType);\n return out;\n }\n\n /**\n * Stages a grid image and returns its id at once. The image is validated\n * here (`VDB_BAD_IMAGE`, `VDB_UNSUPPORTED_GRID_TYPE`) and written by the next\n * `update`. Dead ids are reused, lowest first.\n *\n * The shader reading this pool decodes only the types its module was\n * generated for; a grid of any other type reads as 0. A module must\n * therefore be generated for every type the host may add (its known set,\n * or `VDB_ALL_SCALAR_TYPES`), or regenerated and its pipeline rebuilt when\n * a new type arrives. Call `vdbCheckModule(pool, options)` after `add` to\n * catch a mismatch (`VDB_TYPE_NOT_COMPILED`).\n *\n * @param image A NanoVDB grid image (one grid) as 32-bit words.\n * @param options Reserved capacity, transform, majorant, density bound and label.\n */\n add(image: Uint32Array, options: VDBAddOptions = {}): number {\n this.#checkAlive();\n const header = readImageHeader(image);\n const capacity = align32(Math.max(header.byteLength, checkCount(\"capacity\", options.capacity ?? 0, 0)));\n const transform = copyTransform(options.transform);\n const affines = composeGridAffines(header, transform);\n const valueMaxOverride = checkValueMax(options.valueMax);\n const majorant = options.majorant ? validateMajorant(options.majorant, header) : null;\n\n let id = this.#grids.findIndex((g) => g === undefined);\n if (id < 0) id = this.#grids.length;\n if (!this.#ownsBuffer && id >= this.#capacity) {\n throw new VDBError(\n \"VDB_POOL_FULL\",\n `The host buffer's table holds ${this.#capacity} grids and all are live. Remove a grid, or create the pool with a larger maxGrids.`,\n );\n }\n this.#checkCanFit(Math.max(this.#grids.length, id + 1), majorant ? [capacity, majorant.bytes] : [capacity], \"image\");\n const grid: GridState = {\n header,\n label: options.label,\n capacity,\n image: { range: null, resident: false },\n pendingImage: image,\n retainedImage: null,\n imageSerial: 0,\n imageRevision: 0,\n transform,\n affines,\n valueMaxOverride,\n majorant,\n };\n // Place now when it fits; a host buffer must fit now (it never grows).\n const tableFits = id < this.#capacity && this.#grids.length <= this.#capacity;\n this.#place(grid.image, capacity, \"image\", tableFits);\n if (majorant) {\n try {\n this.#place(majorant, majorant.bytes, \"majorant\", tableFits);\n } catch (e) {\n if (grid.image.range) this.#alloc.free(grid.image.range.offset);\n throw e;\n }\n }\n this.#grids[id] = grid;\n this.#touch(id);\n grid.imageRevision = this.#revision;\n return id;\n }\n\n /**\n * Stages a new image for grid `id`. It is written in place when it fits the\n * grid's reserved range (no `version` change: the sequence-player path), else\n * moved. A brick majorant set on the grid is dropped (it described the old\n * image); call `setMajorant` again. Transform, label and `valueMax` are kept.\n *\n * @param id The grid's pool id.\n * @param image The new grid image, as for `add`.\n */\n replace(id: number, image: Uint32Array): void {\n this.#checkAlive();\n const grid = this.#grid(id);\n const header = readImageHeader(image);\n // A GPU-built majorant follows the image (P1.15): lay it out for the new image before anything changes.\n const rebuild = grid.majorant?.gpu ? gpuMajorant(grid.majorant.gpu.options, header) : null;\n if (align32(header.byteLength) > grid.capacity) {\n const capacity = align32(header.byteLength);\n this.#checkCanFit(this.#grids.length, rebuild ? [capacity, rebuild.bytes] : [capacity], \"image\"); // replace drops a CPU majorant\n const next: RangeState = { range: null, resident: false };\n this.#replaceRange(grid.image.range, () => this.#place(next, capacity, \"image\"));\n grid.image = next;\n grid.capacity = capacity;\n }\n grid.header = header;\n grid.pendingImage = image;\n grid.imageSerial++;\n grid.affines = composeGridAffines(header, grid.transform);\n if (rebuild) this.#installMajorant(grid, rebuild);\n else this.#dropMajorant(grid);\n this.#touch(id);\n grid.imageRevision = this.#revision;\n }\n\n /** Frees grid `id`'s ranges and clears its record; the id may be reused by the next `add`. */\n remove(id: number): void {\n this.#checkAlive();\n const grid = this.#grid(id);\n if (grid.image.range) this.#alloc.free(grid.image.range.offset);\n this.#dropMajorant(grid);\n this.#grids[id] = undefined;\n while (this.#grids.length > 0 && this.#grids[this.#grids.length - 1] === undefined) this.#grids.pop();\n this.#touch(id);\n }\n\n /**\n * Sets grid `id`'s instance transform: a 4x4 column-major object-to-world\n * matrix (WebGPU / three convention), or `null` for the file's own map. The\n * pool composes `worldToIndex = map⁻¹ ∘ objectToWorld⁻¹` and `indexToWorld`\n * in f64 and rounds to f32. Only the record changes; the image is untouched.\n *\n * @param id The grid's pool id.\n * @param objectToWorld A 4x4 column-major matrix, or `null` for the file's own map.\n */\n setTransform(id: number, objectToWorld: VDBTransformInput): void {\n this.#checkAlive();\n const grid = this.#grid(id);\n const transform = copyTransform(objectToWorld);\n grid.affines = composeGridAffines(grid.header, transform);\n grid.transform = transform;\n this.#touch(id);\n }\n\n /**\n * Stores brick-majorant bounds for grid `id` in the pool (record words\n * 36–39, flag b2, brick log2 in b16–23), or clears them with `null`.\n *\n * @param id The grid's pool id.\n * @param majorant The brick bounds, or `null` to clear them.\n */\n setMajorant(id: number, majorant: VDBBrickMajorant | null): void {\n this.#checkAlive();\n const grid = this.#grid(id);\n if (majorant === null) {\n this.#dropMajorant(grid);\n this.#touch(id);\n return;\n }\n this.#installMajorant(grid, validateMajorant(majorant, grid.header));\n this.#touch(id);\n }\n\n /**\n * Builds grid `id`'s brick majorant on the GPU (P1.15; K1-core §5.1) instead of taking CPU data: the next\n * `update(encoder)` records a compute pass into `encoder`, after its writes, that fills the majorant range\n * (header, upper bounds, optional lower bounds). The result equals `tools` `vdbBrickMajorant(image, options)`\n * bit for bit (same options, same layout; Fp8 / FpN on a GPU that fuses the decode's multiply-add may differ by\n * the reader's 1 ulp, as `vdbReadValue` itself does).\n *\n * The build follows the image: `replace` lays it out again and the next `update` rebuilds it (a sequence\n * keeps GPU bricks without a CPU pass per frame). `setMajorant` replaces it with CPU data, `null` clears it.\n * Record passes that read the majorant after that `update`.\n *\n * @param id The grid's pool id.\n * @param options As `vdbBrickMajorant`'s: `brickLog2` (0..6 on the GPU), `minima`, `align`, `outside`, `resolution`.\n * @throws VDBError `VDB_BAD_OPTION` for invalid options (as the CPU builder), `VDB_POOL_LIMIT` / `VDB_POOL_FULL` as `setMajorant`.\n */\n buildMajorant(id: number, options: VDBBrickMajorantOptions = {}): void {\n this.#checkAlive();\n const grid = this.#grid(id);\n this.#installMajorant(grid, gpuMajorant(options, grid.header));\n this.#touch(id);\n }\n\n /**\n * Sets grid `id`'s global value bound (record word 35; EX1f-a), or with `null` returns to the default. Only\n * the record changes: the next `update` writes 160 bytes, and `version` does not move. The bound is kept\n * across `replace`, as `add`'s `valueMax` is, so set it again (or pass `null`) when the new image needs another.\n *\n * It is what `vdbMajorantGlobal(g)` returns and what the `'global'` majorant walk uses (a `'brick'` module\n * walks a grid without brick bounds the same way), so every sample of the grid must be at or under it.\n *\n * The default, `max(root max, background)`, costs nothing and holds whenever the inactive values are the\n * background, but it counts a root background that no voxel near the grid may hold: 3 against 1 on a fog\n * volume converted from a level set, and with `outside: 'zero'` a background the field never takes outside\n * the bbox. `vdbValueRange(image, { outside }).max` (`@pmndrs/vdb/tools`) is the exact bound over the box the\n * walks cover; for a fog volume whose inactive voxels are 0, `Math.max(pool.info(id).rootMax, 0)` is the\n * same number without the tree walk. An image without statistics has no default (+Infinity): give it a\n * bound here (`vdbCheckModule` throws `VDB_NO_STATS` for a majorant module that would walk it).\n *\n * @param id The grid's pool id.\n * @param valueMax The bound, or `null` for the default.\n * @throws VDBError `VDB_BAD_OPTION` when `valueMax` is not a number, `VDB_UNKNOWN_GRID` for a dead id.\n */\n setValueMax(id: number, valueMax: number | null): void {\n this.#checkAlive();\n const grid = this.#grid(id);\n grid.valueMaxOverride = valueMax === null ? undefined : checkValueMax(valueMax, \"setValueMax: valueMax must be a number or null\");\n this.#touch(id);\n }\n\n /**\n * The live grids whose global bound (`info(id).valueMax`) is not finite: images without statistics that the\n * host gave no `valueMax`. A majorant walk that falls back on the global bound cannot use them;\n * `vdbCheckModule(pool, options)` reads this list.\n */\n get unboundedGrids(): { id: number; hasStats: boolean; hasBrickMajorant: boolean }[] {\n const out: { id: number; hasStats: boolean; hasBrickMajorant: boolean }[] = [];\n this.#grids.forEach((g, id) => {\n if (g && !Number.isFinite(this.#valueMax(g))) out.push({ id, hasStats: g.header.hasStats, hasBrickMajorant: g.majorant !== null });\n });\n return out;\n }\n\n /** Describes grid `id`. Throws `VDB_UNKNOWN_GRID` for a dead or out-of-range id. */\n info(id: number): VDBGridInfo {\n this.#checkAlive();\n const g = this.#grid(id);\n const h = g.header;\n const lo = h.indexBBoxMin;\n const hi = h.indexBBoxMax.map((v) => v + 1) as VDBVec3;\n const min: VDBVec3 = [Infinity, Infinity, Infinity];\n const max: VDBVec3 = [-Infinity, -Infinity, -Infinity];\n for (let c = 0; c < 8; c++) {\n const p = applyAffine(g.affines.indexToWorld, [c & 1 ? hi[0] : lo[0], c & 2 ? hi[1] : lo[1], c & 4 ? hi[2] : lo[2]]);\n for (let a = 0; a < 3; a++) {\n min[a] = Math.min(min[a]!, p[a]!);\n max[a] = Math.max(max[a]!, p[a]!);\n }\n }\n const m = g.majorant;\n return {\n id,\n type: h.gridType,\n gridTypeId: h.gridTypeId,\n gridClass: gridClassName(h.gridClass),\n gridClassId: h.gridClass,\n name: h.name,\n label: g.label,\n imageBytes: h.byteLength,\n capacity: g.capacity,\n imageOffset: g.image.range?.offset ?? null,\n resident: g.image.resident && g.pendingImage === null,\n imageRevision: g.imageRevision,\n hasStats: h.hasStats,\n hasBrickMajorant: m !== null,\n majorantOffset: m?.range?.offset ?? null,\n majorantDims: m ? [...m.dims] : null,\n majorantOrigin: m ? [...m.origin] : null,\n majorantMinima: m?.minima ?? false,\n majorantBuilt: m?.gpu != null,\n instanceTransform: g.transform !== null,\n background: h.background,\n valueMax: this.#valueMax(g),\n rootMin: h.rootMin,\n rootMax: h.rootMax,\n rootAverage: h.rootAverage,\n voxelSize: [...h.voxelSize],\n indexBBox: { min: [...lo], max: [...h.indexBBoxMax] },\n worldBBox: { min, max },\n worldToIndex: g.affines.worldToIndex.slice(),\n indexToWorld: g.affines.indexToWorld.slice(),\n };\n }\n\n /**\n * Applies staged changes, recording any copies into `encoder`:\n * 1. asks the queue about buffers retired at least two updates ago (once\n * their growth is confirmed); each is destroyed when\n * `onSubmittedWorkDone` resolves;\n * 2. if the staged state doesn't fit, grows (or, when only fragmentation\n * blocks a placement, compacts) into a new buffer, copying ranges that\n * were resident before this call, and bumps `version`. The allocation is\n * checked in error scopes; if it fails, the pool rolls back later (see\n * {@link settled}). Planned before anything changes: when the staged\n * grids together pass the byte limit, nothing is re-laid out;\n * 3. writes new images, majorants, dirty records and the header with\n * `queue.writeBuffer`, for ranges placed in the current buffer (a grid\n * still waiting for space reads as dead on the GPU).\n * Then, if step 2 hit the limit, throws `VDB_POOL_LIMIT` (buffer and\n * `version` unchanged; remove grids and update again).\n *\n * Submit `encoder` before the second `update` after this one (one update of\n * slack): a buffer this update retires stays alive until then.\n *\n * Call `update(encoder)` before building or reusing bind groups this frame,\n * then compare `version` with the version the bind group was built at. A\n * bind group built before `update()` keeps the previous (still-alive)\n * buffer and silently misses new grids: no validation error, just stale\n * data.\n */\n update(encoder: GPUCommandEncoder): void {\n this.#checkAlive();\n this.#updates++;\n this.#reapRetired();\n\n let limitError: VDBError | null = null;\n const needIds = this.#grids.length;\n const unplaced = this.#unplaced();\n if (needIds > this.#capacity || unplaced.length > 0) {\n if (needIds <= this.#capacity && this.#tryPlace(unplaced)) {\n // Placed in gaps freed since staging.\n } else {\n try {\n this.#relayout(encoder, needIds);\n } catch (e) {\n if (!(e instanceof VDBError) || e.code !== \"VDB_POOL_LIMIT\") throw e;\n limitError = e; // independent writes below still reach the current buffer\n }\n }\n }\n this.#writePending();\n this.#recordMajorantBuilds(encoder);\n if (limitError) throw limitError;\n }\n\n /** Convenience: creates an encoder, calls `update`, and submits it. */\n flush(): void {\n this.#checkAlive();\n const encoder = this.device.createCommandEncoder({ label: `${this.#label} flush` });\n this.update(encoder);\n this.device.queue.submit([encoder.finish()]);\n }\n\n /**\n * The bind group entry for `slot`: `{ binding: slot.firstBinding, resource: { buffer } }`.\n * Takes the same `VDBSlot` as `vdbModuleWgsl({ slot })` and\n * `vdbModuleEntries(slot)`.\n *\n * It names the current `buffer`, so call `update(encoder)` before building\n * or reusing bind groups this frame, and rebuild when `version` changed. A\n * bind group built before `update()` keeps the previous (still-alive)\n * buffer and silently misses new grids.\n */\n bindGroupEntry(slot: VDBSlot): GPUBindGroupEntry {\n this.#checkAlive();\n checkCount(\"slot.firstBinding\", slot?.firstBinding, 0);\n return { binding: slot.firstBinding, resource: { buffer: this.#buffer } };\n }\n\n /**\n * Destroys every buffer this pool created (current, retired, and those of an\n * unconfirmed growth) at once, never a host buffer or the device. Submit no\n * work recorded by `update` after this. Idempotent.\n */\n dispose(): void {\n if (this.#disposed) return;\n this.#disposed = true;\n const owned = new Set<GPUBuffer>();\n for (const r of this.#retired) owned.add(r.buffer);\n for (const g of this.#growths) owned.add(g.from).add(g.to);\n if (this.#ownsBuffer) owned.add(this.#buffer);\n for (const b of owned) b.destroy();\n this.#retired = [];\n this.#growths = [];\n this.#grids = [];\n this.#dirtyRecords.clear();\n }\n\n // -------------------------------------------------------------------------\n\n #checkAlive(): void {\n if (this.#disposed) throw new VDBError(\"VDB_DISPOSED\", \"This VDBGridPool was disposed. Create a new pool.\");\n }\n\n #grid(id: number): GridState {\n const g = Number.isInteger(id) ? this.#grids[id] : undefined;\n if (!g) {\n throw new VDBError(\n \"VDB_UNKNOWN_GRID\",\n `Grid id ${id} is not live in this pool (removed, or never returned by add). Use an id from add().`,\n );\n }\n return g;\n }\n\n #touch(id: number): void {\n this.#dirtyRecords.add(id);\n this.#headerDirty = true;\n this.#revision++;\n }\n\n #valueMax(g: GridState): number {\n if (g.valueMaxOverride !== undefined) return g.valueMaxOverride;\n // Without stats there is no bound in the image; Infinity tells the integrator to pass valueMax.\n return g.header.hasStats ? Math.max(g.header.rootMax, g.header.background) : Infinity;\n }\n\n /** Limit detail for `VDB_POOL_LIMIT` messages. */\n #limitDetail(): string {\n const { maxStorageBufferBindingSize, maxBufferSize } = this.device.limits;\n return (\n `device maxStorageBufferBindingSize ${maxStorageBufferBindingSize}, maxBufferSize ${maxBufferSize}` +\n `${this.#limit < deviceByteLimit(this.device) ? `, maxBytes ${this.#limit}` : \"\"}`\n );\n }\n\n /**\n * Throws `VDB_POOL_LIMIT` when ranges of `bytes` could not fit under the\n * limit even alone, beside a table of `ids` records (§1.5). Staged, such a\n * request would make every later `update` fail; reject it while the pool is\n * unchanged. Host buffers are checked by `#place` instead (`VDB_POOL_FULL`).\n */\n #checkCanFit(ids: number, bytes: number[], what: string): void {\n if (!this.#ownsBuffer) return;\n let capacity = this.#capacity;\n while (capacity < ids) capacity *= 2;\n const start = dataStartOffset(capacity);\n let needed = start;\n for (const b of bytes) needed += align32(b);\n if (needed <= this.#limit) return;\n throw new VDBError(\n \"VDB_POOL_LIMIT\",\n `This ${what} needs ${needed - start} bytes beside a ${capacity}-grid table (${start} bytes), ${needed} in all: ` +\n `more than the pool limit of ${this.#limit} bytes (${this.#limitDetail()}) even with no other grids. ` +\n `Use a smaller grid, or request the device with VDBGridPool.requiredLimits(adapter). The pool is unchanged.`,\n );\n }\n\n /** Frees `old`, runs `place` (which may reuse its space), and restores `old` if `place` throws. */\n #replaceRange(old: AllocatedRange | null, place: () => void): void {\n if (old) this.#alloc.free(old.offset);\n try {\n place();\n } catch (e) {\n if (old) this.#alloc.restore(old);\n throw e;\n }\n }\n\n /**\n * First-fit placement at staging time; a host buffer must fit now. In an\n * owned pool a range that doesn't fit (or any range while the table is\n * over capacity) stays unplaced and the next `update` re-lays out.\n */\n #place(state: RangeState, bytes: number, what: string, tableFits = this.#grids.length <= this.#capacity): void {\n const offset = tableFits ? this.#alloc.alloc(bytes) : null;\n if (offset !== null) {\n state.range = { offset, size: align32(bytes) };\n return;\n }\n if (!this.#ownsBuffer) {\n throw new VDBError(\n \"VDB_POOL_FULL\",\n `The host buffer (${this.#buffer.size} bytes, ${this.#alloc.allocatedBytes} allocated) has no free range of ` +\n `${align32(bytes)} bytes for this ${what}. Remove grids, or create the pool on a larger buffer (or without one, so it can grow).`,\n );\n }\n state.range = null; // placed by the next update\n }\n\n /** Puts `next` on `grid`, in the current majorant's range when it fits. */\n #installMajorant(grid: GridState, next: MajorantState): void {\n const current = grid.majorant;\n if (current?.range && align32(next.bytes) <= current.range.size) {\n next.range = current.range;\n next.resident = next.gpu ? false : current.resident;\n } else {\n this.#checkCanFit(this.#grids.length, [grid.capacity, next.bytes], \"majorant\");\n this.#replaceRange(current?.range ?? null, () => this.#place(next, next.bytes, \"majorant\"));\n }\n grid.majorant = next;\n }\n\n #dropMajorant(grid: GridState): void {\n const m = grid.majorant;\n if (m?.range) this.#alloc.free(m.range.offset);\n grid.majorant = null;\n }\n\n #unplaced(): { state: RangeState; bytes: number }[] {\n const out: { state: RangeState; bytes: number }[] = [];\n for (const g of this.#grids) {\n if (!g) continue;\n if (!g.image.range) out.push({ state: g.image, bytes: g.capacity });\n if (g.majorant && !g.majorant.range) out.push({ state: g.majorant, bytes: g.majorant.bytes });\n }\n return out;\n }\n\n /** Places every unplaced range first-fit, or changes nothing and returns false. */\n #tryPlace(unplaced: { state: RangeState; bytes: number }[]): boolean {\n const placed: number[] = [];\n for (const u of unplaced) {\n const offset = this.#alloc.alloc(u.bytes);\n if (offset === null) {\n for (const o of placed) this.#alloc.free(o);\n return false;\n }\n placed.push(offset);\n }\n unplaced.forEach((u, k) => (u.state.range = { offset: placed[k]!, size: align32(u.bytes) }));\n return true;\n }\n\n /** Grows or compacts into a new buffer (§1.4 step 2). Plans and checks before changing anything. */\n #relayout(encoder: GPUCommandEncoder, needIds: number): void {\n if (!this.#ownsBuffer) {\n // #place already guarantees host-buffer placements; reaching here is a pool bug.\n throw new VDBError(\"VDB_POOL_FULL\", \"The host buffer cannot be re-laid out. Remove grids or use a larger buffer.\");\n }\n let capacity = this.#capacity;\n while (capacity < needIds) capacity *= 2;\n\n // Pack every live range in id order: image, then majorant.\n const ranges: { state: RangeState; bytes: number; copyBytes: number }[] = [];\n for (const g of this.#grids) {\n if (!g) continue;\n ranges.push({ state: g.image, bytes: g.capacity, copyBytes: g.pendingImage ? 0 : g.header.byteLength });\n if (g.majorant) ranges.push({ state: g.majorant, bytes: g.majorant.bytes, copyBytes: g.majorant.pending ? 0 : g.majorant.bytes });\n }\n const start = dataStartOffset(capacity);\n let needed = start;\n for (const r of ranges) needed += align32(r.bytes);\n\n const current = this.#buffer.size;\n const grows = capacity > this.#capacity || needed > current;\n const size = grows ? Math.min(this.#limit, Math.max(needed, 2 * current)) : current;\n if (needed > size) {\n throw new VDBError(\n \"VDB_POOL_LIMIT\",\n `The staged grids need a ${needed}-byte pool; the limit is ${this.#limit} bytes (${this.#limitDetail()}). ` +\n `Remove grids, or request the device with VDBGridPool.requiredLimits(adapter). The buffer is unchanged; ` +\n `staged changes that fit it were applied.`,\n );\n }\n\n // What `from` holds (clean, resident ranges), for a rollback if the allocation fails.\n const snapshot = new Map<GridState, GridSnapshot>();\n for (const g of this.#grids) {\n if (!g) continue;\n const m = g.majorant;\n snapshot.set(g, {\n imageSerial: g.imageSerial,\n image: g.image.range && g.image.resident && !g.pendingImage ? { ...g.image.range } : null,\n majorant: m,\n majorantRange: m?.range && m.resident && !m.pending ? { ...m.range } : null,\n });\n }\n\n // update() is synchronous: switch now, keep `from` alive, and settle when the scopes resolve.\n const device = this.device;\n device.pushErrorScope(\"out-of-memory\");\n device.pushErrorScope(\"validation\");\n const next = device.createBuffer({\n label: `${this.#label} (v${this.#version + 1})`,\n size,\n usage: POOL_BUFFER_USAGE | this.#usage,\n });\n const validation = device.popErrorScope();\n const oom = device.popErrorScope();\n const growth: Growth = {\n from: this.#buffer,\n to: next,\n capacity: this.#capacity,\n update: this.#updates,\n snapshot,\n done: Promise.resolve(null),\n };\n // A rejected pop (e.g. the host popped our scope) tells us nothing: treat it as success.\n const scopeError = Promise.all([oom, validation]).then(\n ([o, v]) => o ?? v,\n () => null,\n );\n const previous = this.#growths[this.#growths.length - 1]?.done ?? Promise.resolve(null);\n growth.done = Promise.all([scopeError, previous]).then(([e]) => this.#settleGrowth(growth, e));\n this.#growths.push(growth);\n\n const alloc = new RangeAllocator(start, size);\n for (const r of ranges) {\n const offset = alloc.alloc(r.bytes)!;\n const old = r.state.range;\n if (old && r.state.resident && r.copyBytes > 0) {\n encoder.copyBufferToBuffer(this.#buffer, old.offset, next, offset, r.copyBytes);\n }\n r.state.range = { offset, size: align32(r.bytes) };\n if (r.copyBytes === 0) r.state.resident = false;\n }\n\n this.#buffer = next;\n this.#alloc = alloc;\n this.#capacity = capacity;\n this.#version++;\n this.#writeTable();\n }\n\n /**\n * Runs when a growth's error scopes resolve, in growth order. Confirmed: its\n * old buffer is retired. Failed: roll back to that old buffer, voiding every\n * later growth (they copied from the failed buffer).\n */\n #settleGrowth(growth: Growth, scopeError: { message: string } | null): VDBError | null {\n // Disposed (dispose destroyed everything), or voided by an earlier failure.\n if (this.#disposed || this.#growths[0] !== growth) return null;\n if (!scopeError) {\n this.#growths.shift();\n this.#retired.push({ buffer: growth.from, since: growth.update, waiting: false });\n this.#lastError = null;\n if (this.#growths.length === 0) this.#releaseRetained();\n return null;\n }\n const error = new VDBError(\n \"VDB_POOL_LIMIT\",\n `The device could not allocate a ${growth.to.size}-byte pool buffer while growing (${scopeError.message}). ` +\n `The pool rolled back to its previous ${growth.from.size}-byte buffer as version ${this.#version + 1}; rebuild ` +\n `bind groups. Grids resident before the growth are intact; ones staged or written since are staged again. ` +\n `Remove grids or free GPU memory, then update again.`,\n );\n this.#rollBack(growth);\n this.#lastError = error;\n return error;\n }\n\n /** Returns to `growth.from` and what it holds; every other range is staged again. */\n #rollBack(growth: Growth): void {\n for (const g of this.#growths) g.to.destroy(); // the failed buffer and any chained after it\n this.#growths = [];\n const alloc = new RangeAllocator(dataStartOffset(growth.capacity), growth.from.size);\n for (const g of this.#grids) {\n if (!g) continue;\n const snap = growth.snapshot.get(g);\n // Same serial: no replace since the snapshot, so `from` holds the current image and nothing is pending.\n if (snap?.image && snap.imageSerial === g.imageSerial) {\n alloc.restore(snap.image);\n g.image.range = { ...snap.image };\n g.image.resident = true;\n } else {\n g.image.range = null;\n g.image.resident = false;\n g.pendingImage ??= g.retainedImage;\n }\n const m = g.majorant;\n if (!m) continue;\n if (snap?.majorantRange && snap.majorant === m) {\n alloc.restore(snap.majorantRange);\n m.range = { ...snap.majorantRange };\n m.resident = true;\n } else {\n m.range = null;\n m.resident = false;\n m.pending ??= m.retained;\n if (m.gpu) m.gpu.stale = true; // built into the failed buffer (or never): build again\n }\n }\n this.#releaseRetained();\n this.#buffer = growth.from;\n this.#alloc = alloc;\n this.#capacity = growth.capacity;\n this.#version++;\n this.#writeTable(); // `from`'s table is stale: restored grids are live, the rest read as dead until placed\n }\n\n #releaseRetained(): void {\n for (const g of this.#grids) {\n if (!g) continue;\n g.retainedImage = null;\n if (g.majorant) g.majorant.retained = null;\n }\n }\n\n /**\n * §1.4 step 1: for retired buffers that are confirmed and at least\n * {@link RETIRE_AFTER_UPDATES} updates old (so the encoder that copied out of\n * them has been submitted), asks the queue once and destroys them when that\n * work is done.\n */\n #reapRetired(): void {\n const ready = this.#retired.filter((r) => !r.waiting && this.#updates - r.since >= RETIRE_AFTER_UPDATES);\n if (ready.length === 0) return;\n for (const r of ready) r.waiting = true;\n const destroy = (): void => {\n if (this.#disposed) return; // dispose destroyed them\n this.#retired = this.#retired.filter((r) => !ready.includes(r));\n for (const r of ready) r.buffer.destroy();\n };\n this.device.queue.onSubmittedWorkDone().then(destroy, destroy);\n }\n\n /** Every range of `g` is placed. Until then its record stays dirty. */\n #complete(g: GridState): boolean {\n return g.image.range !== null && (g.majorant === null || g.majorant.range !== null);\n }\n\n /** The header's grid count: highest live id + 1, clamped to the table (ids past it can't be read). */\n #headerGridCount(): number {\n return Math.min(this.gridCount, this.#capacity);\n }\n\n /** Writes the header and every record (after create on a host buffer, a relayout, or a rollback). */\n #writeTable(): void {\n const words = new Uint32Array(VDB_POOL_HEADER_WORDS + this.#capacity * VDB_POOL_RECORD_WORDS);\n const dirty = new Set<number>();\n this.#grids.forEach((g, id) => {\n if (!g) return;\n if (id < this.#capacity && g.image.range) {\n encodeRecord(this.#record(g), words, VDB_POOL_HEADER_WORDS + id * VDB_POOL_RECORD_WORDS);\n }\n if (!this.#complete(g)) dirty.add(id);\n });\n encodeHeader({ gridCapacity: this.#capacity, gridCount: this.#headerGridCount(), usedBytes: this.usedBytes }, words, 0);\n write(this.device.queue, this.#buffer, 0, words);\n this.#dirtyRecords = dirty;\n this.#headerDirty = false;\n }\n\n #writeHeader(): void {\n const words = encodeHeader({ gridCapacity: this.#capacity, gridCount: this.#headerGridCount(), usedBytes: this.usedBytes });\n write(this.device.queue, this.#buffer, 0, words);\n this.#headerDirty = false;\n }\n\n /**\n * §1.4 step 3: images, majorants, dirty records, header. Only ranges placed\n * in the current buffer are written; a grid whose image is unplaced gets a\n * dead record, and its id stays dirty until every range of it is placed.\n */\n #writePending(): void {\n const queue = this.device.queue;\n const keep = this.#growths.length > 0; // a rollback may have to stage these again\n for (const g of this.#grids) {\n if (!g) continue;\n if (g.pendingImage && g.image.range) {\n write(queue, this.#buffer, g.image.range.offset, g.pendingImage);\n if (keep) g.retainedImage = g.pendingImage;\n g.pendingImage = null;\n g.image.resident = true;\n }\n const m = g.majorant;\n if (m?.pending && m.range) {\n write(queue, this.#buffer, m.range.offset, m.pending);\n if (keep) m.retained = m.pending;\n m.pending = null;\n m.resident = true;\n }\n }\n const dirty = new Set<number>();\n for (const id of [...this.#dirtyRecords].sort((a, b) => a - b)) {\n const g = this.#grids[id];\n if (g && !this.#complete(g)) dirty.add(id);\n if (id >= this.#capacity) continue; // past the table end: the relayout that grows the table writes it\n const words = new Uint32Array(VDB_POOL_RECORD_WORDS);\n if (g?.image.range) encodeRecord(this.#record(g), words, 0);\n write(queue, this.#buffer, recordByteOffset(id), words);\n }\n this.#dirtyRecords = dirty;\n if (this.#headerDirty) this.#writeHeader();\n }\n\n /**\n * P1.15: records the staged GPU majorant builds into `encoder` (one compute pass), after this update's writes\n * (the queue runs `writeBuffer`s before the encoder's commands, so the kernel reads the new image and record).\n * A build needs its range placed and its image and record in the current buffer; else it waits for an update\n * that has them. Each build's 96-byte parameters live in their own uniform buffer, retired like an old pool buffer.\n */\n #recordMajorantBuilds(encoder: GPUCommandEncoder): void {\n const builds: { id: number; g: GridState; m: MajorantState; gpu: GpuMajorantBuild; range: AllocatedRange }[] = [];\n this.#grids.forEach((g, id) => {\n const m = g?.majorant;\n if (!g || !m?.gpu?.stale || !m.range || !g.image.range || !g.image.resident || id >= this.#capacity) return;\n builds.push({ id, g, m, gpu: m.gpu, range: m.range });\n });\n if (builds.length === 0) return;\n const device = this.device;\n const maxGroups = (device.limits as Partial<GPUSupportedLimits> | undefined)?.maxComputeWorkgroupsPerDimension ?? 65535;\n const pass = encoder.beginComputePass({ label: `${this.#label} buildMajorant` });\n for (const { id, g, m, gpu, range } of builds) {\n const h = g.header;\n const { params, groups } = packMajorantBuild(\n {\n grid: id,\n rangeOffset: range.offset,\n brickLog2: m.brickLog2,\n origin: m.origin,\n dims: m.dims,\n bboxMin: h.indexBBoxMin,\n bboxMax: h.indexBBoxMax,\n resolution: gpu.resolution,\n zero: gpu.zero,\n pathtracer: gpu.pathtracer,\n minima: m.minima,\n },\n maxGroups,\n );\n const cached = majorantBuildPipeline(device, h.gridType);\n const uniform = device.createBuffer({\n label: `${this.#label} buildMajorant ${id}`,\n size: MAJORANT_BUILD_PARAMS_BYTES,\n usage: BUFFER_USAGE.UNIFORM | BUFFER_USAGE.COPY_DST,\n });\n write(device.queue, uniform, 0, new Uint32Array(params));\n this.#retired.push({ buffer: uniform, since: this.#updates, waiting: false, params: true });\n pass.setPipeline(cached.pipeline);\n pass.setBindGroup(\n 0,\n device.createBindGroup({\n layout: cached.layout,\n entries: [\n { binding: 0, resource: { buffer: this.#buffer } },\n { binding: 1, resource: { buffer: uniform } },\n ],\n }),\n );\n pass.dispatchWorkgroups(groups[0], groups[1]);\n gpu.stale = false;\n m.resident = true;\n }\n pass.end();\n }\n\n /** The record for `g`, whose image is placed. A majorant is recorded only once it is placed. */\n #record(g: GridState): VDBGridRecord {\n const h = g.header;\n const m = g.majorant?.range ? g.majorant : null;\n return {\n imageOffset: g.image.range!.offset,\n imageBytes: h.byteLength,\n gridType: h.gridTypeId,\n live: true,\n hasStats: h.hasStats,\n hasBrickMajorant: m !== null,\n instanceTransform: g.transform !== null,\n gridClass: h.gridClass,\n brickLog2: m?.brickLog2 ?? 0,\n worldToIndex: Array.from(g.affines.worldToIndex),\n indexToWorld: Array.from(g.affines.indexToWorld),\n indexBBoxMin: h.indexBBoxMin,\n indexBBoxMax: h.indexBBoxMax,\n background: h.background,\n valueMax: this.#valueMax(g),\n majorantOffset: m?.range?.offset ?? 0,\n majorantDims: m ? m.dims : [0, 0, 0],\n };\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * K6.R: the reference renderer's GPU half (design K6-core-renderer.md §7.4). Internal (`core/internal.ts`); no public
3
+ * export. The scene types and the CPU twin are in `tools/reference/`.
4
+ */
5
+ export * from "./wgsl.js";
6
+ export * from "./renderer.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * K6.R: the reference renderer's GPU half (design K6-core-renderer.md §7.4). Internal (`core/internal.ts`); no public
3
+ * export. The scene types and the CPU twin are in `tools/reference/`.
4
+ */
5
+ export * from "./wgsl.js";
6
+ export * from "./renderer.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/reference/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC","sourcesContent":["/**\n * K6.R: the reference renderer's GPU half (design K6-core-renderer.md §7.4). Internal (`core/internal.ts`); no public\n * export. The scene types and the CPU twin are in `tools/reference/`.\n */\nexport * from \"./wgsl.js\";\nexport * from \"./renderer.js\";\n"]}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * K6.R: the reference renderer on the host's device (design K6-core-renderer.md §7.4). A brute-force volumetric path
3
+ * tracer over one volume source (dense textures or the sparse pool: the group-2 `vdbSrc*` contract), accumulated
4
+ * progressively in rgba32float textures with per-pixel variance. Engine-free, internal only (no public export). The
5
+ * CPU twin is `tools/reference/trace.ts` (same stream, same draw order).
6
+ *
7
+ * const ref = await vdbCreateReferenceRenderer(device, { source, width, height });
8
+ * ref.setScene(scene, settings); // resets the accumulation
9
+ * const enc = device.createCommandEncoder();
10
+ * pool?.update(enc); source.update?.(enc); // host order (Traps): the pool, the source, then the kernel
11
+ * ref.render(enc, 4); // 4 batches of settings.spp samples per pixel
12
+ * device.queue.submit([enc.finish()]);
13
+ * const accum = await ref.readback(); // sums of batch means → vdbReferenceStatistics (tools)
14
+ *
15
+ * One `render()` per submitted encoder (its batch records are written with `queue.writeBuffer`). The renderer frees
16
+ * only what it made (textures, buffers); the source is the host's.
17
+ */
18
+ import type { VDBSlot } from "../types.js";
19
+ import type { VDBVolumeSource } from "../source/types.js";
20
+ import { type VDBReferenceAccum, type VDBReferenceColorTable, type VDBReferenceMajorantGrid, type VDBReferencePhaseTable, type VDBReferenceScene, type VDBReferenceSettings } from "../../tools/reference/index.js";
21
+ /** The source slot of the kernel (the K6 group-2 contract). */
22
+ export declare const VDB_REFERENCE_SOURCE_SLOT: VDBSlot;
23
+ /** Most batches one `render()` records. */
24
+ export declare const VDB_REFERENCE_MAX_BATCHES_PER_RENDER = 64;
25
+ /** A source the kernel can read: the group-2 contract, plus the sparse source's module and update. */
26
+ export type VDBReferenceSource = VDBVolumeSource & {
27
+ moduleWgsl?(slot: VDBSlot): string;
28
+ };
29
+ /** Options of {@link vdbCreateReferenceRenderer}. */
30
+ export interface VDBReferenceRendererOptions {
31
+ /** The source every volume of the scene reads (its slots: `VDBReferenceVolume.v`). One source per kernel (D10). */
32
+ source: VDBReferenceSource;
33
+ width: number;
34
+ height: number;
35
+ label?: string;
36
+ /** Tests: patch the WGSL before it compiles (the fail-before mutations, `VDB_REFERENCE_MUTATIONS`). */
37
+ wgslPatch?: (wgsl: string) => string;
38
+ /**
39
+ * Issue #2: how sigma reads the density. 'trilinear' (default): `vdbSrcDensity` (eight taps on a sparse source).
40
+ * 'stochastic': ONE voxel picked with probability equal to its trilinear weight (`vdbSrcDensityStochastic`, three
41
+ * more draws per sigma lookup in the shared stream; the CPU twin's `densityFilter`). Unbiased for a cutoff of 0:
42
+ * delta and ratio tracking are linear in sigma and the cell majorants bound the 2x2x2 support. Compiled in, so a
43
+ * setting of the kernel, not of the scene.
44
+ */
45
+ densityFilter?: VDBReferenceDensityFilter;
46
+ }
47
+ /** Issue #2: the reference kernel's density reconstruction (see {@link VDBReferenceRendererOptions.densityFilter}). */
48
+ export type VDBReferenceDensityFilter = "trilinear" | "stochastic";
49
+ /** The reference renderer (internal). */
50
+ export interface VDBReferenceRenderer {
51
+ readonly device: GPUDevice;
52
+ readonly width: number;
53
+ readonly height: number;
54
+ /** The composed WGSL (module + source + kernel). */
55
+ readonly wgsl: string;
56
+ /** Batches accumulated since the last {@link setScene} / {@link reset}. */
57
+ readonly batches: number;
58
+ /**
59
+ * Set the scene and settings (packs the uniforms, uploads an equirect map) and reset the accumulation. The textures it
60
+ * replaces are destroyed in a later task (K6.10b): submit the encoder of an earlier `render()` in the task that recorded it.
61
+ */
62
+ setScene(scene: VDBReferenceScene, settings: Omit<VDBReferenceSettings, "width" | "height">): void;
63
+ /** Drop the accumulation (the next batch starts from 0; batch indices restart, so the samples repeat). */
64
+ reset(): void;
65
+ /** Record `batches` dispatches (each `settings.spp` samples per pixel). One `render()` per submitted encoder. */
66
+ render(encoder: GPUCommandEncoder, batches?: number): void;
67
+ /** Read the accumulation back (after the encoder was submitted): sums of batch means and of their squares. */
68
+ readback(): Promise<VDBReferenceAccum>;
69
+ dispose(): void;
70
+ }
71
+ /**
72
+ * K6.R1: where the scene's tables and majorant grids live in the kernel's table texture (rows) and majorant atlas
73
+ * (z offsets), and their texel data. Tables and grids are shared by identity (instanced volumes upload once).
74
+ */
75
+ export interface VDBReferenceTableLayout {
76
+ phaseRows: Map<VDBReferencePhaseTable, number>;
77
+ colorRows: Map<VDBReferenceColorTable, number>;
78
+ gridOffsets: Map<VDBReferenceMajorantGrid, number>;
79
+ tables: {
80
+ width: number;
81
+ height: number;
82
+ data: Float32Array;
83
+ };
84
+ majorants: {
85
+ width: number;
86
+ height: number;
87
+ depth: number;
88
+ data: Float32Array;
89
+ };
90
+ }
91
+ /** The table texture and majorant atlas of a scene (one row / one z range per distinct table or grid). */
92
+ export declare function vdbReferenceTableLayout(scene: VDBReferenceScene): VDBReferenceTableLayout;
93
+ /** K6.R2: whether the kernel samples the scene's equirect map (MIS): the setting, a map, and light in it. */
94
+ export declare function vdbReferenceEnvironmentMis(scene: VDBReferenceScene, settings: Pick<Required<VDBReferenceSettings>, "environmentSampling">): boolean;
95
+ /** Pack `VdbRefUniforms` (layout in `wgsl.ts`). Exported for tests. */
96
+ export declare function vdbReferencePackUniforms(scene: VDBReferenceScene, settingsIn: VDBReferenceSettings, layout?: VDBReferenceTableLayout): ArrayBuffer;
97
+ /** The composed WGSL of a reference kernel over `source` (module + source + kernel). */
98
+ export declare function vdbReferenceWgsl(source: VDBReferenceSource, o?: {
99
+ densityFilter?: VDBReferenceDensityFilter;
100
+ }): string;
101
+ /**
102
+ * Create the reference renderer on the host's device: compiles the kernel for `options.source` (under a validation
103
+ * error scope; WGSL errors throw `VDBError('VDB_BAD_OPTION')` with the compiler messages).
104
+ */
105
+ export declare function vdbCreateReferenceRenderer(device: GPUDevice, o: VDBReferenceRendererOptions): Promise<VDBReferenceRenderer>;