@driftengine/core 4.4.2 → 4.6.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 (339) hide show
  1. package/CHANGELOG.json +97 -0
  2. package/README.md +1 -1
  3. package/dist/geometry/boxCsg.d.ts +28 -0
  4. package/dist/geometry/boxCsg.js +139 -0
  5. package/dist/geometry/csg.d.ts +36 -0
  6. package/dist/geometry/csg.js +329 -0
  7. package/dist/geometry/meshBuilder.js +13 -0
  8. package/dist/geometry/meshConcat.js +1 -0
  9. package/dist/geometry/pixelFont.js +2 -0
  10. package/dist/geometry/solid.d.ts +61 -0
  11. package/dist/geometry/solid.js +152 -0
  12. package/dist/geometry/solidFlat.d.ts +35 -0
  13. package/dist/geometry/solidFlat.js +428 -0
  14. package/dist/geometry/solidHarness.d.ts +19 -0
  15. package/dist/geometry/solidHarness.js +66 -0
  16. package/dist/geometry/solidNormals.d.ts +17 -0
  17. package/dist/geometry/solidNormals.js +86 -0
  18. package/dist/geometry/solidRound.d.ts +41 -0
  19. package/dist/geometry/solidRound.js +323 -0
  20. package/dist/geometry/solidWriter.d.ts +16 -0
  21. package/dist/geometry/solidWriter.js +42 -0
  22. package/dist/index.d.ts +28 -3
  23. package/dist/index.js +20 -1
  24. package/dist/render/backend/api.d.ts +34 -14
  25. package/dist/render/backend/drawFog.d.ts +26 -0
  26. package/dist/render/backend/drawFog.js +30 -0
  27. package/dist/render/backend/materialChanges.d.ts +2 -1
  28. package/dist/render/backend/materialChanges.js +6 -1
  29. package/dist/render/backend/webgl2/glassTintPrograms.d.ts +13 -0
  30. package/dist/render/backend/webgl2/glassTintPrograms.js +38 -0
  31. package/dist/render/backend/webgl2/instanced.d.ts +24 -5
  32. package/dist/render/backend/webgl2/instanced.js +72 -15
  33. package/dist/render/backend/webgl2/renderer.d.ts +201 -16
  34. package/dist/render/backend/webgl2/renderer.js +596 -224
  35. package/dist/render/backend/webgpu/buffers.d.ts +29 -1
  36. package/dist/render/backend/webgpu/buffers.js +61 -4
  37. package/dist/render/backend/webgpu/depthPass.d.ts +1 -1
  38. package/dist/render/backend/webgpu/depthPass.js +7 -2
  39. package/dist/render/backend/webgpu/drawCommand.d.ts +5 -0
  40. package/dist/render/backend/webgpu/drawCommand.js +1 -0
  41. package/dist/render/backend/webgpu/flatPass.d.ts +6 -1
  42. package/dist/render/backend/webgpu/flatPass.js +57 -9
  43. package/dist/render/backend/webgpu/glassTintPass.d.ts +28 -0
  44. package/dist/render/backend/webgpu/glassTintPass.js +206 -0
  45. package/dist/render/backend/webgpu/gpuDrivenPass.d.ts +60 -1
  46. package/dist/render/backend/webgpu/gpuDrivenPass.js +305 -5
  47. package/dist/render/backend/webgpu/instanceCullPass.d.ts +34 -0
  48. package/dist/render/backend/webgpu/instanceCullPass.js +144 -0
  49. package/dist/render/backend/webgpu/instanced.d.ts +23 -2
  50. package/dist/render/backend/webgpu/instanced.js +41 -4
  51. package/dist/render/backend/webgpu/latePass.d.ts +30 -0
  52. package/dist/render/backend/webgpu/latePass.js +140 -0
  53. package/dist/render/backend/webgpu/lightVolumePass.js +5 -1
  54. package/dist/render/backend/webgpu/motionPass.d.ts +95 -0
  55. package/dist/render/backend/webgpu/motionPass.js +491 -0
  56. package/dist/render/backend/webgpu/pipelineCache.d.ts +10 -1
  57. package/dist/render/backend/webgpu/pipelineCache.js +11 -1
  58. package/dist/render/backend/webgpu/pointGlassTintPass.d.ts +32 -0
  59. package/dist/render/backend/webgpu/pointGlassTintPass.js +193 -0
  60. package/dist/render/backend/webgpu/pointShadowPass.d.ts +35 -6
  61. package/dist/render/backend/webgpu/pointShadowPass.js +105 -20
  62. package/dist/render/backend/webgpu/postPass.d.ts +3 -13
  63. package/dist/render/backend/webgpu/renderer.d.ts +271 -64
  64. package/dist/render/backend/webgpu/renderer.js +1395 -580
  65. package/dist/render/backend/webgpu/scatterPass.js +2 -1
  66. package/dist/render/backend/webgpu/sdfTextPass.js +6 -1
  67. package/dist/render/backend/webgpu/shaders/instanceCull.wgsl.d.ts +18 -0
  68. package/dist/render/backend/webgpu/shaders/instanceCull.wgsl.js +59 -0
  69. package/dist/render/backend/webgpu/skinPaletteRing.d.ts +4 -0
  70. package/dist/render/backend/webgpu/skinPaletteRing.js +4 -0
  71. package/dist/render/backend/webgpu/snapshotMips.d.ts +29 -0
  72. package/dist/render/backend/webgpu/snapshotMips.js +52 -0
  73. package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +22 -3
  74. package/dist/render/backend/webgpu/surfaceTexturePass.js +78 -39
  75. package/dist/render/driftLight/bake.d.ts +7 -0
  76. package/dist/render/driftLight/bake.js +61 -56
  77. package/dist/render/driftLight/denseField.d.ts +46 -0
  78. package/dist/render/driftLight/denseField.js +109 -0
  79. package/dist/render/driftLight/lightField.d.ts +10 -5
  80. package/dist/render/driftLight/lightField.js +25 -19
  81. package/dist/render/driftLight/presence.d.ts +50 -0
  82. package/dist/render/driftLight/presence.js +43 -0
  83. package/dist/render/driftLight/uniforms.d.ts +3 -3
  84. package/dist/render/driftLight/uniforms.js +5 -6
  85. package/dist/render/driftLight/worldLightField.d.ts +41 -0
  86. package/dist/render/driftLight/worldLightField.js +66 -0
  87. package/dist/render/fixtureAtlas.d.ts +20 -0
  88. package/dist/render/fixtureAtlas.js +49 -0
  89. package/dist/render/glass.d.ts +45 -0
  90. package/dist/render/glass.js +39 -0
  91. package/dist/render/glassCasters.d.ts +40 -0
  92. package/dist/render/glassCasters.js +84 -0
  93. package/dist/render/glassShadow.d.ts +78 -0
  94. package/dist/render/glassShadow.js +125 -0
  95. package/dist/render/globalMediumPass.d.ts +2 -3
  96. package/dist/render/globalMediumPass.js +2 -8
  97. package/dist/render/gpudriven/lit.d.ts +12 -0
  98. package/dist/render/gpudriven/lit.js +23 -0
  99. package/dist/render/gpudriven/materialTable.d.ts +15 -5
  100. package/dist/render/gpudriven/materialTable.js +26 -6
  101. package/dist/render/gpudriven/pipeline.d.ts +1 -1
  102. package/dist/render/gpudriven/pipeline.js +4 -3
  103. package/dist/render/gpudriven/sunGlass.d.ts +35 -0
  104. package/dist/render/gpudriven/sunGlass.js +89 -0
  105. package/dist/render/instanceCull.d.ts +63 -0
  106. package/dist/render/instanceCull.js +160 -0
  107. package/dist/render/instances.d.ts +15 -0
  108. package/dist/render/lightBudget.d.ts +36 -35
  109. package/dist/render/lightBudget.js +38 -37
  110. package/dist/render/lightGrid.d.ts +42 -0
  111. package/dist/render/lightGrid.js +87 -0
  112. package/dist/render/mesh.d.ts +18 -24
  113. package/dist/render/mesh.js +51 -68
  114. package/dist/render/occlusion.d.ts +10 -0
  115. package/dist/render/occlusion.js +36 -7
  116. package/dist/render/pointGlassTint.d.ts +59 -0
  117. package/dist/render/pointGlassTint.js +198 -0
  118. package/dist/render/pointLightSelection.d.ts +7 -0
  119. package/dist/render/pointLightSelection.js +29 -4
  120. package/dist/render/pointShadowArray.d.ts +56 -3
  121. package/dist/render/pointShadowArray.js +127 -16
  122. package/dist/render/pointShadowMap.d.ts +23 -1
  123. package/dist/render/pointShadowMap.js +27 -1
  124. package/dist/render/rainField.d.ts +13 -0
  125. package/dist/render/rainField.js +27 -5
  126. package/dist/render/recon/changeFrames.d.ts +15 -0
  127. package/dist/render/recon/changeFrames.js +21 -0
  128. package/dist/render/recon/lateDepth.d.ts +11 -0
  129. package/dist/render/recon/lateDepth.js +70 -0
  130. package/dist/render/recon/lateRouting.d.ts +14 -0
  131. package/dist/render/recon/lateRouting.js +18 -0
  132. package/dist/render/recon/mover.d.ts +57 -0
  133. package/dist/render/recon/mover.js +86 -0
  134. package/dist/render/recon/resolve.d.ts +34 -4
  135. package/dist/render/recon/resolve.js +161 -20
  136. package/dist/render/renderQuality.d.ts +35 -0
  137. package/dist/render/renderQuality.js +7 -0
  138. package/dist/render/rendererHarness.js +16 -0
  139. package/dist/render/sceneTarget.d.ts +9 -1
  140. package/dist/render/sceneTarget.js +60 -12
  141. package/dist/render/shaders/depth.d.ts +16 -1
  142. package/dist/render/shaders/depth.js +94 -15
  143. package/dist/render/shaders/flat/directionalShadow.js +91 -6
  144. package/dist/render/shaders/flat/driftLight.d.ts +1 -1
  145. package/dist/render/shaders/flat/driftLight.js +32 -7
  146. package/dist/render/shaders/flat/glassTint.d.ts +6 -0
  147. package/dist/render/shaders/flat/glassTint.js +25 -0
  148. package/dist/render/shaders/flat/index.d.ts +13 -0
  149. package/dist/render/shaders/flat/index.js +9 -3
  150. package/dist/render/shaders/flat/lampGlass.d.ts +1 -0
  151. package/dist/render/shaders/flat/lampGlass.js +183 -0
  152. package/dist/render/shaders/flat/main.d.ts +1 -1
  153. package/dist/render/shaders/flat/main.js +190 -38
  154. package/dist/render/shaders/flat/pointShadow.d.ts +1 -1
  155. package/dist/render/shaders/flat/pointShadow.js +2 -0
  156. package/dist/render/shaders/flat/preamble.js +96 -26
  157. package/dist/render/shaders/flat/surfaceEffects.d.ts +29 -0
  158. package/dist/render/shaders/flat/surfaceEffects.js +152 -0
  159. package/dist/render/shaders/generated/depth.wgsl.d.ts +230 -7
  160. package/dist/render/shaders/generated/depth.wgsl.js +230 -7
  161. package/dist/render/shaders/generated/flat.wgsl.d.ts +1644 -1596
  162. package/dist/render/shaders/generated/flat.wgsl.js +1683 -1621
  163. package/dist/render/shaders/generated/globalMedium.wgsl.d.ts +3 -13
  164. package/dist/render/shaders/generated/globalMedium.wgsl.js +3 -13
  165. package/dist/render/shaders/generated/lightVolume.wgsl.d.ts +3 -13
  166. package/dist/render/shaders/generated/lightVolume.wgsl.js +21 -17
  167. package/dist/render/shaders/generated/octahedralResolve.wgsl.d.ts +29 -0
  168. package/dist/render/shaders/generated/octahedralResolve.wgsl.js +29 -0
  169. package/dist/render/shaders/generated/rush.wgsl.d.ts +21 -16
  170. package/dist/render/shaders/generated/rush.wgsl.js +21 -16
  171. package/dist/render/shaders/generated/sdfText.wgsl.d.ts +2 -2
  172. package/dist/render/shaders/generated/sdfText.wgsl.js +2 -2
  173. package/dist/render/shaders/generated/text.wgsl.d.ts +1 -1
  174. package/dist/render/shaders/generated/text.wgsl.js +1 -1
  175. package/dist/render/shaders/gi/driftLight.wgsl.d.ts +1 -1
  176. package/dist/render/shaders/gi/driftLight.wgsl.js +27 -4
  177. package/dist/render/shaders/globalMedium.js +6 -6
  178. package/dist/render/shaders/gpudriven/blendRaster.wgsl.d.ts +7 -0
  179. package/dist/render/shaders/gpudriven/blendRaster.wgsl.js +86 -1
  180. package/dist/render/shaders/gpudriven/cull.wgsl.d.ts +1 -1
  181. package/dist/render/shaders/gpudriven/cull.wgsl.js +11 -2
  182. package/dist/render/shaders/gpudriven/materialTable.wgsl.d.ts +1 -1
  183. package/dist/render/shaders/gpudriven/materialTable.wgsl.js +3 -1
  184. package/dist/render/shaders/gpudriven/shade.wgsl.js +50 -1
  185. package/dist/render/shaders/gpudriven/sunGlass.wgsl.d.ts +9 -0
  186. package/dist/render/shaders/gpudriven/sunGlass.wgsl.js +133 -0
  187. package/dist/render/shaders/lightVolume.js +6 -6
  188. package/dist/render/shaders/octahedralResolve.d.ts +8 -0
  189. package/dist/render/shaders/octahedralResolve.js +48 -17
  190. package/dist/render/shaders/recon/lateDepth.wgsl.d.ts +1 -0
  191. package/dist/render/shaders/recon/lateDepth.wgsl.js +69 -0
  192. package/dist/render/shaders/recon/motion.wgsl.d.ts +1 -1
  193. package/dist/render/shaders/recon/motion.wgsl.js +84 -0
  194. package/dist/render/shaders/recon/resolve.wgsl.d.ts +8 -7
  195. package/dist/render/shaders/recon/resolve.wgsl.js +161 -27
  196. package/dist/render/shaders/rush.js +11 -1
  197. package/dist/render/shaders/sdfText.d.ts +1 -1
  198. package/dist/render/shaders/sdfText.js +3 -2
  199. package/dist/render/shaders/text.d.ts +1 -1
  200. package/dist/render/shaders/text.js +18 -9
  201. package/dist/render/shadowCasters.d.ts +20 -1
  202. package/dist/render/shadowCasters.js +15 -1
  203. package/dist/render/shadowMap.d.ts +54 -5
  204. package/dist/render/shadowMap.js +190 -36
  205. package/dist/render/sunGlassTint.d.ts +25 -0
  206. package/dist/render/sunGlassTint.js +79 -0
  207. package/dist/render/surfaceEffects.d.ts +83 -0
  208. package/dist/render/surfaceEffects.js +75 -0
  209. package/dist/render/surfaceScene.d.ts +8 -0
  210. package/dist/render/surfaceScene.js +8 -0
  211. package/dist/render/surfaceTexture.d.ts +18 -2
  212. package/dist/render/surfaceTexture.js +68 -15
  213. package/dist/render/temporalAa.d.ts +25 -6
  214. package/dist/render/temporalAa.js +45 -15
  215. package/dist/render/textureSource.d.ts +30 -0
  216. package/dist/render/textureSource.js +53 -0
  217. package/dist/render/translucentQueue.d.ts +6 -0
  218. package/dist/render/translucentQueue.js +15 -1
  219. package/dist/render/vertexDefaults.js +2 -0
  220. package/dist/world/hlod.d.ts +104 -0
  221. package/dist/world/hlod.js +214 -0
  222. package/package.json +6 -6
  223. package/src/geometry/boxCsg.ts +186 -0
  224. package/src/geometry/csg.ts +384 -0
  225. package/src/geometry/meshBuilder.ts +15 -0
  226. package/src/geometry/meshConcat.ts +1 -0
  227. package/src/geometry/pixelFont.ts +2 -0
  228. package/src/geometry/solid.ts +189 -0
  229. package/src/geometry/solidFlat.ts +522 -0
  230. package/src/geometry/solidHarness.ts +83 -0
  231. package/src/geometry/solidNormals.ts +103 -0
  232. package/src/geometry/solidRound.ts +443 -0
  233. package/src/geometry/solidWriter.ts +58 -0
  234. package/src/index.ts +61 -1
  235. package/src/render/backend/api.ts +36 -11
  236. package/src/render/backend/drawFog.ts +31 -0
  237. package/src/render/backend/materialChanges.ts +9 -2
  238. package/src/render/backend/webgl2/glassTintPrograms.ts +58 -0
  239. package/src/render/backend/webgl2/instanced.ts +80 -14
  240. package/src/render/backend/webgl2/renderer.ts +700 -250
  241. package/src/render/backend/webgpu/buffers.ts +92 -5
  242. package/src/render/backend/webgpu/depthPass.ts +7 -2
  243. package/src/render/backend/webgpu/drawCommand.ts +6 -0
  244. package/src/render/backend/webgpu/flatPass.ts +62 -11
  245. package/src/render/backend/webgpu/glassTintPass.ts +245 -0
  246. package/src/render/backend/webgpu/gpuDrivenPass.ts +349 -5
  247. package/src/render/backend/webgpu/instanceCullPass.ts +165 -0
  248. package/src/render/backend/webgpu/instanced.ts +42 -4
  249. package/src/render/backend/webgpu/latePass.ts +161 -0
  250. package/src/render/backend/webgpu/lightVolumePass.ts +5 -1
  251. package/src/render/backend/webgpu/motionPass.ts +535 -0
  252. package/src/render/backend/webgpu/pipelineCache.ts +12 -1
  253. package/src/render/backend/webgpu/pointGlassTintPass.ts +233 -0
  254. package/src/render/backend/webgpu/pointShadowPass.ts +158 -26
  255. package/src/render/backend/webgpu/renderer.ts +1671 -670
  256. package/src/render/backend/webgpu/scatterPass.ts +2 -1
  257. package/src/render/backend/webgpu/sdfTextPass.ts +6 -1
  258. package/src/render/backend/webgpu/shaders/instanceCull.wgsl.ts +61 -0
  259. package/src/render/backend/webgpu/skinPaletteRing.ts +4 -0
  260. package/src/render/backend/webgpu/snapshotMips.ts +80 -0
  261. package/src/render/backend/webgpu/surfaceTexturePass.ts +91 -51
  262. package/src/render/driftLight/bake.ts +85 -62
  263. package/src/render/driftLight/denseField.ts +149 -0
  264. package/src/render/driftLight/lightField.ts +33 -18
  265. package/src/render/driftLight/presence.ts +69 -0
  266. package/src/render/driftLight/uniforms.ts +8 -9
  267. package/src/render/driftLight/worldLightField.ts +83 -0
  268. package/src/render/fixtureAtlas.ts +63 -0
  269. package/src/render/glass.ts +74 -0
  270. package/src/render/glassCasters.ts +164 -0
  271. package/src/render/glassShadow.ts +153 -0
  272. package/src/render/globalMediumPass.ts +4 -11
  273. package/src/render/gpudriven/lit.ts +31 -0
  274. package/src/render/gpudriven/materialTable.ts +28 -6
  275. package/src/render/gpudriven/pipeline.ts +4 -3
  276. package/src/render/gpudriven/sunGlass.ts +117 -0
  277. package/src/render/instanceCull.ts +205 -0
  278. package/src/render/instances.ts +16 -0
  279. package/src/render/lightBudget.ts +41 -38
  280. package/src/render/lightGrid.ts +130 -0
  281. package/src/render/mesh.ts +59 -72
  282. package/src/render/occlusion.ts +51 -7
  283. package/src/render/pointGlassTint.ts +250 -0
  284. package/src/render/pointLightSelection.ts +72 -4
  285. package/src/render/pointShadowArray.ts +188 -22
  286. package/src/render/pointShadowMap.ts +41 -0
  287. package/src/render/rainField.ts +39 -5
  288. package/src/render/recon/changeFrames.ts +24 -0
  289. package/src/render/recon/lateDepth.ts +83 -0
  290. package/src/render/recon/lateRouting.ts +29 -0
  291. package/src/render/recon/mover.ts +118 -0
  292. package/src/render/recon/resolve.ts +206 -20
  293. package/src/render/renderQuality.ts +47 -0
  294. package/src/render/rendererHarness.ts +16 -0
  295. package/src/render/sceneTarget.ts +62 -11
  296. package/src/render/shaders/depth.ts +118 -15
  297. package/src/render/shaders/flat/directionalShadow.ts +97 -6
  298. package/src/render/shaders/flat/driftLight.ts +32 -7
  299. package/src/render/shaders/flat/glassTint.ts +25 -0
  300. package/src/render/shaders/flat/index.ts +22 -3
  301. package/src/render/shaders/flat/lampGlass.ts +185 -0
  302. package/src/render/shaders/flat/main.ts +190 -38
  303. package/src/render/shaders/flat/pointShadow.ts +2 -0
  304. package/src/render/shaders/flat/preamble.ts +96 -26
  305. package/src/render/shaders/flat/surfaceEffects.ts +152 -0
  306. package/src/render/shaders/generated/depth.wgsl.ts +237 -7
  307. package/src/render/shaders/generated/flat.wgsl.ts +1685 -1621
  308. package/src/render/shaders/generated/globalMedium.wgsl.ts +3 -13
  309. package/src/render/shaders/generated/lightVolume.wgsl.ts +23 -17
  310. package/src/render/shaders/generated/octahedralResolve.wgsl.ts +30 -0
  311. package/src/render/shaders/generated/rush.wgsl.ts +21 -16
  312. package/src/render/shaders/generated/sdfText.wgsl.ts +2 -2
  313. package/src/render/shaders/generated/text.wgsl.ts +1 -1
  314. package/src/render/shaders/gi/driftLight.wgsl.ts +27 -4
  315. package/src/render/shaders/globalMedium.ts +6 -6
  316. package/src/render/shaders/gpudriven/blendRaster.wgsl.ts +88 -1
  317. package/src/render/shaders/gpudriven/cull.wgsl.ts +11 -2
  318. package/src/render/shaders/gpudriven/materialTable.wgsl.ts +3 -1
  319. package/src/render/shaders/gpudriven/shade.wgsl.ts +50 -1
  320. package/src/render/shaders/gpudriven/sunGlass.wgsl.ts +139 -0
  321. package/src/render/shaders/lightVolume.ts +6 -6
  322. package/src/render/shaders/octahedralResolve.ts +50 -17
  323. package/src/render/shaders/recon/lateDepth.wgsl.ts +72 -0
  324. package/src/render/shaders/recon/motion.wgsl.ts +84 -0
  325. package/src/render/shaders/recon/resolve.wgsl.ts +161 -27
  326. package/src/render/shaders/rush.ts +11 -1
  327. package/src/render/shaders/sdfText.ts +3 -2
  328. package/src/render/shaders/text.ts +18 -9
  329. package/src/render/shadowCasters.ts +28 -1
  330. package/src/render/shadowMap.ts +231 -37
  331. package/src/render/sunGlassTint.ts +86 -0
  332. package/src/render/surfaceEffects.ts +132 -0
  333. package/src/render/surfaceScene.ts +16 -0
  334. package/src/render/surfaceTexture.ts +110 -19
  335. package/src/render/temporalAa.ts +78 -14
  336. package/src/render/textureSource.ts +72 -0
  337. package/src/render/translucentQueue.ts +20 -1
  338. package/src/render/vertexDefaults.ts +2 -0
  339. package/src/world/hlod.ts +290 -0
