@driftengine/core 4.9.0 → 4.11.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.
- package/CHANGELOG.json +133 -11
- package/README.md +43 -38
- package/dist/index.d.ts +7 -4
- package/dist/index.js +5 -4
- package/dist/render/ambientHarmonics.d.ts +1 -1
- package/dist/render/ambientHarmonics.js +1 -1
- package/dist/render/areaLights.d.ts +4 -4
- package/dist/render/areaLights.js +1 -1
- package/dist/render/backend/api.d.ts +10 -3
- package/dist/render/backend/select.js +11 -5
- package/dist/render/backend/webgl2/boneAnimations.d.ts +29 -0
- package/dist/render/backend/webgl2/boneAnimations.js +80 -0
- package/dist/render/backend/webgl2/instanced.d.ts +5 -1
- package/dist/render/backend/webgl2/instanced.js +13 -1
- package/dist/render/backend/webgl2/renderer.d.ts +189 -4
- package/dist/render/backend/webgl2/renderer.js +614 -66
- package/dist/render/backend/webgl2/skinPaletteTexture.d.ts +5 -3
- package/dist/render/backend/webgl2/skinPaletteTexture.js +6 -4
- package/dist/render/backend/webgpu/boneAnimations.d.ts +34 -0
- package/dist/render/backend/webgpu/boneAnimations.js +76 -0
- package/dist/render/backend/webgpu/buffers.d.ts +24 -4
- package/dist/render/backend/webgpu/buffers.js +116 -59
- package/dist/render/backend/webgpu/clothKernels.d.ts +8 -0
- package/dist/render/backend/webgpu/clothKernels.js +76 -0
- package/dist/render/backend/webgpu/clothOps.d.ts +39 -0
- package/dist/render/backend/webgpu/clothOps.js +78 -0
- package/dist/render/backend/webgpu/clothSetLayout.d.ts +25 -0
- package/dist/render/backend/webgpu/clothSetLayout.js +84 -0
- package/dist/render/backend/webgpu/clothSetPack.d.ts +33 -0
- package/dist/render/backend/webgpu/clothSetPack.js +144 -0
- package/dist/render/backend/webgpu/compressedUpload.d.ts +0 -1
- package/dist/render/backend/webgpu/compressedUpload.js +53 -8
- package/dist/render/backend/webgpu/depthPass.d.ts +59 -3
- package/dist/render/backend/webgpu/depthPass.js +49 -14
- package/dist/render/backend/webgpu/drawCommand.d.ts +20 -4
- package/dist/render/backend/webgpu/drawCommand.js +11 -3
- package/dist/render/backend/webgpu/flatPass.d.ts +85 -42
- package/dist/render/backend/webgpu/flatPass.js +137 -20
- package/dist/render/backend/webgpu/gpuClothSet.d.ts +80 -0
- package/dist/render/backend/webgpu/gpuClothSet.js +462 -0
- package/dist/render/backend/webgpu/instanced.d.ts +14 -1
- package/dist/render/backend/webgpu/instanced.js +24 -1
- package/dist/render/backend/webgpu/latePass.js +1 -0
- package/dist/render/backend/webgpu/materialStore.d.ts +101 -0
- package/dist/render/backend/webgpu/materialStore.js +265 -0
- package/dist/render/backend/webgpu/motionPass.js +15 -6
- package/dist/render/backend/webgpu/pipelineCache.d.ts +28 -1
- package/dist/render/backend/webgpu/pipelineCache.js +46 -1
- package/dist/render/backend/webgpu/postPass.d.ts +1 -1
- package/dist/render/backend/webgpu/renderer.d.ts +200 -35
- package/dist/render/backend/webgpu/renderer.js +993 -168
- package/dist/render/backend/webgpu/shaders/clothSolve.wgsl.d.ts +9 -2
- package/dist/render/backend/webgpu/shaders/clothSolve.wgsl.js +121 -47
- package/dist/render/backend/webgpu/skinPaletteRing.d.ts +7 -3
- package/dist/render/backend/webgpu/skinPaletteRing.js +13 -7
- package/dist/render/backend/webgpu/skinPaletteTexture.d.ts +6 -0
- package/dist/render/backend/webgpu/skinPaletteTexture.js +7 -1
- package/dist/render/backend/webgpu/staticBundles.d.ts +125 -0
- package/dist/render/backend/webgpu/staticBundles.js +242 -0
- package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +10 -3
- package/dist/render/backend/webgpu/surfaceTexturePass.js +20 -2
- package/dist/render/backend/webgpu/uniformRing.d.ts +21 -0
- package/dist/render/backend/webgpu/uniformRing.js +9 -1
- package/dist/render/backend/webgpu/vertexFormats.d.ts +22 -0
- package/dist/render/backend/webgpu/vertexFormats.js +97 -0
- package/dist/render/bloomChain.d.ts +3 -3
- package/dist/render/boneAnimation.d.ts +92 -0
- package/dist/render/boneAnimation.js +133 -0
- package/dist/render/compressedSource.d.ts +33 -13
- package/dist/render/compressedSource.js +70 -25
- package/dist/render/glCompressed.js +83 -0
- package/dist/render/globalMediumPass.d.ts +2 -0
- package/dist/render/globalMediumPass.js +1 -0
- package/dist/render/indexWidth.d.ts +17 -0
- package/dist/render/indexWidth.js +23 -0
- package/dist/render/instances.d.ts +26 -0
- package/dist/render/lightBudget.d.ts +10 -0
- package/dist/render/lightBudget.js +10 -0
- package/dist/render/lightMatrix.d.ts +11 -0
- package/dist/render/lightMatrix.js +14 -0
- package/dist/render/lightmap.d.ts +1 -1
- package/dist/render/mesh.d.ts +14 -0
- package/dist/render/mesh.js +44 -14
- package/dist/render/pointLightSelection.d.ts +4 -4
- package/dist/render/renderQuality.d.ts +30 -0
- package/dist/render/renderQuality.js +5 -0
- package/dist/render/rendererHarness.d.ts +7 -0
- package/dist/render/rendererHarness.js +12 -0
- package/dist/render/screenSpaceReflection.d.ts +2 -1
- package/dist/render/shader.d.ts +15 -0
- package/dist/render/shader.js +41 -0
- package/dist/render/shaders/boneAnimation.d.ts +19 -0
- package/dist/render/shaders/boneAnimation.js +63 -0
- package/dist/render/shaders/depth.d.ts +7 -0
- package/dist/render/shaders/depth.js +35 -10
- package/dist/render/shaders/flat/directionalShadow.js +84 -10
- package/dist/render/shaders/flat/glassTint.d.ts +1 -1
- package/dist/render/shaders/flat/glassTint.js +3 -0
- package/dist/render/shaders/flat/index.d.ts +21 -0
- package/dist/render/shaders/flat/index.js +42 -7
- package/dist/render/shaders/flat/layered.d.ts +19 -0
- package/dist/render/shaders/flat/layered.js +115 -0
- package/dist/render/shaders/flat/main.d.ts +1 -1
- package/dist/render/shaders/flat/main.js +58 -21
- package/dist/render/shaders/flat/mapReads.d.ts +10 -0
- package/dist/render/shaders/flat/mapReads.js +38 -0
- package/dist/render/shaders/flat/models.js +1 -1
- package/dist/render/shaders/flat/movingSun.d.ts +21 -0
- package/dist/render/shaders/flat/movingSun.js +46 -0
- package/dist/render/shaders/flat/normalMap.d.ts +6 -2
- package/dist/render/shaders/flat/normalMap.js +14 -3
- package/dist/render/shaders/flat/overlay.d.ts +3 -2
- package/dist/render/shaders/flat/overlay.js +42 -20
- package/dist/render/shaders/flat/pointShadow.js +2 -2
- package/dist/render/shaders/flat/preamble.js +59 -27
- package/dist/render/shaders/flat/worldUv.d.ts +22 -0
- package/dist/render/shaders/flat/worldUv.js +113 -0
- package/dist/render/shaders/generated/depth.wgsl.d.ts +93 -0
- package/dist/render/shaders/generated/depth.wgsl.js +93 -0
- package/dist/render/shaders/generated/flat.wgsl.d.ts +3616 -3042
- package/dist/render/shaders/generated/flat.wgsl.js +3688 -3113
- package/dist/render/shaders/generated/globalMedium.wgsl.d.ts +8 -3
- package/dist/render/shaders/generated/globalMedium.wgsl.js +8 -3
- package/dist/render/shaders/generated/lightVolume.wgsl.d.ts +15 -10
- package/dist/render/shaders/generated/lightVolume.wgsl.js +16 -11
- package/dist/render/shaders/globalMedium.js +9 -1
- package/dist/render/shaders/lightVolume.js +9 -1
- package/dist/render/shaders/outputTransform.d.ts +7 -0
- package/dist/render/shaders/outputTransform.js +28 -14
- package/dist/render/shaders/tangentFrame.d.ts +1 -1
- package/dist/render/shaders/tangentFrame.js +16 -3
- package/dist/render/shaders/vertexChannel.d.ts +7 -0
- package/dist/render/shaders/vertexChannel.js +26 -0
- package/dist/render/skinnedClothRun.d.ts +28 -0
- package/dist/render/skinnedClothRun.js +103 -35
- package/dist/render/staticDraws.d.ts +47 -0
- package/dist/render/staticDraws.js +43 -0
- package/dist/render/surfaceLayers.d.ts +39 -0
- package/dist/render/surfaceLayers.js +26 -0
- package/dist/render/surfaceOverlay.d.ts +16 -3
- package/dist/render/surfaceOverlay.js +11 -6
- package/dist/render/surfaceProjection.d.ts +34 -0
- package/dist/render/surfaceProjection.js +30 -0
- package/dist/render/surfaceTexture.d.ts +68 -7
- package/dist/render/surfaceTexture.js +56 -17
- package/dist/render/vertexPacking.d.ts +48 -0
- package/dist/render/vertexPacking.js +68 -0
- package/package.json +6 -6
- package/src/index.ts +12 -4
- package/src/render/ambientHarmonics.ts +1 -1
- package/src/render/areaLights.ts +4 -4
- package/src/render/backend/api.ts +13 -3
- package/src/render/backend/select.ts +10 -5
- package/src/render/backend/webgl2/boneAnimations.ts +105 -0
- package/src/render/backend/webgl2/instanced.ts +20 -1
- package/src/render/backend/webgl2/renderer.ts +723 -79
- package/src/render/backend/webgl2/skinPaletteTexture.ts +6 -4
- package/src/render/backend/webgpu/boneAnimations.ts +97 -0
- package/src/render/backend/webgpu/buffers.ts +195 -70
- package/src/render/backend/webgpu/clothKernels.ts +86 -0
- package/src/render/backend/webgpu/clothOps.ts +86 -0
- package/src/render/backend/webgpu/clothSetLayout.ts +102 -0
- package/src/render/backend/webgpu/clothSetPack.ts +197 -0
- package/src/render/backend/webgpu/compressedUpload.ts +59 -9
- package/src/render/backend/webgpu/depthPass.ts +51 -10
- package/src/render/backend/webgpu/drawCommand.ts +25 -4
- package/src/render/backend/webgpu/flatPass.ts +212 -41
- package/src/render/backend/webgpu/gpuClothSet.ts +564 -0
- package/src/render/backend/webgpu/instanced.ts +32 -1
- package/src/render/backend/webgpu/latePass.ts +1 -0
- package/src/render/backend/webgpu/materialStore.ts +276 -0
- package/src/render/backend/webgpu/motionPass.ts +18 -7
- package/src/render/backend/webgpu/pipelineCache.ts +53 -7
- package/src/render/backend/webgpu/renderer.ts +1201 -202
- package/src/render/backend/webgpu/shaders/clothSolve.wgsl.ts +121 -47
- package/src/render/backend/webgpu/skinPaletteRing.ts +13 -7
- package/src/render/backend/webgpu/skinPaletteTexture.ts +7 -1
- package/src/render/backend/webgpu/staticBundles.ts +364 -0
- package/src/render/backend/webgpu/surfaceTexturePass.ts +29 -3
- package/src/render/backend/webgpu/uniformRing.ts +10 -1
- package/src/render/backend/webgpu/vertexFormats.ts +113 -0
- package/src/render/bloomChain.ts +3 -3
- package/src/render/boneAnimation.ts +223 -0
- package/src/render/compressedSource.ts +121 -29
- package/src/render/glCompressed.ts +83 -0
- package/src/render/globalMediumPass.ts +7 -0
- package/src/render/indexWidth.ts +27 -0
- package/src/render/instances.ts +27 -0
- package/src/render/lightBudget.ts +11 -0
- package/src/render/lightMatrix.ts +15 -0
- package/src/render/lightmap.ts +1 -1
- package/src/render/mesh.ts +72 -14
- package/src/render/pointLightSelection.ts +4 -4
- package/src/render/renderQuality.ts +38 -0
- package/src/render/rendererHarness.ts +15 -0
- package/src/render/screenSpaceReflection.ts +2 -1
- package/src/render/shader.ts +59 -0
- package/src/render/shaders/boneAnimation.ts +63 -0
- package/src/render/shaders/depth.ts +45 -10
- package/src/render/shaders/flat/directionalShadow.ts +84 -10
- package/src/render/shaders/flat/glassTint.ts +7 -1
- package/src/render/shaders/flat/index.ts +63 -7
- package/src/render/shaders/flat/layered.ts +115 -0
- package/src/render/shaders/flat/main.ts +58 -21
- package/src/render/shaders/flat/mapReads.ts +38 -0
- package/src/render/shaders/flat/models.ts +1 -1
- package/src/render/shaders/flat/movingSun.ts +46 -0
- package/src/render/shaders/flat/normalMap.ts +14 -3
- package/src/render/shaders/flat/overlay.ts +42 -20
- package/src/render/shaders/flat/pointShadow.ts +2 -2
- package/src/render/shaders/flat/preamble.ts +59 -27
- package/src/render/shaders/flat/worldUv.ts +113 -0
- package/src/render/shaders/generated/depth.wgsl.ts +95 -0
- package/src/render/shaders/generated/flat.wgsl.ts +3688 -3113
- package/src/render/shaders/generated/globalMedium.wgsl.ts +8 -3
- package/src/render/shaders/generated/lightVolume.wgsl.ts +16 -11
- package/src/render/shaders/globalMedium.ts +9 -1
- package/src/render/shaders/lightVolume.ts +9 -1
- package/src/render/shaders/outputTransform.ts +30 -14
- package/src/render/shaders/tangentFrame.ts +16 -3
- package/src/render/shaders/vertexChannel.ts +27 -0
- package/src/render/skinnedClothRun.ts +138 -38
- package/src/render/staticDraws.ts +95 -0
- package/src/render/surfaceLayers.ts +57 -0
- package/src/render/surfaceOverlay.ts +24 -7
- package/src/render/surfaceProjection.ts +57 -0
- package/src/render/surfaceTexture.ts +124 -27
- package/src/render/vertexPacking.ts +109 -0
- package/dist/render/backend/webgpu/gpuSkinnedCloth.d.ts +0 -74
- package/dist/render/backend/webgpu/gpuSkinnedCloth.js +0 -452
- package/src/render/backend/webgpu/gpuSkinnedCloth.ts +0 -502
|
@@ -25,7 +25,7 @@ import { GpuClothBinding, GpuClothParticles } from './clothTextures.ts';
|
|
|
25
25
|
import type { ComputeHost } from './computeHost.ts';
|
|
26
26
|
import { type SurfaceOverlay } from '../../surfaceOverlay.ts';
|
|
27
27
|
import type { ClothBindingData } from '../../clothBindingData.ts';
|
|
28
|
-
import type { CompressedTextureFormat, SurfaceSource } from '../../compressedSource.ts';
|
|
28
|
+
import type { CompressedTextureFormat, CompressedTextureSource, SurfaceSource } from '../../compressedSource.ts';
|
|
29
29
|
import { GpuSdfText } from './sdfTextPass.ts';
|
|
30
30
|
import type { SdfFont } from '../../sdfFont.ts';
|
|
31
31
|
import type { SdfTextStyle } from '../../sdfTextLayout.ts';
|
|
@@ -47,6 +47,8 @@ import type { MeshData } from '../../mesh.ts';
|
|
|
47
47
|
import type { ShadowCasters } from '../../shadowCasters.ts';
|
|
48
48
|
import { type GpuMesh } from './buffers.ts';
|
|
49
49
|
import type { GpuSurface } from './device.ts';
|
|
50
|
+
import type { BoneAnimationClip, BoneAnimationHandle } from '../../boneAnimation.ts';
|
|
51
|
+
import type { StaticDrawsHandle } from '../../staticDraws.ts';
|
|
50
52
|
import { type GpuScatter } from './scatterPass.ts';
|
|
51
53
|
import { type GpuWater } from './waterPass.ts';
|
|
52
54
|
import { type GpuPlumes } from './plumePass.ts';
|
|
@@ -131,6 +133,10 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
131
133
|
* flight at the time, so a consumer that builds more meshes later can wait again.
|
|
132
134
|
*/
|
|
133
135
|
ready(): Promise<void>;
|
|
136
|
+
/** Every distinct cache a lit draw reaches: the frame's, the canvas's, the late pass's, skin's. */
|
|
137
|
+
private pipelineCaches;
|
|
138
|
+
/** Whether a lit draw whose pipeline is not built is left out while it compiles. */
|
|
139
|
+
private skipCompiling;
|
|
134
140
|
private presentedFrameCount;
|
|
135
141
|
/**
|
|
136
142
|
* The joint palettes this frame has set, one slot each. The WebGL2 field of this name is a
|
|
@@ -143,6 +149,8 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
143
149
|
private readonly skinnedBindGroupLayout;
|
|
144
150
|
private readonly morphedBindGroupLayout;
|
|
145
151
|
private readonly bothBindGroupLayout;
|
|
152
|
+
/** The instanced layout of a batch playing a bone animation. See `animatedGroup`. */
|
|
153
|
+
private readonly animatedBindGroupLayout;
|
|
146
154
|
/** The morph weights the following draws use, or null for none. */
|
|
147
155
|
private morphWeights;
|
|
148
156
|
/**
|
|
@@ -156,13 +164,6 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
156
164
|
* Keyed by slot instead, the groups are built once and reused for the life of the renderer.
|
|
157
165
|
*/
|
|
158
166
|
private readonly skinnedGroups;
|
|
159
|
-
/** The unskinned group each was built beside, for identity-based invalidation. */
|
|
160
|
-
private readonly skinnedGroupsBeside;
|
|
161
|
-
private readonly skinnedGroupsPalette;
|
|
162
|
-
private readonly skinnedGroupsDeltas;
|
|
163
|
-
/** The cloth views each skinned twin was built with, compared by identity like the palette. */
|
|
164
|
-
private readonly skinnedGroupsCloth;
|
|
165
|
-
private readonly skinnedGroupsClothBinding;
|
|
166
167
|
/** The cloth the next skinned draws are placed by, or null. See `setCloth`. */
|
|
167
168
|
private cloth;
|
|
168
169
|
private clothStandCache;
|
|
@@ -230,22 +231,51 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
230
231
|
/** Every distinct cache above, so a mesh's pipelines are built for each. One entry when aliased. */
|
|
231
232
|
private readonly pipelineTargets;
|
|
232
233
|
private readonly bindGroupLayout;
|
|
233
|
-
/** One slot per draw, uploaded once a frame. See `UniformRing`. */
|
|
234
|
-
private
|
|
235
|
-
/** The lights, fog and camera, settled once per frame by `bindMeshPass`. */
|
|
236
|
-
private readonly perFrame;
|
|
234
|
+
/** One slot per draw, uploaded once a frame. See `UniformRing`. Swapped while a static list records. */
|
|
235
|
+
private perDraw;
|
|
237
236
|
/**
|
|
238
|
-
* The
|
|
237
|
+
* The lights, fog and camera, a slot per mesh pass a frame opens: `bindMeshPass` writes them, and
|
|
238
|
+
* the first draw after it takes a slot. A ring rather than one buffer because a frame opens more
|
|
239
|
+
* than one pass — a mirror's, a capture's, a probe face's — and a queue write does not interleave
|
|
240
|
+
* with the draws recorded between them. See `UniformRing`.
|
|
241
|
+
*/
|
|
242
|
+
private passRing;
|
|
243
|
+
/** Each material's block, kept across frames for as long as it does not change. */
|
|
244
|
+
private readonly materialStore;
|
|
245
|
+
/**
|
|
246
|
+
* Both blocks as the CPU holds them, the pass's then the material's, patched by name and copied
|
|
247
|
+
* into a slot by the next draw after something changed them. See `FlatFragmentScratch`.
|
|
239
248
|
*
|
|
240
249
|
* Authoritative between draws: a setter changes one field here and marks the block dirty, and
|
|
241
|
-
* the next `drawMesh`
|
|
242
|
-
*
|
|
250
|
+
* the next `drawMesh` places it. That keeps a setter free of any knowledge of slots, which is
|
|
251
|
+
* what lets it be called anywhere a scene wants.
|
|
243
252
|
*/
|
|
244
253
|
private readonly perFrameStaging;
|
|
245
254
|
private readonly perFrameFloats;
|
|
246
255
|
private readonly perFrameInts;
|
|
256
|
+
/** The two halves of the scratch, as the words a slot is written from. */
|
|
257
|
+
private readonly passInts;
|
|
258
|
+
private readonly materialInts;
|
|
247
259
|
/** The slot the open material occupies, and whether the next draw must take a new one. */
|
|
248
260
|
private readonly materials;
|
|
261
|
+
/** The same for the pass's block: reopened by `bindMeshPass` and by nothing a material sets. */
|
|
262
|
+
private readonly passBlock;
|
|
263
|
+
/**
|
|
264
|
+
* The vertex stage's view block — the camera, the light's matrix, the wind — a slot a pass, and a
|
|
265
|
+
* second, unjittered, for a blended draw landing after the upscale. Reopened with the pass, and by
|
|
266
|
+
* `setWind` and `beginShadowPass`, which change what it holds.
|
|
267
|
+
*/
|
|
268
|
+
private viewRing;
|
|
269
|
+
private readonly viewBlock;
|
|
270
|
+
private readonly lateViewBlock;
|
|
271
|
+
/** The view slot the draw being submitted bound, read by the halves it keeps for later passes. */
|
|
272
|
+
private drawViewOffset;
|
|
273
|
+
/** Pass slots asked for and refused this frame, and materials refused: what grows the two. */
|
|
274
|
+
private passesAsked;
|
|
275
|
+
private passesRefused;
|
|
276
|
+
private viewsAsked;
|
|
277
|
+
private viewsRefused;
|
|
278
|
+
private materialsRefused;
|
|
249
279
|
/**
|
|
250
280
|
* What this frame asked for against the ceilings above, reported rather than only warned about.
|
|
251
281
|
*
|
|
@@ -453,7 +483,7 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
453
483
|
private readonly variant;
|
|
454
484
|
/** Whether this profile compiled the point-shadow path, and so has sentinels to write. */
|
|
455
485
|
private readonly pointShadowsCompiled;
|
|
456
|
-
/** What the generator recorded about that permutation
|
|
486
|
+
/** What the generator recorded about that permutation, as the renderer's scratch lays it out. */
|
|
457
487
|
private readonly fragment;
|
|
458
488
|
private depth;
|
|
459
489
|
private depthView;
|
|
@@ -1153,6 +1183,11 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1153
1183
|
private modelMap;
|
|
1154
1184
|
/** The material's shading model, which picks the lit pipeline: null the standard. */
|
|
1155
1185
|
private materialModel;
|
|
1186
|
+
/** `uWorldUv`, the material's projection packed by `packSurfaceProjection`. */
|
|
1187
|
+
private readonly projection;
|
|
1188
|
+
/** `uLayers`, the material's layers packed by `packSurfaceLayers`. */
|
|
1189
|
+
private readonly layerFloats;
|
|
1190
|
+
private warnedLayersModelMap;
|
|
1156
1191
|
/** Its numbers, `uModelParams`, packed by `packModel`. */
|
|
1157
1192
|
private readonly modelParams;
|
|
1158
1193
|
/**
|
|
@@ -1181,7 +1216,7 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1181
1216
|
* ones that move something *every* group holds: the shadow cubemaps, the probe fence, the cookie
|
|
1182
1217
|
* atlas and the IES rows. None of those is a frame path.
|
|
1183
1218
|
*/
|
|
1184
|
-
private
|
|
1219
|
+
private flatBindGroups;
|
|
1185
1220
|
/** The group holding the one-pixel stand-in, for every draw with no texture set. */
|
|
1186
1221
|
private blankAlbedoBindGroup;
|
|
1187
1222
|
/** Repeats across the mesh's own UV range. Per draw, because `uUvScale` is a vertex uniform. */
|
|
@@ -1238,7 +1273,7 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1238
1273
|
* opens is submitted by the time the next one begins.
|
|
1239
1274
|
*/
|
|
1240
1275
|
private readonly retiredTextures;
|
|
1241
|
-
updateSurfaceTexture(texture: GpuSurfaceTexture, source: TexImageSource): void;
|
|
1276
|
+
updateSurfaceTexture(texture: GpuSurfaceTexture, source: TexImageSource | CompressedTextureSource): void;
|
|
1242
1277
|
disposeSurfaceTexture(texture: GpuSurfaceTexture): void;
|
|
1243
1278
|
/**
|
|
1244
1279
|
* Drop every bind group that may hold `texture`'s view, and rebuild the ones bound now.
|
|
@@ -1352,6 +1387,16 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1352
1387
|
setSurfaceReflectivity(amount: number): void;
|
|
1353
1388
|
/** How bright the environment the surfaces drawn next reflect is. See `renderer.ts`. */
|
|
1354
1389
|
setEnvironmentGain(gain: number): void;
|
|
1390
|
+
/**
|
|
1391
|
+
* The reflectivity and environment gain the setters gave the pass, and the ones the material
|
|
1392
|
+
* set now states, or null where it states none (`SurfaceMaterial.reflectivity`). A draw wears the
|
|
1393
|
+
* material's where it has one and the pass's otherwise, the rule `renderer.ts` keeps too.
|
|
1394
|
+
*/
|
|
1395
|
+
private passReflectivity;
|
|
1396
|
+
private passEnvironmentGain;
|
|
1397
|
+
private materialReflectivity;
|
|
1398
|
+
private materialEnvironmentGain;
|
|
1399
|
+
private writeEnvironmentDials;
|
|
1355
1400
|
setSurfaceGrain(amount: number): void;
|
|
1356
1401
|
/** Whether the surfaces drawn next meet the medium. See `renderer.ts`. */
|
|
1357
1402
|
setSurfaceFog(enabled: boolean): void;
|
|
@@ -1362,6 +1407,8 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1362
1407
|
* this one is called per crossfading region per frame and a closure per call is an allocation.
|
|
1363
1408
|
*/
|
|
1364
1409
|
setDitherFade(amount: number): void;
|
|
1410
|
+
/** Whether the draws that follow spend their own opacity on that screen door. See `renderer.ts`. */
|
|
1411
|
+
setDitherOpacity(on: boolean): void;
|
|
1365
1412
|
/**
|
|
1366
1413
|
* How strong the microscopic relief on the surfaces drawn next is, and how coarse.
|
|
1367
1414
|
*
|
|
@@ -1818,14 +1865,6 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1818
1865
|
* its own two programs.
|
|
1819
1866
|
*/
|
|
1820
1867
|
private writeShadowWind;
|
|
1821
|
-
/**
|
|
1822
|
-
* The five wind fields of one per-draw slot.
|
|
1823
|
-
*
|
|
1824
|
-
* **Never called for an instanced draw.** That variant declares none of these, and
|
|
1825
|
-
* `flatPass.ts` records what writing a field a variant does not declare costs: the block is
|
|
1826
|
-
* shorter, so the write lands on whatever occupies that offset instead.
|
|
1827
|
-
*/
|
|
1828
|
-
private writeWind;
|
|
1829
1868
|
/** Refilled per frame rather than allocated; see `resolvePointLights`. */
|
|
1830
1869
|
private readonly lights;
|
|
1831
1870
|
/** The fixed arm's rectangles as `uAreaLightSize` holds them. See `packAreaSizesAndDoors`. */
|
|
@@ -1945,6 +1984,9 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1945
1984
|
* at submit, and a texture's view is new when an update changes its size.
|
|
1946
1985
|
*/
|
|
1947
1986
|
private readonly shadowCutoutLayout;
|
|
1987
|
+
/** A crowd's casters: the plain and cutout layouts with a bone animation's three textures. */
|
|
1988
|
+
private readonly shadowAnimatedLayout;
|
|
1989
|
+
private readonly shadowAnimatedCutoutLayout;
|
|
1948
1990
|
private readonly cutoutGroups;
|
|
1949
1991
|
private readonly cutoutPeelGroups;
|
|
1950
1992
|
private shadowPeelPassUniforms;
|
|
@@ -1982,6 +2024,22 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1982
2024
|
* the texel-for-texel comparison that settled it.
|
|
1983
2025
|
*/
|
|
1984
2026
|
private readonly correctedLightViewProj;
|
|
2027
|
+
/**
|
|
2028
|
+
* What a receiver projects through to read the sun's static layers: the environment's
|
|
2029
|
+
* `lightViewProj`, taken at `bindMeshPass` as WebGL2 takes it there.
|
|
2030
|
+
*
|
|
2031
|
+
* **It was the last shadow pass's matrix**, which is the environment's wherever both layers are
|
|
2032
|
+
* drawn with one and the moving layer's wherever they are not: the static layer was then read
|
|
2033
|
+
* through the moving layer's tight square, and a distant pillar lost its shadow on WebGPU and kept
|
|
2034
|
+
* it on WebGL2, measured on demo/dev/sunLayers.html?moving=tight.
|
|
2035
|
+
*/
|
|
2036
|
+
private readonly receiverLightViewProj;
|
|
2037
|
+
/**
|
|
2038
|
+
* The matrix the sun's dynamic shadow pass was last drawn with, uncorrected as the lit stage
|
|
2039
|
+
* projects with, and whether one has been. See `movingLightFor`.
|
|
2040
|
+
*/
|
|
2041
|
+
private readonly movingLightViewProj;
|
|
2042
|
+
private movingLightKnown;
|
|
1985
2043
|
/**
|
|
1986
2044
|
* The same matrix *uncorrected*, which is what the flat shader must project with.
|
|
1987
2045
|
*
|
|
@@ -2030,6 +2088,19 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2030
2088
|
* the lit pass on every surface whether they find anything or not.
|
|
2031
2089
|
*/
|
|
2032
2090
|
private noteGlassCaster;
|
|
2091
|
+
/**
|
|
2092
|
+
* A material's layers where they can be drawn: none asked, or a model's map in the mask's place,
|
|
2093
|
+
* said once, leave one layer.
|
|
2094
|
+
*/
|
|
2095
|
+
private layersOf;
|
|
2096
|
+
/**
|
|
2097
|
+
* What the sun's moving layer is read through: the matrix its shadow pass was last drawn with,
|
|
2098
|
+
* where the lit pipelines carry one (`MOVING_SUN`); the environment's otherwise, which every caller
|
|
2099
|
+
* drawing both layers with one matrix hands it anyway.
|
|
2100
|
+
*/
|
|
2101
|
+
private movingLightFor;
|
|
2102
|
+
/** The moving layer's own matrix on, the first time a frame draws that layer with one. */
|
|
2103
|
+
private enableMovingSun;
|
|
2033
2104
|
/** One of the lit stage's switches on, in every cache a lit pipeline can come from. */
|
|
2034
2105
|
private enableLit;
|
|
2035
2106
|
/** One resolution every glass caster is read through, so recording one allocates nothing. */
|
|
@@ -2267,6 +2338,21 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2267
2338
|
* can do nothing about. Done with `complete` still false is the signal that it was abandoned.
|
|
2268
2339
|
*/
|
|
2269
2340
|
createMeshIncremental(given: MeshData, options?: MeshOptions): IncrementalMeshHandle;
|
|
2341
|
+
/**
|
|
2342
|
+
* The copies this frame's mesh rewrites owe (`StagedRewrite`), recorded since the last submit and
|
|
2343
|
+
* sent at the head of the next one: one encoder however many meshes are rewritten. Null while
|
|
2344
|
+
* nothing is owed.
|
|
2345
|
+
*/
|
|
2346
|
+
private pendingRewrites;
|
|
2347
|
+
/** One record handed to every staged rewrite, refilled each call, so a rewrite allocates nothing. */
|
|
2348
|
+
private readonly stagedRewrite;
|
|
2349
|
+
private rewriteCopies;
|
|
2350
|
+
/**
|
|
2351
|
+
* Submit `buffers`, led by any copies the frame's mesh rewrites owe. **Every submit of this
|
|
2352
|
+
* renderer goes through here**, because any of them may draw a rewritten mesh — the frame's own,
|
|
2353
|
+
* a mirror's, a shadow's, a probe's — and the copies must be ahead of the first that does.
|
|
2354
|
+
*/
|
|
2355
|
+
private submit;
|
|
2270
2356
|
/**
|
|
2271
2357
|
* Rewrite a mesh's positions, and its normals where the caller has them.
|
|
2272
2358
|
*
|
|
@@ -2285,15 +2371,34 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2285
2371
|
*/
|
|
2286
2372
|
bindMeshPass(camera: Camera, env: Environment): void;
|
|
2287
2373
|
/**
|
|
2288
|
-
* The slot the next draw's material lives in,
|
|
2374
|
+
* The slot the next draw's material lives in, placing it when something dirtied it, with the
|
|
2375
|
+
* pass's slot taken first where `bindMeshPass` reopened it: `passOffset` is that one's offset.
|
|
2289
2376
|
*
|
|
2290
|
-
* **A
|
|
2291
|
-
* material
|
|
2292
|
-
*
|
|
2377
|
+
* **A placement per material change, not per draw.** A scene drawing a hundred meshes of one
|
|
2378
|
+
* material places it once; a scene switching material every draw places one each, and a material
|
|
2379
|
+
* the store already holds — the same numbers as a draw before it, this frame or an earlier one —
|
|
2380
|
+
* is bound where it is and uploads nothing.
|
|
2293
2381
|
*/
|
|
2294
2382
|
private materialSlotForDraw;
|
|
2383
|
+
/** The pass slot `materialSlotForDraw` left open, read beside the material's by every lit draw. */
|
|
2384
|
+
private get passOffset();
|
|
2385
|
+
/** A new pass: its block, and both its views, are taken afresh by the next draw. */
|
|
2386
|
+
private reopenPass;
|
|
2387
|
+
/** What a view holds changed — the wind, the light's matrix — so the next draw takes a new one. */
|
|
2388
|
+
private reopenViews;
|
|
2389
|
+
/**
|
|
2390
|
+
* The view slot a lit draw reads its camera from: the pass's, or its unjittered twin for a blended
|
|
2391
|
+
* draw landing after the upscale. Taken by the first draw that needs it after the pass, the wind or
|
|
2392
|
+
* the light's matrix changed, and shared by every draw until then. Null when the ring is full, which
|
|
2393
|
+
* skips the draw and grows the ring for the next frame, as the pass ring does.
|
|
2394
|
+
*/
|
|
2395
|
+
private viewSlotFor;
|
|
2396
|
+
/** A view block: the camera, the light's matrix and the frame's wind, into `ring` at `slot`. */
|
|
2397
|
+
private writeView;
|
|
2398
|
+
private warnMaterialsFull;
|
|
2295
2399
|
/** Said once rather than every frame, for the reason `warnedFull` gives. */
|
|
2296
2400
|
private warnedMaterialsFull;
|
|
2401
|
+
private warnedPassesFull;
|
|
2297
2402
|
private warnedSkyFull;
|
|
2298
2403
|
private warnedParticlesTwice;
|
|
2299
2404
|
/**
|
|
@@ -2407,6 +2512,26 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2407
2512
|
* the shape this repository spent a week removing.
|
|
2408
2513
|
*/
|
|
2409
2514
|
createInstanced(mesh: GpuMesh, capacity: number, options?: InstancedOptions): GpuInstancedBatch;
|
|
2515
|
+
/** See `Renderer.setAnimationTime`. Every view taken after it reads the new clock. */
|
|
2516
|
+
setAnimationTime(seconds: number): void;
|
|
2517
|
+
/** The clock `setAnimationTime` set, 0 until it is. */
|
|
2518
|
+
private animationTime;
|
|
2519
|
+
/** See `Renderer.createBoneAnimation`. */
|
|
2520
|
+
createBoneAnimation(clip: BoneAnimationClip): BoneAnimationHandle;
|
|
2521
|
+
/** See `Renderer.disposeBoneAnimation`. A batch still playing it draws nothing after. */
|
|
2522
|
+
disposeBoneAnimation(animation: BoneAnimationHandle): void;
|
|
2523
|
+
/** An animated batch's clip and clocks, as its groups bind them. */
|
|
2524
|
+
private animationViews;
|
|
2525
|
+
/** An animated batch's groups, dropped wherever the renderer drops its own. */
|
|
2526
|
+
private freshAnimatedGroups;
|
|
2527
|
+
/**
|
|
2528
|
+
* The lit group an animated batch draws with: the material's group, or its overlay twin, again
|
|
2529
|
+
* with the clip's and the clocks' textures — kept on the batch by the group it was built beside,
|
|
2530
|
+
* as a skinned twin is kept by its palette slot.
|
|
2531
|
+
*/
|
|
2532
|
+
private animatedGroup;
|
|
2533
|
+
/** An animated caster's shadow group, by what it cuts with and whether this is the peel. */
|
|
2534
|
+
private animatedDepthGroup;
|
|
2410
2535
|
/** The device instance culls, built on the first culling draw. See `InstanceCullPass`. */
|
|
2411
2536
|
private instanceCulls;
|
|
2412
2537
|
/** Counts frames, so a batch knows when its cull slots were last taken. */
|
|
@@ -2527,6 +2652,38 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2527
2652
|
* face. What it replaces is a consumer re-entering its whole draw path with a second camera.
|
|
2528
2653
|
*/
|
|
2529
2654
|
drawSceneCasters(casters: ShadowCasters): void;
|
|
2655
|
+
/** See `Renderer.createStaticDraws`. Recorded on its first draw, into each view it is drawn in. */
|
|
2656
|
+
createStaticDraws(casters: ShadowCasters): StaticDrawsHandle;
|
|
2657
|
+
/**
|
|
2658
|
+
* See `Renderer.drawStaticDraws`. One bundle executed, after a pass block and a view block are
|
|
2659
|
+
* written for this view; the list is recorded first where it has no recording that is current for
|
|
2660
|
+
* this target and starting state. See `staticBundles.ts`.
|
|
2661
|
+
*/
|
|
2662
|
+
drawStaticDraws(draws: StaticDrawsHandle): void;
|
|
2663
|
+
/** A list drawn the way `drawSceneCasters` draws, a draw at a time, for where a bundle cannot be. */
|
|
2664
|
+
private replayStaticImmediately;
|
|
2665
|
+
/** See `Renderer.disposeStaticDraws`. Its pins let go; its meshes and materials are the caller's. */
|
|
2666
|
+
disposeStaticDraws(draws: StaticDrawsHandle): void;
|
|
2667
|
+
/** The recording to replay `list` from here, made now if none is current; null if it cannot be. */
|
|
2668
|
+
private staticRecordingFor;
|
|
2669
|
+
/** How a list's pins are let go: through the store, unless it has forgotten them since. */
|
|
2670
|
+
private unpinFor;
|
|
2671
|
+
/**
|
|
2672
|
+
* Record `list` into `recording`: its entries through the scene-caster path, with the list's
|
|
2673
|
+
* rings and group cache swapped in for the frame's and the pass and view slots held at the list's
|
|
2674
|
+
* first copy, so every command the path records binds the list's buffers and offsets the bundle
|
|
2675
|
+
* can rewrite per copy. Everything swapped is put back, whatever the path throws.
|
|
2676
|
+
*/
|
|
2677
|
+
private recordStatic;
|
|
2678
|
+
/** The recording under way, which `recordDraw` and the side passes take their commands into. */
|
|
2679
|
+
private staticRecording;
|
|
2680
|
+
/** Whether the replay about to count its material changes recorded them, and so counted them. */
|
|
2681
|
+
private staticJustRecorded;
|
|
2682
|
+
/** A disposed list drawn, said once: the frame loop does not throw. */
|
|
2683
|
+
private warnStaticDisposed;
|
|
2684
|
+
private warnedStaticDisposed;
|
|
2685
|
+
/** Bumped wherever the lit groups are dropped, which a static list's own groups follow. */
|
|
2686
|
+
private flatGroupEpoch;
|
|
2530
2687
|
drawShadowCasters(casters: ShadowCasters): void;
|
|
2531
2688
|
/** Close the shadow pass and submit it, so the frame can sample what it wrote. */
|
|
2532
2689
|
/**
|
|
@@ -2673,11 +2830,11 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2673
2830
|
/**
|
|
2674
2831
|
* The bind group a draw uses, skinned or not.
|
|
2675
2832
|
*
|
|
2676
|
-
* **The skinned twin is
|
|
2677
|
-
*
|
|
2678
|
-
*
|
|
2679
|
-
*
|
|
2680
|
-
* missed invalidation is not possible rather than merely unlikely, and it is why
|
|
2833
|
+
* **The skinned twin is kept by palette slot and by the unskinned group it was built beside**,
|
|
2834
|
+
* which is one a material, and compared against the views it holds — the palette's, which
|
|
2835
|
+
* changes only when the slot's texture grows, the morph deltas and the cloth's — rather than
|
|
2836
|
+
* against a flag somebody has to remember to clear at six call sites. Comparing object identity
|
|
2837
|
+
* means a missed invalidation is not possible rather than merely unlikely, and it is why
|
|
2681
2838
|
* `SkinPaletteTexture.view()` caches: a fresh view every call never compares equal and would
|
|
2682
2839
|
* rebuild this every draw.
|
|
2683
2840
|
*/
|
|
@@ -3085,6 +3242,14 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3085
3242
|
* light alone and its colour alone into the blur's targets and test for the depth its frame half
|
|
3086
3243
|
* wrote.
|
|
3087
3244
|
*/
|
|
3245
|
+
/**
|
|
3246
|
+
* Whether a split skin draw's two kept halves have pipelines, starting the compile of either that
|
|
3247
|
+
* has not: a skin drawn without them would lose its diffuse light for the frames they take, so a
|
|
3248
|
+
* split skin draws all three halves or none. See `PipelineCache.lit`.
|
|
3249
|
+
*/
|
|
3250
|
+
private skinHalvesReady;
|
|
3251
|
+
/** One kept half's pipeline, or none where it is still compiling: see `PipelineCache.lit`. */
|
|
3252
|
+
private skinHalfPipeline;
|
|
3088
3253
|
private keepSkinDiffuse;
|
|
3089
3254
|
/**
|
|
3090
3255
|
* Spread the frame's skin and add it back: once, at the first blended draw or before the frame's
|