@pmndrs/vdb 0.1.0 → 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 (576) hide show
  1. package/CHANGELOG.md +592 -2
  2. package/README.md +85 -37
  3. package/THIRD_PARTY_NOTICES.md +197 -29
  4. package/dist/core/compute/atlas.d.ts +10 -2
  5. package/dist/core/compute/atlas.js +6 -1
  6. package/dist/core/compute/atlas.js.map +1 -1
  7. package/dist/core/compute/index.d.ts +3 -3
  8. package/dist/core/compute/index.js +2 -2
  9. package/dist/core/compute/index.js.map +1 -1
  10. package/dist/core/compute/majorant-build.d.ts +45 -0
  11. package/dist/core/compute/majorant-build.js +193 -0
  12. package/dist/core/compute/majorant-build.js.map +1 -0
  13. package/dist/core/compute/multi-scale.d.ts +155 -0
  14. package/dist/core/compute/multi-scale.js +684 -0
  15. package/dist/core/compute/multi-scale.js.map +1 -0
  16. package/dist/core/compute/pyramid.d.ts +22 -7
  17. package/dist/core/compute/pyramid.js +22 -9
  18. package/dist/core/compute/pyramid.js.map +1 -1
  19. package/dist/core/compute/shared.d.ts +1 -0
  20. package/dist/core/compute/shared.js.map +1 -1
  21. package/dist/core/compute/stats.d.ts +10 -3
  22. package/dist/core/compute/stats.js +6 -1
  23. package/dist/core/compute/stats.js.map +1 -1
  24. package/dist/core/compute/value-transform.d.ts +8 -1
  25. package/dist/core/compute/value-transform.js +9 -3
  26. package/dist/core/compute/value-transform.js.map +1 -1
  27. package/dist/core/errors.d.ts +10 -0
  28. package/dist/core/errors.js +8 -0
  29. package/dist/core/errors.js.map +1 -1
  30. package/dist/core/frame/emission.d.ts +85 -0
  31. package/dist/core/frame/emission.js +422 -0
  32. package/dist/core/frame/emission.js.map +1 -0
  33. package/dist/core/frame/environment.d.ts +47 -0
  34. package/dist/core/frame/environment.js +178 -0
  35. package/dist/core/frame/environment.js.map +1 -0
  36. package/dist/core/frame/index.d.ts +39 -0
  37. package/dist/core/frame/index.js +27 -0
  38. package/dist/core/frame/index.js.map +1 -0
  39. package/dist/core/frame/kernels.d.ts +115 -0
  40. package/dist/core/frame/kernels.js +496 -0
  41. package/dist/core/frame/kernels.js.map +1 -0
  42. package/dist/core/frame/limits.d.ts +67 -0
  43. package/dist/core/frame/limits.js +109 -0
  44. package/dist/core/frame/limits.js.map +1 -0
  45. package/dist/core/frame/phase.d.ts +17 -0
  46. package/dist/core/frame/phase.js +53 -0
  47. package/dist/core/frame/phase.js.map +1 -0
  48. package/dist/core/frame/pipelines.d.ts +49 -0
  49. package/dist/core/frame/pipelines.js +147 -0
  50. package/dist/core/frame/pipelines.js.map +1 -0
  51. package/dist/core/frame/renderer.d.ts +122 -0
  52. package/dist/core/frame/renderer.js +1712 -0
  53. package/dist/core/frame/renderer.js.map +1 -0
  54. package/dist/core/frame/resources.d.ts +71 -0
  55. package/dist/core/frame/resources.js +100 -0
  56. package/dist/core/frame/resources.js.map +1 -0
  57. package/dist/core/frame/scattering.d.ts +97 -0
  58. package/dist/core/frame/scattering.js +332 -0
  59. package/dist/core/frame/scattering.js.map +1 -0
  60. package/dist/core/frame/settings.d.ts +243 -0
  61. package/dist/core/frame/settings.js +67 -0
  62. package/dist/core/frame/settings.js.map +1 -0
  63. package/dist/core/frame/shadows.d.ts +55 -0
  64. package/dist/core/frame/shadows.js +460 -0
  65. package/dist/core/frame/shadows.js.map +1 -0
  66. package/dist/core/frame/types.d.ts +415 -0
  67. package/dist/core/frame/types.js +49 -0
  68. package/dist/core/frame/types.js.map +1 -0
  69. package/dist/core/frame/uniforms.d.ts +105 -0
  70. package/dist/core/frame/uniforms.js +276 -0
  71. package/dist/core/frame/uniforms.js.map +1 -0
  72. package/dist/core/frame/wgsl/chunks.d.ts +4 -0
  73. package/dist/core/frame/wgsl/chunks.js +728 -0
  74. package/dist/core/frame/wgsl/chunks.js.map +1 -0
  75. package/dist/core/frame/wgsl/emission.d.ts +82 -0
  76. package/dist/core/frame/wgsl/emission.js +353 -0
  77. package/dist/core/frame/wgsl/emission.js.map +1 -0
  78. package/dist/core/frame/wgsl/environment.d.ts +42 -0
  79. package/dist/core/frame/wgsl/environment.js +711 -0
  80. package/dist/core/frame/wgsl/environment.js.map +1 -0
  81. package/dist/core/frame/wgsl/gather.d.ts +55 -0
  82. package/dist/core/frame/wgsl/gather.js +850 -0
  83. package/dist/core/frame/wgsl/gather.js.map +1 -0
  84. package/dist/core/frame/wgsl/integrate.d.ts +78 -0
  85. package/dist/core/frame/wgsl/integrate.js +213 -0
  86. package/dist/core/frame/wgsl/integrate.js.map +1 -0
  87. package/dist/core/frame/wgsl/lighting.d.ts +103 -0
  88. package/dist/core/frame/wgsl/lighting.js +1636 -0
  89. package/dist/core/frame/wgsl/lighting.js.map +1 -0
  90. package/dist/core/frame/wgsl/occluders.d.ts +20 -0
  91. package/dist/core/frame/wgsl/occluders.js +95 -0
  92. package/dist/core/frame/wgsl/occluders.js.map +1 -0
  93. package/dist/core/frame/wgsl/resolve.d.ts +19 -0
  94. package/dist/core/frame/wgsl/resolve.js +205 -0
  95. package/dist/core/frame/wgsl/resolve.js.map +1 -0
  96. package/dist/core/frame/wgsl/shadows.d.ts +35 -0
  97. package/dist/core/frame/wgsl/shadows.js +328 -0
  98. package/dist/core/frame/wgsl/shadows.js.map +1 -0
  99. package/dist/core/half.d.ts +11 -0
  100. package/dist/core/half.js +22 -0
  101. package/dist/core/half.js.map +1 -0
  102. package/dist/core/index.d.ts +25 -3
  103. package/dist/core/index.js +23 -4
  104. package/dist/core/index.js.map +1 -1
  105. package/dist/core/internal.d.ts +17 -1
  106. package/dist/core/internal.js +18 -1
  107. package/dist/core/internal.js.map +1 -1
  108. package/dist/core/pool/image-header.d.ts +13 -2
  109. package/dist/core/pool/image-header.js +24 -5
  110. package/dist/core/pool/image-header.js.map +1 -1
  111. package/dist/core/pool/layout.d.ts +35 -1
  112. package/dist/core/pool/layout.js +51 -2
  113. package/dist/core/pool/layout.js.map +1 -1
  114. package/dist/core/pool/limits.d.ts +1 -0
  115. package/dist/core/pool/limits.js +1 -0
  116. package/dist/core/pool/limits.js.map +1 -1
  117. package/dist/core/pool/pool.d.ts +120 -15
  118. package/dist/core/pool/pool.js +255 -24
  119. package/dist/core/pool/pool.js.map +1 -1
  120. package/dist/core/reference/index.d.ts +6 -0
  121. package/dist/core/reference/index.js +7 -0
  122. package/dist/core/reference/index.js.map +1 -0
  123. package/dist/core/reference/renderer.d.ts +105 -0
  124. package/dist/core/reference/renderer.js +474 -0
  125. package/dist/core/reference/renderer.js.map +1 -0
  126. package/dist/core/reference/wgsl.d.ts +65 -0
  127. package/dist/core/reference/wgsl.js +803 -0
  128. package/dist/core/reference/wgsl.js.map +1 -0
  129. package/dist/{three → core}/sequence.d.ts +32 -2
  130. package/dist/{three → core}/sequence.js +24 -2
  131. package/dist/core/sequence.js.map +1 -0
  132. package/dist/core/source/brick-cache.d.ts +165 -0
  133. package/dist/core/source/brick-cache.js +627 -0
  134. package/dist/core/source/brick-cache.js.map +1 -0
  135. package/dist/core/source/dense-fill.d.ts +53 -0
  136. package/dist/core/source/dense-fill.js +377 -0
  137. package/dist/core/source/dense-fill.js.map +1 -0
  138. package/dist/core/source/dense.d.ts +33 -2
  139. package/dist/core/source/dense.js +121 -24
  140. package/dist/core/source/dense.js.map +1 -1
  141. package/dist/core/source/sparse-wgsl.d.ts +92 -0
  142. package/dist/core/source/sparse-wgsl.js +481 -0
  143. package/dist/core/source/sparse-wgsl.js.map +1 -0
  144. package/dist/core/source/sparse.d.ts +192 -0
  145. package/dist/core/source/sparse.js +762 -0
  146. package/dist/core/source/sparse.js.map +1 -0
  147. package/dist/core/source/types.d.ts +59 -2
  148. package/dist/core/source/types.js.map +1 -1
  149. package/dist/core/surface/index.d.ts +10 -0
  150. package/dist/core/surface/index.js +9 -0
  151. package/dist/core/surface/index.js.map +1 -0
  152. package/dist/core/surface/level-set-pass.d.ts +140 -0
  153. package/dist/core/surface/level-set-pass.js +291 -0
  154. package/dist/core/surface/level-set-pass.js.map +1 -0
  155. package/dist/core/surface/level-set-wgsl.d.ts +46 -0
  156. package/dist/core/surface/level-set-wgsl.js +99 -0
  157. package/dist/core/surface/level-set-wgsl.js.map +1 -0
  158. package/dist/core/surface/points.d.ts +109 -0
  159. package/dist/core/surface/points.js +226 -0
  160. package/dist/core/surface/points.js.map +1 -0
  161. package/dist/core/types.d.ts +12 -3
  162. package/dist/core/types.js +6 -2
  163. package/dist/core/types.js.map +1 -1
  164. package/dist/core/wgsl/api.d.ts +29 -5
  165. package/dist/core/wgsl/api.js +110 -27
  166. package/dist/core/wgsl/api.js.map +1 -1
  167. package/dist/core/wgsl/generate.d.ts +8 -0
  168. package/dist/core/wgsl/generate.js +195 -22
  169. package/dist/core/wgsl/generate.js.map +1 -1
  170. package/dist/core/wgsl/lean.d.ts +50 -0
  171. package/dist/core/wgsl/lean.js +327 -0
  172. package/dist/core/wgsl/lean.js.map +1 -0
  173. package/dist/core/wgsl/level-set.d.ts +5 -1
  174. package/dist/core/wgsl/level-set.js +11 -5
  175. package/dist/core/wgsl/level-set.js.map +1 -1
  176. package/dist/core/wgsl/majorant.d.ts +62 -0
  177. package/dist/core/wgsl/majorant.js +381 -0
  178. package/dist/core/wgsl/majorant.js.map +1 -0
  179. package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +2 -2
  180. package/dist/core/wgsl/pnanovdb.chunks.generated.js +15 -12
  181. package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -1
  182. package/dist/core/wgsl/types.d.ts +97 -3
  183. package/dist/core/wgsl/types.js.map +1 -1
  184. package/dist/three/coarse-first.d.ts +53 -8
  185. package/dist/three/coarse-first.js +24 -6
  186. package/dist/three/coarse-first.js.map +1 -1
  187. package/dist/three/compute.d.ts +12 -2
  188. package/dist/three/compute.js +16 -6
  189. package/dist/three/compute.js.map +1 -1
  190. package/dist/three/device.d.ts +7 -0
  191. package/dist/three/device.js +3 -0
  192. package/dist/three/device.js.map +1 -1
  193. package/dist/three/frame/core-environment.d.ts +38 -0
  194. package/dist/three/frame/core-environment.js +154 -0
  195. package/dist/three/frame/core-environment.js.map +1 -0
  196. package/dist/three/frame/core-integrate-material.d.ts +34 -0
  197. package/dist/three/frame/core-integrate-material.js +162 -0
  198. package/dist/three/frame/core-integrate-material.js.map +1 -0
  199. package/dist/three/frame/core-occluders.d.ts +53 -0
  200. package/dist/three/frame/core-occluders.js +193 -0
  201. package/dist/three/frame/core-occluders.js.map +1 -0
  202. package/dist/three/frame/core-structs.d.ts +34 -0
  203. package/dist/three/frame/core-structs.js +61 -0
  204. package/dist/three/frame/core-structs.js.map +1 -0
  205. package/dist/three/frame/core-textures.d.ts +41 -0
  206. package/dist/three/frame/core-textures.js +114 -0
  207. package/dist/three/frame/core-textures.js.map +1 -0
  208. package/dist/three/frame/emission-light.d.ts +64 -114
  209. package/dist/three/frame/emission-light.js +188 -567
  210. package/dist/three/frame/emission-light.js.map +1 -1
  211. package/dist/three/frame/index.d.ts +11 -31
  212. package/dist/three/frame/index.js +9 -29
  213. package/dist/three/frame/index.js.map +1 -1
  214. package/dist/three/frame/medium.d.ts +12 -0
  215. package/dist/three/frame/medium.js.map +1 -1
  216. package/dist/three/frame/renderer.d.ts +58 -454
  217. package/dist/three/frame/renderer.js +409 -1427
  218. package/dist/three/frame/renderer.js.map +1 -1
  219. package/dist/three/frame/spectrum.d.ts +0 -14
  220. package/dist/three/frame/spectrum.js +2 -23
  221. package/dist/three/frame/spectrum.js.map +1 -1
  222. package/dist/three/frame/three-internals.d.ts +3 -8
  223. package/dist/three/frame/three-internals.js +13 -11
  224. package/dist/three/frame/three-internals.js.map +1 -1
  225. package/dist/three/frame/volume-shadows.d.ts +93 -107
  226. package/dist/three/frame/volume-shadows.js +278 -631
  227. package/dist/three/frame/volume-shadows.js.map +1 -1
  228. package/dist/three/frame/volume.d.ts +91 -33
  229. package/dist/three/frame/volume.js +63 -51
  230. package/dist/three/frame/volume.js.map +1 -1
  231. package/dist/three/grid-node.d.ts +34 -1
  232. package/dist/three/grid-node.js +36 -1
  233. package/dist/three/grid-node.js.map +1 -1
  234. package/dist/three/index.d.ts +20 -11
  235. package/dist/three/index.js +21 -12
  236. package/dist/three/index.js.map +1 -1
  237. package/dist/three/internal.d.ts +14 -8
  238. package/dist/three/internal.js +11 -7
  239. package/dist/three/internal.js.map +1 -1
  240. package/dist/three/level-set-material.d.ts +81 -8
  241. package/dist/three/level-set-material.js +162 -125
  242. package/dist/three/level-set-material.js.map +1 -1
  243. package/dist/three/level-set-physical-material.d.ts +154 -0
  244. package/dist/three/level-set-physical-material.js +253 -0
  245. package/dist/three/level-set-physical-material.js.map +1 -0
  246. package/dist/three/level-set-velocity.d.ts +94 -0
  247. package/dist/three/level-set-velocity.js +208 -0
  248. package/dist/three/level-set-velocity.js.map +1 -0
  249. package/dist/three/material.d.ts +141 -11
  250. package/dist/three/material.js +161 -18
  251. package/dist/three/material.js.map +1 -1
  252. package/dist/three/points.d.ts +60 -4
  253. package/dist/three/points.js +140 -9
  254. package/dist/three/points.js.map +1 -1
  255. package/dist/three/sparse-source.d.ts +49 -117
  256. package/dist/three/sparse-source.js +109 -580
  257. package/dist/three/sparse-source.js.map +1 -1
  258. package/dist/three/volume-source.d.ts +11 -156
  259. package/dist/three/volume-source.js +29 -272
  260. package/dist/three/volume-source.js.map +1 -1
  261. package/dist/tools/cpu/brick-atlas.d.ts +36 -0
  262. package/dist/tools/cpu/brick-atlas.js +129 -0
  263. package/dist/tools/cpu/brick-atlas.js.map +1 -0
  264. package/dist/tools/cpu/compute.d.ts +23 -4
  265. package/dist/tools/cpu/compute.js +35 -14
  266. package/dist/tools/cpu/compute.js.map +1 -1
  267. package/dist/tools/cpu/lean-reads.d.ts +81 -0
  268. package/dist/tools/cpu/lean-reads.js +262 -0
  269. package/dist/tools/cpu/lean-reads.js.map +1 -0
  270. package/dist/tools/cpu/level-set.d.ts +42 -3
  271. package/dist/tools/cpu/level-set.js +59 -7
  272. package/dist/tools/cpu/level-set.js.map +1 -1
  273. package/dist/tools/cpu/majorant.d.ts +265 -0
  274. package/dist/tools/cpu/majorant.js +541 -0
  275. package/dist/tools/cpu/majorant.js.map +1 -0
  276. package/dist/tools/cpu/march.d.ts +93 -2
  277. package/dist/tools/cpu/march.js +165 -14
  278. package/dist/tools/cpu/march.js.map +1 -1
  279. package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
  280. package/dist/tools/cpu/mesh-decimate.js +1225 -0
  281. package/dist/tools/cpu/mesh-decimate.js.map +1 -0
  282. package/dist/tools/cpu/points.d.ts +29 -0
  283. package/dist/tools/cpu/points.js +38 -0
  284. package/dist/tools/cpu/points.js.map +1 -0
  285. package/dist/tools/cpu/read-value.d.ts +19 -6
  286. package/dist/tools/cpu/read-value.js +32 -17
  287. package/dist/tools/cpu/read-value.js.map +1 -1
  288. package/dist/tools/cpu/sample-trilinear.d.ts +17 -4
  289. package/dist/tools/cpu/sample-trilinear.js +19 -7
  290. package/dist/tools/cpu/sample-trilinear.js.map +1 -1
  291. package/dist/tools/cpu/stride-tables.d.ts +2 -2
  292. package/dist/tools/cpu/stride-tables.generated.d.ts +6 -5
  293. package/dist/tools/cpu/stride-tables.generated.js +7 -6
  294. package/dist/tools/cpu/stride-tables.generated.js.map +1 -1
  295. package/dist/tools/cpu/stride-tables.js +1 -1
  296. package/dist/tools/cpu/stride-tables.js.map +1 -1
  297. package/dist/tools/cpu/surface-nets.d.ts +90 -0
  298. package/dist/tools/cpu/surface-nets.js +597 -0
  299. package/dist/tools/cpu/surface-nets.js.map +1 -0
  300. package/dist/tools/errors.d.ts +9 -0
  301. package/dist/tools/errors.js +9 -0
  302. package/dist/tools/errors.js.map +1 -1
  303. package/dist/tools/frame/ambient.d.ts +98 -0
  304. package/dist/tools/frame/ambient.js +274 -0
  305. package/dist/tools/frame/ambient.js.map +1 -0
  306. package/dist/tools/frame/blackbody.d.ts +15 -0
  307. package/dist/tools/frame/blackbody.js +35 -0
  308. package/dist/tools/frame/blackbody.js.map +1 -1
  309. package/dist/tools/frame/brick-cache.d.ts +165 -0
  310. package/dist/tools/frame/brick-cache.js +326 -0
  311. package/dist/tools/frame/brick-cache.js.map +1 -0
  312. package/dist/tools/frame/emission.d.ts +9 -0
  313. package/dist/tools/frame/emission.js +9 -1
  314. package/dist/tools/frame/emission.js.map +1 -1
  315. package/dist/tools/frame/environment-gpu.d.ts +111 -0
  316. package/dist/tools/frame/environment-gpu.js +280 -0
  317. package/dist/tools/frame/environment-gpu.js.map +1 -0
  318. package/dist/tools/frame/environment.d.ts +3 -2
  319. package/dist/tools/frame/environment.js +8 -4
  320. package/dist/tools/frame/environment.js.map +1 -1
  321. package/dist/tools/frame/froxel.d.ts +58 -0
  322. package/dist/tools/frame/froxel.js +115 -0
  323. package/dist/tools/frame/froxel.js.map +1 -0
  324. package/dist/tools/frame/grid.d.ts +90 -0
  325. package/dist/tools/frame/grid.js +112 -13
  326. package/dist/tools/frame/grid.js.map +1 -1
  327. package/dist/tools/frame/index.d.ts +14 -0
  328. package/dist/tools/frame/index.js +45 -4
  329. package/dist/tools/frame/index.js.map +1 -1
  330. package/dist/tools/frame/medium.d.ts +16 -0
  331. package/dist/tools/frame/medium.js +3 -1
  332. package/dist/tools/frame/medium.js.map +1 -1
  333. package/dist/tools/frame/mie.d.ts +9 -0
  334. package/dist/tools/frame/mie.js +18 -0
  335. package/dist/tools/frame/mie.js.map +1 -1
  336. package/dist/tools/frame/mlp-nn.d.ts +36 -0
  337. package/dist/tools/frame/mlp-nn.js +159 -0
  338. package/dist/tools/frame/mlp-nn.js.map +1 -0
  339. package/dist/tools/frame/mlp-tza.d.ts +29 -0
  340. package/dist/tools/frame/mlp-tza.js +186 -0
  341. package/dist/tools/frame/mlp-tza.js.map +1 -0
  342. package/dist/tools/frame/mlp.d.ts +183 -0
  343. package/dist/tools/frame/mlp.js +434 -0
  344. package/dist/tools/frame/mlp.js.map +1 -0
  345. package/dist/tools/frame/ms-exit.d.ts +42 -0
  346. package/dist/tools/frame/ms-exit.js +90 -0
  347. package/dist/tools/frame/ms-exit.js.map +1 -0
  348. package/dist/tools/frame/multi-scale.d.ts +152 -0
  349. package/dist/tools/frame/multi-scale.js +302 -0
  350. package/dist/tools/frame/multi-scale.js.map +1 -0
  351. package/dist/tools/frame/neural-weights.d.ts +6 -5
  352. package/dist/tools/frame/neural-weights.js +234 -235
  353. package/dist/tools/frame/neural-weights.js.map +1 -1
  354. package/dist/tools/frame/neural.js +1 -1
  355. package/dist/tools/frame/neural.js.map +1 -1
  356. package/dist/tools/frame/occluders.d.ts +51 -0
  357. package/dist/tools/frame/occluders.js +72 -0
  358. package/dist/tools/frame/occluders.js.map +1 -0
  359. package/dist/tools/frame/pyramid-layout.d.ts +17 -0
  360. package/dist/tools/frame/pyramid-layout.js +47 -0
  361. package/dist/tools/frame/pyramid-layout.js.map +1 -1
  362. package/dist/tools/frame/shadows.d.ts +110 -0
  363. package/dist/tools/frame/shadows.js +286 -0
  364. package/dist/tools/frame/shadows.js.map +1 -1
  365. package/dist/tools/frame/sparse.d.ts +82 -0
  366. package/dist/tools/frame/sparse.js +242 -1
  367. package/dist/tools/frame/sparse.js.map +1 -1
  368. package/dist/tools/frame/spectral-stack.d.ts +159 -0
  369. package/dist/tools/frame/spectral-stack.js +391 -0
  370. package/dist/tools/frame/spectral-stack.js.map +1 -0
  371. package/dist/tools/frame/spectral.d.ts +21 -2
  372. package/dist/tools/frame/spectral.js +30 -8
  373. package/dist/tools/frame/spectral.js.map +1 -1
  374. package/dist/tools/frame/stack.d.ts +115 -0
  375. package/dist/tools/frame/stack.js +290 -0
  376. package/dist/tools/frame/stack.js.map +1 -0
  377. package/dist/tools/frame/view.d.ts +131 -0
  378. package/dist/tools/frame/view.js +337 -0
  379. package/dist/tools/frame/view.js.map +1 -0
  380. package/dist/tools/index.d.ts +66 -15
  381. package/dist/tools/index.js +55 -11
  382. package/dist/tools/index.js.map +1 -1
  383. package/dist/tools/internal.d.ts +58 -17
  384. package/dist/tools/internal.js +65 -11
  385. package/dist/tools/internal.js.map +1 -1
  386. package/dist/tools/nanovdb/build-from-vdb.d.ts +11 -2
  387. package/dist/tools/nanovdb/build-from-vdb.js +10 -2
  388. package/dist/tools/nanovdb/build-from-vdb.js.map +1 -1
  389. package/dist/tools/nanovdb/bytes.d.ts +17 -4
  390. package/dist/tools/nanovdb/bytes.js +46 -3
  391. package/dist/tools/nanovdb/bytes.js.map +1 -1
  392. package/dist/tools/nanovdb/coarse-first.d.ts +19 -3
  393. package/dist/tools/nanovdb/coarse-first.js +7 -1
  394. package/dist/tools/nanovdb/coarse-first.js.map +1 -1
  395. package/dist/tools/nanovdb/half.d.ts +22 -0
  396. package/dist/tools/nanovdb/half.js +73 -0
  397. package/dist/tools/nanovdb/half.js.map +1 -0
  398. package/dist/tools/nanovdb/index.d.ts +3 -1
  399. package/dist/tools/nanovdb/index.js +2 -1
  400. package/dist/tools/nanovdb/index.js.map +1 -1
  401. package/dist/tools/nanovdb/inspect.d.ts +10 -1
  402. package/dist/tools/nanovdb/inspect.js +8 -1
  403. package/dist/tools/nanovdb/inspect.js.map +1 -1
  404. package/dist/tools/nanovdb/leaf-codec.d.ts +35 -1
  405. package/dist/tools/nanovdb/leaf-codec.js +40 -4
  406. package/dist/tools/nanovdb/leaf-codec.js.map +1 -1
  407. package/dist/tools/nanovdb/quantize.d.ts +39 -10
  408. package/dist/tools/nanovdb/quantize.js +96 -44
  409. package/dist/tools/nanovdb/quantize.js.map +1 -1
  410. package/dist/tools/nanovdb/resample.d.ts +20 -3
  411. package/dist/tools/nanovdb/resample.js +20 -7
  412. package/dist/tools/nanovdb/resample.js.map +1 -1
  413. package/dist/tools/nanovdb/serialize.d.ts +34 -3
  414. package/dist/tools/nanovdb/serialize.js +51 -7
  415. package/dist/tools/nanovdb/serialize.js.map +1 -1
  416. package/dist/tools/nanovdb/stats.d.ts +34 -5
  417. package/dist/tools/nanovdb/stats.js +87 -11
  418. package/dist/tools/nanovdb/stats.js.map +1 -1
  419. package/dist/tools/nanovdb/transform.d.ts +4 -0
  420. package/dist/tools/nanovdb/transform.js +3 -0
  421. package/dist/tools/nanovdb/transform.js.map +1 -1
  422. package/dist/tools/nanovdb/tree.d.ts +14 -3
  423. package/dist/tools/nanovdb/tree.js +25 -13
  424. package/dist/tools/nanovdb/tree.js.map +1 -1
  425. package/dist/tools/nanovdb/write-nvdb.d.ts +47 -12
  426. package/dist/tools/nanovdb/write-nvdb.js +108 -28
  427. package/dist/tools/nanovdb/write-nvdb.js.map +1 -1
  428. package/dist/tools/nvdb-file.d.ts +77 -7
  429. package/dist/tools/nvdb-file.js +177 -20
  430. package/dist/tools/nvdb-file.js.map +1 -1
  431. package/dist/tools/nvdb-stream.d.ts +23 -7
  432. package/dist/tools/nvdb-stream.js +78 -34
  433. package/dist/tools/nvdb-stream.js.map +1 -1
  434. package/dist/tools/reference/analytic.d.ts +41 -0
  435. package/dist/tools/reference/analytic.js +95 -0
  436. package/dist/tools/reference/analytic.js.map +1 -0
  437. package/dist/tools/reference/environment.d.ts +62 -0
  438. package/dist/tools/reference/environment.js +154 -0
  439. package/dist/tools/reference/environment.js.map +1 -0
  440. package/dist/tools/reference/index.d.ts +12 -0
  441. package/dist/tools/reference/index.js +13 -0
  442. package/dist/tools/reference/index.js.map +1 -0
  443. package/dist/tools/reference/media.d.ts +14 -0
  444. package/dist/tools/reference/media.js +30 -0
  445. package/dist/tools/reference/media.js.map +1 -0
  446. package/dist/tools/reference/rng.d.ts +20 -0
  447. package/dist/tools/reference/rng.js +30 -0
  448. package/dist/tools/reference/rng.js.map +1 -0
  449. package/dist/tools/reference/scene.d.ts +312 -0
  450. package/dist/tools/reference/scene.js +169 -0
  451. package/dist/tools/reference/scene.js.map +1 -0
  452. package/dist/tools/reference/tables.d.ts +98 -0
  453. package/dist/tools/reference/tables.js +264 -0
  454. package/dist/tools/reference/tables.js.map +1 -0
  455. package/dist/tools/reference/trace.d.ts +160 -0
  456. package/dist/tools/reference/trace.js +497 -0
  457. package/dist/tools/reference/trace.js.map +1 -0
  458. package/dist/tools/vdb/blosc-write.d.ts +43 -0
  459. package/dist/tools/vdb/blosc-write.js +197 -0
  460. package/dist/tools/vdb/blosc-write.js.map +1 -0
  461. package/dist/tools/vdb/blosc.d.ts +35 -5
  462. package/dist/tools/vdb/blosc.js +82 -26
  463. package/dist/tools/vdb/blosc.js.map +1 -1
  464. package/dist/tools/vdb/blosclz.d.ts +33 -0
  465. package/dist/tools/vdb/blosclz.js +112 -0
  466. package/dist/tools/vdb/blosclz.js.map +1 -0
  467. package/dist/tools/vdb/byte-reader.d.ts +13 -3
  468. package/dist/tools/vdb/byte-reader.js +26 -4
  469. package/dist/tools/vdb/byte-reader.js.map +1 -1
  470. package/dist/tools/vdb/compression.d.ts +13 -5
  471. package/dist/tools/vdb/compression.js +13 -2
  472. package/dist/tools/vdb/compression.js.map +1 -1
  473. package/dist/tools/vdb/grid.js +8 -2
  474. package/dist/tools/vdb/grid.js.map +1 -1
  475. package/dist/tools/vdb/index.d.ts +2 -1
  476. package/dist/tools/vdb/index.js.map +1 -1
  477. package/dist/tools/vdb/lz4.d.ts +30 -0
  478. package/dist/tools/vdb/lz4.js +228 -0
  479. package/dist/tools/vdb/lz4.js.map +1 -0
  480. package/dist/tools/vdb/metadata.js +1 -1
  481. package/dist/tools/vdb/metadata.js.map +1 -1
  482. package/dist/tools/vdb/parse.d.ts +24 -2
  483. package/dist/tools/vdb/parse.js +102 -32
  484. package/dist/tools/vdb/parse.js.map +1 -1
  485. package/dist/tools/vdb/point-render-data.d.ts +49 -1
  486. package/dist/tools/vdb/point-render-data.js +91 -11
  487. package/dist/tools/vdb/point-render-data.js.map +1 -1
  488. package/dist/tools/vdb/points.d.ts +26 -0
  489. package/dist/tools/vdb/points.js +46 -5
  490. package/dist/tools/vdb/points.js.map +1 -1
  491. package/dist/tools/vdb/types.d.ts +59 -2
  492. package/dist/tools/vdb/types.js.map +1 -1
  493. package/dist/tools/wvdb/bake.d.ts +38 -9
  494. package/dist/tools/wvdb/bake.js +63 -13
  495. package/dist/tools/wvdb/bake.js.map +1 -1
  496. package/dist/tools/wvdb/dense.d.ts +80 -1
  497. package/dist/tools/wvdb/dense.js +67 -8
  498. package/dist/tools/wvdb/dense.js.map +1 -1
  499. package/dist/tools/wvdb/format.d.ts +59 -0
  500. package/dist/tools/wvdb/format.js +3 -0
  501. package/dist/tools/wvdb/format.js.map +1 -1
  502. package/dist/tools/wvdb/index.d.ts +1 -0
  503. package/dist/tools/wvdb/index.js +1 -0
  504. package/dist/tools/wvdb/index.js.map +1 -1
  505. package/dist/tools/wvdb/level-set.d.ts +10 -2
  506. package/dist/tools/wvdb/level-set.js.map +1 -1
  507. package/dist/tools/wvdb/nanovdb.d.ts +6 -1
  508. package/dist/tools/wvdb/nanovdb.js +5 -1
  509. package/dist/tools/wvdb/nanovdb.js.map +1 -1
  510. package/dist/tools/wvdb/partial.d.ts +74 -0
  511. package/dist/tools/wvdb/partial.js +233 -0
  512. package/dist/tools/wvdb/partial.js.map +1 -0
  513. package/dist/tools/wvdb/read.d.ts +77 -1
  514. package/dist/tools/wvdb/read.js +30 -7
  515. package/dist/tools/wvdb/read.js.map +1 -1
  516. package/dist/tools/wvdb/write.d.ts +23 -1
  517. package/dist/tools/wvdb/write.js +8 -1
  518. package/dist/tools/wvdb/write.js.map +1 -1
  519. package/package.json +2 -1
  520. package/vendor/VENDOR.md +21 -6
  521. package/vendor/pnanovdb.wgsl +52 -14
  522. package/dist/three/frame/blackbody.d.ts +0 -42
  523. package/dist/three/frame/blackbody.js +0 -74
  524. package/dist/three/frame/blackbody.js.map +0 -1
  525. package/dist/three/frame/chunks.d.ts +0 -157
  526. package/dist/three/frame/chunks.js +0 -559
  527. package/dist/three/frame/chunks.js.map +0 -1
  528. package/dist/three/frame/density-material.d.ts +0 -53
  529. package/dist/three/frame/density-material.js +0 -353
  530. package/dist/three/frame/density-material.js.map +0 -1
  531. package/dist/three/frame/environment-grid-material.d.ts +0 -21
  532. package/dist/three/frame/environment-grid-material.js +0 -184
  533. package/dist/three/frame/environment-grid-material.js.map +0 -1
  534. package/dist/three/frame/environment-material.d.ts +0 -22
  535. package/dist/three/frame/environment-material.js +0 -87
  536. package/dist/three/frame/environment-material.js.map +0 -1
  537. package/dist/three/frame/grid-mip-material.d.ts +0 -12
  538. package/dist/three/frame/grid-mip-material.js +0 -61
  539. package/dist/three/frame/grid-mip-material.js.map +0 -1
  540. package/dist/three/frame/inject-material.d.ts +0 -56
  541. package/dist/three/frame/inject-material.js +0 -424
  542. package/dist/three/frame/inject-material.js.map +0 -1
  543. package/dist/three/frame/integrate-material.d.ts +0 -26
  544. package/dist/three/frame/integrate-material.js +0 -198
  545. package/dist/three/frame/integrate-material.js.map +0 -1
  546. package/dist/three/frame/layout.d.ts +0 -34
  547. package/dist/three/frame/layout.js +0 -48
  548. package/dist/three/frame/layout.js.map +0 -1
  549. package/dist/three/frame/lighting-material.d.ts +0 -41
  550. package/dist/three/frame/lighting-material.js +0 -257
  551. package/dist/three/frame/lighting-material.js.map +0 -1
  552. package/dist/three/frame/lights.d.ts +0 -11
  553. package/dist/three/frame/lights.js +0 -16
  554. package/dist/three/frame/lights.js.map +0 -1
  555. package/dist/three/frame/neural.d.ts +0 -14
  556. package/dist/three/frame/neural.js +0 -105
  557. package/dist/three/frame/neural.js.map +0 -1
  558. package/dist/three/frame/phase.d.ts +0 -44
  559. package/dist/three/frame/phase.js +0 -80
  560. package/dist/three/frame/phase.js.map +0 -1
  561. package/dist/three/frame/shadow-density-material.d.ts +0 -30
  562. package/dist/three/frame/shadow-density-material.js +0 -123
  563. package/dist/three/frame/shadow-density-material.js.map +0 -1
  564. package/dist/three/frame/temporal-material.d.ts +0 -29
  565. package/dist/three/frame/temporal-material.js +0 -152
  566. package/dist/three/frame/temporal-material.js.map +0 -1
  567. package/dist/three/frame/transmittance-material.d.ts +0 -31
  568. package/dist/three/frame/transmittance-material.js +0 -315
  569. package/dist/three/frame/transmittance-material.js.map +0 -1
  570. package/dist/three/frame/view.d.ts +0 -103
  571. package/dist/three/frame/view.js +0 -296
  572. package/dist/three/frame/view.js.map +0 -1
  573. package/dist/three/frame/volume-shadow-material.d.ts +0 -36
  574. package/dist/three/frame/volume-shadow-material.js +0 -128
  575. package/dist/three/frame/volume-shadow-material.js.map +0 -1
  576. package/dist/three/sequence.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/core/wgsl/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAa9C,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAA8C;IAC3E,KAAK,EAAE,qBAAqB;IAC5B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE,oBAAoB;IAC1B,GAAG,EAAE,mBAAmB;CACzB,CAAC;AAEF,2FAA2F;AAC3F,SAAS,WAAW,CAAC,WAAmB,EAAE,CAAa;IACrD,OAAO,WAAW,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC;AAClD,CAAC;AAED,6EAA6E;AAC7E,SAAS,YAAY,CAAC,WAAmB;IACvC,OAAO,WAAW,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,SAAS,CAAC,CAAa,EAAE,WAAmB;IACnD,MAAM,IAAI,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChF,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CA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AAE,UAAU,CAAC,CAAC;AAE5H,0HAA0H;AAC1H,MAAM,UAAU,OAAO,CAAC,WAAmB,EAAE,CAAa;IACxD,OAAO,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3H,CAAC","sourcesContent":["/**\n * The public `vdb*` WGSL API layered over the vendored traversal\n * (docs/dev/design/K1-core.md §3.2). Written in the generated module's final names:\n * vendored declarations appear renamed (`vdb_*`, `VDB_*`), and the generator\n * pulls in exactly the vendored declarations this text references.\n *\n * Every pool read goes through `vdb_load`, the module's one buffer access,\n * which the generator emits for the chosen binding mode.\n *\n * Layers stack: `sample` includes `read`, `march` includes `sample`\n * (`majorant` is deferred past 0.1, D22). Each layer is a function of the\n * normalized options and the profile rank.\n *\n * Conventions every layer keeps:\n * - A grid id is usable when it is below `vdbGridCount()` and its record is\n * live. Every per-grid function checks that first: a dead or out-of-range\n * id never reads a zeroed record or image bytes as a record.\n * - Voxel centres sit at integer index coordinates (the vendored trilinear and\n * NanoVDB `SampleFromVoxels`); HDDA cells are floor-based, so voxel `i`\n * occupies `[i, i + 1)` for ray clipping and traversal.\n */\n\nimport type { VDBGridTypeName } from \"../types.js\";\nimport { levelSetWgsl } from \"./level-set.js\";\nimport type { VDBModuleHelper } from \"./types.js\";\n\n/** Options the API layer depends on (normalized by the generator). */\nexport interface ApiOptions {\n readonly types: readonly VDBGridTypeName[];\n readonly isActive: boolean;\n readonly sampler: \"trilinear\" | \"nearest\";\n readonly outside: \"background\" | \"zero\";\n /** Opt-in helpers, canonical order; the generator has checked each one's profile. */\n readonly helpers: readonly VDBModuleHelper[];\n}\n\n/** Vendored grid-type constant names (after the rename) per compiled type. */\nexport const GRID_TYPE_CONSTANT: Readonly<Record<VDBGridTypeName, string>> = {\n float: \"VDB_GRID_TYPE_FLOAT\",\n fp4: \"VDB_GRID_TYPE_FP4\",\n fp8: \"VDB_GRID_TYPE_FP8\",\n fp16: \"VDB_GRID_TYPE_FP16\",\n fpn: \"VDB_GRID_TYPE_FPN\",\n};\n\n/** Whether the accessor carries the index bbox (only `sample`+ with `outside: 'zero'`). */\nfunction carriesBBox(profileRank: number, o: ApiOptions): boolean {\n return profileRank >= 1 && o.outside === \"zero\";\n}\n\n/** Whether the accessor carries the stats flag and `valueMax` (`march`+). */\nfunction carriesStats(profileRank: number): boolean {\n return profileRank >= 2;\n}\n\nfunction readLayer(o: ApiOptions, profileRank: number): string {\n const bbox = carriesBBox(profileRank, o);\n const stats = carriesStats(profileRank);\n const typeOk = o.types.map((t) => `t == ${GRID_TYPE_CONSTANT[t]}`).join(\" || \");\n const extraFields = (bbox ? \"\\n lo: vec3i,\\n hi: vec3i,\" : \"\") + (stats ? \"\\n stats: bool,\\n vmax: f32,\" : \"\");\n const extraInit =\n (bbox ? \"\\n a.lo = vdbIndexMin(g);\\n a.hi = vdbIndexMax(g);\" : \"\") +\n (stats\n ? \"\\n a.stats = (vdb_rec(g, VDB_REC_FLAGS) & VDB_REC_FLAG_HAS_STATS) != 0u;\\n a.vmax = bitcast<f32>(vdb_rec(g, VDB_REC_VALUE_MAX));\"\n : \"\");\n const parts = [\n `struct VdbAccessor {\n buf: vdb_buf_t,\n gridType: u32,\n ok: bool,\n inner: vdb_readaccessor_t,${extraFields}\n}`,\n `fn vdb_rec(g: u32, w: u32) -> u32 {\n return vdb_load(VDB_POOL_TABLE_WORD + g * VDB_POOL_RECORD_WORDS + w);\n}`,\n `fn vdb_type_ok(t: u32) -> bool {\n return ${typeOk};\n}`,\n `fn vdbGridCount() -> u32 {\n return vdb_load(VDB_HEADER_GRID_COUNT);\n}`,\n `fn vdb_live(g: u32) -> bool {\n return g < vdbGridCount() && (vdb_rec(g, VDB_REC_FLAGS) & VDB_REC_FLAG_LIVE) != 0u;\n}`,\n `fn vdbGridType(g: u32) -> u32 {\n if !vdb_live(g) {\n return 0u;\n }\n return vdb_rec(g, VDB_REC_GRID_TYPE);\n}`,\n `fn vdbIndexMin(g: u32) -> vec3i {\n if !vdb_live(g) {\n return vec3i(0);\n }\n return bitcast<vec3i>(vec3u(vdb_rec(g, VDB_REC_INDEX_BBOX_MIN), vdb_rec(g, VDB_REC_INDEX_BBOX_MIN + 1u), vdb_rec(g, VDB_REC_INDEX_BBOX_MIN + 2u)));\n}`,\n `fn vdbIndexMax(g: u32) -> vec3i {\n if !vdb_live(g) {\n return vec3i(-1);\n }\n return bitcast<vec3i>(vec3u(vdb_rec(g, VDB_REC_INDEX_BBOX_MAX), vdb_rec(g, VDB_REC_INDEX_BBOX_MAX + 1u), vdb_rec(g, VDB_REC_INDEX_BBOX_MAX + 2u)));\n}`,\n `fn vdbAccessorInit(g: u32) -> VdbAccessor {\n var a: VdbAccessor;\n a.gridType = vdbGridType(g);\n a.ok = vdb_type_ok(a.gridType);\n var root = vdb_root_handle_t(0u);\n if a.ok {\n a.buf = vdb_make_buffer(vdb_rec(g, VDB_REC_IMAGE_OFFSET), vdb_rec(g, VDB_REC_IMAGE_BYTES) >> 2u);\n root = vdb_tree_get_root(a.buf, vdb_grid_get_tree(vdb_grid_handle_t(0u)));${extraInit}\n }\n var inner: vdb_readaccessor_t;\n vdb_readaccessor_init(&inner, root);\n a.inner = inner;\n return a;\n}`,\n `fn vdbReadValue(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n var inner = (*acc).inner;\n let v = vdb_readaccessor_get_value_float((*acc).gridType, (*acc).buf, &inner, ijk);\n (*acc).inner = inner;\n return v;\n}`,\n ];\n if (o.isActive) {\n parts.push(`fn vdbIsActive(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> bool {\n if !(*acc).ok {\n return false;\n }\n var inner = (*acc).inner;\n let v = vdb_readaccessor_is_active((*acc).gridType, (*acc).buf, &inner, ijk);\n (*acc).inner = inner;\n return v;\n}`);\n }\n return parts.join(\"\\n\");\n}\n\n/**\n * `vdbSample` per sampler and `outside` mode.\n *\n * `outside: 'background'` reads the tree everywhere (NanoVDB: outside the\n * tree the background value).\n *\n * `outside: 'zero'` samples the field that equals the tree inside the index\n * bbox `[min, max]` (voxels, inclusive) and 0 outside it, so both samplers\n * see the same box with voxel centres at integers:\n * - trilinear: each of the 8 taps outside `[min, max]` reads 0. A point is\n * 0 unless its base voxel `floor(xyz)` lies in `[min - 1, max]` (some tap\n * inside), i.e. `xyz` in `[min - 1, max + 1)`.\n * - nearest: the voxel `floor(xyz + 0.5)` must lie in `[min, max]`, i.e.\n * `xyz` in `[min - 0.5, max + 0.5)`; else 0.\n * CPU twins: `tools` `vdbSampleTrilinear` / `vdbSampleNearest` with `{ outside: 'zero' }`.\n */\nfunction sampleFunction(o: ApiOptions, profileRank: number): string[] {\n const read = (ijk: string) => `vdb_readaccessor_get_value_float((*acc).gridType, (*acc).buf, &inner, ${ijk})`;\n if (!carriesBBox(profileRank, o)) {\n const lookup =\n o.sampler === \"trilinear\" ? \"vdb_sample_trilinear_typed((*acc).gridType, (*acc).buf, &inner, xyz)\" : read(\"vec3i(floor(xyz + vec3f(0.5)))\");\n return [\n `fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n var inner = (*acc).inner;\n let v = ${lookup};\n (*acc).inner = inner;\n return v;\n}`,\n ];\n }\n if (o.sampler === \"nearest\") {\n return [\n `fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n let ijk = vec3i(floor(xyz + vec3f(0.5)));\n if !(*acc).ok || any(ijk < (*acc).lo) || any(ijk > (*acc).hi) {\n return 0.0;\n }\n var inner = (*acc).inner;\n let v = ${read(\"ijk\")};\n (*acc).inner = inner;\n return v;\n}`,\n ];\n }\n // Same tap order and lerp structure as the vendored sample_trilinear_typed.\n return [\n `fn vdb_tap0(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {\n if any(ijk < (*acc).lo) || any(ijk > (*acc).hi) {\n return 0.0;\n }\n var inner = (*acc).inner;\n let v = ${read(\"ijk\")};\n (*acc).inner = inner;\n return v;\n}`,\n `fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n let b = vec3i(floor(xyz));\n if !(*acc).ok || any(b < (*acc).lo - vec3i(1)) || any(b > (*acc).hi) {\n return 0.0;\n }\n let u = xyz - vec3f(b);\n let x00 = mix(vdb_tap0(acc, b), vdb_tap0(acc, b + vec3i(1, 0, 0)), u.x);\n let x10 = mix(vdb_tap0(acc, b + vec3i(0, 1, 0)), vdb_tap0(acc, b + vec3i(1, 1, 0)), u.x);\n let x01 = mix(vdb_tap0(acc, b + vec3i(0, 0, 1)), vdb_tap0(acc, b + vec3i(1, 0, 1)), u.x);\n let x11 = mix(vdb_tap0(acc, b + vec3i(0, 1, 1)), vdb_tap0(acc, b + vec3i(1, 1, 1)), u.x);\n return mix(mix(x00, x10, u.y), mix(x01, x11, u.y), u.z);\n}`,\n ];\n}\n\nfunction sampleLayer(o: ApiOptions, profileRank: number): string {\n return [\n `fn vdb_row(b: u32) -> vec4f {\n return bitcast<vec4f>(vec4u(vdb_load(b), vdb_load(b + 1u), vdb_load(b + 2u), vdb_load(b + 3u)));\n}`,\n `fn vdb_affine(g: u32, w: u32, p: vec4f) -> vec3f {\n if !vdb_live(g) {\n return vec3f(0.0);\n }\n let b = VDB_POOL_TABLE_WORD + g * VDB_POOL_RECORD_WORDS + w;\n return vec3f(dot(vdb_row(b), p), dot(vdb_row(b + 4u), p), dot(vdb_row(b + 8u), p));\n}`,\n `fn vdbWorldToIndex(g: u32, p: vec3f) -> vec3f {\n return vdb_affine(g, VDB_REC_WORLD_TO_INDEX, vec4f(p, 1.0));\n}`,\n `fn vdbWorldToIndexDir(g: u32, d: vec3f) -> vec3f {\n return vdb_affine(g, VDB_REC_WORLD_TO_INDEX, vec4f(d, 0.0));\n}`,\n `fn vdbIndexToWorld(g: u32, p: vec3f) -> vec3f {\n return vdb_affine(g, VDB_REC_INDEX_TO_WORLD, vec4f(p, 1.0));\n}`,\n `fn vdbIndexToWorldDir(g: u32, d: vec3f) -> vec3f {\n return vdb_affine(g, VDB_REC_INDEX_TO_WORLD, vec4f(d, 0.0));\n}`,\n ...sampleFunction(o, profileRank),\n `fn vdbRayClip(g: u32, o: vec3f, d: vec3f, t: ptr<function, vec2f>) -> bool {\n if !vdb_live(g) {\n return false;\n }\n var t0 = (*t).x;\n var t1 = (*t).y;\n let hit = vdb_hdda_ray_clip(vec3f(vdbIndexMin(g)), vec3f(vdbIndexMax(g) + vec3i(1)), o, &t0, d, &t1);\n *t = vec2f(t0, t1);\n return hit && t0 <= t1;\n}`,\n ].join(\"\\n\");\n}\n\n/**\n * `march` (design note §3.2): the vendored HDDA, the accessor's node size at a\n * voxel, and node stats.\n *\n * `vdbGetDim(acc, ijk)` is the vendored `readaccessor_get_dim`: 1 inside a\n * leaf, 8 in a lower-node tile, 128 in an upper-node tile, 4096 in a root tile\n * or the background (and 4096 for a grid the accessor can't read, so a walk\n * ends after one cell instead of stalling at dim 0).\n *\n * `vdbNodeMax(acc, ijk, dim)` bounds the aligned cell of size `dim` holding\n * `ijk`. With `a = vdbGetDim(acc, ijk)`:\n * - `a > 1` and `dim <= a`: the cell lies in one tile; returns its value\n * (exact, active or not).\n * - otherwise the max statistic of the smallest node spanning the cell: the\n * leaf for `dim <= 8`, lower for `<= 128`, upper for `<= 4096`, else root.\n * NanoVDB stats cover ACTIVE values only: the result bounds the active\n * voxels and active tiles of that node, not inactive values, and not a\n * trilinear sample, whose taps reach one voxel into the neighbours.\n * - without stats (record flag b1 clear) the stats branches return the\n * record's `valueMax`: the caller's bound from `pool.add`, else +Infinity\n * (the pool convention for \"no bound\"). Test `vdbHasStats(g)` rather than\n * relying on infinity arithmetic.\n * The node handles come from the accessor cache that `vdbGetDim` just filled\n * along `ijk`'s path (leaf, lower and upper are all valid whenever the level\n * below them is, see the vendored `readaccessor_iscached*`).\n */\nfunction marchLayer(): string {\n return [\n `alias VdbHdda = vdb_hdda_t;`,\n `fn vdbHddaInit(h: ptr<function, VdbHdda>, o: vec3f, tmin: f32, d: vec3f, tmax: f32, dim: u32) {\n vdb_hdda_init(h, o, tmin, d, tmax, i32(dim));\n}`,\n `fn vdbHddaUpdate(h: ptr<function, VdbHdda>, o: vec3f, d: vec3f, dim: u32) -> bool {\n return vdb_hdda_update(h, o, d, i32(dim));\n}`,\n `fn vdbHddaStep(h: ptr<function, VdbHdda>) -> bool {\n return vdb_hdda_step(h);\n}`,\n `fn vdbGetDim(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> u32 {\n if !(*acc).ok {\n return 4096u;\n }\n var inner = (*acc).inner;\n let v = vdb_readaccessor_get_dim((*acc).gridType, (*acc).buf, &inner, ijk);\n (*acc).inner = inner;\n return v;\n}`,\n `fn vdbHasStats(g: u32) -> bool {\n return vdb_live(g) && (vdb_rec(g, VDB_REC_FLAGS) & VDB_REC_FLAG_HAS_STATS) != 0u;\n}`,\n `fn vdbValueMax(g: u32) -> f32 {\n if !vdb_live(g) {\n return 0.0;\n }\n return bitcast<f32>(vdb_rec(g, VDB_REC_VALUE_MAX));\n}`,\n `fn vdbNodeMax(acc: ptr<function, VdbAccessor>, ijk: vec3i, dim: u32) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n let a = vdbGetDim(acc, ijk);\n if a > 1u && dim <= a {\n return vdbReadValue(acc, ijk);\n }\n if !(*acc).stats {\n return (*acc).vmax;\n }\n let t = (*acc).gridType;\n let b = (*acc).buf;\n if dim <= 8u {\n return vdb_leaf_get_max_float(t, b, (*acc).inner.leaf);\n }\n if dim <= 128u {\n return vdb_lower_get_max_float(t, b, (*acc).inner.lower);\n }\n if dim <= 4096u {\n return vdb_upper_get_max_float(t, b, (*acc).inner.upper);\n }\n return vdb_root_get_max_float(t, b, (*acc).inner.root);\n}`,\n ].join(\"\\n\");\n}\n\n/**\n * Opt-in helpers (K1.7a, the `helpers` option). Each is emitted only when\n * asked for, so modules without helpers keep their bytes (the size snapshot).\n *\n * `vdbCellBoundTrilinear(acc, ijk, dim)`: the max of `vdbNodeMax` over the\n * 2x2x2 block of aligned `dim`-cells whose min corner is the cell holding\n * `ijk` (that cell and its +x/+y/+z neighbours). A trilinear sample at `p`\n * reads voxels `floor(p) + {0,1}^3`, so when `floor(p)` lies in the cell every\n * tap lies in the block and the result bounds the sample, with `vdbNodeMax`'s\n * caveat: stats bound ACTIVE values, so inactive leaf voxels must be <= their\n * leaf's max (true of fog volumes). With `outside: 'zero'` and a negative\n * field, also take max(result, 0). This is the skip test a march needs; the\n * cell's own `vdbNodeMax` is not one (CLAUDE.md Traps). CPU twin: `tools`\n * `cellBoundTrilinear`.\n *\n * `vdbHddaCellEnd(h)`: the ray `t` where the HDDA's current cell ends,\n * `min(next.x, next.y, next.z, tmax)` of the vendored state, so a host\n * needn't name `VdbHdda`'s vendored fields. CPU twin: `tools` `hddaCellEnd`.\n *\n * `vdbNodeAverage(acc, ijk, dim)` (K3.2): the box mean of the aligned\n * `dim`-cell holding `ijk`, from node statistics instead of voxels (the\n * sparse volume source's `'node-average'` LOD). A cell inside one tile (or the\n * background) is that tile's value, exactly. Otherwise, for `dim <= 8`, the\n * leaf's average times its active fraction (`countOneBits` of the value mask\n * / 512): the exact mean when the leaf's inactive voxels are 0 (fog); for\n * `dim <= 128`, the lower node's average, which is the mean of its ACTIVE\n * voxels (NanoVDB stores no active count per lower node), so it overstates a\n * partly empty lower node; larger cells read the lower node too (`dim` is\n * meant to be 8 or 128; no upper level, to keep the module small). Without stats it is the value at `ijk` (no\n * prefilter). CPU twin: `tools` `nodeAverage`.\n *\n * `vdbRayClipSupport(g, o, d, t)`: `vdbRayClip` against the box where\n * `vdbSample` can read the grid's voxels: `[min - 1, max + 1]` for trilinear\n * (the taps of a point in `[min - 1, min)` reach voxel `min`) and\n * `[min - 0.5, max + 0.5]` for nearest. `vdbRayClip`'s box, `[min, max + 1]`,\n * is the voxel-cell box the HDDA walks; it cuts the min-side half voxel of the\n * trilinear support. CPU twin: `tools` `rayClipSupport`.\n */\nfunction helperFunctions(o: ApiOptions): string[] {\n const out: string[] = [];\n if (o.helpers.includes(\"rayClipSupport\")) {\n const pad = o.sampler === \"nearest\" ? \"0.5\" : \"1.0\";\n out.push(`fn vdbRayClipSupport(g: u32, o: vec3f, d: vec3f, t: ptr<function, vec2f>) -> bool {\n if !vdb_live(g) {\n return false;\n }\n var t0 = (*t).x;\n var t1 = (*t).y;\n let hit = vdb_hdda_ray_clip(vec3f(vdbIndexMin(g)) - vec3f(${pad}), vec3f(vdbIndexMax(g)) + vec3f(${pad}), o, &t0, d, &t1);\n *t = vec2f(t0, t1);\n return hit && t0 <= t1;\n}`);\n }\n if (o.helpers.includes(\"cellBoundTrilinear\")) {\n out.push(`fn vdbCellBoundTrilinear(acc: ptr<function, VdbAccessor>, ijk: vec3i, dim: u32) -> f32 {\n var m = vdbNodeMax(acc, ijk, dim);\n for (var k = 1u; k < 8u; k++) {\n let c = vec3i(vec3u(k & 1u, (k >> 1u) & 1u, (k >> 2u) & 1u)) * i32(dim);\n m = max(m, vdbNodeMax(acc, ijk + c, dim));\n }\n return m;\n}`);\n }\n if (o.helpers.includes(\"hddaCellEnd\")) {\n out.push(`fn vdbHddaCellEnd(h: ptr<function, VdbHdda>) -> f32 {\n return min(min((*h).next.x, (*h).next.y), min((*h).next.z, (*h).tmax));\n}`);\n }\n if (o.helpers.includes(\"fastTrilinear\")) {\n // Only trilinear has 8 taps to share (the generator rejects the helper with 'nearest').\n const inside = carriesBBox(1, o) ? \" || any(b < (*acc).lo) || any(b >= (*acc).hi)\" : \"\";\n // Uniform per-tap work (no per-lane choice between a leaf read and a descent: lanes of a SIMD group that\n // disagree would run both). All 8 taps lie in the base voxel's lower node (128-block) unless the base is\n // on its +x/+y/+z face; each tap is then one lower-node child lookup (the same words for taps in the same\n // leaf), never a tree walk. The vendored taps instead thrash the accessor's one-leaf cache when the cell\n // straddles leaves (x-fastest tap order alternates them).\n // A tap: one lower-node child lookup (the caching variant the accessor already uses, on a scratch cache).\n // vdbSampleFast: the lower node holding the base is the accessor's cached one, else a descent (which caches\n // it); at level 2+ the base's 128-block, which holds all 8 taps, is one tile (or the background): one value.\n // c0 holds taps 0-3 (z = 0), c1 taps 4-7 (z = 1), x fastest: the vendored c000, c100, c010, c110, c001, ...\n // No comments inside the WGSL: generated modules carry only the banner.\n out.push(`fn vdb_lower_tap(t: u32, buf: vdb_buf_t, node: vdb_lower_handle_t, b: vec3i, k: u32) -> f32 {\n let ijk = b + vec3i(vec3u(k & 1u, (k >> 1u) & 1u, k >> 2u));\n var s: vdb_readaccessor_t;\n let al = vdb_lower_get_value_address_and_level_and_cache(t, buf, node, ijk, &s);\n return vdb_read_float_typed(t, buf, al.address, ijk, al.level);\n}`);\n const taps = (from: number) => [0, 1, 2, 3].map((k) => `vdb_lower_tap(t, buf, n, b, ${from + k}u)`).join(\", \");\n out.push(`fn vdbSampleFast(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n let b = vec3i(floor(xyz));\n if !(*acc).ok || any((b & vec3i(127)) == vec3i(127))${inside} {\n return vdbSample(acc, xyz);\n }\n let t = (*acc).gridType;\n let buf = (*acc).buf;\n var inner = (*acc).inner;\n var lower = vdb_readaccessor_iscached1(&inner, vdb_readaccessor_computedirty(&inner, b));\n var v = 0.0;\n if !lower {\n let al = vdb_readaccessor_get_value_address_and_level(t, buf, &inner, b);\n lower = al.level <= 1u;\n v = vdb_read_float_typed(t, buf, al.address, b, al.level);\n }\n (*acc).inner = inner;\n var c0 = vec4f(v);\n var c1 = vec4f(v);\n if lower {\n let n = inner.lower;\n c0 = vec4f(${taps(0)});\n c1 = vec4f(${taps(4)});\n }\n let u = xyz - vec3f(b);\n return mix(mix(mix(c0.x, c0.y, u.x), mix(c0.z, c0.w, u.x), u.y), mix(mix(c1.x, c1.y, u.x), mix(c1.z, c1.w, u.x), u.y), u.z);\n}`);\n }\n if (o.helpers.includes(\"nodeAverage\")) {\n out.push(`fn vdbNodeAverage(acc: ptr<function, VdbAccessor>, ijk: vec3i, dim: u32) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n let a = vdbGetDim(acc, ijk);\n if (a > 1u && dim <= a) || !(*acc).stats || dim <= 1u {\n return vdbReadValue(acc, ijk);\n }\n let t = (*acc).gridType;\n let b = (*acc).buf;\n if dim <= 8u {\n let leaf = (*acc).inner.leaf;\n var n = 0u;\n for (var w = 0u; w < 16u; w++) {\n n += countOneBits(vdb_read_uint32(b, vdb_address_offset(leaf.address, VDB_LEAF_OFF_VALUE_MASK + 4u * w)));\n }\n return vdb_leaf_get_ave_float(t, b, leaf) * (f32(n) / 512.0);\n }\n return vdb_lower_get_ave_float(t, b, (*acc).inner.lower);\n}`);\n }\n // K3.7: the level-set zero-crossing finder and normal (./level-set.ts).\n if (o.helpers.includes(\"levelSet\")) out.push(...levelSetWgsl());\n return out;\n}\n\n/**\n * API layers in profile order. A profile's API is every layer up to and\n * including its own (`majorant`, rank 3, is deferred past 0.1, D22).\n */\nexport const API_LAYERS: readonly ((o: ApiOptions, profileRank: number) => string)[] = [readLayer, sampleLayer, marchLayer];\n\n/** The public API text for the profile at `profileRank` (0 = read, 1 = sample, 2 = march), then the requested helpers. */\nexport function apiWgsl(profileRank: number, o: ApiOptions): string {\n return [...API_LAYERS.slice(0, profileRank + 1).map((layer) => layer(o, profileRank)), ...helperFunctions(o)].join(\"\\n\");\n}\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/core/wgsl/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,gB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al\n * (docs/dev/design/K1-core.md §3.2). Written in the generated module's final names:\n * vendored declarations appear renamed (`vdb_*`, `VDB_*`), and the generator\n * pulls in exactly the vendored declarations this text references.\n *\n * Every pool read goes through `vdb_load`, the module's one buffer access,\n * which the generator emits for the chosen binding mode.\n *\n * Layers stack: `sample` includes `read`, `march` includes `sample`, and\n * `majorant` (P1.3) includes `sample` and, with `majorant: 'nodeMax'`, `march`\n * (`./majorant.ts`). `reader: 'lean'` (P1.5) swaps the vendored accessor for\n * `./lean.ts`. Each layer is a function of the normalized options and the\n * profile rank.\n *\n * Conventions every layer keeps:\n * - A grid id is usable when it is below `vdbGridCount()` and its record is\n * live. Every per-grid function checks that first: a dead or out-of-range\n * id never reads a zeroed record or image bytes as a record.\n * - Voxel centres sit at integer index coordinates (the vendored trilinear and\n * NanoVDB `SampleFromVoxels`); HDDA cells are floor-based, so voxel `i`\n * occupies `[i, i + 1)` for ray clipping and traversal.\n */\n\nimport type { VDBGridTypeName } from \"../types.js\";\nimport { leanHelperFunctions, leanReadLayer, leanSampleFunctions } from \"./lean.js\";\nimport { levelSetWgsl } from \"./level-set.js\";\nimport { majorantHelpersWgsl, majorantWgsl, type VDBMajorantMode } from \"./majorant.js\";\nimport type { VDBModuleHelper } from \"./types.js\";\n\n/** Options the API layer depends on (normalized by the generator). */\nexport interface ApiOptions {\n readonly types: readonly VDBGridTypeName[];\n readonly isActive: boolean;\n readonly sampler: \"trilinear\" | \"nearest\";\n readonly outside: \"background\" | \"zero\";\n /** Opt-in helpers, canonical order; the generator has checked each one's profile. */\n readonly helpers: readonly VDBModuleHelper[];\n /** P1.5: the vendored accessor or the lean reader (`./lean.ts`). */\n readonly reader: \"vendored\" | \"lean\";\n /** P1.3/P1.4, `majorant` profile only (else `'brick'`): which walk. `'nodeMax'` includes the march layer. */\n readonly majorant: VDBMajorantMode;\n /** `majorant` profile only (else false): emit `vdbMajorantMinimum`. */\n readonly minima: boolean;\n /** EX1f-b: the host's random function the tracking helpers call (a WGSL identifier), else null. */\n readonly random: string | null;\n /** P1.16: what the lean accessor caches (`'leaf'` for the vendored reader, which has its own cache). */\n readonly cache: \"leaf\" | \"lower\" | \"lowerLeaf\";\n}\n\n/** Whether the module has the march layer: `march`, or `majorant` with `'nodeMax'`. */\nexport function hasMarch(profileRank: number, o: Pick<ApiOptions, \"majorant\">): boolean {\n return profileRank === 2 || (profileRank === 3 && o.majorant === \"nodeMax\");\n}\n\n/** Vendored grid-type constant names (after the rename) per compiled type. */\nexport const GRID_TYPE_CONSTANT: Readonly<Record<VDBGridTypeName, string>> = {\n float: \"VDB_GRID_TYPE_FLOAT\",\n fp4: \"VDB_GRID_TYPE_FP4\",\n fp8: \"VDB_GRID_TYPE_FP8\",\n fp16: \"VDB_GRID_TYPE_FP16\",\n fpn: \"VDB_GRID_TYPE_FPN\",\n half: \"VDB_GRID_TYPE_HALF\",\n};\n\n/** Whether the accessor carries the index bbox (only `sample`+ with `outside: 'zero'`). */\nfunction carriesBBox(profileRank: number, o: ApiOptions): boolean {\n return profileRank >= 1 && o.outside === \"zero\";\n}\n\n/** Whether the accessor carries the stats flag and `valueMax` (the march layer). */\nfunction carriesStats(profileRank: number, o: ApiOptions): boolean {\n return hasMarch(profileRank, o);\n}\n\n/** The record functions every reader shares, in emission order. */\nfunction recordFunctions(o: ApiOptions): string[] {\n const typeOk = o.types.map((t) => `t == ${GRID_TYPE_CONSTANT[t]}`).join(\" || \");\n return [\n `fn vdb_rec(g: u32, w: u32) -> u32 {\n return vdb_load(VDB_POOL_TABLE_WORD + g * VDB_POOL_RECORD_WORDS + w);\n}`,\n `fn vdb_type_ok(t: u32) -> bool {\n return ${typeOk};\n}`,\n `fn vdbGridCount() -> u32 {\n return vdb_load(VDB_HEADER_GRID_COUNT);\n}`,\n `fn vdb_live(g: u32) -> bool {\n return g < vdbGridCount() && (vdb_rec(g, VDB_REC_FLAGS) & VDB_REC_FLAG_LIVE) != 0u;\n}`,\n `fn vdbGridType(g: u32) -> u32 {\n if !vdb_live(g) {\n return 0u;\n }\n return vdb_rec(g, VDB_REC_GRID_TYPE);\n}`,\n `fn vdbIndexMin(g: u32) -> vec3i {\n if !vdb_live(g) {\n return vec3i(0);\n }\n return bitcast<vec3i>(vec3u(vdb_rec(g, VDB_REC_INDEX_BBOX_MIN), vdb_rec(g, VDB_REC_INDEX_BBOX_MIN + 1u), vdb_rec(g, VDB_REC_INDEX_BBOX_MIN + 2u)));\n}`,\n `fn vdbIndexMax(g: u32) -> vec3i {\n if !vdb_live(g) {\n return vec3i(-1);\n }\n return bitcast<vec3i>(vec3u(vdb_rec(g, VDB_REC_INDEX_BBOX_MAX), vdb_rec(g, VDB_REC_INDEX_BBOX_MAX + 1u), vdb_rec(g, VDB_REC_INDEX_BBOX_MAX + 2u)));\n}`,\n ];\n}\n\nfunction readLayer(o: ApiOptions, profileRank: number): string {\n const bbox = carriesBBox(profileRank, o);\n if (o.reader === \"lean\") return leanReadLayer(o, bbox, recordFunctions(o));\n const stats = carriesStats(profileRank, o);\n const extraFields = (bbox ? \"\\n lo: vec3i,\\n hi: vec3i,\" : \"\") + (stats ? \"\\n stats: bool,\\n vmax: f32,\" : \"\");\n const extraInit =\n (bbox ? \"\\n a.lo = vdbIndexMin(g);\\n a.hi = vdbIndexMax(g);\" : \"\") +\n (stats\n ? \"\\n a.stats = (vdb_rec(g, VDB_REC_FLAGS) & VDB_REC_FLAG_HAS_STATS) != 0u;\\n a.vmax = bitcast<f32>(vdb_rec(g, VDB_REC_VALUE_MAX));\"\n : \"\");\n const parts = [\n `struct VdbAccessor {\n buf: vdb_buf_t,\n gridType: u32,\n ok: bool,\n inner: vdb_readaccessor_t,${extraFields}\n}`,\n ...recordFunctions(o),\n `fn vdbAccessorInit(g: u32) -> VdbAccessor {\n var a: VdbAccessor;\n a.gridType = vdbGridType(g);\n a.ok = vdb_type_ok(a.gridType);\n var root = vdb_root_handle_t(0u);\n if a.ok {\n a.buf = vdb_make_buffer(vdb_rec(g, VDB_REC_IMAGE_OFFSET), vdb_rec(g, VDB_REC_IMAGE_BYTES) >> 2u);\n root = vdb_tree_get_root(a.buf, vdb_grid_get_tree(vdb_grid_handle_t(0u)));${extraInit}\n }\n var inner: vdb_readaccessor_t;\n vdb_readaccessor_init(&inner, root);\n a.inner = inner;\n return a;\n}`,\n `fn vdbReadValue(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n var inner = (*acc).inner;\n let v = vdb_readaccessor_get_value_float((*acc).gridType, (*acc).buf, &inner, ijk);\n (*acc).inner = inner;\n return v;\n}`,\n ];\n if (o.isActive) {\n parts.push(`fn vdbIsActive(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> bool {\n if !(*acc).ok {\n return false;\n }\n var inner = (*acc).inner;\n let v = vdb_readaccessor_is_active((*acc).gridType, (*acc).buf, &inner, ijk);\n (*acc).inner = inner;\n return v;\n}`);\n }\n return parts.join(\"\\n\");\n}\n\n/**\n * `vdbSample` per sampler and `outside` mode.\n *\n * `outside: 'background'` reads the tree everywhere (NanoVDB: outside the\n * tree the background value).\n *\n * `outside: 'zero'` samples the field that equals the tree inside the index\n * bbox `[min, max]` (voxels, inclusive) and 0 outside it, so both samplers\n * see the same box with voxel centres at integers:\n * - trilinear: each of the 8 taps outside `[min, max]` reads 0. A point is\n * 0 unless its base voxel `floor(xyz)` lies in `[min - 1, max]` (some tap\n * inside), i.e. `xyz` in `[min - 1, max + 1)`.\n * - nearest: the voxel `floor(xyz + 0.5)` must lie in `[min, max]`, i.e.\n * `xyz` in `[min - 0.5, max + 0.5)`; else 0.\n * CPU twins: `tools` `vdbSampleTrilinearCpu` / `vdbSampleNearestCpu` with `{ outside: 'zero' }`.\n */\nfunction sampleFunction(o: ApiOptions, profileRank: number): string[] {\n if (o.reader === \"lean\") return leanSampleFunctions(o, carriesBBox(profileRank, o));\n const read =(ijk: string) => `vdb_readaccessor_get_value_float((*acc).gridType, (*acc).buf, &inner, ${ijk})`;\n if (!carriesBBox(profileRank, o)) {\n const lookup =\n o.sampler === \"trilinear\" ? \"vdb_sample_trilinear_typed((*acc).gridType, (*acc).buf, &inner, xyz)\" : read(\"vec3i(floor(xyz + vec3f(0.5)))\");\n return [\n `fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n var inner = (*acc).inner;\n let v = ${lookup};\n (*acc).inner = inner;\n return v;\n}`,\n ];\n }\n if (o.sampler === \"nearest\") {\n return [\n `fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n let ijk = vec3i(floor(xyz + vec3f(0.5)));\n if !(*acc).ok || any(ijk < (*acc).lo) || any(ijk > (*acc).hi) {\n return 0.0;\n }\n var inner = (*acc).inner;\n let v = ${read(\"ijk\")};\n (*acc).inner = inner;\n return v;\n}`,\n ];\n }\n // Same tap order and lerp structure as the vendored sample_trilinear_typed.\n return [\n `fn vdb_tap0(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {\n if any(ijk < (*acc).lo) || any(ijk > (*acc).hi) {\n return 0.0;\n }\n var inner = (*acc).inner;\n let v = ${read(\"ijk\")};\n (*acc).inner = inner;\n return v;\n}`,\n `fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n let b = vec3i(floor(xyz));\n if !(*acc).ok || any(b < (*acc).lo - vec3i(1)) || any(b > (*acc).hi) {\n return 0.0;\n }\n let u = xyz - vec3f(b);\n let x00 = mix(vdb_tap0(acc, b), vdb_tap0(acc, b + vec3i(1, 0, 0)), u.x);\n let x10 = mix(vdb_tap0(acc, b + vec3i(0, 1, 0)), vdb_tap0(acc, b + vec3i(1, 1, 0)), u.x);\n let x01 = mix(vdb_tap0(acc, b + vec3i(0, 0, 1)), vdb_tap0(acc, b + vec3i(1, 0, 1)), u.x);\n let x11 = mix(vdb_tap0(acc, b + vec3i(0, 1, 1)), vdb_tap0(acc, b + vec3i(1, 1, 1)), u.x);\n return mix(mix(x00, x10, u.y), mix(x01, x11, u.y), u.z);\n}`,\n ];\n}\n\nfunction sampleLayer(o: ApiOptions, profileRank: number): string {\n return [\n `fn vdb_row(b: u32) -> vec4f {\n return bitcast<vec4f>(vec4u(vdb_load(b), vdb_load(b + 1u), vdb_load(b + 2u), vdb_load(b + 3u)));\n}`,\n `fn vdb_affine(g: u32, w: u32, p: vec4f) -> vec3f {\n if !vdb_live(g) {\n return vec3f(0.0);\n }\n let b = VDB_POOL_TABLE_WORD + g * VDB_POOL_RECORD_WORDS + w;\n return vec3f(dot(vdb_row(b), p), dot(vdb_row(b + 4u), p), dot(vdb_row(b + 8u), p));\n}`,\n `fn vdbWorldToIndex(g: u32, p: vec3f) -> vec3f {\n return vdb_affine(g, VDB_REC_WORLD_TO_INDEX, vec4f(p, 1.0));\n}`,\n `fn vdbWorldToIndexDir(g: u32, d: vec3f) -> vec3f {\n return vdb_affine(g, VDB_REC_WORLD_TO_INDEX, vec4f(d, 0.0));\n}`,\n `fn vdbIndexToWorld(g: u32, p: vec3f) -> vec3f {\n return vdb_affine(g, VDB_REC_INDEX_TO_WORLD, vec4f(p, 1.0));\n}`,\n `fn vdbIndexToWorldDir(g: u32, d: vec3f) -> vec3f {\n return vdb_affine(g, VDB_REC_INDEX_TO_WORLD, vec4f(d, 0.0));\n}`,\n ...sampleFunction(o, profileRank),\n `fn vdbRayClip(g: u32, o: vec3f, d: vec3f, t: ptr<function, vec2f>) -> bool {\n if !vdb_live(g) {\n return false;\n }\n var t0 = (*t).x;\n var t1 = (*t).y;\n let hit = vdb_hdda_ray_clip(vec3f(vdbIndexMin(g)), vec3f(vdbIndexMax(g) + vec3i(1)), o, &t0, d, &t1);\n *t = vec2f(t0, t1);\n return hit && t0 <= t1;\n}`,\n ].join(\"\\n\");\n}\n\n/**\n * `march` (design note §3.2): the vendored HDDA, the accessor's node size at a\n * voxel, and node stats.\n *\n * `vdbGetDim(acc, ijk)` is the vendored `readaccessor_get_dim`: 1 inside a\n * leaf, 8 in a lower-node tile, 128 in an upper-node tile, 4096 in a root tile\n * or the background (and 4096 for a grid the accessor can't read, so a walk\n * ends after one cell instead of stalling at dim 0).\n *\n * `vdbNodeMax(acc, ijk, dim)` bounds the aligned cell of size `dim` holding\n * `ijk`. With `a = vdbGetDim(acc, ijk)`:\n * - `a > 1` and `dim <= a`: the cell lies in one tile; returns its value\n * (exact, active or not).\n * - otherwise the max statistic of the smallest node spanning the cell: the\n * leaf for `dim <= 8`, lower for `<= 128`, upper for `<= 4096`, else root.\n * NanoVDB stats cover ACTIVE values only: the result bounds the active\n * voxels and active tiles of that node, not inactive values, and not a\n * trilinear sample, whose taps reach one voxel into the neighbours.\n * - without stats (record flag b1 clear) the stats branches return the\n * record's `valueMax`: the caller's bound from `pool.add`, else +Infinity\n * (the pool convention for \"no bound\"). Test `vdbHasStats(g)` rather than\n * relying on infinity arithmetic.\n * The node handles come from the accessor cache that `vdbGetDim` just filled\n * along `ijk`'s path (leaf, lower and upper are all valid whenever the level\n * below them is, see the vendored `readaccessor_iscached*`).\n */\nfunction marchLayer(): string {\n return [\n `alias VdbHdda = vdb_hdda_t;`,\n `fn vdbHddaInit(h: ptr<function, VdbHdda>, o: vec3f, tmin: f32, d: vec3f, tmax: f32, dim: u32) {\n vdb_hdda_init(h, o, tmin, d, tmax, i32(dim));\n}`,\n `fn vdbHddaUpdate(h: ptr<function, VdbHdda>, o: vec3f, d: vec3f, dim: u32) -> bool {\n return vdb_hdda_update(h, o, d, i32(dim));\n}`,\n `fn vdbHddaStep(h: ptr<function, VdbHdda>) -> bool {\n return vdb_hdda_step(h);\n}`,\n `fn vdbGetDim(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> u32 {\n if !(*acc).ok {\n return 4096u;\n }\n var inner = (*acc).inner;\n let v = vdb_readaccessor_get_dim((*acc).gridType, (*acc).buf, &inner, ijk);\n (*acc).inner = inner;\n return v;\n}`,\n `fn vdbHasStats(g: u32) -> bool {\n return vdb_live(g) && (vdb_rec(g, VDB_REC_FLAGS) & VDB_REC_FLAG_HAS_STATS) != 0u;\n}`,\n `fn vdbValueMax(g: u32) -> f32 {\n if !vdb_live(g) {\n return 0.0;\n }\n return bitcast<f32>(vdb_rec(g, VDB_REC_VALUE_MAX));\n}`,\n `fn vdbNodeMax(acc: ptr<function, VdbAccessor>, ijk: vec3i, dim: u32) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n let a = vdbGetDim(acc, ijk);\n if a > 1u && dim <= a {\n return vdbReadValue(acc, ijk);\n }\n if !(*acc).stats {\n return (*acc).vmax;\n }\n let t = (*acc).gridType;\n let b = (*acc).buf;\n if dim <= 8u {\n return vdb_leaf_get_max_float(t, b, (*acc).inner.leaf);\n }\n if dim <= 128u {\n return vdb_lower_get_max_float(t, b, (*acc).inner.lower);\n }\n if dim <= 4096u {\n return vdb_upper_get_max_float(t, b, (*acc).inner.upper);\n }\n return vdb_root_get_max_float(t, b, (*acc).inner.root);\n}`,\n ].join(\"\\n\");\n}\n\n/**\n * Opt-in helpers (K1.7a, the `helpers` option). Each is emitted only when\n * asked for, so modules without helpers keep their bytes (the size snapshot).\n *\n * `vdbCellBoundTrilinear(acc, ijk, dim)`: the max of `vdbNodeMax` over the\n * 2x2x2 block of aligned `dim`-cells whose min corner is the cell holding\n * `ijk` (that cell and its +x/+y/+z neighbours). A trilinear sample at `p`\n * reads voxels `floor(p) + {0,1}^3`, so when `floor(p)` lies in the cell every\n * tap lies in the block and the result bounds the sample, with `vdbNodeMax`'s\n * caveat: stats bound ACTIVE values, so inactive leaf voxels must be <= their\n * leaf's max (true of fog volumes). With `outside: 'zero'` and a negative\n * field, also take max(result, 0). This is the skip test a march needs; the\n * cell's own `vdbNodeMax` is not one (CLAUDE.md Traps). CPU twin: `tools`\n * `cellBoundTrilinear`.\n *\n * `vdbHddaCellEnd(h)`: the ray `t` where the HDDA's current cell ends,\n * `min(next.x, next.y, next.z, tmax)` of the vendored state, so a host\n * needn't name `VdbHdda`'s vendored fields. CPU twin: `tools` `hddaCellEnd`.\n *\n * `vdbNodeAverage(acc, ijk, dim)` (K3.2): the box mean of the aligned\n * `dim`-cell holding `ijk`, from node statistics instead of voxels (the\n * sparse volume source's `'node-average'` LOD). A cell inside one tile (or the\n * background) is that tile's value, exactly. Otherwise, for `dim <= 8`, the\n * leaf's average times its active fraction (`countOneBits` of the value mask\n * / 512): the exact mean when the leaf's inactive voxels are 0 (fog); for\n * `dim <= 128`, the lower node's average, which is the mean of its ACTIVE\n * voxels (NanoVDB stores no active count per lower node), so it overstates a\n * partly empty lower node; larger cells read the lower node too (`dim` is\n * meant to be 8 or 128; no upper level, to keep the module small). Without stats it is the value at `ijk` (no\n * prefilter). CPU twin: `tools` `nodeAverage`.\n *\n * `vdbRayClipSupport(g, o, d, t)`: `vdbRayClip` against the box where\n * `vdbSample` can read the grid's voxels: `[min - 1, max + 1]` for trilinear\n * (the taps of a point in `[min - 1, min)` reach voxel `min`) and\n * `[min - 0.5, max + 0.5]` for nearest. `vdbRayClip`'s box, `[min, max + 1]`,\n * is the voxel-cell box the HDDA walks; it cuts the min-side half voxel of the\n * trilinear support. CPU twin: `tools` `rayClipSupport`.\n */\nfunction helperFunctions(o: ApiOptions): string[] {\n const out: string[] = [];\n if (o.helpers.includes(\"rayClipSupport\")) {\n const pad = o.sampler === \"nearest\" ? \"0.5\" : \"1.0\";\n out.push(`fn vdbRayClipSupport(g: u32, o: vec3f, d: vec3f, t: ptr<function, vec2f>) -> bool {\n if !vdb_live(g) {\n return false;\n }\n var t0 = (*t).x;\n var t1 = (*t).y;\n let hit = vdb_hdda_ray_clip(vec3f(vdbIndexMin(g)) - vec3f(${pad}), vec3f(vdbIndexMax(g)) + vec3f(${pad}), o, &t0, d, &t1);\n *t = vec2f(t0, t1);\n return hit && t0 <= t1;\n}`);\n }\n if (o.helpers.includes(\"cellBoundTrilinear\")) {\n out.push(`fn vdbCellBoundTrilinear(acc: ptr<function, VdbAccessor>, ijk: vec3i, dim: u32) -> f32 {\n var m = vdbNodeMax(acc, ijk, dim);\n for (var k = 1u; k < 8u; k++) {\n let c = vec3i(vec3u(k & 1u, (k >> 1u) & 1u, (k >> 2u) & 1u)) * i32(dim);\n m = max(m, vdbNodeMax(acc, ijk + c, dim));\n }\n return m;\n}`);\n }\n if (o.helpers.includes(\"hddaCellEnd\")) {\n out.push(`fn vdbHddaCellEnd(h: ptr<function, VdbHdda>) -> f32 {\n return min(min((*h).next.x, (*h).next.y), min((*h).next.z, (*h).tmax));\n}`);\n }\n // P1.16: the lean reader's own helpers (its vdbSampleFast, the unchecked init).\n if (o.reader === \"lean\") out.push(...leanHelperFunctions(o, carriesBBox(1, o)));\n if (o.reader !== \"lean\" && o.helpers.includes(\"fastTrilinear\")) {\n // Only trilinear has 8 taps to share (the generator rejects the helper with 'nearest').\n const inside = carriesBBox(1, o) ? \" || any(b < (*acc).lo) || any(b >= (*acc).hi)\" : \"\";\n // Uniform per-tap work (no per-lane choice between a leaf read and a descent: lanes of a SIMD group that\n // disagree would run both). All 8 taps lie in the base voxel's lower node (128-block) unless the base is\n // on its +x/+y/+z face; each tap is then one lower-node child lookup (the same words for taps in the same\n // leaf), never a tree walk. The vendored taps instead thrash the accessor's one-leaf cache when the cell\n // straddles leaves (x-fastest tap order alternates them).\n // A tap: one lower-node child lookup (the caching variant the accessor already uses, on a scratch cache).\n // vdbSampleFast: the lower node holding the base is the accessor's cached one, else a descent (which caches\n // it); at level 2+ the base's 128-block, which holds all 8 taps, is one tile (or the background): one value.\n // c0 holds taps 0-3 (z = 0), c1 taps 4-7 (z = 1), x fastest: the vendored c000, c100, c010, c110, c001, ...\n // No comments inside the WGSL: generated modules carry only the banner.\n out.push(`fn vdb_lower_tap(t: u32, buf: vdb_buf_t, node: vdb_lower_handle_t, b: vec3i, k: u32) -> f32 {\n let ijk = b + vec3i(vec3u(k & 1u, (k >> 1u) & 1u, k >> 2u));\n var s: vdb_readaccessor_t;\n let al = vdb_lower_get_value_address_and_level_and_cache(t, buf, node, ijk, &s);\n return vdb_read_float_typed(t, buf, al.address, ijk, al.level);\n}`);\n const taps = (from: number) => [0, 1, 2, 3].map((k) => `vdb_lower_tap(t, buf, n, b, ${from + k}u)`).join(\", \");\n out.push(`fn vdbSampleFast(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n let b = vec3i(floor(xyz));\n if !(*acc).ok || any((b & vec3i(127)) == vec3i(127))${inside} {\n return vdbSample(acc, xyz);\n }\n let t = (*acc).gridType;\n let buf = (*acc).buf;\n var inner = (*acc).inner;\n var lower = vdb_readaccessor_iscached1(&inner, vdb_readaccessor_computedirty(&inner, b));\n var v = 0.0;\n if !lower {\n let al = vdb_readaccessor_get_value_address_and_level(t, buf, &inner, b);\n lower = al.level <= 1u;\n v = vdb_read_float_typed(t, buf, al.address, b, al.level);\n }\n (*acc).inner = inner;\n var c0 = vec4f(v);\n var c1 = vec4f(v);\n if lower {\n let n = inner.lower;\n c0 = vec4f(${taps(0)});\n c1 = vec4f(${taps(4)});\n }\n let u = xyz - vec3f(b);\n return mix(mix(mix(c0.x, c0.y, u.x), mix(c0.z, c0.w, u.x), u.y), mix(mix(c1.x, c1.y, u.x), mix(c1.z, c1.w, u.x), u.y), u.z);\n}`);\n }\n if (o.helpers.includes(\"nodeAverage\")) {\n out.push(`fn vdbNodeAverage(acc: ptr<function, VdbAccessor>, ijk: vec3i, dim: u32) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n let a = vdbGetDim(acc, ijk);\n if (a > 1u && dim <= a) || !(*acc).stats || dim <= 1u {\n return vdbReadValue(acc, ijk);\n }\n let t = (*acc).gridType;\n let b = (*acc).buf;\n if dim <= 8u {\n let leaf = (*acc).inner.leaf;\n var n = 0u;\n for (var w = 0u; w < 16u; w++) {\n n += countOneBits(vdb_read_uint32(b, vdb_address_offset(leaf.address, VDB_LEAF_OFF_VALUE_MASK + 4u * w)));\n }\n return vdb_leaf_get_ave_float(t, b, leaf) * (f32(n) / 512.0);\n }\n return vdb_lower_get_ave_float(t, b, (*acc).inner.lower);\n}`);\n }\n // K3.7: the level-set zero-crossing finder and normal (./level-set.ts).\n if (o.helpers.includes(\"levelSet\")) out.push(...levelSetWgsl());\n // EX1f-b: the majorant profile's helpers (world and global inits, the two trackers; ./majorant.ts).\n out.push(...majorantHelpersWgsl(o));\n return out;\n}\n\n/**\n * API layers in profile order. A profile's API is every layer up to and\n * including its own, except that `majorant` (rank 3) takes the march layer\n * only with `majorant: 'nodeMax'` (P1.3: `brick` / `global` are `sample` plus\n * the walk, K1-core §3.2).\n */\nexport const API_LAYERS: readonly ((o: ApiOptions, profileRank: number) => string)[] = [\n readLayer,\n sampleLayer,\n marchLayer,\n (o) => majorantWgsl(o),\n];\n\n/** The public API text for the profile at `profileRank` (0 = read, 1 = sample, 2 = march, 3 = majorant), then the requested helpers. */\nexport function apiWgsl(profileRank: number, o: ApiOptions): string {\n const layers = API_LAYERS.slice(0, profileRank + 1).filter((_, i) => i !== 2 || hasMarch(profileRank, o));\n return [...layers.map((layer) => layer(o, profileRank)), ...helperFunctions(o)].join(\"\\n\");\n}\n\n/** A top-level declaration of the API text. */\ninterface ApiDeclaration {\n readonly kind: \"fn\" | \"struct\" | \"alias\";\n readonly name: string;\n readonly text: string;\n}\n\n/** The API text as its top-level declarations, in order (every one starts a line with `fn`, `struct` or `alias`). */\nfunction apiDeclarations(api: string): ApiDeclaration[] {\n const out: ApiDeclaration[] = [];\n let lines: string[] = [];\n const flush = () => {\n if (lines.length === 0) return;\n const m = /^(fn|struct|alias)\\s+([A-Za-z_][A-Za-z0-9_]*)/.exec(lines[0] as string);\n if (!m) throw new Error(`@pmndrs/vdb: unexpected API text before a declaration: ${lines[0]}`);\n out.push({ kind: m[1] as ApiDeclaration[\"kind\"], name: m[2] as string, text: lines.join(\"\\n\") });\n lines = [];\n };\n for (const line of api.split(\"\\n\")) {\n if (/^(fn|struct|alias)\\s/.test(line)) flush();\n lines.push(line);\n }\n flush();\n return out;\n}\n\n/** The public functions of an API text: what `keep` can name. */\nexport function apiPublicFunctions(api: string): string[] {\n return apiDeclarations(api)\n .filter((d) => d.kind === \"fn\" && /^vdb[A-Z]/.test(d.name))\n .map((d) => d.name);\n}\n\n/**\n * P1.16 `keep`: the API text cut to the named public functions and the declarations they reach (by identifier),\n * in the original order. The generator's vendored closure then follows from the cut text.\n */\nexport function pruneApiWgsl(api: string, keep: readonly string[]): string {\n const decls = apiDeclarations(api);\n const byName = new Map(decls.map((d) => [d.name, d]));\n const kept = new Set<string>();\n const stack = [...keep];\n while (stack.length > 0) {\n const name = stack.pop() as string;\n if (kept.has(name)) continue;\n kept.add(name);\n for (const m of (byName.get(name) as ApiDeclaration).text.matchAll(/[A-Za-z_][A-Za-z0-9_]*/g)) {\n if (byName.has(m[0]) && !kept.has(m[0])) stack.push(m[0]);\n }\n }\n return decls\n .filter((d) => kept.has(d.name))\n .map((d) => d.text)\n .join(\"\\n\");\n}\n"]}
