@plasius/gpu-renderer 0.2.3 → 0.2.5
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 +33 -2
- package/README.md +30 -9
- package/dist/index.cjs +611 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +611 -68
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +83 -0
- package/src/wavefront-compute.js +640 -63
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;
|
|
@@ -331,6 +358,8 @@ export interface WavefrontPathTracingComputeConfig {
|
|
|
331
358
|
readonly environmentPortalCount: number;
|
|
332
359
|
readonly environmentPortalCapacity: number;
|
|
333
360
|
readonly environmentPortalMode: 0 | 1 | 2;
|
|
361
|
+
readonly environmentMap: WavefrontEnvironmentMapInput;
|
|
362
|
+
readonly deferredPathResolve: boolean;
|
|
334
363
|
readonly triangleCount: number;
|
|
335
364
|
readonly triangleCapacity: number;
|
|
336
365
|
readonly bvhNodeCount: number;
|
|
@@ -367,8 +396,11 @@ export interface WavefrontEnvironmentLightingInput {
|
|
|
367
396
|
readonly intensity?: number;
|
|
368
397
|
readonly mode?: number;
|
|
369
398
|
readonly exposure?: number;
|
|
399
|
+
readonly sunlitBaseline?: number;
|
|
400
|
+
readonly daylightBaseline?: number;
|
|
370
401
|
readonly environmentPortals?: readonly WavefrontEnvironmentPortalInput[];
|
|
371
402
|
readonly environmentPortalMode?: WavefrontEnvironmentPortalMode;
|
|
403
|
+
readonly environmentMap?: WavefrontEnvironmentMapInput;
|
|
372
404
|
}
|
|
373
405
|
|
|
374
406
|
export interface WavefrontEnvironmentLightingConfig {
|
|
@@ -381,6 +413,7 @@ export interface WavefrontEnvironmentLightingConfig {
|
|
|
381
413
|
readonly intensity: number;
|
|
382
414
|
readonly mode: number;
|
|
383
415
|
readonly exposure: number;
|
|
416
|
+
readonly sunlitBaseline: number;
|
|
384
417
|
}
|
|
385
418
|
|
|
386
419
|
export interface WavefrontPathTracingMemoryEstimate {
|
|
@@ -388,6 +421,7 @@ export interface WavefrontPathTracingMemoryEstimate {
|
|
|
388
421
|
readonly queuePairBytes: number;
|
|
389
422
|
readonly hitBytes: number;
|
|
390
423
|
readonly accumulationBytes: number;
|
|
424
|
+
readonly pathVertexBytes: number;
|
|
391
425
|
readonly sceneObjectBytes: number;
|
|
392
426
|
readonly triangleBytes: number;
|
|
393
427
|
readonly bvhNodeBytes: number;
|
|
@@ -400,6 +434,43 @@ export interface WavefrontPathTracingMemoryEstimate {
|
|
|
400
434
|
readonly totalHotBufferBytes: number;
|
|
401
435
|
}
|
|
402
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
|
+
|
|
403
474
|
export interface CreateWavefrontPathTracingComputeRendererOptions {
|
|
404
475
|
readonly canvas?: HTMLCanvasElement | string;
|
|
405
476
|
readonly navigator?: Navigator | { gpu?: GPU };
|
|
@@ -429,6 +500,11 @@ export interface CreateWavefrontPathTracingComputeRendererOptions {
|
|
|
429
500
|
readonly environmentLightPortals?: readonly WavefrontEnvironmentPortalInput[];
|
|
430
501
|
readonly environmentPortalMode?: WavefrontEnvironmentPortalMode;
|
|
431
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 };
|
|
432
508
|
readonly accelerationBuildMode?: WavefrontAccelerationBuildMode;
|
|
433
509
|
readonly camera?: WavefrontCameraOptions;
|
|
434
510
|
readonly environmentColor?: readonly [number, number, number, number?] | readonly number[];
|
|
@@ -475,6 +551,8 @@ export interface WavefrontPathTracingComputeRenderer {
|
|
|
475
551
|
emissiveTriangleCount: number;
|
|
476
552
|
environmentPortalCount: number;
|
|
477
553
|
environmentPortalMode: 0 | 1 | 2;
|
|
554
|
+
environmentMap: WavefrontEnvironmentMapSnapshot;
|
|
555
|
+
deferredPathResolve: boolean;
|
|
478
556
|
bvhNodeCount: number;
|
|
479
557
|
displayQuality: boolean;
|
|
480
558
|
accelerationBuildMode: WavefrontAccelerationBuildMode;
|
|
@@ -482,6 +560,7 @@ export interface WavefrontPathTracingComputeRenderer {
|
|
|
482
560
|
accelerationBuilt: boolean;
|
|
483
561
|
accelerationBuildCount: number;
|
|
484
562
|
frameConfigSlots: number;
|
|
563
|
+
gpuParallelism: WavefrontGpuParallelismDiagnostics;
|
|
485
564
|
memory: WavefrontPathTracingMemoryEstimate;
|
|
486
565
|
}>;
|
|
487
566
|
destroy(): void;
|
|
@@ -503,6 +582,8 @@ export interface WavefrontPathTracingComputeFrameStats {
|
|
|
503
582
|
readonly emissiveTriangleCount: number;
|
|
504
583
|
readonly environmentPortalCount: number;
|
|
505
584
|
readonly environmentPortalMode: 0 | 1 | 2;
|
|
585
|
+
readonly environmentMap: WavefrontEnvironmentMapSnapshot;
|
|
586
|
+
readonly deferredPathResolve: boolean;
|
|
506
587
|
readonly bvhNodeCount: number;
|
|
507
588
|
readonly displayQuality: boolean;
|
|
508
589
|
readonly accelerationBuildMode: WavefrontAccelerationBuildMode;
|
|
@@ -512,6 +593,7 @@ export interface WavefrontPathTracingComputeFrameStats {
|
|
|
512
593
|
readonly accelerationBuildCount: number;
|
|
513
594
|
readonly commandSubmissions: number;
|
|
514
595
|
readonly frameConfigSlots: number;
|
|
596
|
+
readonly gpuParallelism: WavefrontGpuParallelismDiagnostics;
|
|
515
597
|
readonly memory: WavefrontPathTracingMemoryEstimate;
|
|
516
598
|
readonly outputProbe?: Readonly<{
|
|
517
599
|
x: number;
|
|
@@ -661,6 +743,7 @@ export const wavefrontPathTracingComputeLimits: Readonly<{
|
|
|
661
743
|
emissiveTriangleMetadataRecordBytes: 48;
|
|
662
744
|
environmentPortalRecordBytes: 96;
|
|
663
745
|
accumulationRecordBytes: 16;
|
|
746
|
+
pathVertexRecordBytes: 16;
|
|
664
747
|
counterRecordBytes: 32;
|
|
665
748
|
indirectDispatchRecordBytes: 12;
|
|
666
749
|
}>;
|