@plasius/gpu-renderer 0.2.2 → 0.2.4
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.md +28 -5
- package/README.md +36 -11
- package/dist/index.cjs +749 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +749 -71
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +88 -0
- package/src/wavefront-compute.js +785 -66
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -308,6 +308,33 @@ export interface WavefrontEnvironmentPortalRecord {
|
|
|
308
308
|
readonly color: readonly [number, number, number, number] | readonly number[];
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
export interface WavefrontEnvironmentMapInput {
|
|
312
|
+
readonly enabled?: boolean;
|
|
313
|
+
readonly width?: number;
|
|
314
|
+
readonly height?: number;
|
|
315
|
+
readonly projection?: "equirectangular" | string;
|
|
316
|
+
readonly format?: GPUTextureFormat | "rgba16float";
|
|
317
|
+
readonly texture?: GPUTexture;
|
|
318
|
+
readonly view?: GPUTextureView;
|
|
319
|
+
readonly sampler?: GPUSampler;
|
|
320
|
+
readonly data?: readonly number[] | Float32Array | Uint16Array | Uint8Array;
|
|
321
|
+
readonly intensity?: number;
|
|
322
|
+
readonly radianceScale?: number;
|
|
323
|
+
readonly rotationRadians?: number;
|
|
324
|
+
readonly rotation?: number;
|
|
325
|
+
readonly ambientStrength?: number;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface WavefrontEnvironmentMapSnapshot {
|
|
329
|
+
readonly enabled: boolean;
|
|
330
|
+
readonly width: number;
|
|
331
|
+
readonly height: number;
|
|
332
|
+
readonly projection: string;
|
|
333
|
+
readonly intensity: number;
|
|
334
|
+
readonly rotationRadians: number;
|
|
335
|
+
readonly ambientStrength: number;
|
|
336
|
+
}
|
|
337
|
+
|
|
311
338
|
export interface WavefrontPathTracingComputeConfig {
|
|
312
339
|
readonly mode: typeof rendererWavefrontComputeMode;
|
|
313
340
|
readonly width: number;
|
|
@@ -315,6 +342,7 @@ export interface WavefrontPathTracingComputeConfig {
|
|
|
315
342
|
readonly maxDepth: number;
|
|
316
343
|
readonly tileSize: number;
|
|
317
344
|
readonly samplesPerPixel: number;
|
|
345
|
+
readonly maxFramePassesPerSubmission: number;
|
|
318
346
|
readonly tilePixelCapacity: number;
|
|
319
347
|
readonly sceneObjects: readonly WavefrontSceneObject[];
|
|
320
348
|
readonly sceneObjectCount: number;
|
|
@@ -330,6 +358,8 @@ export interface WavefrontPathTracingComputeConfig {
|
|
|
330
358
|
readonly environmentPortalCount: number;
|
|
331
359
|
readonly environmentPortalCapacity: number;
|
|
332
360
|
readonly environmentPortalMode: 0 | 1 | 2;
|
|
361
|
+
readonly environmentMap: WavefrontEnvironmentMapInput;
|
|
362
|
+
readonly deferredPathResolve: boolean;
|
|
333
363
|
readonly triangleCount: number;
|
|
334
364
|
readonly triangleCapacity: number;
|
|
335
365
|
readonly bvhNodeCount: number;
|
|
@@ -366,8 +396,11 @@ export interface WavefrontEnvironmentLightingInput {
|
|
|
366
396
|
readonly intensity?: number;
|
|
367
397
|
readonly mode?: number;
|
|
368
398
|
readonly exposure?: number;
|
|
399
|
+
readonly sunlitBaseline?: number;
|
|
400
|
+
readonly daylightBaseline?: number;
|
|
369
401
|
readonly environmentPortals?: readonly WavefrontEnvironmentPortalInput[];
|
|
370
402
|
readonly environmentPortalMode?: WavefrontEnvironmentPortalMode;
|
|
403
|
+
readonly environmentMap?: WavefrontEnvironmentMapInput;
|
|
371
404
|
}
|
|
372
405
|
|
|
373
406
|
export interface WavefrontEnvironmentLightingConfig {
|
|
@@ -380,6 +413,7 @@ export interface WavefrontEnvironmentLightingConfig {
|
|
|
380
413
|
readonly intensity: number;
|
|
381
414
|
readonly mode: number;
|
|
382
415
|
readonly exposure: number;
|
|
416
|
+
readonly sunlitBaseline: number;
|
|
383
417
|
}
|
|
384
418
|
|
|
385
419
|
export interface WavefrontPathTracingMemoryEstimate {
|
|
@@ -387,6 +421,7 @@ export interface WavefrontPathTracingMemoryEstimate {
|
|
|
387
421
|
readonly queuePairBytes: number;
|
|
388
422
|
readonly hitBytes: number;
|
|
389
423
|
readonly accumulationBytes: number;
|
|
424
|
+
readonly pathVertexBytes: number;
|
|
390
425
|
readonly sceneObjectBytes: number;
|
|
391
426
|
readonly triangleBytes: number;
|
|
392
427
|
readonly bvhNodeBytes: number;
|
|
@@ -399,6 +434,43 @@ export interface WavefrontPathTracingMemoryEstimate {
|
|
|
399
434
|
readonly totalHotBufferBytes: number;
|
|
400
435
|
}
|
|
401
436
|
|
|
437
|
+
export interface WavefrontGpuParallelismDiagnostics {
|
|
438
|
+
readonly physicalCoreCount: number | null;
|
|
439
|
+
readonly physicalCoreCountAvailable: boolean;
|
|
440
|
+
readonly physicalCoreCountUnavailableReason: string;
|
|
441
|
+
readonly adapterInfo: Readonly<{
|
|
442
|
+
readonly vendor: string;
|
|
443
|
+
readonly architecture: string;
|
|
444
|
+
readonly device: string;
|
|
445
|
+
readonly description: string;
|
|
446
|
+
}> | null;
|
|
447
|
+
readonly adapterLimits: Readonly<{
|
|
448
|
+
readonly maxComputeInvocationsPerWorkgroup: number | null;
|
|
449
|
+
readonly maxComputeWorkgroupSizeX: number | null;
|
|
450
|
+
readonly maxComputeWorkgroupSizeY: number | null;
|
|
451
|
+
readonly maxComputeWorkgroupSizeZ: number | null;
|
|
452
|
+
readonly maxComputeWorkgroupsPerDimension: number | null;
|
|
453
|
+
readonly maxStorageBuffersPerShaderStage: number | null;
|
|
454
|
+
readonly maxStorageBufferBindingSize: number | null;
|
|
455
|
+
}>;
|
|
456
|
+
readonly configuredWorkgroupSize: number;
|
|
457
|
+
readonly directDispatches: number;
|
|
458
|
+
readonly directWorkgroups: number;
|
|
459
|
+
readonly directShaderInvocations: number;
|
|
460
|
+
readonly multiWorkgroupDispatches: number;
|
|
461
|
+
readonly largestDirectWorkgroupsPerDispatch: number;
|
|
462
|
+
readonly indirectDispatches: number;
|
|
463
|
+
readonly estimatedIndirectWorkgroupsUpperBound: number;
|
|
464
|
+
readonly estimatedIndirectShaderInvocationsUpperBound: number;
|
|
465
|
+
readonly indirectDispatchesWithMultiWorkgroupCapacity: number;
|
|
466
|
+
readonly largestEstimatedIndirectWorkgroupsPerDispatch: number;
|
|
467
|
+
readonly totalEstimatedWorkgroupsUpperBound: number;
|
|
468
|
+
readonly totalEstimatedShaderInvocationsUpperBound: number;
|
|
469
|
+
readonly exposesMultiWorkgroupParallelism: boolean;
|
|
470
|
+
readonly likelyUsesMoreThanOnePhysicalGpuCore: boolean | null;
|
|
471
|
+
readonly coreUtilizationStatus: "not-exposed-by-webgpu";
|
|
472
|
+
}
|
|
473
|
+
|
|
402
474
|
export interface CreateWavefrontPathTracingComputeRendererOptions {
|
|
403
475
|
readonly canvas?: HTMLCanvasElement | string;
|
|
404
476
|
readonly navigator?: Navigator | { gpu?: GPU };
|
|
@@ -413,6 +485,7 @@ export interface CreateWavefrontPathTracingComputeRendererOptions {
|
|
|
413
485
|
readonly maxDepth?: number;
|
|
414
486
|
readonly tileSize?: number;
|
|
415
487
|
readonly samplesPerPixel?: number;
|
|
488
|
+
readonly maxFramePassesPerSubmission?: number;
|
|
416
489
|
readonly tilePixelCapacity?: number;
|
|
417
490
|
readonly sceneObjectCapacity?: number;
|
|
418
491
|
readonly sceneObjects?: readonly WavefrontSceneObjectInput[];
|
|
@@ -427,6 +500,11 @@ export interface CreateWavefrontPathTracingComputeRendererOptions {
|
|
|
427
500
|
readonly environmentLightPortals?: readonly WavefrontEnvironmentPortalInput[];
|
|
428
501
|
readonly environmentPortalMode?: WavefrontEnvironmentPortalMode;
|
|
429
502
|
readonly portalMode?: WavefrontEnvironmentPortalMode;
|
|
503
|
+
readonly environmentMap?: WavefrontEnvironmentMapInput;
|
|
504
|
+
readonly environmentTexture?: WavefrontEnvironmentMapInput;
|
|
505
|
+
readonly deferredPathResolve?: boolean;
|
|
506
|
+
readonly deferredResolve?: boolean;
|
|
507
|
+
readonly pathResolve?: { readonly deferred?: boolean };
|
|
430
508
|
readonly accelerationBuildMode?: WavefrontAccelerationBuildMode;
|
|
431
509
|
readonly camera?: WavefrontCameraOptions;
|
|
432
510
|
readonly environmentColor?: readonly [number, number, number, number?] | readonly number[];
|
|
@@ -458,6 +536,7 @@ export interface WavefrontPathTracingComputeRenderer {
|
|
|
458
536
|
}>
|
|
459
537
|
>;
|
|
460
538
|
updateSceneObjects(sceneObjects: readonly WavefrontSceneObjectInput[]): WavefrontPathTracingComputeConfig;
|
|
539
|
+
updateCamera(camera: WavefrontCameraOptions): WavefrontPathTracingComputeConfig;
|
|
461
540
|
getSnapshot(): Readonly<{
|
|
462
541
|
frame: number;
|
|
463
542
|
width: number;
|
|
@@ -466,11 +545,14 @@ export interface WavefrontPathTracingComputeRenderer {
|
|
|
466
545
|
tiles: number;
|
|
467
546
|
tileSize: number;
|
|
468
547
|
samplesPerPixel: number;
|
|
548
|
+
maxFramePassesPerSubmission: number;
|
|
469
549
|
sceneObjectCount: number;
|
|
470
550
|
triangleCount: number;
|
|
471
551
|
emissiveTriangleCount: number;
|
|
472
552
|
environmentPortalCount: number;
|
|
473
553
|
environmentPortalMode: 0 | 1 | 2;
|
|
554
|
+
environmentMap: WavefrontEnvironmentMapSnapshot;
|
|
555
|
+
deferredPathResolve: boolean;
|
|
474
556
|
bvhNodeCount: number;
|
|
475
557
|
displayQuality: boolean;
|
|
476
558
|
accelerationBuildMode: WavefrontAccelerationBuildMode;
|
|
@@ -478,6 +560,7 @@ export interface WavefrontPathTracingComputeRenderer {
|
|
|
478
560
|
accelerationBuilt: boolean;
|
|
479
561
|
accelerationBuildCount: number;
|
|
480
562
|
frameConfigSlots: number;
|
|
563
|
+
gpuParallelism: WavefrontGpuParallelismDiagnostics;
|
|
481
564
|
memory: WavefrontPathTracingMemoryEstimate;
|
|
482
565
|
}>;
|
|
483
566
|
destroy(): void;
|
|
@@ -491,6 +574,7 @@ export interface WavefrontPathTracingComputeFrameStats {
|
|
|
491
574
|
readonly tiles: number;
|
|
492
575
|
readonly tileSize: number;
|
|
493
576
|
readonly samplesPerPixel: number;
|
|
577
|
+
readonly maxFramePassesPerSubmission: number;
|
|
494
578
|
readonly screenRays: number;
|
|
495
579
|
readonly primaryRays: number;
|
|
496
580
|
readonly sceneObjectCount: number;
|
|
@@ -498,6 +582,8 @@ export interface WavefrontPathTracingComputeFrameStats {
|
|
|
498
582
|
readonly emissiveTriangleCount: number;
|
|
499
583
|
readonly environmentPortalCount: number;
|
|
500
584
|
readonly environmentPortalMode: 0 | 1 | 2;
|
|
585
|
+
readonly environmentMap: WavefrontEnvironmentMapSnapshot;
|
|
586
|
+
readonly deferredPathResolve: boolean;
|
|
501
587
|
readonly bvhNodeCount: number;
|
|
502
588
|
readonly displayQuality: boolean;
|
|
503
589
|
readonly accelerationBuildMode: WavefrontAccelerationBuildMode;
|
|
@@ -507,6 +593,7 @@ export interface WavefrontPathTracingComputeFrameStats {
|
|
|
507
593
|
readonly accelerationBuildCount: number;
|
|
508
594
|
readonly commandSubmissions: number;
|
|
509
595
|
readonly frameConfigSlots: number;
|
|
596
|
+
readonly gpuParallelism: WavefrontGpuParallelismDiagnostics;
|
|
510
597
|
readonly memory: WavefrontPathTracingMemoryEstimate;
|
|
511
598
|
readonly outputProbe?: Readonly<{
|
|
512
599
|
x: number;
|
|
@@ -656,6 +743,7 @@ export const wavefrontPathTracingComputeLimits: Readonly<{
|
|
|
656
743
|
emissiveTriangleMetadataRecordBytes: 48;
|
|
657
744
|
environmentPortalRecordBytes: 96;
|
|
658
745
|
accumulationRecordBytes: 16;
|
|
746
|
+
pathVertexRecordBytes: 16;
|
|
659
747
|
counterRecordBytes: 32;
|
|
660
748
|
indirectDispatchRecordBytes: 12;
|
|
661
749
|
}>;
|