@@ -22,6 +22,11 @@
22
22
  * 7. `pnanovdb_leaf_get_stat_float` keeps only the compiled types' branch
23
23
  * (the Fp leaf-stats decode, K1.4b), so a Float-only module has no
24
24
  * uint16 decoder.
25
+ * 8. Half min/max stats (K7.H): without `half`, calls to
26
+ * `pnanovdb_read_minmax_float` / `pnanovdb_leaf_get_minmax_float` are
27
+ * rewritten to the plain readers they wrap (so modules without `half` are
28
+ * byte-identical to those generated before Half existed); with `half`,
29
+ * the two keep only the compiled types' branch.
25
30
  *
26
31
  * Output is deterministic: the same options give the same bytes, and `types`
27
32
  * is a set (order and duplicates do not matter).
@@ -73,6 +78,9 @@ export declare function vdbModuleEntries(slotOrOptions: VDBSlot | {
73
78
  * After every `pool.add`: a module must be generated for every type the host
74
79
  * may add, or regenerated and its pipeline rebuilt.
75
80
  *
81
+ * @param pool The pool whose grids the module must read.
82
+ * @param options The module's options, or just `{ types, layoutVersion? }`.
83
+ *
76
84
  * @throws VDBError `VDB_LAYOUT_MISMATCH` if the pool's layout is not the one
77
85
  * the module targets; `VDB_TYPE_NOT_COMPILED` if the pool holds a grid
78
86
  * type the module would not decode; `VDB_BAD_OPTION` for invalid options.
@@ -22,6 +22,11 @@
22
22
  * 7. `pnanovdb_leaf_get_stat_float` keeps only the compiled types' branch
23
23
  * (the Fp leaf-stats decode, K1.4b), so a Float-only module has no
24
24
  * uint16 decoder.
25
+ * 8. Half min/max stats (K7.H): without `half`, calls to
26
+ * `pnanovdb_read_minmax_float` / `pnanovdb_leaf_get_minmax_float` are
27
+ * rewritten to the plain readers they wrap (so modules without `half` are
28
+ * byte-identical to those generated before Half existed); with `half`,
29
+ * the two keep only the compiled types' branch.
25
30
  *
26
31
  * Output is deterministic: the same options give the same bytes, and `types`
27
32
  * is a set (order and duplicates do not matter).
@@ -29,16 +34,16 @@
29
34
  import { VDBError } from "../errors.js";
30
35
  import { VDB_GPU_LAYOUT_VERSION, vdbPoolLayoutWgsl } from "../pool/layout.js";
31
36
  import { VDB_GRID_TYPE_IDS, VDB_GRID_TYPE_NAMES } from "../types.js";
32
- import { apiWgsl } from "./api.js";
37
+ import { apiPublicFunctions, apiWgsl, hasMarch, pruneApiWgsl } from "./api.js";
33
38
  import { WGSL_KEYWORDS, WGSL_RESERVED_WORDS } from "./reserved.js";
34
39
  import { PNANOVDB_CHUNKS } from "./pnanovdb.chunks.generated.js";
35
40
  /** First line of every generated module (§3.3). */
36
41
  export const VDB_MODULE_BANNER = "// SPDX-License-Identifier: Apache-2.0 AND MIT. Derived from PNanoVDB.h (OpenVDB) via emcfarlane/webgpu-nanovdb; see NOTICE.";
37
42
  /** Name of the storage binding `slot` mode declares. */
38
43
  export const VDB_POOL_BINDING_NAME = "vdbPool";
39
- /** Profiles in inclusion order; only the first `IMPLEMENTED_PROFILES` generate (`majorant` is deferred, D22). */
44
+ /** Profiles in inclusion order (`majorant`, P1.3, takes the march layer only with `majorant: 'nodeMax'`). */
40
45
  const PROFILES = ["read", "sample", "march", "majorant"];
41
- const IMPLEMENTED_PROFILES = 3;
46
+ const MAJORANT_MODES = ["brick", "global", "nodeMax"];
42
47
  /** `GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE` (0x2 | 0x4); the global does not exist in Node. */
43
48
  const SHADER_STAGE_FRAGMENT_COMPUTE = 0x2 | 0x4;
44
49
  /** Opt-in helpers in canonical order, with the lowest profile rank each needs. */
@@ -49,7 +54,19 @@ const HELPERS = {
49
54
  nodeAverage: { rank: 2 },
50
55
  rayClipSupport: { rank: 1 },
51
56
  fastTrilinear: { rank: 1 },
57
+ // EX1f-b, the majorant profile's helpers (appended: the canonical order of the older ones is unchanged).
58
+ majorantWorld: { rank: 3 },
59
+ majorantGlobal: { rank: 3 },
60
+ deltaTrack: { rank: 3 },
61
+ ratioTrack: { rank: 3 },
62
+ // P1.16, the lean reader's unchecked init (appended).
63
+ accessorUnchecked: { rank: 0 },
52
64
  };
65
+ /** Helpers that never touch the vendored accessor (the lean reader takes them). */
66
+ const LEAN_HELPERS = ["rayClipSupport", "majorantWorld", "majorantGlobal", "deltaTrack", "ratioTrack", "accessorUnchecked"];
67
+ const LEAN_CACHES = ["leaf", "lower", "lowerLeaf"];
68
+ const TRACK_HELPERS = ["deltaTrack", "ratioTrack"];
69
+ const WGSL_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
53
70
  const HELPER_NAMES = Object.keys(HELPERS);
54
71
  const IDENTIFIER = /[A-Za-z_][A-Za-z0-9_]*/g;
55
72
  const BUFFER_EXPRESSION = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/;
@@ -74,7 +91,7 @@ function rejectPositionalSlot(where, options) {
74
91
  throw bad(`${where}: got 'group' or 'firstBinding' at the top level. Pass { slot: { group, firstBinding } }.`);
75
92
  }
76
93
  }
77
- function normalizeHelpers(helpers, profile, profileRank, where) {
94
+ function normalizeHelpers(helpers, profile, profileRank, majorant, reader, cache, where) {
78
95
  if (helpers === undefined)
79
96
  return [];
80
97
  if (helpers === null || typeof helpers === "string" || typeof helpers[Symbol.iterator] !== "function") {
@@ -86,8 +103,24 @@ function normalizeHelpers(helpers, profile, profileRank, where) {
86
103
  throw bad(`${where}: unknown helper ${JSON.stringify(h)}; use ${HELPER_NAMES.join(", ")}.`);
87
104
  }
88
105
  const need = HELPERS[h].rank;
89
- if (profileRank < need) {
90
- throw bad(`${where}: helper '${h}' needs profile '${PROFILES[need]}' or above, got '${profile}'.`);
106
+ if (profileRank < need || (need === 2 && !hasMarch(profileRank, { majorant }))) {
107
+ const also = profileRank === 3 ? " (profile 'majorant' has the march layer only with majorant: 'nodeMax')" : "";
108
+ throw bad(`${where}: helper '${h}' needs profile '${PROFILES[need]}' or above, got '${profile}'${also}.`);
109
+ }
110
+ if (reader === "lean" && h === "fastTrilinear") {
111
+ // P1.16: with a lower-node cache the lean vdbSample is the fast sampler; vdbSampleFast is its other name.
112
+ if (cache === "leaf") {
113
+ throw bad(`${where}: helper 'fastTrilinear' with reader 'lean' needs cache: 'lower' or 'lowerLeaf' (the lean vdbSample then reads every tap as one lower-node lookup).`);
114
+ }
115
+ }
116
+ else if (reader === "lean" && !LEAN_HELPERS.includes(h)) {
117
+ throw bad(`${where}: helper '${h}' reads the vendored accessor; reader 'lean' takes only ${LEAN_HELPERS.map((n) => `'${n}'`).join(", ")} (and 'fastTrilinear' with cache 'lower' / 'lowerLeaf').`);
118
+ }
119
+ if (reader !== "lean" && h === "accessorUnchecked") {
120
+ throw bad(`${where}: helper 'accessorUnchecked' needs reader: 'lean'.`);
121
+ }
122
+ if (h === "majorantGlobal" && majorant === "nodeMax") {
123
+ throw bad(`${where}: helper 'majorantGlobal' needs majorant 'brick' or 'global' (the 'nodeMax' iterator has no one-segment mode).`);
91
124
  }
92
125
  seen.add(h);
93
126
  }
@@ -142,8 +175,53 @@ function normalize(options, where) {
142
175
  if (profileRank < 0) {
143
176
  throw bad(`${where}: profile must be one of ${PROFILES.map((p) => `'${p}'`).join(", ")}, got ${JSON.stringify(options.profile)}.`);
144
177
  }
145
- if (profileRank >= IMPLEMENTED_PROFILES) {
146
- throw bad(`${where}: profile '${options.profile}' is deferred past 0.1 (D22). Use 'read', 'sample' or 'march'.`);
178
+ const isMajorant = profileRank === 3;
179
+ if (options.majorant !== undefined && !isMajorant) {
180
+ throw bad(`${where}: majorant applies to profile 'majorant' only, got profile '${options.profile}'.`);
181
+ }
182
+ if (options.minima !== undefined && !isMajorant) {
183
+ throw bad(`${where}: minima applies to profile 'majorant' only, got profile '${options.profile}'.`);
184
+ }
185
+ const majorant = options.majorant ?? "brick";
186
+ if (!MAJORANT_MODES.includes(majorant)) {
187
+ throw bad(`${where}: majorant must be ${MAJORANT_MODES.map((m) => `'${m}'`).join(", ")}, got ${JSON.stringify(majorant)}.`);
188
+ }
189
+ const minima = options.minima ?? false;
190
+ if (typeof minima !== "boolean")
191
+ throw bad(`${where}: minima must be a boolean, got ${JSON.stringify(minima)}.`);
192
+ const reader = options.reader ?? "vendored";
193
+ if (reader !== "vendored" && reader !== "lean") {
194
+ throw bad(`${where}: reader must be 'vendored' or 'lean', got ${JSON.stringify(reader)}.`);
195
+ }
196
+ if (reader === "lean" && hasMarch(profileRank, { majorant })) {
197
+ throw bad(`${where}: reader 'lean' has no march layer (HDDA, node stats); use the vendored reader for profile 'march' or majorant 'nodeMax'.`);
198
+ }
199
+ // P1.16: the lean accessor's cache.
200
+ const cache = options.cache ?? "leaf";
201
+ if (!LEAN_CACHES.includes(cache)) {
202
+ throw bad(`${where}: cache must be ${LEAN_CACHES.map((c) => `'${c}'`).join(", ")}, got ${JSON.stringify(cache)}.`);
203
+ }
204
+ if (options.cache !== undefined && reader !== "lean") {
205
+ throw bad(`${where}: cache applies to reader 'lean' only (the vendored accessor has its own leaf / lower / upper cache).`);
206
+ }
207
+ // EX1f-b: the trackers call the host's random function by name.
208
+ const helperNames = normalizeHelpers(options.helpers, options.profile, profileRank, majorant, reader, cache, where);
209
+ const tracking = helperNames.some((h) => TRACK_HELPERS.includes(h));
210
+ const random = options.random;
211
+ if (random !== undefined) {
212
+ if (!tracking)
213
+ throw bad(`${where}: random applies to the helpers 'deltaTrack' and 'ratioTrack' only.`);
214
+ if (typeof random !== "string" || !WGSL_IDENTIFIER.test(random)) {
215
+ throw bad(`${where}: random must be the name of a WGSL function \`fn name() -> f32\` (an identifier), got ${JSON.stringify(random)}.`);
216
+ }
217
+ if (random.startsWith("__") || random === "_" || WGSL_RESERVED_WORDS.has(random) || WGSL_KEYWORDS.has(random)) {
218
+ throw bad(`${where}: random '${random}' is not a name WGSL allows for a function. Rename the host's function.`);
219
+ }
220
+ if (/^vdb/i.test(random))
221
+ throw bad(`${where}: random '${random}' starts with 'vdb', the module's own prefix. Rename the host's function.`);
222
+ }
223
+ else if (tracking) {
224
+ throw bad(`${where}: helpers 'deltaTrack' / 'ratioTrack' need random: '<name>', a function \`fn <name>() -> f32\` in your shader that returns uniform numbers in [0, 1).`);
147
225
  }
148
226
  const sampler = options.sampler ?? "trilinear";
149
227
  if (sampler !== "trilinear" && sampler !== "nearest") {
@@ -168,9 +246,44 @@ function normalize(options, where) {
168
246
  isActive,
169
247
  sampler: sampleOnly ? sampler : "trilinear",
170
248
  outside: sampleOnly ? outside : "background",
171
- helpers: checkHelperSampler(normalizeHelpers(options.helpers, options.profile, profileRank, where), sampleOnly ? sampler : "trilinear", where),
249
+ helpers: checkHelperSampler(helperNames, sampleOnly ? sampler : "trilinear", where),
250
+ reader,
251
+ majorant,
252
+ minima,
253
+ random: random ?? null,
254
+ cache: cache,
255
+ keep: normalizeKeep(options.keep, where),
172
256
  };
173
257
  }
258
+ /** P1.16 `keep`: a set of function names (checked against the module's functions at build), sorted. */
259
+ function normalizeKeep(keep, where) {
260
+ if (keep === undefined)
261
+ return null;
262
+ if (keep === null || typeof keep === "string" || typeof keep[Symbol.iterator] !== "function") {
263
+ throw bad(`${where}: keep must be an array or set of the module's function names, e.g. ['vdbAccessorInit', 'vdbSample'].`);
264
+ }
265
+ const seen = new Set();
266
+ for (const k of keep) {
267
+ if (typeof k !== "string" || !WGSL_IDENTIFIER.test(k))
268
+ throw bad(`${where}: keep entries are function names, got ${JSON.stringify(k)}.`);
269
+ seen.add(k);
270
+ }
271
+ if (seen.size === 0)
272
+ throw bad(`${where}: keep is empty; list the functions the kernel calls, or leave it out.`);
273
+ return [...seen].sort();
274
+ }
275
+ /** The API text of the options: every layer and helper, cut to `keep` when given. */
276
+ function apiText(o, where) {
277
+ const api = apiWgsl(o.profileRank, o);
278
+ if (o.keep === null)
279
+ return api;
280
+ const names = apiPublicFunctions(api);
281
+ const unknown = o.keep.filter((k) => !names.includes(k));
282
+ if (unknown.length > 0) {
283
+ throw bad(`${where}: keep names ${unknown.map((k) => `'${k}'`).join(", ")}, which this module does not have. Its functions: ${names.join(", ")}.`);
284
+ }
285
+ return pruneApiWgsl(api, o.keep);
286
+ }
174
287
  /** `fastTrilinear` shares one leaf between the 8 trilinear taps; `nearest` has one tap. */
175
288
  function checkHelperSampler(helpers, sampler, where) {
176
289
  if (sampler === "nearest" && helpers.includes("fastTrilinear")) {
@@ -199,7 +312,10 @@ const GRID_TYPE_CONSTANT_PRE = {
199
312
  fp8: "PNANOVDB_GRID_TYPE_FP8",
200
313
  fp16: "PNANOVDB_GRID_TYPE_FP16",
201
314
  fpn: "PNANOVDB_GRID_TYPE_FPN",
315
+ half: "PNANOVDB_GRID_TYPE_HALF",
202
316
  };
317
+ /** Types whose leaf values are Fp codes (decoded by `pnanovdb_root_<t>_read_float`). */
318
+ const FP_TYPES = new Set(["fp4", "fp8", "fp16", "fpn"]);
203
319
  /** Field names of the vendored `pnanovdb_grid_type_constants_t`, in order. */
204
320
  const TYPE_TABLE_FIELDS = [...chunk("pnanovdb_grid_type_constants_t").text.matchAll(/^\s+(\w+)\s*:/gm)].map((m) => m[1]);
205
321
  /** The 27 rows of the vendored type table, as argument lists. */
@@ -253,37 +369,40 @@ function typeTableOverride({ o, fields }) {
253
369
  function readFloatTypedOverride({ o }) {
254
370
  const text = chunk("pnanovdb_read_float_typed").text;
255
371
  const signature = text.slice(0, text.indexOf("{") + 1);
256
- const fpTypes = o.types.filter((t) => t !== "float");
257
- const decode = (t) => `pnanovdb_root_${t}_read_float(buf, address, ijk, level)`;
372
+ const special = o.types.filter((t) => t !== "float");
373
+ const decode = (t) => t === "half" ? "pnanovdb_read_half(buf, address)" : `pnanovdb_root_${t}_read_float(buf, address, ijk, level)`;
258
374
  const lines = [signature];
259
- // Without Float, the last Fp type is the fallthrough: `ok` already rejects
260
- // every other type before a read reaches here.
261
- const branches = o.types.includes("float") ? fpTypes : fpTypes.slice(0, -1);
375
+ // Without Float, the last other type is the fallthrough: `ok` already rejects
376
+ // every type not compiled before a read reaches here.
377
+ const branches = o.types.includes("float") ? special : special.slice(0, -1);
262
378
  for (const t of branches) {
263
379
  lines.push(` if grid_type == ${GRID_TYPE_CONSTANT_PRE[t]} {`);
264
380
  lines.push(` return ${decode(t)};`);
265
381
  lines.push(` }`);
266
382
  }
267
- lines.push(o.types.includes("float") ? " return pnanovdb_read_float(buf, address);" : ` return ${decode(fpTypes[fpTypes.length - 1])};`);
383
+ lines.push(o.types.includes("float") ? " return pnanovdb_read_float(buf, address);" : ` return ${decode(special[special.length - 1])};`);
268
384
  lines.push("}");
269
385
  return lines.join("\n");
270
386
  }
271
387
  /**
272
388
  * Transform 7: the leaf-stat dispatch limited to the compiled types. No Fp type
273
389
  * compiled: a plain f32 read (the code decoder drops out). Only Fp types: the
274
- * decode, unconditionally. Both: one branch over the compiled Fp types.
390
+ * decode, unconditionally. Both: one branch over the compiled Fp types. (Half
391
+ * leaf ave/stddev are f32, so Half counts as a plain type here; its min/max go
392
+ * through transform 8.)
275
393
  */
276
394
  function leafStatOverride({ o }) {
277
395
  const text = chunk("pnanovdb_leaf_get_stat_float").text;
278
396
  const signature = text.slice(0, text.indexOf("{") + 1);
279
- const fpTypes = o.types.filter((t) => t !== "float");
397
+ const fpTypes = o.types.filter((t) => FP_TYPES.has(t));
398
+ const plainTypes = o.types.filter((t) => !FP_TYPES.has(t));
280
399
  const decode = "return pnanovdb_leaf_fp_get_stat_float(grid_type, buf, node, address, with_minimum);";
281
400
  const plain = "return pnanovdb_read_float(buf, address);";
282
401
  const lines = [signature];
283
402
  if (fpTypes.length === 0) {
284
403
  lines.push(` ${plain}`);
285
404
  }
286
- else if (!o.types.includes("float")) {
405
+ else if (plainTypes.length === 0) {
287
406
  lines.push(` ${decode}`);
288
407
  }
289
408
  else {
@@ -295,17 +414,51 @@ function leafStatOverride({ o }) {
295
414
  lines.push("}");
296
415
  return lines.join("\n");
297
416
  }
417
+ /** Transform 8 (with `half`): a Half-aware min/max reader keeping only the compiled types' branch. */
418
+ function minmaxOverride(name, other) {
419
+ return ({ o }) => {
420
+ const text = chunk(name).text;
421
+ const signature = text.slice(0, text.indexOf("{") + 1);
422
+ const half = "return pnanovdb_read_half(buf, address);";
423
+ const lines = [signature];
424
+ if (o.types.length === 1) {
425
+ lines.push(` ${half}`);
426
+ }
427
+ else {
428
+ lines.push(` if grid_type == ${GRID_TYPE_CONSTANT_PRE.half} {`);
429
+ lines.push(` ${half}`);
430
+ lines.push(" }");
431
+ lines.push(` ${other}`);
432
+ }
433
+ lines.push("}");
434
+ return lines.join("\n");
435
+ };
436
+ }
437
+ /** Transform 8 (without `half`): call sites of the Half-aware min/max readers, back to the readers they wrap. */
438
+ const MINMAX_CALL_SITE = /\bpnanovdb_read_minmax_float\(grid_type, buf, /g;
439
+ const LEAF_MINMAX_CALL_SITE = /\bpnanovdb_leaf_get_minmax_float\(grid_type, buf, node, (pnanovdb_leaf_get_m(?:in|ax)_address\(grid_type, buf, node\))\)/g;
298
440
  const OVERRIDES = new Map([
299
441
  ["pnanovdb_buf_read_uint32", bufReadOverride],
300
442
  [TYPE_TABLE, typeTableOverride],
301
443
  ["pnanovdb_read_float_typed", readFloatTypedOverride],
302
444
  ["pnanovdb_leaf_get_stat_float", leafStatOverride],
445
+ ["pnanovdb_read_minmax_float", minmaxOverride("pnanovdb_read_minmax_float", "return pnanovdb_read_float(buf, address);")],
446
+ [
447
+ "pnanovdb_leaf_get_minmax_float",
448
+ minmaxOverride("pnanovdb_leaf_get_minmax_float", "return pnanovdb_leaf_get_stat_float(grid_type, buf, node, address, true);"),
449
+ ],
303
450
  ]);
304
451
  function effectiveText(c, ctx) {
305
452
  const override = OVERRIDES.get(c.name);
306
453
  if (override)
307
454
  return override(ctx);
308
- return c.text.replace(TYPE_TABLE_CALL_SITE, `${TYPE_TABLE_FN}($1)`);
455
+ let text = c.text.replace(TYPE_TABLE_CALL_SITE, `${TYPE_TABLE_FN}($1)`);
456
+ if (!ctx.o.types.includes("half")) {
457
+ text = text
458
+ .replace(MINMAX_CALL_SITE, "pnanovdb_read_float(buf, ")
459
+ .replace(LEAF_MINMAX_CALL_SITE, "pnanovdb_leaf_get_stat_float(grid_type, buf, node, $1, true)");
460
+ }
461
+ return text;
309
462
  }
310
463
  function referencedChunks(text, self) {
311
464
  const out = new Set();
@@ -375,7 +528,7 @@ function closure(api, o) {
375
528
  }
376
529
  const cache = new Map();
377
530
  function build(o) {
378
- const api = apiWgsl(o.profileRank, o);
531
+ const api = apiText(o, "vdbModuleWgsl");
379
532
  const access = o.binding.kind === "slot" ? VDB_POOL_BINDING_NAME : o.binding.expression;
380
533
  const load = `fn vdb_load(vdb_i: u32) -> u32 {
381
534
  return ${access}[vdb_i];
@@ -466,6 +619,9 @@ export function vdbModuleEntries(slotOrOptions) {
466
619
  * After every `pool.add`: a module must be generated for every type the host
467
620
  * may add, or regenerated and its pipeline rebuilt.
468
621
  *
622
+ * @param pool The pool whose grids the module must read.
623
+ * @param options The module's options, or just `{ types, layoutVersion? }`.
624
+ *
469
625
  * @throws VDBError `VDB_LAYOUT_MISMATCH` if the pool's layout is not the one
470
626
  * the module targets; `VDB_TYPE_NOT_COMPILED` if the pool holds a grid
471
627
  * type the module would not decode; `VDB_BAD_OPTION` for invalid options.
@@ -473,6 +629,7 @@ export function vdbModuleEntries(slotOrOptions) {
473
629
  export function vdbCheckModule(pool, options) {
474
630
  const where = "vdbCheckModule";
475
631
  let o;
632
+ let walk = null;
476
633
  let target = VDB_GPU_LAYOUT_VERSION;
477
634
  if (options !== null && typeof options === "object" && !("slot" in options) && !("buffer" in options) && !("profile" in options)) {
478
635
  // Type/layout-only form.
@@ -485,7 +642,10 @@ export function vdbCheckModule(pool, options) {
485
642
  }
486
643
  }
487
644
  else {
488
- o = normalize(options, where);
645
+ const n = normalize(options, where);
646
+ o = n;
647
+ if (n.profileRank === 3)
648
+ walk = n.majorant;
489
649
  }
490
650
  if (pool.layoutVersion !== target) {
491
651
  throw new VDBError("VDB_LAYOUT_MISMATCH", `the pool uses layout ${pool.layoutVersion} but the module targets layout ${target}. Use one @pmndrs/vdb version for both.`);
@@ -496,10 +656,23 @@ export function vdbCheckModule(pool, options) {
496
656
  `A module must be generated for every type the host may add: regenerate it with types that include ${missing.join(", ")} ` +
497
657
  `(e.g. [...pool.types], or VDB_ALL_SCALAR_TYPES to never rebuild) and rebuild the pipeline that uses it.`);
498
658
  }
659
+ // EX1f-a: a walk on the global bound needs a finite one (WGSL may assume no infinities). 'global' always walks
660
+ // on it, 'brick' for a grid without brick bounds, 'nodeMax' for a grid without statistics.
661
+ if (walk !== null && pool.unboundedGrids !== undefined) {
662
+ const mode = walk;
663
+ const open = [...pool.unboundedGrids].filter((g) => (mode === "global" ? true : mode === "brick" ? !g.hasBrickMajorant : !g.hasStats));
664
+ if (open.length > 0) {
665
+ const ids = open.map((g) => g.id).join(", ");
666
+ throw new VDBError("VDB_NO_STATS", `grid ${ids} has no min/max statistics and no valueMax, so its global bound is infinite and the '${mode}' majorant walk ` +
667
+ `would step with it. Give it a bound: pool.setValueMax(id, vdbValueRange(image, { outside }).max) with vdbValueRange from ` +
668
+ `@pmndrs/vdb/tools (or valueMax in pool.add)` +
669
+ (mode === "brick" ? `, or brick bounds (pool.buildMajorant(id) / pool.setMajorant).` : `.`));
670
+ }
671
+ }
499
672
  }
500
673
  /** @internal Vendored declarations (vendored names) a module with these options includes, in file order. For tests. */
501
674
  export function vdbModuleDeclarations(options) {
502
675
  const o = normalize(options, "vdbModuleDeclarations");
503
- return closure(apiWgsl(o.profileRank, o), o).names;
676
+ return closure(apiText(o, "vdbModuleDeclarations"), o).names;
504
677
  }
505
678
  //# sourceMappingURL=generate.js.map