@hology/webgpu-renderer 0.1.18 → 0.1.20
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/README.md +49 -0
- package/dist/index.d.ts +208 -108
- package/dist/index.js +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -426,3 +426,52 @@ Natural follow-ups from here:
|
|
|
426
426
|
- add cascaded directional shadows, light arrays, and shadow atlases
|
|
427
427
|
- add material templates and pipeline caches for larger shader families
|
|
428
428
|
- separate extraction, render graph nodes, and resource registries into dedicated modules
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
### Automatic detail rejection
|
|
432
|
+
|
|
433
|
+
WebGPU objects default to a conservative minimum bounding-sphere diameter of 2 render pixels, with a separate 2-shadow-texel threshold for directional casters. This rejects detail before vertex processing; it does not generate mesh LODs or change geometry. Long thin objects use their longest extent through the enclosing sphere, and camera/near-plane intersections are retained.
|
|
434
|
+
|
|
435
|
+
```ts
|
|
436
|
+
import { setObjectDetailCulling } from '@hology/webgpu-renderer';
|
|
437
|
+
|
|
438
|
+
// Defaults for an entire scene / actor hierarchy; descendants can override fields.
|
|
439
|
+
setObjectDetailCulling(scene, { minScreenSize: 2, shadow: { minScreenSize: 2 } });
|
|
440
|
+
setObjectDetailCulling(importantActor, { enabled: false, shadow: { enabled: false } });
|
|
441
|
+
setObjectDetailCulling(smallProp, { maxDistance: 100, shadow: { minScreenSize: 4, maxDistance: 200 } });
|
|
442
|
+
renderer.createStaticDrawSet(root, { detailCulling: { minScreenSize: 3 } });
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
Settings are stored in `Object3D.userData.detailCulling` and inherited from parents, field by field. `enabled: false` disables automatic rejection in that domain; an explicit distance still applies. Zero distance disables distance rejection. Distances are measured from the viewer to the sphere surface. Camera and shadow settings are independent. Hology's `RenderingView.setObjectDetailCulling` exposes the same runtime object policy, and `SceneObject.detailCulling` carries it through materialization. Objects with different policies remain separate in materialization and renderer batching.
|
|
446
|
+
|
|
447
|
+
Static registration freezes settings and bounds. Change policies before registration, or dispose and re-register a static set after changing them. The existing 32-byte GPU instance metadata stores camera threshold and distance in its formerly reserved words. Camera rejection runs in the existing visibility compute kernel, before frustum/Hi-Z work, with no additional compute dispatch or visibility readback. A persistent bit in the visibility mask provides 115% entry / 85% exit hysteresis. Ordinary meshes receive CPU detail decisions before batching, with object history; already-instanced dynamic/resident batches conservatively use their aggregate bounds. Per-instance dynamic/resident compaction is not added here.
|
|
448
|
+
|
|
449
|
+
Directional shadows use independent light-space sphere tests over the complete cascade camera volume, including off-camera casters. Spatial chunks remain a broad phase. A CPU mirror of the immutable sphere metadata selects contiguous source-instance runs from the resident buffer; pooled draw descriptors avoid per-frame descriptor allocation. Cascade histories use the same hysteresis band. This path adds CPU selection/encoding work in exchange for fewer shadow vertices; it does not reuse the camera's compacted instance list. Point and spot shadow detail policies are not changed.
|
|
450
|
+
|
|
451
|
+
Profiling now includes per-pass `triangleCount` and `drawCallCount`. Indirect submission counters remain **upper bounds**, since the CPU records registered draw capacity; they include repeated depth/color/shadow submissions. `visibility.visibleTriangles` reads actual index/instance counts from the camera's indirect arguments and represents one GPU-culled camera submission, excluding direct and transparent draws. Directional shadow run counts are exact. GPU profiling readback is diagnostic only, never needed for culling.
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
### Cached directional shadow updates
|
|
455
|
+
|
|
456
|
+
Temporal shadow scheduling is opt-in. Configure the renderer with `directionalShadowUpdates`, or call `setDirectionalShadowUpdateOptions`. Hology exposes the same method on `RenderingView`.
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
renderingView.setDirectionalShadowUpdateOptions({
|
|
460
|
+
enabled: true,
|
|
461
|
+
maxUpdateHz: 60,
|
|
462
|
+
cascadeUpdateHz: [60, 30, 15, 7.5],
|
|
463
|
+
maxUpdatesPerFrame: 2,
|
|
464
|
+
coverageMargin: 0.05,
|
|
465
|
+
teleportDistance: 10,
|
|
466
|
+
});
|
|
467
|
+
// Call after discontinuous dynamic-caster changes or other external scene edits.
|
|
468
|
+
renderingView.invalidateDirectionalShadows();
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Ordinary refreshes use monotonic-time deadlines, independent of render FPS and simulation time. Initial deadlines are staggered; the oldest overdue deadline wins the ordinary per-frame budget. Rates are upper bounds, rather than guaranteed frequencies if the budget cannot sustain the requested workload. Hard invalidation bypasses both the budget and rate cap.
|
|
472
|
+
|
|
473
|
+
Each retained map keeps its rendered light camera and sampling matrix. Material and volumetric-fog sampling share the renderer's cached light-uniform matrices. Custom graph consumers can use `RendererExtractedLightState.directionals[i].shadowViewProjection` (WebGPU 0�1 depth) rather than reconstructing a matrix from the current scene light. Temporal camera jitter does not invalidate maps. Initialisation, shadow-texture reallocation, light identity/direction, cascade-range changes, FOV/aspect/clip changes, viewer teleports and static draw-set membership/enabled changes force refresh. The complete nominal light volume must fit inside the cached padded volume; coverage loss forces a layer update even before its deadline. Camera turns/translations that remain inside coverage may reuse the map.
|
|
474
|
+
|
|
475
|
+
Coverage padding adds conservative caster coverage and slightly reduces effective shadow texel density. Lower far-cascade rates introduce bounded temporal lag for moving casters. Use higher rates or disable scheduling where that tradeoff is unsuitable. Static material/uniform edits and discontinuous dynamic-caster edits that are not represented by the tracked scene state should explicitly invalidate shadows. This path does not cache point or spot shadows.
|
|
476
|
+
|
|
477
|
+
`RendererFrameProfile.directionalShadows` reports updated/reused/forced layer counts and an update bit mask. Per-pass triangle statistics count only newly submitted shadow geometry on refresh frames. Camera visibility remains independent.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters,
|
|
2
|
+
import { Object3D, Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, PerspectiveCamera, OrthographicCamera, BufferGeometry, DirectionalLight, PointLight, SpotLight, Scene } from 'three';
|
|
3
3
|
export { AmbientLight, BackSide, BatchedMesh, Bone, BoxGeometry, BufferAttribute, BufferGeometry, CanvasTexture, Color, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedArrayTexture as CompressedTextureArray, CubeTexture, Data3DTexture, DataArrayTexture, DataTexture, DepthTexture, DirectionalLight, DoubleSide, FrontSide, Group, HemisphereLight, InstancedMesh, MathUtils, Matrix4, Mesh, Object3D, OrthographicCamera, PerspectiveCamera, PlaneGeometry, PointLight, RepeatWrapping, Scene, Skeleton, SkinnedMesh, SphereGeometry, SpotLight, Texture, Vector2, Vector3, Vector4 } from 'three';
|
|
4
4
|
|
|
5
|
-
interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
entryPoint?: string;
|
|
9
|
-
bindGroupLayoutEntries: GPUBindGroupLayoutEntry[];
|
|
5
|
+
interface PipelineDiagnosticOrigin {
|
|
6
|
+
key: string;
|
|
7
|
+
[detail: string]: unknown;
|
|
10
8
|
}
|
|
11
|
-
declare
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
declare function setPipelineDiagnosticLoading(device: GPUDevice, loading: boolean, phase: string): void;
|
|
10
|
+
declare function registerPipelineDiagnosticOrigin(device: GPUDevice, label: string, origin: PipelineDiagnosticOrigin): void;
|
|
11
|
+
|
|
12
|
+
/** Detail rejection, not mesh simplification. Diameters are measured in render pixels / shadow texels. */
|
|
13
|
+
interface DetailCullingSettings {
|
|
14
|
+
/** Disable automatic camera detail rejection; explicit maxDistance still applies. */
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
minScreenSize?: number;
|
|
17
|
+
/** Distance to the bounding sphere surface in world units. Zero disables. */
|
|
18
|
+
maxDistance?: number;
|
|
19
|
+
shadow?: {
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
minScreenSize?: number;
|
|
22
|
+
maxDistance?: number;
|
|
23
|
+
};
|
|
16
24
|
}
|
|
25
|
+
interface ResolvedDetailCulling {
|
|
26
|
+
minScreenSize: number;
|
|
27
|
+
maxDistance: number;
|
|
28
|
+
shadowMinScreenSize: number;
|
|
29
|
+
shadowMaxDistance: number;
|
|
30
|
+
}
|
|
31
|
+
/** Serialized in Object3D.userData, inherited through parents, and usable by runtime-created objects. */
|
|
32
|
+
declare function setObjectDetailCulling(object: Object3D, settings: DetailCullingSettings): void;
|
|
33
|
+
declare function resolveDetailCulling(object: Object3D | null, registration?: DetailCullingSettings): ResolvedDetailCulling;
|
|
17
34
|
|
|
18
35
|
type ShaderDefineValue = string | number | boolean;
|
|
19
36
|
type ShaderDefines = Record<string, ShaderDefineValue | null | undefined>;
|
|
@@ -151,6 +168,9 @@ declare class WGSLShaderMaterial extends Material {
|
|
|
151
168
|
private invalidateBindingCache;
|
|
152
169
|
}
|
|
153
170
|
|
|
171
|
+
/** Shared renderer lighting ABI for procedural particle geometry. */
|
|
172
|
+
declare function buildParticleLightingShaderHeader(receiveShadow?: boolean, modelMatrixBody?: string): string;
|
|
173
|
+
|
|
154
174
|
interface RenderGraphContext {
|
|
155
175
|
readonly device: GPUDevice;
|
|
156
176
|
readonly encoder: GPUCommandEncoder;
|
|
@@ -179,102 +199,6 @@ declare class RenderGraph {
|
|
|
179
199
|
private resolveExecutionOrder;
|
|
180
200
|
}
|
|
181
201
|
|
|
182
|
-
/** Shared renderer lighting ABI for procedural particle geometry. */
|
|
183
|
-
declare function buildParticleLightingShaderHeader(receiveShadow?: boolean, modelMatrixBody?: string): string;
|
|
184
|
-
|
|
185
|
-
interface TextureResource {
|
|
186
|
-
version: number;
|
|
187
|
-
width: number;
|
|
188
|
-
height: number;
|
|
189
|
-
depthOrArrayLayers: number;
|
|
190
|
-
format: GPUTextureFormat;
|
|
191
|
-
textureDimension: GPUTextureDimension;
|
|
192
|
-
viewDimension: GPUTextureViewDimension;
|
|
193
|
-
sampleType: GPUTextureSampleType;
|
|
194
|
-
samplerBindingType: GPUSamplerBindingType;
|
|
195
|
-
mipLevelCount: number;
|
|
196
|
-
texture: GPUTexture;
|
|
197
|
-
view: GPUTextureView;
|
|
198
|
-
sampler: GPUSampler;
|
|
199
|
-
}
|
|
200
|
-
interface ExtractedLightState {
|
|
201
|
-
ambient: Vector4;
|
|
202
|
-
hemisphere: ExtractedHemisphereLight | null;
|
|
203
|
-
directionals: ExtractedDirectionalLight[];
|
|
204
|
-
points: ExtractedPointLight[];
|
|
205
|
-
spots: ExtractedSpotLight[];
|
|
206
|
-
directional: ExtractedDirectionalLight | null;
|
|
207
|
-
point: ExtractedPointLight | null;
|
|
208
|
-
spot: ExtractedSpotLight | null;
|
|
209
|
-
}
|
|
210
|
-
interface ExtractedHemisphereLight {
|
|
211
|
-
direction: Vector3;
|
|
212
|
-
skyColor: Vector3;
|
|
213
|
-
groundColor: Vector3;
|
|
214
|
-
intensity: number;
|
|
215
|
-
}
|
|
216
|
-
interface ExtractedDirectionalLight {
|
|
217
|
-
sourceLight: DirectionalLight | null;
|
|
218
|
-
position: Vector3;
|
|
219
|
-
target: Vector3;
|
|
220
|
-
direction: Vector3;
|
|
221
|
-
color: Vector3;
|
|
222
|
-
intensity: number;
|
|
223
|
-
volumetricIntensity: number;
|
|
224
|
-
castShadow: boolean;
|
|
225
|
-
shadowBias: number;
|
|
226
|
-
shadowNormalBias: number;
|
|
227
|
-
shadowRadius: number;
|
|
228
|
-
shadowIntensity: number;
|
|
229
|
-
shadowMapSize: number;
|
|
230
|
-
shadowCameraLeft: number;
|
|
231
|
-
shadowCameraRight: number;
|
|
232
|
-
shadowCameraTop: number;
|
|
233
|
-
shadowCameraBottom: number;
|
|
234
|
-
shadowCameraNear: number;
|
|
235
|
-
shadowCameraFar: number;
|
|
236
|
-
}
|
|
237
|
-
interface ExtractedPointLight {
|
|
238
|
-
sourceLight: PointLight;
|
|
239
|
-
position: Vector3;
|
|
240
|
-
color: Vector3;
|
|
241
|
-
intensity: number;
|
|
242
|
-
volumetricIntensity: number;
|
|
243
|
-
distance: number;
|
|
244
|
-
range: number;
|
|
245
|
-
decay: number;
|
|
246
|
-
castShadow: boolean;
|
|
247
|
-
shadowBias: number;
|
|
248
|
-
shadowNormalBias: number;
|
|
249
|
-
shadowRadius: number;
|
|
250
|
-
shadowIntensity: number;
|
|
251
|
-
shadowMapSize: number;
|
|
252
|
-
shadowCameraNear: number;
|
|
253
|
-
shadowCameraFar: number;
|
|
254
|
-
}
|
|
255
|
-
interface ExtractedSpotLight {
|
|
256
|
-
sourceLight: SpotLight;
|
|
257
|
-
position: Vector3;
|
|
258
|
-
direction: Vector3;
|
|
259
|
-
color: Vector3;
|
|
260
|
-
intensity: number;
|
|
261
|
-
volumetricIntensity: number;
|
|
262
|
-
range: number;
|
|
263
|
-
angle: number;
|
|
264
|
-
penumbra: number;
|
|
265
|
-
decay: number;
|
|
266
|
-
castShadow: boolean;
|
|
267
|
-
shadowBias: number;
|
|
268
|
-
shadowNormalBias: number;
|
|
269
|
-
shadowRadius: number;
|
|
270
|
-
shadowIntensity: number;
|
|
271
|
-
shadowMapSize: number;
|
|
272
|
-
shadowCameraNear: number;
|
|
273
|
-
shadowCameraFar: number;
|
|
274
|
-
shadowCameraFov: number;
|
|
275
|
-
map: Texture | null;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
202
|
/** Camera-visible lights collected during the renderer's scene extraction. */
|
|
279
203
|
type RendererExtractedLightState = ExtractedLightState;
|
|
280
204
|
/**
|
|
@@ -289,6 +213,7 @@ interface RendererOptions {
|
|
|
289
213
|
clearColor?: readonly [number, number, number, number];
|
|
290
214
|
powerPreference?: GPUPowerPreference;
|
|
291
215
|
shadowMapSize?: number;
|
|
216
|
+
directionalShadowUpdates?: DirectionalShadowUpdateOptions;
|
|
292
217
|
pointShadowMapSize?: number;
|
|
293
218
|
sampleCount?: number;
|
|
294
219
|
hiZOcclusionCulling?: boolean;
|
|
@@ -338,6 +263,8 @@ interface RendererOptions {
|
|
|
338
263
|
invokeObjectRenderCallbacks?: boolean;
|
|
339
264
|
}
|
|
340
265
|
interface StaticDrawSetOptions {
|
|
266
|
+
/** Defaults inherited by objects without overrides. Frozen at registration. */
|
|
267
|
+
detailCulling?: DetailCullingSettings;
|
|
341
268
|
label?: string;
|
|
342
269
|
onUnsupported?: "throw" | "skip";
|
|
343
270
|
/**
|
|
@@ -475,11 +402,16 @@ interface RendererCustomPassDescriptor {
|
|
|
475
402
|
execute(context: RendererCustomPassContext): void;
|
|
476
403
|
}
|
|
477
404
|
interface RendererPassProfile {
|
|
405
|
+
/** Submission upper bound for GPU-indirect draws; exact for direct draws. */
|
|
406
|
+
triangleCount?: number;
|
|
407
|
+
drawCallCount?: number;
|
|
478
408
|
name: string;
|
|
479
409
|
cpuTimeMs: number;
|
|
480
410
|
gpuTimeMs: number | null;
|
|
481
411
|
}
|
|
482
412
|
interface RendererVisibilityProfile {
|
|
413
|
+
/** Actual triangles in GPU camera-visible indirect arguments (one color submission). */
|
|
414
|
+
visibleTriangles?: number;
|
|
483
415
|
totalInstances: number;
|
|
484
416
|
visibleInstances: number;
|
|
485
417
|
culledInstances: number;
|
|
@@ -489,10 +421,17 @@ interface RendererVisibilityProfile {
|
|
|
489
421
|
staticVisibleInstances: number;
|
|
490
422
|
}
|
|
491
423
|
interface RendererFrameProfile {
|
|
424
|
+
directionalShadows?: {
|
|
425
|
+
updatedLayers: number;
|
|
426
|
+
reusedLayers: number;
|
|
427
|
+
forcedLayers: number;
|
|
428
|
+
updateMask: number;
|
|
429
|
+
};
|
|
492
430
|
frameIndex: number;
|
|
493
431
|
cpuTimeMs: number;
|
|
494
432
|
gpuTimeMs: number | null;
|
|
495
433
|
drawCallCount: number;
|
|
434
|
+
/** Counts repeated passes; upper bound for GPU-indirect draws, not unique visible geometry. */
|
|
496
435
|
triangleCount: number;
|
|
497
436
|
cpuPhases: {
|
|
498
437
|
extractSceneMs: number;
|
|
@@ -513,6 +452,141 @@ interface RendererFrameProfile {
|
|
|
513
452
|
visibility: RendererVisibilityProfile | null;
|
|
514
453
|
}
|
|
515
454
|
|
|
455
|
+
interface TextureResource {
|
|
456
|
+
version: number;
|
|
457
|
+
width: number;
|
|
458
|
+
height: number;
|
|
459
|
+
depthOrArrayLayers: number;
|
|
460
|
+
format: GPUTextureFormat;
|
|
461
|
+
textureDimension: GPUTextureDimension;
|
|
462
|
+
viewDimension: GPUTextureViewDimension;
|
|
463
|
+
sampleType: GPUTextureSampleType;
|
|
464
|
+
samplerBindingType: GPUSamplerBindingType;
|
|
465
|
+
mipLevelCount: number;
|
|
466
|
+
texture: GPUTexture;
|
|
467
|
+
view: GPUTextureView;
|
|
468
|
+
sampler: GPUSampler;
|
|
469
|
+
}
|
|
470
|
+
interface ExtractedLightState {
|
|
471
|
+
ambient: Vector4;
|
|
472
|
+
hemisphere: ExtractedHemisphereLight | null;
|
|
473
|
+
directionals: ExtractedDirectionalLight[];
|
|
474
|
+
points: ExtractedPointLight[];
|
|
475
|
+
spots: ExtractedSpotLight[];
|
|
476
|
+
directional: ExtractedDirectionalLight | null;
|
|
477
|
+
point: ExtractedPointLight | null;
|
|
478
|
+
spot: ExtractedSpotLight | null;
|
|
479
|
+
}
|
|
480
|
+
interface ExtractedHemisphereLight {
|
|
481
|
+
direction: Vector3;
|
|
482
|
+
skyColor: Vector3;
|
|
483
|
+
groundColor: Vector3;
|
|
484
|
+
intensity: number;
|
|
485
|
+
}
|
|
486
|
+
interface ExtractedDirectionalLight {
|
|
487
|
+
/** Actual WebGPU (0..1 depth) projection of this frame's retained shadow layer. */
|
|
488
|
+
shadowViewProjection?: Matrix4;
|
|
489
|
+
sourceLight: DirectionalLight | null;
|
|
490
|
+
position: Vector3;
|
|
491
|
+
target: Vector3;
|
|
492
|
+
direction: Vector3;
|
|
493
|
+
color: Vector3;
|
|
494
|
+
intensity: number;
|
|
495
|
+
volumetricIntensity: number;
|
|
496
|
+
castShadow: boolean;
|
|
497
|
+
shadowBias: number;
|
|
498
|
+
shadowNormalBias: number;
|
|
499
|
+
shadowRadius: number;
|
|
500
|
+
shadowIntensity: number;
|
|
501
|
+
shadowMapSize: number;
|
|
502
|
+
shadowCameraLeft: number;
|
|
503
|
+
shadowCameraRight: number;
|
|
504
|
+
shadowCameraTop: number;
|
|
505
|
+
shadowCameraBottom: number;
|
|
506
|
+
shadowCameraNear: number;
|
|
507
|
+
shadowCameraFar: number;
|
|
508
|
+
}
|
|
509
|
+
interface ExtractedPointLight {
|
|
510
|
+
sourceLight: PointLight;
|
|
511
|
+
position: Vector3;
|
|
512
|
+
color: Vector3;
|
|
513
|
+
intensity: number;
|
|
514
|
+
volumetricIntensity: number;
|
|
515
|
+
distance: number;
|
|
516
|
+
range: number;
|
|
517
|
+
decay: number;
|
|
518
|
+
castShadow: boolean;
|
|
519
|
+
shadowBias: number;
|
|
520
|
+
shadowNormalBias: number;
|
|
521
|
+
shadowRadius: number;
|
|
522
|
+
shadowIntensity: number;
|
|
523
|
+
shadowMapSize: number;
|
|
524
|
+
shadowCameraNear: number;
|
|
525
|
+
shadowCameraFar: number;
|
|
526
|
+
}
|
|
527
|
+
interface ExtractedSpotLight {
|
|
528
|
+
sourceLight: SpotLight;
|
|
529
|
+
position: Vector3;
|
|
530
|
+
direction: Vector3;
|
|
531
|
+
color: Vector3;
|
|
532
|
+
intensity: number;
|
|
533
|
+
volumetricIntensity: number;
|
|
534
|
+
range: number;
|
|
535
|
+
angle: number;
|
|
536
|
+
penumbra: number;
|
|
537
|
+
decay: number;
|
|
538
|
+
castShadow: boolean;
|
|
539
|
+
shadowBias: number;
|
|
540
|
+
shadowNormalBias: number;
|
|
541
|
+
shadowRadius: number;
|
|
542
|
+
shadowIntensity: number;
|
|
543
|
+
shadowMapSize: number;
|
|
544
|
+
shadowCameraNear: number;
|
|
545
|
+
shadowCameraFar: number;
|
|
546
|
+
shadowCameraFov: number;
|
|
547
|
+
map: Texture | null;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/** Opt-in temporal caching for directional shadow maps, independent of render FPS. */
|
|
551
|
+
interface DirectionalShadowUpdateOptions {
|
|
552
|
+
enabled?: boolean;
|
|
553
|
+
/** Upper limit for ordinary layer refreshes, in updates/second. Default 60. */
|
|
554
|
+
maxUpdateHz?: number;
|
|
555
|
+
/** Near-to-far maximum rates. Default [60, 30, 15, 7.5]. */
|
|
556
|
+
cascadeUpdateHz?: readonly number[];
|
|
557
|
+
/** Ordinary refresh budget. Hard invalidations bypass it. Default 2. */
|
|
558
|
+
maxUpdatesPerFrame?: number;
|
|
559
|
+
/** Extra light-space coverage per side, as a fraction of nominal extent. Default .05. */
|
|
560
|
+
coverageMargin?: number;
|
|
561
|
+
/** Viewer displacement in one frame that invalidates all layers. Default 10 world units. */
|
|
562
|
+
teleportDistance?: number;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Lighting and post-processing stay in linear HDR until the present pass.
|
|
567
|
+
* The canvas format is intentionally kept separate because it is a display
|
|
568
|
+
* target, not an intermediate scene-color target.
|
|
569
|
+
*/
|
|
570
|
+
declare const SCENE_COLOR_FORMAT: GPUTextureFormat;
|
|
571
|
+
|
|
572
|
+
declare function createRenderPipelineAsync(device: GPUDevice, descriptor: GPURenderPipelineDescriptor): Promise<GPURenderPipeline>;
|
|
573
|
+
declare function createComputePipelineAsync(device: GPUDevice, descriptor: GPUComputePipelineDescriptor): Promise<GPUComputePipeline>;
|
|
574
|
+
|
|
575
|
+
interface ComputeKernelDescriptor {
|
|
576
|
+
label?: string;
|
|
577
|
+
code: string;
|
|
578
|
+
entryPoint?: string;
|
|
579
|
+
bindGroupLayoutEntries: GPUBindGroupLayoutEntry[];
|
|
580
|
+
}
|
|
581
|
+
declare class ComputeKernel {
|
|
582
|
+
readonly layout: GPUBindGroupLayout;
|
|
583
|
+
readonly pipeline: GPUComputePipeline;
|
|
584
|
+
static createAsync(device: GPUDevice, descriptor: ComputeKernelDescriptor): Promise<ComputeKernel>;
|
|
585
|
+
/** The optional pipeline allows adopting an already compiled kernel. */
|
|
586
|
+
constructor(device: GPUDevice, descriptor: ComputeKernelDescriptor, pipeline?: GPUComputePipeline);
|
|
587
|
+
createBindGroup(device: GPUDevice, entries: GPUBindGroupEntry[], label?: string): GPUBindGroup;
|
|
588
|
+
}
|
|
589
|
+
|
|
516
590
|
type FrameGraphTextureHandle = string;
|
|
517
591
|
interface FrameGraphPassDescriptor {
|
|
518
592
|
readonly name: string;
|
|
@@ -551,6 +625,7 @@ interface CompiledNodeFullscreenShader {
|
|
|
551
625
|
}>): void;
|
|
552
626
|
}
|
|
553
627
|
interface FrameGraphNodeFullscreenPassDescriptor {
|
|
628
|
+
readonly diagnosticOrigin?: PipelineDiagnosticOrigin;
|
|
554
629
|
readonly name: string;
|
|
555
630
|
readonly shader: CompiledNodeFullscreenShader;
|
|
556
631
|
/** Overrides frame-graph resources for named compiled graph/scene texture bindings. */
|
|
@@ -854,6 +929,8 @@ declare class WebGpuRenderer {
|
|
|
854
929
|
* so regular meshes see that change without paying resolver work per mesh.
|
|
855
930
|
*/
|
|
856
931
|
private readonly resolvedMaterialFrameCache;
|
|
932
|
+
private readonly repeatedMeshInstances;
|
|
933
|
+
private readonly repeatedInstanceResources;
|
|
857
934
|
private readonly instancedMeshExtractionCache;
|
|
858
935
|
private readonly batchedMeshExtractionCache;
|
|
859
936
|
private readonly materialCache;
|
|
@@ -909,6 +986,7 @@ declare class WebGpuRenderer {
|
|
|
909
986
|
private readonly presentationOverlay;
|
|
910
987
|
private readonly presentationOverlayContext;
|
|
911
988
|
private readonly directionalShadowCameras;
|
|
989
|
+
private readonly directionalShadowScheduler;
|
|
912
990
|
private readonly pointShadowCameras;
|
|
913
991
|
private readonly spotShadowCameras;
|
|
914
992
|
private readonly colorTargetCache;
|
|
@@ -930,6 +1008,7 @@ declare class WebGpuRenderer {
|
|
|
930
1008
|
private readonly vertexAttributeGroupCache;
|
|
931
1009
|
private readonly materialVertexAttributeCache;
|
|
932
1010
|
private readonly vertexBufferBindingPlanCache;
|
|
1011
|
+
private readonly preparedVertexBufferCache;
|
|
933
1012
|
private readonly vertexAttributeGroupBufferKeyCache;
|
|
934
1013
|
private readonly compileDrawScratch;
|
|
935
1014
|
private readonly dynamicIndirectSubmissionCache;
|
|
@@ -953,6 +1032,14 @@ declare class WebGpuRenderer {
|
|
|
953
1032
|
private staticFrameToken;
|
|
954
1033
|
private hizResourceVersion;
|
|
955
1034
|
private graphTextureResourceVersion;
|
|
1035
|
+
private transmissionSnapshotTexture;
|
|
1036
|
+
private transmissionSnapshotView;
|
|
1037
|
+
private transmissionSnapshotSize;
|
|
1038
|
+
private transmissionMipViews;
|
|
1039
|
+
private transmissionMipBindGroups;
|
|
1040
|
+
private transmissionSourceBindGroups;
|
|
1041
|
+
private transmissionSnapshotPipeline;
|
|
1042
|
+
private transmissionSampler;
|
|
956
1043
|
private readonly visibilityParamsUpload;
|
|
957
1044
|
private drawMetadataUpload;
|
|
958
1045
|
private indirectDrawUpload;
|
|
@@ -996,6 +1083,9 @@ declare class WebGpuRenderer {
|
|
|
996
1083
|
private readonly objectMotionHistory;
|
|
997
1084
|
private readonly cameraFrustumPlanesScratch;
|
|
998
1085
|
private readonly objectTraversalStackScratch;
|
|
1086
|
+
private readonly shadowDrawsScratch;
|
|
1087
|
+
private extractingCaster;
|
|
1088
|
+
private readonly cameraDetailHistory;
|
|
999
1089
|
private readonly isSphereVisibleScratch;
|
|
1000
1090
|
private readonly isSphereVisibleForCompilationScratch;
|
|
1001
1091
|
private readonly updateExtractedBoundsFromMatrixScratch;
|
|
@@ -1042,6 +1132,9 @@ declare class WebGpuRenderer {
|
|
|
1042
1132
|
}[], lights?: readonly DirectionalLight[]): void;
|
|
1043
1133
|
/** Sets the base resolution used by directional shadow-map array layers. */
|
|
1044
1134
|
setDirectionalShadowMapSize(size: number): void;
|
|
1135
|
+
setDirectionalShadowUpdateOptions(options: DirectionalShadowUpdateOptions): void;
|
|
1136
|
+
/** Invalidate retained maps after discontinuous caster/scene changes. */
|
|
1137
|
+
invalidateDirectionalShadows(): void;
|
|
1045
1138
|
setDirectionalShadowsEnabled(enabled: boolean): void;
|
|
1046
1139
|
setRenderGraphProfilingEnabled(enabled: boolean): void;
|
|
1047
1140
|
getRenderGraphProfilingEnabled(): boolean;
|
|
@@ -1108,6 +1201,8 @@ declare class WebGpuRenderer {
|
|
|
1108
1201
|
private recordPresentationOverlay;
|
|
1109
1202
|
destroy(): void;
|
|
1110
1203
|
private createStaticPipelines;
|
|
1204
|
+
private ensureTransmissionSnapshot;
|
|
1205
|
+
private copyTransmissionSnapshot;
|
|
1111
1206
|
private recreateShadowResources;
|
|
1112
1207
|
private recreateDirectionalShadowResources;
|
|
1113
1208
|
private ensureShadowTextureSizes;
|
|
@@ -1235,6 +1330,7 @@ declare class WebGpuRenderer {
|
|
|
1235
1330
|
private getInterleavedGeometryVertexBuffer;
|
|
1236
1331
|
private ensureWireframeIndex;
|
|
1237
1332
|
private bindGeometryVertexBuffers;
|
|
1333
|
+
private prepareGeometryVertexBuffers;
|
|
1238
1334
|
private getStandardVertexAttribute;
|
|
1239
1335
|
private prepareDrawGeometryVertexBuffers;
|
|
1240
1336
|
private getDefaultInstanceAttributeBuffer;
|
|
@@ -1320,6 +1416,10 @@ interface GTAOTemporalOptions {
|
|
|
1320
1416
|
readonly neighborhoodClamp?: boolean;
|
|
1321
1417
|
}
|
|
1322
1418
|
interface GTAOOptions {
|
|
1419
|
+
/** Strength used by addCompositePass unless explicitly overridden. Defaults to 0.6. */
|
|
1420
|
+
readonly intensity?: number;
|
|
1421
|
+
/** Visibility exponent used by addCompositePass. Defaults to 1. */
|
|
1422
|
+
readonly power?: number;
|
|
1323
1423
|
readonly enabled?: boolean;
|
|
1324
1424
|
/** Resolution relative to the render target. Defaults to 1. */
|
|
1325
1425
|
readonly resolutionScale?: number;
|
|
@@ -1743,4 +1843,4 @@ declare class OutlineEffect {
|
|
|
1743
1843
|
dispose(): void;
|
|
1744
1844
|
}
|
|
1745
1845
|
|
|
1746
|
-
export { type BloomCompositeOptions, BloomEffect, type BloomOptions, ColorGradingEffect, type ColorGradingOptions, type ColorGradingRange, type ColorGradingVector, type CompiledNodeFullscreenShader, ComputeKernel, type ComputeKernelDescriptor, DEFAULT_WGSL_VERTEX_ATTRIBUTES, DepthOfFieldEffect, type DepthOfFieldOptions, type FXAACompositeOptions, FXAAEffect, type FXAAOptions, FrameGraphBuilder, type FrameGraphFullscreenPassDescriptor, type FrameGraphMaterialPassDescriptor, type FrameGraphNodeFullscreenPassDescriptor, type FrameGraphPassDescriptor, type FrameGraphTextureHandle, type GTAOCompositeOptions, type GTAODenoiseOptions, GTAOEffect, type GTAOInputs, type GTAOOptions, type GTAOQuality, type GTAOTemporalOptions, GTAO_PRESETS, MOTION_BLUR_PRESETS, MotionBlurEffect, MotionBlurMode, type MotionBlurOptions, type MotionBlurOverride, type MotionBlurOverrideHandle, type MotionBlurQuality, OutlineEffect, type OutlineInputs, type OutlineInstanceSelection, type OutlineOptions, RenderGraph, type RenderGraphContext, type RenderGraphExecutionObserver, type RenderGraphPass, type RendererColorTargetDescriptor, type RendererCustomPassContext, type RendererCustomPassDescriptor, type RendererFrameProfile, type RendererGraphBuilder, type RendererGraphBuilderContext, type RendererMaterialPassDescriptor, type RendererMaterialResolver, type RendererOptions, type RendererPassProfile, type RendererShadowMapDebugInfo, type RendererShadowMapDebugTextureInfo, type RendererTextureTargetDescriptor, type RendererVisibilityProfile, type SMAACompositeOptions, type SMAAEdgeDetectionMode, SMAAEffect, type SMAAOptions, type SMAAQualityPreset, SSREffect, type SSRInputs, type SSROptions, type ShaderDefineValue, type ShaderDefines, type StaticDrawSet, type StaticDrawSetOptions, TemporalAAEffect, type TemporalAAOptions, type ToneMappingMode, type ToonOutlineParameters, type UniformDefinition, type UniformType, type UniformValue, VOLUMETRIC_FOG_MATERIAL_WGSL, VOLUMETRIC_FOG_PRESETS, type VolumetricFogBlurOptions, VolumetricFogEffect, type VolumetricFogInputs, type VolumetricFogOptions, type VolumetricFogQuality, type VolumetricFogScatteringMode, type VolumetricFogTemporalOptions, VolumetricFogVolumeObject, type VolumetricFogVolumeSettings, type WGSLGraphTextureDimension, type WGSLGraphTextureInput, type WGSLSceneTextureSemantic, WGSLShaderMaterial, type WGSLShaderMaterialParameters, type WGSLShaderMaterialUniform, type WGSLShaderMaterialUniformInput, type WGSLStorageBufferBinding, type WGSLStorageBufferVisibility, type WGSLSupportedVertexFormat, type WGSLVertexAttributeBinding, WebGpuPMREMGenerator, WebGpuRenderer, buildParticleLightingShaderHeader, configureVolumetricFogMaterial };
|
|
1846
|
+
export { type BloomCompositeOptions, BloomEffect, type BloomOptions, ColorGradingEffect, type ColorGradingOptions, type ColorGradingRange, type ColorGradingVector, type CompiledNodeFullscreenShader, ComputeKernel, type ComputeKernelDescriptor, DEFAULT_WGSL_VERTEX_ATTRIBUTES, DepthOfFieldEffect, type DepthOfFieldOptions, type DetailCullingSettings, type DirectionalShadowUpdateOptions, type FXAACompositeOptions, FXAAEffect, type FXAAOptions, FrameGraphBuilder, type FrameGraphFullscreenPassDescriptor, type FrameGraphMaterialPassDescriptor, type FrameGraphNodeFullscreenPassDescriptor, type FrameGraphPassDescriptor, type FrameGraphTextureHandle, type GTAOCompositeOptions, type GTAODenoiseOptions, GTAOEffect, type GTAOInputs, type GTAOOptions, type GTAOQuality, type GTAOTemporalOptions, GTAO_PRESETS, MOTION_BLUR_PRESETS, MotionBlurEffect, MotionBlurMode, type MotionBlurOptions, type MotionBlurOverride, type MotionBlurOverrideHandle, type MotionBlurQuality, OutlineEffect, type OutlineInputs, type OutlineInstanceSelection, type OutlineOptions, type PipelineDiagnosticOrigin, RenderGraph, type RenderGraphContext, type RenderGraphExecutionObserver, type RenderGraphPass, type RendererColorTargetDescriptor, type RendererCustomPassContext, type RendererCustomPassDescriptor, type RendererFrameProfile, type RendererGraphBuilder, type RendererGraphBuilderContext, type RendererMaterialPassDescriptor, type RendererMaterialResolver, type RendererOptions, type RendererPassProfile, type RendererShadowMapDebugInfo, type RendererShadowMapDebugTextureInfo, type RendererTextureTargetDescriptor, type RendererVisibilityProfile, SCENE_COLOR_FORMAT, type SMAACompositeOptions, type SMAAEdgeDetectionMode, SMAAEffect, type SMAAOptions, type SMAAQualityPreset, SSREffect, type SSRInputs, type SSROptions, type ShaderDefineValue, type ShaderDefines, type StaticDrawSet, type StaticDrawSetOptions, TemporalAAEffect, type TemporalAAOptions, type ToneMappingMode, type ToonOutlineParameters, type UniformDefinition, type UniformType, type UniformValue, VOLUMETRIC_FOG_MATERIAL_WGSL, VOLUMETRIC_FOG_PRESETS, type VolumetricFogBlurOptions, VolumetricFogEffect, type VolumetricFogInputs, type VolumetricFogOptions, type VolumetricFogQuality, type VolumetricFogScatteringMode, type VolumetricFogTemporalOptions, VolumetricFogVolumeObject, type VolumetricFogVolumeSettings, type WGSLGraphTextureDimension, type WGSLGraphTextureInput, type WGSLSceneTextureSemantic, WGSLShaderMaterial, type WGSLShaderMaterialParameters, type WGSLShaderMaterialUniform, type WGSLShaderMaterialUniformInput, type WGSLStorageBufferBinding, type WGSLStorageBufferVisibility, type WGSLSupportedVertexFormat, type WGSLVertexAttributeBinding, WebGpuPMREMGenerator, WebGpuRenderer, buildParticleLightingShaderHeader, configureVolumetricFogMaterial, createComputePipelineAsync, createRenderPipelineAsync, registerPipelineDiagnosticOrigin, resolveDetailCulling, setObjectDetailCulling, setPipelineDiagnosticLoading };
|