@@ -0,0 +1,535 @@
1
+ /**
2
+ * Where every mover was last frame, drawn into the reconstruction's motion target.
3
+ *
4
+ * Moved out of `renderer.ts` when it grew variants: the renderer decides *which* draws moved and
5
+ * hands them here; this owns how their motion is drawn. See `shaders/recon/motion.wgsl.ts` for what
6
+ * a texel carries, why it is a pass of its own, and why its matrices are unjittered.
7
+ */
8
+ import { DEPTH_COMPARE_EQUAL, DEPTH_FORMAT } from '../../depthConvention.ts';
9
+ import {
10
+ MOTION_DRAW_FLOATS,
11
+ MOTION_DRAW_STRIDE,
12
+ MOTION_FRAME_FLOATS,
13
+ MOTION_TARGET_FORMAT,
14
+ RECON_MOTION_WGSL,
15
+ } from '../../shaders/recon/motion.wgsl.ts';
16
+ import { INSTANCE_STRIDE } from '../../instances.ts';
17
+ import type { GpuMesh } from './buffers.ts';
18
+
19
+ /** What a record is, which decides the vertex stage and what else it binds. */
20
+ const RIGID = 0;
21
+ const SKINNED = 1;
22
+ const DYNAMIC = 2;
23
+ const INSTANCED = 3;
24
+
25
+ /** An instanced record's per-draw matrices are not read; this fills their slot. */
26
+ const IDENTITY = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
27
+
28
+ export class MotionPass {
29
+ private readonly device: GPUDevice;
30
+ /** The frame's movers, in the order they were drawn. */
31
+ private readonly meshes: GpuMesh[] = [];
32
+ /** Two matrices a mover — this frame's model and last frame's — at `MOTION_DRAW_FLOATS` apart. */
33
+ private matrices = new Float32Array(0);
34
+ private count = 0;
35
+ /** `RIGID` or `SKINNED` per record, grown beside `matrices`. */
36
+ private kinds = new Uint8Array(0);
37
+ /** A skinned record's two palettes, this frame's and last frame's, by record index. */
38
+ private readonly paletteNow: (GPUTextureView | null)[] = [];
39
+ private readonly paletteWas: (GPUTextureView | null)[] = [];
40
+ /** A rewritten record's last-frame rows, by record index. */
41
+ private readonly previousRows: (GPUBuffer | null)[] = [];
42
+ /** One pipeline per stride for rewritten meshes: current and previous rows at that stride. */
43
+ private readonly dynamicPipelines = new Map<number, GPURenderPipeline>();
44
+ /** An instanced record's placement this frame and last frame, and how many slots pair. */
45
+ private readonly instancesNow: (GPUBuffer | null)[] = [];
46
+ private readonly instancesWas: (GPUBuffer | null)[] = [];
47
+ private instanceCounts = new Uint32Array(0);
48
+ private readonly instancedPipelines = new Map<number, GPURenderPipeline>();
49
+ private layout: GPUBindGroupLayout | null = null;
50
+ private paletteLayout: GPUBindGroupLayout | null = null;
51
+ private skinnedLayout: GPUPipelineLayout | null = null;
52
+ /** Keyed by stride and the two skin offsets, packed into one number so a lookup builds nothing. */
53
+ private readonly skinnedPipelines = new Map<number, GPURenderPipeline>();
54
+ /**
55
+ * A bind group per pair of palette views. The ring keeps its textures from frame to frame, so a
56
+ * steady scene settles on a handful of pairs and builds nothing per frame.
57
+ */
58
+ private readonly paletteGroups = new Map<GPUTextureView, Map<GPUTextureView, GPUBindGroup>>();
59
+ private module: GPUShaderModule | null = null;
60
+ private pipelineLayout: GPUPipelineLayout | null = null;
61
+ private readonly pipelines = new Map<number, GPURenderPipeline>();
62
+ private frameBuffer: GPUBuffer | null = null;
63
+ private drawBuffer: GPUBuffer | null = null;
64
+ private drawCapacity = 0;
65
+ private group: GPUBindGroup | null = null;
66
+ private readonly frameStaging = new Float32Array(MOTION_FRAME_FLOATS);
67
+ private drawStaging = new Uint8Array(0);
68
+ /** A float view of `drawStaging`, made when it is, so a frame's upload allocates nothing. */
69
+ private drawFloats = new Float32Array(0);
70
+
71
+ constructor(device: GPUDevice) {
72
+ this.device = device;
73
+ }
74
+
75
+ /** A frame states its movers afresh. */
76
+ reset(): void {
77
+ this.count = 0;
78
+ }
79
+
80
+ /** A rigid mover: the same positions under last frame's model. */
81
+ recordRigid(mesh: GpuMesh, model: ArrayLike<number>, previousModel: ArrayLike<number>): void {
82
+ this.take(mesh, model, previousModel, RIGID);
83
+ }
84
+
85
+ /** A skinned mover: its positions under last frame's pose as well as last frame's model. */
86
+ recordSkinned(
87
+ mesh: GpuMesh,
88
+ model: ArrayLike<number>,
89
+ previousModel: ArrayLike<number>,
90
+ palette: GPUTextureView,
91
+ previousPalette: GPUTextureView,
92
+ ): void {
93
+ const at = this.take(mesh, model, previousModel, SKINNED);
94
+ this.paletteNow[at] = palette;
95
+ this.paletteWas[at] = previousPalette;
96
+ }
97
+
98
+ /** A rewritten mesh: its vertices as they were, read from `previous`, under last frame's model. */
99
+ recordDynamic(
100
+ mesh: GpuMesh,
101
+ model: ArrayLike<number>,
102
+ previousModel: ArrayLike<number>,
103
+ previous: GPUBuffer,
104
+ ): void {
105
+ const at = this.take(mesh, model, previousModel, DYNAMIC);
106
+ this.previousRows[at] = previous;
107
+ }
108
+
109
+ /** An instanced batch: its first `count` slots, each under last frame's placement of that slot. */
110
+ recordInstanced(
111
+ mesh: GpuMesh,
112
+ placement: GPUBuffer,
113
+ previousPlacement: GPUBuffer,
114
+ count: number,
115
+ ): void {
116
+ const at = this.take(mesh, IDENTITY, IDENTITY, INSTANCED);
117
+ this.instancesNow[at] = placement;
118
+ this.instancesWas[at] = previousPlacement;
119
+ this.instanceCounts[at] = count;
120
+ }
121
+
122
+ /** One record's slot: its mesh, its two matrices and its kind. Returns the record's index. */
123
+ private take(
124
+ mesh: GpuMesh,
125
+ model: ArrayLike<number>,
126
+ previousModel: ArrayLike<number>,
127
+ kind: number,
128
+ ): number {
129
+ const at = this.count;
130
+ const wanted = (at + 1) * MOTION_DRAW_FLOATS;
131
+ if (this.matrices.length < wanted) {
132
+ /* Doubling, so a scene settles on one allocation rather than one a draw. */
133
+ const grown = new Float32Array(Math.max(wanted, this.matrices.length * 2, 64));
134
+ grown.set(this.matrices);
135
+ this.matrices = grown;
136
+ const kinds = new Uint8Array(grown.length / MOTION_DRAW_FLOATS);
137
+ kinds.set(this.kinds);
138
+ this.kinds = kinds;
139
+ const counts = new Uint32Array(kinds.length);
140
+ counts.set(this.instanceCounts);
141
+ this.instanceCounts = counts;
142
+ }
143
+ this.matrices.set(model as ArrayLike<number> & Iterable<number>, at * MOTION_DRAW_FLOATS);
144
+ this.matrices.set(
145
+ previousModel as ArrayLike<number> & Iterable<number>,
146
+ at * MOTION_DRAW_FLOATS + 16,
147
+ );
148
+ this.meshes[at] = mesh;
149
+ this.kinds[at] = kind;
150
+ this.count = at + 1;
151
+ return at;
152
+ }
153
+
154
+ /**
155
+ * The pipeline layout and module, built once.
156
+ *
157
+ * **The position alone**, at offset zero of the mesh's interleaved rows: that is all the rigid
158
+ * stage reads, and positions are the layout's first attribute and never optional.
159
+ */
160
+ private buildLayout(): void {
161
+ if (this.layout !== null) return;
162
+ this.layout = this.device.createBindGroupLayout({
163
+ label: 'recon.motion.layout',
164
+ entries: [
165
+ { binding: 0, visibility: 0x1, buffer: { type: 'uniform' as const } },
166
+ {
167
+ binding: 1,
168
+ visibility: 0x1,
169
+ buffer: { type: 'uniform' as const, hasDynamicOffset: true },
170
+ },
171
+ ],
172
+ });
173
+ this.module = this.device.createShaderModule({
174
+ label: 'recon.motion',
175
+ code: RECON_MOTION_WGSL,
176
+ });
177
+ this.pipelineLayout = this.device.createPipelineLayout({
178
+ bindGroupLayouts: [this.layout],
179
+ });
180
+ /* The two palettes, read with `textureLoad` at integer texels: unfilterable is exact. */
181
+ this.paletteLayout = this.device.createBindGroupLayout({
182
+ label: 'recon.motion.palettes',
183
+ entries: [
184
+ { binding: 0, visibility: 0x1, texture: { sampleType: 'unfilterable-float' as const } },
185
+ { binding: 1, visibility: 0x1, texture: { sampleType: 'unfilterable-float' as const } },
186
+ ],
187
+ });
188
+ this.skinnedLayout = this.device.createPipelineLayout({
189
+ bindGroupLayouts: [this.layout, this.paletteLayout],
190
+ });
191
+ }
192
+
193
+ /**
194
+ * The skinned pipeline for one stride and one placement of the joints and weights in it.
195
+ *
196
+ * Same fragment stage, winding and depth test as the rigid one — see `pipelineFor` — with the two
197
+ * skinning attributes read from the interleaved rows at the offsets the mesh records.
198
+ */
199
+ private skinnedPipelineFor(
200
+ stride: number,
201
+ offsets: { readonly joints: number; readonly weights: number },
202
+ ): GPURenderPipeline | null {
203
+ const key = (stride * 4096 + offsets.joints) * 4096 + offsets.weights;
204
+ const held = this.skinnedPipelines.get(key);
205
+ if (held !== undefined) return held;
206
+ const module = this.module;
207
+ const layout = this.skinnedLayout;
208
+ if (module === null || layout === null) return null;
209
+ const pipeline = this.device.createRenderPipeline({
210
+ label: `recon.motion.skinned.${String(stride)}`,
211
+ layout,
212
+ vertex: {
213
+ module,
214
+ entryPoint: 'motionSkinnedVert',
215
+ buffers: [
216
+ {
217
+ arrayStride: stride,
218
+ attributes: [
219
+ { shaderLocation: 0, offset: 0, format: 'float32x3' },
220
+ { shaderLocation: 11, offset: offsets.joints, format: 'float32x4' },
221
+ { shaderLocation: 12, offset: offsets.weights, format: 'float32x4' },
222
+ ],
223
+ },
224
+ ],
225
+ },
226
+ fragment: { module, entryPoint: 'motionFrag', targets: [{ format: MOTION_TARGET_FORMAT }] },
227
+ primitive: { topology: 'triangle-list', cullMode: 'back' },
228
+ depthStencil: {
229
+ format: DEPTH_FORMAT,
230
+ depthWriteEnabled: false,
231
+ depthCompare: DEPTH_COMPARE_EQUAL,
232
+ },
233
+ });
234
+ this.skinnedPipelines.set(key, pipeline);
235
+ return pipeline;
236
+ }
237
+
238
+ /** The rewritten pipeline for one stride: position from each of two buffers of that stride. */
239
+ private dynamicPipelineFor(stride: number): GPURenderPipeline | null {
240
+ const held = this.dynamicPipelines.get(stride);
241
+ if (held !== undefined) return held;
242
+ const module = this.module;
243
+ const layout = this.pipelineLayout;
244
+ if (module === null || layout === null) return null;
245
+ const pipeline = this.device.createRenderPipeline({
246
+ label: `recon.motion.dynamic.${String(stride)}`,
247
+ layout,
248
+ vertex: {
249
+ module,
250
+ entryPoint: 'motionDynamicVert',
251
+ buffers: [
252
+ {
253
+ arrayStride: stride,
254
+ attributes: [{ shaderLocation: 0, offset: 0, format: 'float32x3' }],
255
+ },
256
+ {
257
+ arrayStride: stride,
258
+ attributes: [{ shaderLocation: 1, offset: 0, format: 'float32x3' }],
259
+ },
260
+ ],
261
+ },
262
+ fragment: { module, entryPoint: 'motionFrag', targets: [{ format: MOTION_TARGET_FORMAT }] },
263
+ primitive: { topology: 'triangle-list', cullMode: 'back' },
264
+ depthStencil: {
265
+ format: DEPTH_FORMAT,
266
+ depthWriteEnabled: false,
267
+ depthCompare: DEPTH_COMPARE_EQUAL,
268
+ },
269
+ });
270
+ this.dynamicPipelines.set(stride, pipeline);
271
+ return pipeline;
272
+ }
273
+
274
+ /**
275
+ * The instanced pipeline for one mesh stride: the mesh's positions, then this frame's and last
276
+ * frame's placements, one matrix an instance, as the scene's instanced stage reads them.
277
+ */
278
+ private instancedPipelineFor(stride: number): GPURenderPipeline | null {
279
+ const held = this.instancedPipelines.get(stride);
280
+ if (held !== undefined) return held;
281
+ const module = this.module;
282
+ const layout = this.pipelineLayout;
283
+ if (module === null || layout === null) return null;
284
+ const placement = (first: number): GPUVertexBufferLayout => ({
285
+ arrayStride: INSTANCE_STRIDE,
286
+ stepMode: 'instance',
287
+ attributes: [
288
+ { shaderLocation: first, offset: 0, format: 'float32x4' },
289
+ { shaderLocation: first + 1, offset: 16, format: 'float32x4' },
290
+ { shaderLocation: first + 2, offset: 32, format: 'float32x4' },
291
+ { shaderLocation: first + 3, offset: 48, format: 'float32x4' },
292
+ ],
293
+ });
294
+ const pipeline = this.device.createRenderPipeline({
295
+ label: `recon.motion.instanced.${String(stride)}`,
296
+ layout,
297
+ vertex: {
298
+ module,
299
+ entryPoint: 'motionInstancedVert',
300
+ buffers: [
301
+ {
302
+ arrayStride: stride,
303
+ attributes: [{ shaderLocation: 0, offset: 0, format: 'float32x3' }],
304
+ },
305
+ placement(2),
306
+ placement(6),
307
+ ],
308
+ },
309
+ fragment: { module, entryPoint: 'motionFrag', targets: [{ format: MOTION_TARGET_FORMAT }] },
310
+ primitive: { topology: 'triangle-list', cullMode: 'back' },
311
+ depthStencil: {
312
+ format: DEPTH_FORMAT,
313
+ depthWriteEnabled: false,
314
+ depthCompare: DEPTH_COMPARE_EQUAL,
315
+ },
316
+ });
317
+ this.instancedPipelines.set(stride, pipeline);
318
+ return pipeline;
319
+ }
320
+
321
+ /** The bind group holding one pair of palettes, built the first time the pair is seen. */
322
+ private paletteGroup(now: GPUTextureView, was: GPUTextureView): GPUBindGroup | null {
323
+ const layout = this.paletteLayout;
324
+ if (layout === null) return null;
325
+ let byWas = this.paletteGroups.get(now);
326
+ if (byWas === undefined) {
327
+ byWas = new Map();
328
+ this.paletteGroups.set(now, byWas);
329
+ }
330
+ let group = byWas.get(was);
331
+ if (group === undefined) {
332
+ group = this.device.createBindGroup({
333
+ label: 'recon.motion.palettes',
334
+ layout,
335
+ entries: [
336
+ { binding: 0, resource: now },
337
+ { binding: 1, resource: was },
338
+ ],
339
+ });
340
+ byWas.set(was, group);
341
+ }
342
+ return group;
343
+ }
344
+
345
+ /** The pipeline for one vertex stride, built on first sight of it. */
346
+ private pipelineFor(stride: number): GPURenderPipeline | null {
347
+ const held = this.pipelines.get(stride);
348
+ if (held !== undefined) return held;
349
+ const module = this.module;
350
+ const layout = this.pipelineLayout;
351
+ if (module === null || layout === null) return null;
352
+ const pipeline = this.device.createRenderPipeline({
353
+ label: `recon.motion.${String(stride)}`,
354
+ layout,
355
+ vertex: {
356
+ module,
357
+ entryPoint: 'motionVert',
358
+ buffers: [
359
+ {
360
+ arrayStride: stride,
361
+ attributes: [{ shaderLocation: 0, offset: 0, format: 'float32x3' }],
362
+ },
363
+ ],
364
+ },
365
+ fragment: { module, entryPoint: 'motionFrag', targets: [{ format: MOTION_TARGET_FORMAT }] },
366
+ /*
367
+ * **The scene's own winding**, because this draws the scene's geometry through the scene's
368
+ * clip transform — the product the renderer hands over already carries the negation that
369
+ * `naga` writes into every generated vertex stage, so the faces come out the way they did
370
+ * and a `cw` front face here would draw the inside of every mesh. §3 row 57.
371
+ */
372
+ primitive: { topology: 'triangle-list', cullMode: 'back' },
373
+ depthStencil: {
374
+ format: DEPTH_FORMAT,
375
+ /*
376
+ * **Tested and not written.** The frame's depth is finished; this pass only wants the
377
+ * pixels the scene actually kept, and `DEPTH_COMPARE_EQUAL` is the comparison that admits
378
+ * exactly them — the same transform on the same positions gives the same depth, which is
379
+ * why the rasterisation matrix is handed over whole rather than rebuilt here.
380
+ *
381
+ * **And the equality is not fragile here**, which was worth measuring rather than
382
+ * assuming: this driver contracts multiply-adds (§3 row 107) and two shader modules can
383
+ * contract a matrix product differently, so an equality across them could have admitted
384
+ * only some of a surface. Run with `greater-equal` instead, the ghost measured the same
385
+ * to the pixel — 5,942 either way — so nothing is being dropped.
386
+ */
387
+ depthWriteEnabled: false,
388
+ depthCompare: DEPTH_COMPARE_EQUAL,
389
+ },
390
+ });
391
+ this.pipelines.set(stride, pipeline);
392
+ return pipeline;
393
+ }
394
+
395
+ /**
396
+ * Every mover of the frame, into `target`, tested against the finished `depth`.
397
+ *
398
+ * **After everything that draws and before the resolve reads it.** `raster` is the scene's clip
399
+ * transform with the generated stages' y negation folded in; `viewProj` and `previousViewProj`
400
+ * are this frame's and last frame's unjittered view-projections.
401
+ *
402
+ * **Cleared every frame, even when nothing moved.** A texel left from last frame is a flag saying
403
+ * "a draw wrote this", and the resolve would take a motion belonging to a surface that is no
404
+ * longer there. The clear is the pass's own load operation, so an empty frame still runs it.
405
+ */
406
+ run(
407
+ encoder: GPUCommandEncoder,
408
+ target: GPUTextureView,
409
+ depth: GPUTextureView,
410
+ raster: Float32Array,
411
+ viewProj: Float32Array,
412
+ previousViewProj: Float32Array,
413
+ timestampWrites: GPURenderPassTimestampWrites | undefined,
414
+ ): void {
415
+ this.buildLayout();
416
+ const layout = this.layout;
417
+ if (layout === null) return;
418
+ const pass = encoder.beginRenderPass({
419
+ label: 'recon.motion',
420
+ timestampWrites,
421
+ colorAttachments: [
422
+ { view: target, loadOp: 'clear', storeOp: 'store', clearValue: [0, 0, 0, 0] },
423
+ ],
424
+ depthStencilAttachment: {
425
+ view: depth,
426
+ depthLoadOp: 'load',
427
+ depthStoreOp: 'store',
428
+ depthReadOnly: false,
429
+ },
430
+ });
431
+
432
+ const count = this.count;
433
+ if (count > 0) {
434
+ const bytes = count * MOTION_DRAW_STRIDE;
435
+ if (this.drawCapacity < count) {
436
+ this.drawBuffer?.destroy();
437
+ this.drawCapacity = Math.max(count, this.drawCapacity * 2, 16);
438
+ this.drawBuffer = this.device.createBuffer({
439
+ label: 'recon.motion.draws',
440
+ size: this.drawCapacity * MOTION_DRAW_STRIDE,
441
+ usage: 0x40 | 0x8, // UNIFORM | COPY_DST
442
+ });
443
+ this.drawStaging = new Uint8Array(this.drawCapacity * MOTION_DRAW_STRIDE);
444
+ this.drawFloats = new Float32Array(this.drawStaging.buffer);
445
+ this.group = null;
446
+ }
447
+ this.frameBuffer ??= this.device.createBuffer({
448
+ label: 'recon.motion.frame',
449
+ size: MOTION_FRAME_FLOATS * 4,
450
+ usage: 0x40 | 0x8,
451
+ });
452
+ this.group ??= this.device.createBindGroup({
453
+ label: 'recon.motion.group',
454
+ layout,
455
+ entries: [
456
+ { binding: 0, resource: { buffer: this.frameBuffer } },
457
+ {
458
+ binding: 1,
459
+ resource: { buffer: this.drawBuffer as GPUBuffer, size: MOTION_DRAW_STRIDE },
460
+ },
461
+ ],
462
+ });
463
+
464
+ this.frameStaging.set(raster, 0);
465
+ this.frameStaging.set(viewProj, 16);
466
+ this.frameStaging.set(previousViewProj, 32);
467
+ this.device.queue.writeBuffer(this.frameBuffer, 0, this.frameStaging);
468
+
469
+ /* Copied a float at a time rather than through `subarray`, which is a view allocated per
470
+ mover per frame. */
471
+ for (let i = 0; i < count; i += 1) {
472
+ const from = i * MOTION_DRAW_FLOATS;
473
+ const to = (i * MOTION_DRAW_STRIDE) / 4;
474
+ for (let k = 0; k < MOTION_DRAW_FLOATS; k += 1) {
475
+ this.drawFloats[to + k] = this.matrices[from + k] as number;
476
+ }
477
+ }
478
+ this.device.queue.writeBuffer(this.drawBuffer as GPUBuffer, 0, this.drawStaging, 0, bytes);
479
+
480
+ let bound: GPURenderPipeline | null = null;
481
+ for (let i = 0; i < count; i += 1) {
482
+ const mesh = this.meshes[i];
483
+ if (mesh === undefined) continue;
484
+ const kind = this.kinds[i];
485
+ let pipeline: GPURenderPipeline | null = null;
486
+ let instances = 1;
487
+ if (kind === INSTANCED) {
488
+ const now = this.instancesNow[i] ?? null;
489
+ const was = this.instancesWas[i] ?? null;
490
+ if (now === null || was === null) continue;
491
+ pipeline = this.instancedPipelineFor(mesh.vertexStride);
492
+ pass.setVertexBuffer(1, now);
493
+ pass.setVertexBuffer(2, was);
494
+ instances = this.instanceCounts[i] ?? 0;
495
+ } else if (kind === DYNAMIC) {
496
+ const previous = this.previousRows[i] ?? null;
497
+ if (previous === null) continue;
498
+ pipeline = this.dynamicPipelineFor(mesh.vertexStride);
499
+ pass.setVertexBuffer(1, previous);
500
+ } else if (kind === SKINNED) {
501
+ const offsets = mesh.skinOffsets;
502
+ const now = this.paletteNow[i] ?? null;
503
+ const was = this.paletteWas[i] ?? null;
504
+ if (offsets === null || now === null || was === null) continue;
505
+ pipeline = this.skinnedPipelineFor(mesh.vertexStride, offsets);
506
+ const palettes = this.paletteGroup(now, was);
507
+ if (pipeline === null || palettes === null) continue;
508
+ pass.setBindGroup(1, palettes);
509
+ } else {
510
+ pipeline = this.pipelineFor(mesh.vertexStride);
511
+ }
512
+ if (pipeline === null) continue;
513
+ if (pipeline !== bound) {
514
+ pass.setPipeline(pipeline);
515
+ bound = pipeline;
516
+ }
517
+ pass.setBindGroup(0, this.group, [i * MOTION_DRAW_STRIDE]);
518
+ pass.setVertexBuffer(0, mesh.vertexBuffers[0] as GPUBuffer);
519
+ pass.setIndexBuffer(mesh.indexBuffer, 'uint32');
520
+ pass.drawIndexed(mesh.indexCount, instances);
521
+ }
522
+ }
523
+ pass.end();
524
+ }
525
+
526
+ dispose(): void {
527
+ this.paletteGroups.clear();
528
+ this.frameBuffer?.destroy();
529
+ this.drawBuffer?.destroy();
530
+ this.frameBuffer = null;
531
+ this.drawBuffer = null;
532
+ this.drawCapacity = 0;
533
+ this.group = null;
534
+ }
535
+ }
@@ -34,6 +34,16 @@ export class PipelineCache {
34
34
  */
35
35
  readonly sampleCount: number;
36
36
 
37
+ /**
38
+ * Whether the lit pipelines here read glass in their shadows: `glassShadows` other than `'off'`.
39
+ *
40
+ * **Carried by the cache for the reason the format is**: one value every lit pipeline is built
41
+ * with, chosen once by the renderer. It is the `GLASS_SHADOWS` override the generated lit shader
42
+ * branches on (see `FlatShaderOptions.glassShadows`), so off specialises the lookups away rather
43
+ * than leaving code that returns at its first line and still costs the pass its registers.
44
+ */
45
+ readonly glassShadows: boolean;
46
+
37
47
  private readonly device: GPUDevice;
38
48
  private readonly pipelines = new Map<string, GPURenderPipeline>();
39
49
  /**
@@ -52,10 +62,11 @@ export class PipelineCache {
52
62
  */
53
63
  private readonly compiling = new Map<string, Promise<GPURenderPipeline>>();
54
64
 
55
- constructor(device: GPUDevice, format: GPUTextureFormat, sampleCount = 1) {
65
+ constructor(device: GPUDevice, format: GPUTextureFormat, sampleCount = 1, glassShadows = true) {
56
66
  this.device = device;
57
67
  this.format = format;
58
68
  this.sampleCount = sampleCount;
69
+ this.glassShadows = glassShadows;
59
70
  }
60
71
 
61
72
  /** How many distinct pipelines have been built. Read by tests and diagnostics. */