@driftengine/core 4.4.1 → 4.5.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 (218) hide show
  1. package/CHANGELOG.json +72 -0
  2. package/README.md +1 -1
  3. package/dist/index.d.ts +5 -1
  4. package/dist/index.js +7 -0
  5. package/dist/render/backend/api.d.ts +17 -11
  6. package/dist/render/backend/webgl2/glassTintPrograms.d.ts +13 -0
  7. package/dist/render/backend/webgl2/glassTintPrograms.js +38 -0
  8. package/dist/render/backend/webgl2/renderer.d.ts +82 -8
  9. package/dist/render/backend/webgl2/renderer.js +373 -105
  10. package/dist/render/backend/webgpu/buffers.d.ts +19 -1
  11. package/dist/render/backend/webgpu/buffers.js +27 -1
  12. package/dist/render/backend/webgpu/depthPass.d.ts +1 -1
  13. package/dist/render/backend/webgpu/depthPass.js +2 -1
  14. package/dist/render/backend/webgpu/flatPass.d.ts +2 -0
  15. package/dist/render/backend/webgpu/flatPass.js +20 -1
  16. package/dist/render/backend/webgpu/glassTintPass.d.ts +28 -0
  17. package/dist/render/backend/webgpu/glassTintPass.js +205 -0
  18. package/dist/render/backend/webgpu/gpuDrivenPass.d.ts +60 -1
  19. package/dist/render/backend/webgpu/gpuDrivenPass.js +305 -5
  20. package/dist/render/backend/webgpu/instanced.d.ts +12 -1
  21. package/dist/render/backend/webgpu/instanced.js +20 -1
  22. package/dist/render/backend/webgpu/latePass.d.ts +26 -0
  23. package/dist/render/backend/webgpu/latePass.js +133 -0
  24. package/dist/render/backend/webgpu/lightVolumePass.js +5 -1
  25. package/dist/render/backend/webgpu/motionPass.d.ts +95 -0
  26. package/dist/render/backend/webgpu/motionPass.js +491 -0
  27. package/dist/render/backend/webgpu/pipelineCache.d.ts +10 -1
  28. package/dist/render/backend/webgpu/pipelineCache.js +11 -1
  29. package/dist/render/backend/webgpu/pointGlassTintPass.d.ts +32 -0
  30. package/dist/render/backend/webgpu/pointGlassTintPass.js +193 -0
  31. package/dist/render/backend/webgpu/pointShadowPass.d.ts +35 -6
  32. package/dist/render/backend/webgpu/pointShadowPass.js +105 -20
  33. package/dist/render/backend/webgpu/postPass.d.ts +21 -15
  34. package/dist/render/backend/webgpu/postPass.js +17 -4
  35. package/dist/render/backend/webgpu/renderer.d.ts +181 -54
  36. package/dist/render/backend/webgpu/renderer.js +1011 -394
  37. package/dist/render/backend/webgpu/scatterPass.js +2 -1
  38. package/dist/render/backend/webgpu/skinPaletteRing.d.ts +4 -0
  39. package/dist/render/backend/webgpu/skinPaletteRing.js +4 -0
  40. package/dist/render/backend/webgpu/snapshotMips.d.ts +29 -0
  41. package/dist/render/backend/webgpu/snapshotMips.js +52 -0
  42. package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +5 -0
  43. package/dist/render/backend/webgpu/surfaceTexturePass.js +1 -1
  44. package/dist/render/flameLight.js +15 -2
  45. package/dist/render/glass.d.ts +45 -0
  46. package/dist/render/glass.js +39 -0
  47. package/dist/render/glassCasters.d.ts +40 -0
  48. package/dist/render/glassCasters.js +84 -0
  49. package/dist/render/glassShadow.d.ts +78 -0
  50. package/dist/render/glassShadow.js +125 -0
  51. package/dist/render/globalMediumPass.d.ts +2 -3
  52. package/dist/render/globalMediumPass.js +2 -8
  53. package/dist/render/gpudriven/lit.d.ts +12 -0
  54. package/dist/render/gpudriven/lit.js +23 -0
  55. package/dist/render/gpudriven/materialTable.d.ts +15 -5
  56. package/dist/render/gpudriven/materialTable.js +26 -6
  57. package/dist/render/gpudriven/pipeline.d.ts +1 -1
  58. package/dist/render/gpudriven/pipeline.js +4 -3
  59. package/dist/render/gpudriven/sunGlass.d.ts +35 -0
  60. package/dist/render/gpudriven/sunGlass.js +89 -0
  61. package/dist/render/lightBudget.d.ts +17 -5
  62. package/dist/render/lightBudget.js +17 -5
  63. package/dist/render/pointGlassTint.d.ts +59 -0
  64. package/dist/render/pointGlassTint.js +198 -0
  65. package/dist/render/pointShadowArray.d.ts +56 -3
  66. package/dist/render/pointShadowArray.js +127 -16
  67. package/dist/render/pointShadowBudget.js +51 -41
  68. package/dist/render/pointShadowMap.d.ts +23 -1
  69. package/dist/render/pointShadowMap.js +27 -1
  70. package/dist/render/recon/changeFrames.d.ts +15 -0
  71. package/dist/render/recon/changeFrames.js +21 -0
  72. package/dist/render/recon/disocclusion.d.ts +36 -3
  73. package/dist/render/recon/disocclusion.js +56 -4
  74. package/dist/render/recon/lateRouting.d.ts +14 -0
  75. package/dist/render/recon/lateRouting.js +18 -0
  76. package/dist/render/recon/mover.d.ts +57 -0
  77. package/dist/render/recon/mover.js +86 -0
  78. package/dist/render/recon/resolve.js +95 -12
  79. package/dist/render/renderQuality.d.ts +35 -0
  80. package/dist/render/renderQuality.js +7 -0
  81. package/dist/render/rendererHarness.js +12 -0
  82. package/dist/render/sceneTarget.d.ts +9 -1
  83. package/dist/render/sceneTarget.js +59 -13
  84. package/dist/render/shaders/depth.d.ts +16 -1
  85. package/dist/render/shaders/depth.js +85 -9
  86. package/dist/render/shaders/flat/directionalShadow.js +91 -6
  87. package/dist/render/shaders/flat/glassTint.d.ts +6 -0
  88. package/dist/render/shaders/flat/glassTint.js +25 -0
  89. package/dist/render/shaders/flat/index.d.ts +13 -0
  90. package/dist/render/shaders/flat/index.js +4 -0
  91. package/dist/render/shaders/flat/lampGlass.d.ts +1 -0
  92. package/dist/render/shaders/flat/lampGlass.js +183 -0
  93. package/dist/render/shaders/flat/main.d.ts +1 -1
  94. package/dist/render/shaders/flat/main.js +115 -15
  95. package/dist/render/shaders/flat/pointShadow.d.ts +1 -1
  96. package/dist/render/shaders/flat/pointShadow.js +2 -0
  97. package/dist/render/shaders/flat/preamble.js +21 -6
  98. package/dist/render/shaders/generated/depth.wgsl.d.ts +227 -4
  99. package/dist/render/shaders/generated/depth.wgsl.js +227 -4
  100. package/dist/render/shaders/generated/flat.wgsl.d.ts +360 -312
  101. package/dist/render/shaders/generated/flat.wgsl.js +376 -328
  102. package/dist/render/shaders/generated/globalMedium.wgsl.d.ts +3 -13
  103. package/dist/render/shaders/generated/globalMedium.wgsl.js +3 -13
  104. package/dist/render/shaders/generated/lightVolume.wgsl.d.ts +3 -13
  105. package/dist/render/shaders/generated/lightVolume.wgsl.js +4 -14
  106. package/dist/render/shaders/generated/octahedralResolve.wgsl.d.ts +29 -0
  107. package/dist/render/shaders/generated/octahedralResolve.wgsl.js +29 -0
  108. package/dist/render/shaders/generated/temporalResolve.wgsl.d.ts +31 -6
  109. package/dist/render/shaders/generated/temporalResolve.wgsl.js +31 -6
  110. package/dist/render/shaders/globalMedium.js +6 -6
  111. package/dist/render/shaders/gpudriven/blendRaster.wgsl.d.ts +7 -0
  112. package/dist/render/shaders/gpudriven/blendRaster.wgsl.js +86 -1
  113. package/dist/render/shaders/gpudriven/cull.wgsl.d.ts +1 -1
  114. package/dist/render/shaders/gpudriven/cull.wgsl.js +11 -2
  115. package/dist/render/shaders/gpudriven/materialTable.wgsl.d.ts +1 -1
  116. package/dist/render/shaders/gpudriven/materialTable.wgsl.js +3 -1
  117. package/dist/render/shaders/gpudriven/shade.wgsl.js +50 -1
  118. package/dist/render/shaders/gpudriven/sunGlass.wgsl.d.ts +9 -0
  119. package/dist/render/shaders/gpudriven/sunGlass.wgsl.js +133 -0
  120. package/dist/render/shaders/lightVolume.js +6 -6
  121. package/dist/render/shaders/octahedralResolve.d.ts +8 -0
  122. package/dist/render/shaders/octahedralResolve.js +48 -17
  123. package/dist/render/shaders/recon/lateDepth.wgsl.d.ts +1 -0
  124. package/dist/render/shaders/recon/lateDepth.wgsl.js +44 -0
  125. package/dist/render/shaders/recon/motion.wgsl.d.ts +1 -1
  126. package/dist/render/shaders/recon/motion.wgsl.js +84 -0
  127. package/dist/render/shaders/recon/resolve.wgsl.d.ts +1 -1
  128. package/dist/render/shaders/recon/resolve.wgsl.js +112 -8
  129. package/dist/render/shaders/temporalResolve.js +133 -5
  130. package/dist/render/shadowCasters.d.ts +20 -1
  131. package/dist/render/shadowCasters.js +15 -1
  132. package/dist/render/shadowMap.d.ts +54 -5
  133. package/dist/render/shadowMap.js +190 -36
  134. package/dist/render/sunGlassTint.d.ts +25 -0
  135. package/dist/render/sunGlassTint.js +79 -0
  136. package/dist/render/temporalAa.d.ts +145 -0
  137. package/dist/render/temporalAa.js +190 -0
  138. package/dist/render/temporalPass.d.ts +16 -14
  139. package/dist/render/temporalPass.js +59 -14
  140. package/dist/render/translucentQueue.d.ts +6 -0
  141. package/dist/render/translucentQueue.js +15 -1
  142. package/package.json +6 -6
  143. package/src/index.ts +10 -0
  144. package/src/render/backend/api.ts +15 -9
  145. package/src/render/backend/webgl2/glassTintPrograms.ts +58 -0
  146. package/src/render/backend/webgl2/renderer.ts +422 -109
  147. package/src/render/backend/webgpu/buffers.ts +50 -2
  148. package/src/render/backend/webgpu/depthPass.ts +2 -1
  149. package/src/render/backend/webgpu/flatPass.ts +22 -1
  150. package/src/render/backend/webgpu/glassTintPass.ts +244 -0
  151. package/src/render/backend/webgpu/gpuDrivenPass.ts +349 -5
  152. package/src/render/backend/webgpu/instanced.ts +21 -1
  153. package/src/render/backend/webgpu/latePass.ts +152 -0
  154. package/src/render/backend/webgpu/lightVolumePass.ts +5 -1
  155. package/src/render/backend/webgpu/motionPass.ts +535 -0
  156. package/src/render/backend/webgpu/pipelineCache.ts +12 -1
  157. package/src/render/backend/webgpu/pointGlassTintPass.ts +233 -0
  158. package/src/render/backend/webgpu/pointShadowPass.ts +158 -26
  159. package/src/render/backend/webgpu/postPass.ts +34 -4
  160. package/src/render/backend/webgpu/renderer.ts +1178 -425
  161. package/src/render/backend/webgpu/scatterPass.ts +2 -1
  162. package/src/render/backend/webgpu/skinPaletteRing.ts +4 -0
  163. package/src/render/backend/webgpu/snapshotMips.ts +80 -0
  164. package/src/render/backend/webgpu/surfaceTexturePass.ts +1 -1
  165. package/src/render/flameLight.ts +15 -2
  166. package/src/render/glass.ts +74 -0
  167. package/src/render/glassCasters.ts +164 -0
  168. package/src/render/glassShadow.ts +153 -0
  169. package/src/render/globalMediumPass.ts +4 -11
  170. package/src/render/gpudriven/lit.ts +31 -0
  171. package/src/render/gpudriven/materialTable.ts +28 -6
  172. package/src/render/gpudriven/pipeline.ts +4 -3
  173. package/src/render/gpudriven/sunGlass.ts +117 -0
  174. package/src/render/lightBudget.ts +19 -5
  175. package/src/render/pointGlassTint.ts +250 -0
  176. package/src/render/pointShadowArray.ts +188 -22
  177. package/src/render/pointShadowBudget.ts +49 -39
  178. package/src/render/pointShadowMap.ts +41 -0
  179. package/src/render/recon/changeFrames.ts +24 -0
  180. package/src/render/recon/disocclusion.ts +54 -3
  181. package/src/render/recon/lateRouting.ts +29 -0
  182. package/src/render/recon/mover.ts +118 -0
  183. package/src/render/recon/resolve.ts +137 -10
  184. package/src/render/renderQuality.ts +47 -0
  185. package/src/render/rendererHarness.ts +12 -0
  186. package/src/render/sceneTarget.ts +66 -12
  187. package/src/render/shaders/depth.ts +109 -9
  188. package/src/render/shaders/flat/directionalShadow.ts +97 -6
  189. package/src/render/shaders/flat/glassTint.ts +25 -0
  190. package/src/render/shaders/flat/index.ts +17 -0
  191. package/src/render/shaders/flat/lampGlass.ts +185 -0
  192. package/src/render/shaders/flat/main.ts +115 -15
  193. package/src/render/shaders/flat/pointShadow.ts +2 -0
  194. package/src/render/shaders/flat/preamble.ts +21 -6
  195. package/src/render/shaders/generated/depth.wgsl.ts +234 -4
  196. package/src/render/shaders/generated/flat.wgsl.ts +376 -328
  197. package/src/render/shaders/generated/globalMedium.wgsl.ts +3 -13
  198. package/src/render/shaders/generated/lightVolume.wgsl.ts +4 -14
  199. package/src/render/shaders/generated/octahedralResolve.wgsl.ts +30 -0
  200. package/src/render/shaders/generated/temporalResolve.wgsl.ts +31 -6
  201. package/src/render/shaders/globalMedium.ts +6 -6
  202. package/src/render/shaders/gpudriven/blendRaster.wgsl.ts +88 -1
  203. package/src/render/shaders/gpudriven/cull.wgsl.ts +11 -2
  204. package/src/render/shaders/gpudriven/materialTable.wgsl.ts +3 -1
  205. package/src/render/shaders/gpudriven/shade.wgsl.ts +50 -1
  206. package/src/render/shaders/gpudriven/sunGlass.wgsl.ts +139 -0
  207. package/src/render/shaders/lightVolume.ts +6 -6
  208. package/src/render/shaders/octahedralResolve.ts +50 -17
  209. package/src/render/shaders/recon/lateDepth.wgsl.ts +47 -0
  210. package/src/render/shaders/recon/motion.wgsl.ts +84 -0
  211. package/src/render/shaders/recon/resolve.wgsl.ts +112 -8
  212. package/src/render/shaders/temporalResolve.ts +141 -5
  213. package/src/render/shadowCasters.ts +28 -1
  214. package/src/render/shadowMap.ts +231 -37
  215. package/src/render/sunGlassTint.ts +86 -0
  216. package/src/render/temporalAa.ts +227 -0
  217. package/src/render/temporalPass.ts +88 -12
  218. package/src/render/translucentQueue.ts +20 -1
@@ -1,5 +1,6 @@
1
1
  import type { ProbeBakeOptions } from '../../reflectionProbe.ts';
2
2
  import type { ReadonlyMat4 } from 'gl-matrix';
3
+ import type { Mover } from '../../recon/mover.ts';
3
4
  import type { Vec3 } from '../../../math/color.ts';
4
5
  import { Camera } from '../../camera.ts';
5
6
  import type { PickHit, PickableSource } from '../../pickable.ts';
@@ -156,6 +157,8 @@ export declare class WebGPURenderer implements RendererApi {
156
157
  * caller who passed null gets — rather than reading a slot this frame has already re-let.
157
158
  */
158
159
  private skinPaletteSlot;
160
+ /** The palette `skinPaletteSlot` was uploaded from, for a skinned mover to copy. See `Mover`. */
161
+ private skinPaletteData;
159
162
  private readonly surface;
160
163
  /** The encoder for the frame in flight, or null between frames. */
161
164
  private encoder;
@@ -163,6 +166,27 @@ export declare class WebGPURenderer implements RendererApi {
163
166
  private readonly meshPresent;
164
167
  private pass;
165
168
  private readonly pipelines;
169
+ /**
170
+ * The pipelines a reconstructing frame's blended draws are built for: the reconstructed picture's
171
+ * format at one sample, which is where `LatePass` draws them. Aliased to `pipelines` when the
172
+ * world already lands on exactly that, as `overlayPipelines` is.
173
+ */
174
+ private readonly latePipelines;
175
+ /** The blended draws of a reconstructing frame, drawn after the upscale. See `LatePass`. */
176
+ private latePass;
177
+ /** A late draw asked to refract: `runLate` copies the reconstructed picture before replaying. */
178
+ private lateRefractWanted;
179
+ /** The refraction copy's mip chain, recorded after each copy: what frosted glass reads. */
180
+ private refractMips;
181
+ /**
182
+ * The refraction copy's sampler: filtering, and **between levels as well**, so a frosted pane's
183
+ * level falls smoothly between two blurs rather than stepping from one to the next.
184
+ */
185
+ private refractSampler;
186
+ /** One glass resolution reused by every draw, so a pane allocates nothing. See `glass.ts`. */
187
+ private readonly glassScratch;
188
+ /** `issueCommand` bound once, so the late replay allocates no closure per frame. */
189
+ private readonly issueBound;
166
190
  /**
167
191
  * The same pipelines again, built for the canvas, for anything drawn after `endFrame`.
168
192
  *
@@ -596,6 +620,16 @@ export declare class WebGPURenderer implements RendererApi {
596
620
  private taaUniforms;
597
621
  private taaTextures;
598
622
  private taaViews;
623
+ /** Each pixel's flicker record, paired with the history and swapped with it: see `temporalAa.ts`. */
624
+ private taaRecords;
625
+ private taaRecordViews;
626
+ /** The rest of each pixel's record — depth, pull and recent swing — beside the first. */
627
+ private taaMotions;
628
+ private taaMotionViews;
629
+ /** The resolve's depth-to-metres row, from the inverse of `frameProjection`. */
630
+ private readonly taaInvProjection;
631
+ /** The resolve's two targets, the picture and the record, held for the pipeline cache's sake. */
632
+ private taaTargets;
599
633
  /** Group `i` reads history `i` and the pass writes into the other one. */
600
634
  private taaBindGroups;
601
635
  private taaWrite;
@@ -630,10 +664,10 @@ export declare class WebGPURenderer implements RendererApi {
630
664
  * the *unsharpened* result — sharpening into the history would sharpen a sharpened picture every
631
665
  * frame, which is the halo the reference's own clamp exists to prevent, compounded.
632
666
  *
633
- * The motion target is render size and carries a drawn object's own motion where something wrote
634
- * one. **Nothing writes it yet**, so it is cleared every frame and every pixel takes the camera's
635
- * motion, which the resolve derives from the depth and the reprojection. Static geometry is
636
- * exact that way and a moving object ghosts until the motion pass lands.
667
+ * The motion target is render size and carries a drawn object's own motion where the motion pass
668
+ * wrote one — a draw that named its mover, or passed last frame's matrix. Every other texel is
669
+ * cleared, and the resolve takes the camera's motion there, derived from the depth and the
670
+ * reprojection: exact for anything that did not move. See `MotionPass`.
637
671
  */
638
672
  private reconHistories;
639
673
  private reconHistoryViews;
@@ -655,34 +689,15 @@ export declare class WebGPURenderer implements RendererApi {
655
689
  private reconGroups;
656
690
  private reconSharpenGroups;
657
691
  private reconRushGroup;
658
- /**
659
- * What the motion pass will draw, recorded by `drawMesh` and spent once a frame.
660
- *
661
- * A parallel array of meshes and one flat matrix buffer rather than an array of objects, because
662
- * this is written on the frame's hot path and the house rule about allocating there binds it: the
663
- * matrices are copied into a buffer that only ever grows, and the count is what resets.
664
- */
665
- private readonly motionMeshes;
666
- private motionMatrices;
667
- private motionCount;
668
- private motionLayout;
669
- /**
670
- * One pipeline per vertex stride, because a stride is a property of the *mesh*.
671
- *
672
- * Which optional attributes a mesh supplied decides how far apart its positions are, and this
673
- * pass reads nothing but positions — so two meshes drawn by the same shader still need two
674
- * vertex layouts. A map rather than a cache key on the pipeline cache: there is one shader here
675
- * and a handful of strides in any scene.
676
- */
677
- private readonly motionPipelines;
678
- private motionModule;
679
- private motionPipelineLayout;
680
- private motionFrameBuffer;
681
- private motionDrawBuffer;
682
- private motionDrawCapacity;
683
- private motionGroup;
684
- private readonly motionFrameStaging;
685
- private motionDrawStaging;
692
+ /** The motion pass, made with the reconstruction's targets. See `MotionPass`. */
693
+ private motionPass;
694
+ /** This renderer's identity to a `Mover`. See `claimRendererId`. */
695
+ private readonly moverRenderer;
696
+ /** Frames begun, so a mover can tell last frame from any other. Advanced in `beginFrame`. */
697
+ private moverFrame;
698
+ /** Between `beginFrame` and `endFrame`. A change outside it is the next frame's. */
699
+ private inFrame;
700
+ private warnedMoverTwice;
686
701
  /** The scene's own clip transform with the generated shaders' y negation folded in. */
687
702
  private readonly motionRaster;
688
703
  private reconSizeKey;
@@ -1587,8 +1602,39 @@ export declare class WebGPURenderer implements RendererApi {
1587
1602
  private readonly sdfTextVerts;
1588
1603
  private readonly sdfTextFrags;
1589
1604
  private readonly sdfTextBindGroups;
1590
- private readonly shadowMap;
1591
- private readonly shadowView;
1605
+ /**
1606
+ * The sun's static, moving and peeled maps, as layers of one texture (`shadowMap.ts`). The three
1607
+ * views below are single layers, what each pass attaches; the two here are what is sampled.
1608
+ */
1609
+ private sunShadowTexture;
1610
+ /** Every layer, for the lit pass, the light volumes and the medium. */
1611
+ private sunArrayView;
1612
+ /**
1613
+ * The static layer alone, as an array, for the peel: it draws into another layer of the same
1614
+ * texture, and a view covering that layer too would put it in two usages in one pass.
1615
+ */
1616
+ private sunStaticArrayView;
1617
+ /** How many layers the sun's texture holds: its maps, and the two glass layers once glass casts. */
1618
+ private sunLayerCount;
1619
+ /** The glass depth layers, static then moving, once glass has cast. See `growSunForGlass`. */
1620
+ private sunGlassViews;
1621
+ /** The texture a growth replaced, destroyed once the encoder that copied out of it is submitted. */
1622
+ private retiredSunTexture;
1623
+ /** What the sun's light keeps through glass: two `rgba8unorm` layers, made when glass first casts. */
1624
+ private sunTint;
1625
+ /** The tint pass's layouts, per-draw block, groups and pipelines, made when glass first casts. */
1626
+ private glassTint;
1627
+ /** The tint pass open while the glass list is replayed into it. */
1628
+ private tintPass;
1629
+ /** True while the glass list is replayed into a glass depth layer through `casterSink`. */
1630
+ private drawingGlassDepth;
1631
+ /** Whether the open sun pass is the movers' layer, whose glass goes to the moving glass layer. */
1632
+ private shadowLayerIsDynamic;
1633
+ /** The glass tints' sampler: filtering, and between levels, for frost's coarser reads. */
1634
+ private readonly tintSampler;
1635
+ /** The light a tint pass is drawn for: xyz a direction (w 0) or a position (w 1). */
1636
+ private readonly glassLight;
1637
+ private shadowView;
1592
1638
  private readonly shadowLayout;
1593
1639
  /** The same layout plus the joint palette. See `createDepthBindGroupLayout`. */
1594
1640
  private readonly shadowSkinnedLayout;
@@ -1614,8 +1660,7 @@ export declare class WebGPURenderer implements RendererApi {
1614
1660
  * read twice — so a profile that switches peeling off gets no map and no pass on either
1615
1661
  * backend rather than a map nothing writes.
1616
1662
  */
1617
- private readonly peelMap;
1618
- private readonly peelView;
1663
+ private peelView;
1619
1664
  /**
1620
1665
  * The movers' own layer: the character, the rope it swings on, and anything else that walks.
1621
1666
  *
@@ -1636,10 +1681,9 @@ export declare class WebGPURenderer implements RendererApi {
1636
1681
  * and therefore as lit — so nothing looked broken, only empty, which is why it survived the
1637
1682
  * port and every gate in it.
1638
1683
  */
1639
- private readonly dynamicMap;
1640
- private readonly dynamicView;
1684
+ private dynamicView;
1641
1685
  /** The peel's own bind groups: `uPeelShadowLayer` at 1, and the static map to peel against. */
1642
- private readonly shadowPeelBindGroup;
1686
+ private shadowPeelBindGroup;
1643
1687
  /**
1644
1688
  * The cutout casters' layout, and a bind group per cutout map for each layer, built the first
1645
1689
  * time a map casts and kept: a `createBindGroup` per draw is the allocation the house rules forbid.
@@ -1651,7 +1695,7 @@ export declare class WebGPURenderer implements RendererApi {
1651
1695
  private readonly cutoutPeelGroups;
1652
1696
  private shadowPeelPassUniforms;
1653
1697
  private shadowPeelSampler;
1654
- private readonly scatterDepthPeelBindGroup;
1698
+ private scatterDepthPeelBindGroup;
1655
1699
  /** Which layer the open pass is writing, so the sink picks the bindings that match it. */
1656
1700
  private shadowLayerIsPeel;
1657
1701
  /**
@@ -1722,6 +1766,10 @@ export declare class WebGPURenderer implements RendererApi {
1722
1766
  * Built once and held, rather than made per call: it closes over `this` and a fresh one
1723
1767
  * every frame would be an allocation in a per-frame path.
1724
1768
  */
1769
+ /** The glass the open shadow pass was offered, kept for its own passes: `glassCasters.ts`. */
1770
+ private readonly glassCasters;
1771
+ /** One resolution every glass caster is read through, so recording one allocates nothing. */
1772
+ private readonly glassCasterScratch;
1725
1773
  private readonly casterSink;
1726
1774
  /** Said once rather than every frame, because a full ring is a flood otherwise. */
1727
1775
  private warnedFull;
@@ -2006,7 +2054,7 @@ export declare class WebGPURenderer implements RendererApi {
2006
2054
  */
2007
2055
  drawMesh(mesh: GpuMesh, model: ArrayLike<number>, depthLayer?: number, tint?: Vec3 | null,
2008
2056
  /** Where it was last frame. See `RendererApi.drawMesh`, and `runMotion` for what reads it. */
2009
- previousModel?: ArrayLike<number> | null): void;
2057
+ previousModel?: ArrayLike<number> | Mover | null): void;
2010
2058
  /**
2011
2059
  * Draw a mesh that lets the world through, at `opacity`.
2012
2060
  *
@@ -2105,6 +2153,18 @@ export declare class WebGPURenderer implements RendererApi {
2105
2153
  drawTranslucentInstanced(batch: GpuInstancedBatch, data: MeshInstances, opacity: number, options?: TranslucentMeshOptions): void;
2106
2154
  /** Release the placement. The mesh is the caller's and is not released. */
2107
2155
  disposeInstanced(batch: GpuInstancedBatch): void;
2156
+ /**
2157
+ * Write what a translucent draw shows through it into the material scratch: refraction's bend and
2158
+ * absorption, and glass. Returns whether the frame's copy is there to read, and so whether
2159
+ * `releaseSeeThrough` owes the scratch back.
2160
+ *
2161
+ * **A glass draw takes the copy even when it does not bend**, since a pane shows what is behind it
2162
+ * either way. A copy that cannot be taken — a mirror, a probe bake — leaves both off, so the pane
2163
+ * shades as ordinary translucency rather than sampling a stand-in. See `glass.ts`.
2164
+ */
2165
+ private bindSeeThrough;
2166
+ /** Put the scratch back after `bindSeeThrough`: refraction and glass off. */
2167
+ private releaseSeeThrough;
2108
2168
  /**
2109
2169
  * One draw, one material slot, one uniform slot, however many instances.
2110
2170
  *
@@ -2197,6 +2257,34 @@ export declare class WebGPURenderer implements RendererApi {
2197
2257
  drawSceneCasters(casters: ShadowCasters): void;
2198
2258
  drawShadowCasters(casters: ShadowCasters): void;
2199
2259
  /** Close the shadow pass and submit it, so the frame can sample what it wrote. */
2260
+ /**
2261
+ * Add the sun's two glass layers, once, carrying every layer it holds across on `encoder`.
2262
+ *
2263
+ * **Copied rather than re-baked**, for the reason `SunShadowArray.growForGlass` gives: the static
2264
+ * map is the consumer's to bake and may be baked once, and the glass that grows the texture
2265
+ * arrives in the very pass that drew it. Every view of the old texture is stale afterwards, so
2266
+ * every group holding one is rebuilt here — the lit pass's, the volumes', the medium's and the
2267
+ * peel's — and the old texture is destroyed only once this encoder is submitted.
2268
+ */
2269
+ private growSunForGlass;
2270
+ /** Every group that holds a view of the sun's texture, rebuilt after it has been replaced. */
2271
+ private rebuildSunGroups;
2272
+ /** The sun's tint target, made the first time glass casts and born clear on `encoder`. */
2273
+ private ensureSunTint;
2274
+ /**
2275
+ * Draw the pass's glass twice: where the nearest pane is, and what the panes let through.
2276
+ *
2277
+ * After the opaque casters, on the pass's own encoder. A layer that has held glass is redrawn
2278
+ * even when this pass offered none, so glass that has gone takes its colour with it.
2279
+ */
2280
+ private flushSunGlass;
2281
+ /** The glass list into a glass depth layer: `casterSink` itself, with glass let through. */
2282
+ private readonly glassDepthSink;
2283
+ /**
2284
+ * The glass list into a tint layer, through the tint pipelines, **culling nothing**: every pane on
2285
+ * a ray counts, whichever way it faces. See the other backend's `glassTintSink`.
2286
+ */
2287
+ private readonly glassTintSink;
2200
2288
  endShadowPass(): void;
2201
2289
  /**
2202
2290
  * The pool, or null where the profile switched cube shadows off.
@@ -2217,6 +2305,8 @@ export declare class WebGPURenderer implements RendererApi {
2217
2305
  private preparedPointLightCount;
2218
2306
  /** See `renderer.ts`: built when a world reports its lights, and rebuilt only to grow. */
2219
2307
  private pointShadowArray;
2308
+ /** The array glass replaced, destroyed once the round that copied out of it is submitted. */
2309
+ private retiredPointTexture;
2220
2310
  private readonly bakeScratch;
2221
2311
  /** Said once per renderer; see `updatePointShadows`. */
2222
2312
  private warnedNoPointShadowArray;
@@ -2452,27 +2542,48 @@ export declare class WebGPURenderer implements RendererApi {
2452
2542
  */
2453
2543
  private rebuildReconGroups;
2454
2544
  /**
2455
- * Remember that this mesh moved, so the motion pass can draw where it was.
2545
+ * Whether a blended draw recorded now lands after the upscale. See `lateRouting.ts`.
2456
2546
  *
2457
- * Silent unless a reconstruction is running: a scene that always states its previous transforms
2458
- * — which is the right thing for a scene to do, the alternative being to know what the renderer
2459
- * is configured as — must cost nothing at all when nobody is going to read them.
2547
+ * Not during the order-independent replay, which owns its pass and issues into it directly.
2548
+ */
2549
+ private drawsLate;
2550
+ /**
2551
+ * The command a blended draw records into: the late pool while reconstructing, the frame graph
2552
+ * otherwise. **Late draws record whatever `quality.frameGraph` says**, since the late replay is
2553
+ * the only moment they can land; everything else keeps the path it has.
2554
+ */
2555
+ private recordBlended;
2556
+ /** The pipelines a blended draw is built for: the reconstructed picture's while late. */
2557
+ private blendedPipelines;
2558
+ /**
2559
+ * The blended draws of a reconstructing frame, over the reconstructed picture at the output size
2560
+ * and unjittered, against the render's depth taken up to that size. Before occlusion, bloom and
2561
+ * the grade, so they are graded exactly as they were when they were drawn into the scene.
2460
2562
  */
2461
- private recordMotion;
2563
+ private runLate;
2564
+ /** Whether this draw lands in the reconstructed picture. See `lateRouting.ts`. */
2565
+ private tracksMotionNow;
2462
2566
  /**
2463
- * The pipeline the motion pass draws with, built once.
2567
+ * What this draw's motion is, recorded for the motion pass.
2464
2568
  *
2465
- * **The position buffer alone**, because that is all the shader reads and a mesh keeps one buffer
2466
- * an attribute — so this binds buffer zero and nothing else, whatever else the mesh carries.
2569
+ * A mesh rewritten this frame carries its vertex motion whatever else the draw says — under last
2570
+ * frame's model where a mover or a matrix knows it, under this frame's where nothing does. A
2571
+ * mover otherwise carries a rigid draw's last model or a skinned draw's last pose; a matrix
2572
+ * carries a rigid draw's. A draw that says nothing and moved no vertex takes the camera's motion.
2467
2573
  */
2468
- private buildMotionPipeline;
2469
- /** The pipeline for one vertex stride, built on first sight of it. */
2470
- private motionPipelineFor;
2574
+ private recordDrawMotion;
2471
2575
  /**
2472
- * Where every mover was last frame, into the motion target.
2576
+ * A skinned mover's motion: this frame's palette is the draw's own slot, and last frame's takes a
2577
+ * slot of its own, like any palette a draw binds — so it is uploaded once and nothing overwrites
2578
+ * it before the motion pass reads it. See `SkinPaletteRing`.
2579
+ */
2580
+ private recordSkinnedMotion;
2581
+ private warnMoverTwice;
2582
+ /**
2583
+ * Where every mover was last frame, into the motion target. See `MotionPass`.
2473
2584
  *
2474
2585
  * **After everything that draws and before the resolve reads it.** The frame's depth has to be
2475
- * finished for the equality test to mean anything, and the resolve is what consumes the result.
2586
+ * finished for the pass's equality test to mean anything, and the resolve is what consumes it.
2476
2587
  */
2477
2588
  private runMotion;
2478
2589
  /**
@@ -2732,6 +2843,8 @@ export declare class WebGPURenderer implements RendererApi {
2732
2843
  private recordDraw;
2733
2844
  /** Replay one recorded draw into an open pass. */
2734
2845
  private replayNode;
2846
+ /** One recorded draw, issued into an open pass. Shared by the graph's replay and `runLate`. */
2847
+ private issueCommand;
2735
2848
  private ensurePass;
2736
2849
  /**
2737
2850
  * The pass a verb will draw into, without flushing what is already recorded.
@@ -3233,6 +3346,10 @@ export declare class WebGPURenderer implements RendererApi {
3233
3346
  *
3234
3347
  * What it gives up is one frame of history: the frame after a cut has no blur and no temporal
3235
3348
  * blend, as the first frame of a session has none. Nothing else is reset.
3349
+ *
3350
+ * **A reconstructing renderer depends on it**: its history is the last shot's, and without this
3351
+ * call a cut blends that shot into the first frames of the next. Nothing detects a cut on the
3352
+ * caller's behalf, deliberately — a fast pan and a cut look alike from here.
3236
3353
  */
3237
3354
  cameraCut(): void;
3238
3355
  /**
@@ -3566,6 +3683,16 @@ export declare class WebGPURenderer implements RendererApi {
3566
3683
  * The occlusion and bloom targets are half size. Both are blurs read back at full size, so a
3567
3684
  * full-resolution intermediate buys nothing a bilinear fetch does not already give.
3568
3685
  */
3686
+ /**
3687
+ * The medium's march group, holding the shadow views it reads — built with the composite, and
3688
+ * again when the sun's texture grows its glass layers and every view of the old one is stale.
3689
+ *
3690
+ * **The stand-in has to read as unoccluded and not as absent**, which is `emptyTexture.ts`'s
3691
+ * point and `createLightVolumeBindGroup`'s: `occlusion()` calls any stored depth below the
3692
+ * receiver's a blocker — so a black stand-in would put the whole medium in shadow, which is a
3693
+ * picture rather than an error. `volumeBlank` is the white one-texel texture built for this.
3694
+ */
3695
+ private buildMediumBindGroup;
3569
3696
  private ensureComposite;
3570
3697
  /**
3571
3698
  * Every bloom stage's uniform block, written once per size rather than once per frame.