@plasius/gpu-lighting 0.1.4 → 0.1.7

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/dist/index.cjs CHANGED
@@ -32,7 +32,10 @@ __export(index_exports, {
32
32
  defaultLightingProfile: () => defaultLightingProfile,
33
33
  defaultLightingTechnique: () => defaultLightingTechnique,
34
34
  getLightingProfile: () => getLightingProfile,
35
+ getLightingProfileWorkerManifest: () => getLightingProfileWorkerManifest,
35
36
  getLightingTechnique: () => getLightingTechnique,
37
+ getLightingTechniqueWorkerManifest: () => getLightingTechniqueWorkerManifest,
38
+ lightingDebugOwner: () => lightingDebugOwner,
36
39
  lightingJobLabels: () => lightingJobLabels,
37
40
  lightingJobs: () => lightingJobs,
38
41
  lightingPreludeWgslUrl: () => lightingPreludeWgslUrl,
@@ -40,12 +43,16 @@ __export(index_exports, {
40
43
  lightingProfiles: () => lightingProfiles,
41
44
  lightingTechniqueNames: () => lightingTechniqueNames,
42
45
  lightingTechniques: () => lightingTechniques,
46
+ lightingWorkerManifests: () => lightingWorkerManifests,
47
+ lightingWorkerQueueClass: () => lightingWorkerQueueClass,
43
48
  loadLightingJobs: () => loadLightingJobs,
44
49
  loadLightingPreludeWgsl: () => loadLightingPreludeWgsl,
45
50
  loadLightingProfile: () => loadLightingProfile,
51
+ loadLightingProfileWorkerPlan: () => loadLightingProfileWorkerPlan,
46
52
  loadLightingTechniqueJobWgsl: () => loadLightingTechniqueJobWgsl,
47
53
  loadLightingTechniqueJobs: () => loadLightingTechniqueJobs,
48
- loadLightingTechniquePreludeWgsl: () => loadLightingTechniquePreludeWgsl
54
+ loadLightingTechniquePreludeWgsl: () => loadLightingTechniquePreludeWgsl,
55
+ loadLightingTechniqueWorkerBundle: () => loadLightingTechniqueWorkerBundle
49
56
  });
50
57
  module.exports = __toCommonJS(index_exports);
51
58
  var baseUrl = (() => {
@@ -157,6 +164,649 @@ var lightingProfiles = Object.freeze(
157
164
  );
158
165
  var lightingProfileNames = Object.freeze(Object.keys(lightingProfiles));
159
166
  var defaultLightingProfile = "realtime";
167
+ var lightingWorkerQueueClass = "lighting";
168
+ var lightingDebugOwner = "lighting";
169
+ function buildWorkerBudgetLevels(jobType, queueClass, presets) {
170
+ return Object.freeze([
171
+ Object.freeze({
172
+ id: "low",
173
+ estimatedCostMs: presets.low.estimatedCostMs,
174
+ config: Object.freeze({
175
+ maxDispatchesPerFrame: presets.low.maxDispatchesPerFrame,
176
+ maxJobsPerDispatch: presets.low.maxJobsPerDispatch,
177
+ cadenceDivisor: presets.low.cadenceDivisor,
178
+ workgroupScale: presets.low.workgroupScale,
179
+ maxQueueDepth: presets.low.maxQueueDepth,
180
+ metadata: Object.freeze({
181
+ owner: lightingDebugOwner,
182
+ queueClass,
183
+ jobType,
184
+ quality: "low"
185
+ })
186
+ })
187
+ }),
188
+ Object.freeze({
189
+ id: "medium",
190
+ estimatedCostMs: presets.medium.estimatedCostMs,
191
+ config: Object.freeze({
192
+ maxDispatchesPerFrame: presets.medium.maxDispatchesPerFrame,
193
+ maxJobsPerDispatch: presets.medium.maxJobsPerDispatch,
194
+ cadenceDivisor: presets.medium.cadenceDivisor,
195
+ workgroupScale: presets.medium.workgroupScale,
196
+ maxQueueDepth: presets.medium.maxQueueDepth,
197
+ metadata: Object.freeze({
198
+ owner: lightingDebugOwner,
199
+ queueClass,
200
+ jobType,
201
+ quality: "medium"
202
+ })
203
+ })
204
+ }),
205
+ Object.freeze({
206
+ id: "high",
207
+ estimatedCostMs: presets.high.estimatedCostMs,
208
+ config: Object.freeze({
209
+ maxDispatchesPerFrame: presets.high.maxDispatchesPerFrame,
210
+ maxJobsPerDispatch: presets.high.maxJobsPerDispatch,
211
+ cadenceDivisor: presets.high.cadenceDivisor,
212
+ workgroupScale: presets.high.workgroupScale,
213
+ maxQueueDepth: presets.high.maxQueueDepth,
214
+ metadata: Object.freeze({
215
+ owner: lightingDebugOwner,
216
+ queueClass,
217
+ jobType,
218
+ quality: "high"
219
+ })
220
+ })
221
+ })
222
+ ]);
223
+ }
224
+ var lightingWorkerSpecPresets = {
225
+ hybrid: {
226
+ suggestedAllocationIds: [
227
+ "lighting.hybrid.radiance-cache",
228
+ "lighting.hybrid.reflection-history",
229
+ "lighting.hybrid.shadow-atlas"
230
+ ],
231
+ jobs: {
232
+ directLighting: {
233
+ domain: "lighting",
234
+ importance: "high",
235
+ levels: buildWorkerBudgetLevels(
236
+ "lighting.hybrid.directLighting",
237
+ lightingWorkerQueueClass,
238
+ {
239
+ low: {
240
+ estimatedCostMs: 0.5,
241
+ maxDispatchesPerFrame: 1,
242
+ maxJobsPerDispatch: 64,
243
+ cadenceDivisor: 2,
244
+ workgroupScale: 0.5,
245
+ maxQueueDepth: 128
246
+ },
247
+ medium: {
248
+ estimatedCostMs: 0.9,
249
+ maxDispatchesPerFrame: 1,
250
+ maxJobsPerDispatch: 128,
251
+ cadenceDivisor: 1,
252
+ workgroupScale: 0.75,
253
+ maxQueueDepth: 256
254
+ },
255
+ high: {
256
+ estimatedCostMs: 1.2,
257
+ maxDispatchesPerFrame: 2,
258
+ maxJobsPerDispatch: 256,
259
+ cadenceDivisor: 1,
260
+ workgroupScale: 1,
261
+ maxQueueDepth: 512
262
+ }
263
+ }
264
+ ),
265
+ suggestedAllocationIds: ["lighting.hybrid.shadow-atlas"]
266
+ },
267
+ screenTrace: {
268
+ domain: "reflections",
269
+ importance: "high",
270
+ levels: buildWorkerBudgetLevels(
271
+ "lighting.hybrid.screenTrace",
272
+ lightingWorkerQueueClass,
273
+ {
274
+ low: {
275
+ estimatedCostMs: 0.8,
276
+ maxDispatchesPerFrame: 1,
277
+ maxJobsPerDispatch: 32,
278
+ cadenceDivisor: 3,
279
+ workgroupScale: 0.4,
280
+ maxQueueDepth: 96
281
+ },
282
+ medium: {
283
+ estimatedCostMs: 1.5,
284
+ maxDispatchesPerFrame: 1,
285
+ maxJobsPerDispatch: 96,
286
+ cadenceDivisor: 2,
287
+ workgroupScale: 0.7,
288
+ maxQueueDepth: 192
289
+ },
290
+ high: {
291
+ estimatedCostMs: 2.2,
292
+ maxDispatchesPerFrame: 2,
293
+ maxJobsPerDispatch: 192,
294
+ cadenceDivisor: 1,
295
+ workgroupScale: 1,
296
+ maxQueueDepth: 384
297
+ }
298
+ }
299
+ ),
300
+ suggestedAllocationIds: ["lighting.hybrid.reflection-history"]
301
+ },
302
+ radianceCache: {
303
+ domain: "lighting",
304
+ importance: "high",
305
+ levels: buildWorkerBudgetLevels(
306
+ "lighting.hybrid.radianceCache",
307
+ lightingWorkerQueueClass,
308
+ {
309
+ low: {
310
+ estimatedCostMs: 0.7,
311
+ maxDispatchesPerFrame: 1,
312
+ maxJobsPerDispatch: 32,
313
+ cadenceDivisor: 2,
314
+ workgroupScale: 0.5,
315
+ maxQueueDepth: 96
316
+ },
317
+ medium: {
318
+ estimatedCostMs: 1.2,
319
+ maxDispatchesPerFrame: 1,
320
+ maxJobsPerDispatch: 64,
321
+ cadenceDivisor: 1,
322
+ workgroupScale: 0.75,
323
+ maxQueueDepth: 192
324
+ },
325
+ high: {
326
+ estimatedCostMs: 1.8,
327
+ maxDispatchesPerFrame: 2,
328
+ maxJobsPerDispatch: 128,
329
+ cadenceDivisor: 1,
330
+ workgroupScale: 1,
331
+ maxQueueDepth: 256
332
+ }
333
+ }
334
+ ),
335
+ suggestedAllocationIds: ["lighting.hybrid.radiance-cache"]
336
+ },
337
+ finalGather: {
338
+ domain: "lighting",
339
+ importance: "critical",
340
+ levels: buildWorkerBudgetLevels(
341
+ "lighting.hybrid.finalGather",
342
+ lightingWorkerQueueClass,
343
+ {
344
+ low: {
345
+ estimatedCostMs: 1,
346
+ maxDispatchesPerFrame: 1,
347
+ maxJobsPerDispatch: 48,
348
+ cadenceDivisor: 2,
349
+ workgroupScale: 0.5,
350
+ maxQueueDepth: 128
351
+ },
352
+ medium: {
353
+ estimatedCostMs: 1.8,
354
+ maxDispatchesPerFrame: 1,
355
+ maxJobsPerDispatch: 96,
356
+ cadenceDivisor: 1,
357
+ workgroupScale: 0.75,
358
+ maxQueueDepth: 256
359
+ },
360
+ high: {
361
+ estimatedCostMs: 2.6,
362
+ maxDispatchesPerFrame: 2,
363
+ maxJobsPerDispatch: 192,
364
+ cadenceDivisor: 1,
365
+ workgroupScale: 1,
366
+ maxQueueDepth: 384
367
+ }
368
+ }
369
+ ),
370
+ suggestedAllocationIds: [
371
+ "lighting.hybrid.radiance-cache",
372
+ "lighting.hybrid.reflection-history"
373
+ ]
374
+ },
375
+ reflectionResolve: {
376
+ domain: "reflections",
377
+ importance: "high",
378
+ levels: buildWorkerBudgetLevels(
379
+ "lighting.hybrid.reflectionResolve",
380
+ lightingWorkerQueueClass,
381
+ {
382
+ low: {
383
+ estimatedCostMs: 0.4,
384
+ maxDispatchesPerFrame: 1,
385
+ maxJobsPerDispatch: 32,
386
+ cadenceDivisor: 2,
387
+ workgroupScale: 0.5,
388
+ maxQueueDepth: 96
389
+ },
390
+ medium: {
391
+ estimatedCostMs: 0.8,
392
+ maxDispatchesPerFrame: 1,
393
+ maxJobsPerDispatch: 64,
394
+ cadenceDivisor: 1,
395
+ workgroupScale: 0.75,
396
+ maxQueueDepth: 192
397
+ },
398
+ high: {
399
+ estimatedCostMs: 1.2,
400
+ maxDispatchesPerFrame: 1,
401
+ maxJobsPerDispatch: 128,
402
+ cadenceDivisor: 1,
403
+ workgroupScale: 1,
404
+ maxQueueDepth: 256
405
+ }
406
+ }
407
+ ),
408
+ suggestedAllocationIds: ["lighting.hybrid.reflection-history"]
409
+ }
410
+ }
411
+ },
412
+ pathtracer: {
413
+ suggestedAllocationIds: [
414
+ "lighting.pathtracer.path-state",
415
+ "lighting.pathtracer.accumulation",
416
+ "lighting.pathtracer.denoise-history"
417
+ ],
418
+ jobs: {
419
+ pathTrace: {
420
+ domain: "lighting",
421
+ importance: "critical",
422
+ levels: buildWorkerBudgetLevels(
423
+ "lighting.pathtracer.pathTrace",
424
+ lightingWorkerQueueClass,
425
+ {
426
+ low: {
427
+ estimatedCostMs: 1.2,
428
+ maxDispatchesPerFrame: 1,
429
+ maxJobsPerDispatch: 16,
430
+ cadenceDivisor: 3,
431
+ workgroupScale: 0.45,
432
+ maxQueueDepth: 48
433
+ },
434
+ medium: {
435
+ estimatedCostMs: 2.3,
436
+ maxDispatchesPerFrame: 1,
437
+ maxJobsPerDispatch: 32,
438
+ cadenceDivisor: 2,
439
+ workgroupScale: 0.7,
440
+ maxQueueDepth: 96
441
+ },
442
+ high: {
443
+ estimatedCostMs: 3.8,
444
+ maxDispatchesPerFrame: 2,
445
+ maxJobsPerDispatch: 64,
446
+ cadenceDivisor: 1,
447
+ workgroupScale: 1,
448
+ maxQueueDepth: 128
449
+ }
450
+ }
451
+ ),
452
+ suggestedAllocationIds: ["lighting.pathtracer.path-state"]
453
+ },
454
+ accumulate: {
455
+ domain: "lighting",
456
+ importance: "medium",
457
+ levels: buildWorkerBudgetLevels(
458
+ "lighting.pathtracer.accumulate",
459
+ lightingWorkerQueueClass,
460
+ {
461
+ low: {
462
+ estimatedCostMs: 0.4,
463
+ maxDispatchesPerFrame: 1,
464
+ maxJobsPerDispatch: 16,
465
+ cadenceDivisor: 2,
466
+ workgroupScale: 0.5,
467
+ maxQueueDepth: 32
468
+ },
469
+ medium: {
470
+ estimatedCostMs: 0.8,
471
+ maxDispatchesPerFrame: 1,
472
+ maxJobsPerDispatch: 32,
473
+ cadenceDivisor: 1,
474
+ workgroupScale: 0.75,
475
+ maxQueueDepth: 64
476
+ },
477
+ high: {
478
+ estimatedCostMs: 1.1,
479
+ maxDispatchesPerFrame: 1,
480
+ maxJobsPerDispatch: 64,
481
+ cadenceDivisor: 1,
482
+ workgroupScale: 1,
483
+ maxQueueDepth: 96
484
+ }
485
+ }
486
+ ),
487
+ suggestedAllocationIds: ["lighting.pathtracer.accumulation"]
488
+ },
489
+ denoise: {
490
+ domain: "post-processing",
491
+ importance: "high",
492
+ levels: buildWorkerBudgetLevels(
493
+ "lighting.pathtracer.denoise",
494
+ lightingWorkerQueueClass,
495
+ {
496
+ low: {
497
+ estimatedCostMs: 0.4,
498
+ maxDispatchesPerFrame: 1,
499
+ maxJobsPerDispatch: 16,
500
+ cadenceDivisor: 2,
501
+ workgroupScale: 0.5,
502
+ maxQueueDepth: 32
503
+ },
504
+ medium: {
505
+ estimatedCostMs: 0.9,
506
+ maxDispatchesPerFrame: 1,
507
+ maxJobsPerDispatch: 32,
508
+ cadenceDivisor: 1,
509
+ workgroupScale: 0.75,
510
+ maxQueueDepth: 64
511
+ },
512
+ high: {
513
+ estimatedCostMs: 1.4,
514
+ maxDispatchesPerFrame: 1,
515
+ maxJobsPerDispatch: 64,
516
+ cadenceDivisor: 1,
517
+ workgroupScale: 1,
518
+ maxQueueDepth: 96
519
+ }
520
+ }
521
+ ),
522
+ suggestedAllocationIds: ["lighting.pathtracer.denoise-history"]
523
+ }
524
+ }
525
+ },
526
+ volumetrics: {
527
+ suggestedAllocationIds: [
528
+ "lighting.volumetrics.froxel-grid",
529
+ "lighting.volumetrics.shadow-history"
530
+ ],
531
+ jobs: {
532
+ froxelIntegrate: {
533
+ domain: "volumetrics",
534
+ importance: "high",
535
+ levels: buildWorkerBudgetLevels(
536
+ "lighting.volumetrics.froxelIntegrate",
537
+ lightingWorkerQueueClass,
538
+ {
539
+ low: {
540
+ estimatedCostMs: 0.6,
541
+ maxDispatchesPerFrame: 1,
542
+ maxJobsPerDispatch: 32,
543
+ cadenceDivisor: 2,
544
+ workgroupScale: 0.5,
545
+ maxQueueDepth: 96
546
+ },
547
+ medium: {
548
+ estimatedCostMs: 1.1,
549
+ maxDispatchesPerFrame: 1,
550
+ maxJobsPerDispatch: 64,
551
+ cadenceDivisor: 1,
552
+ workgroupScale: 0.75,
553
+ maxQueueDepth: 192
554
+ },
555
+ high: {
556
+ estimatedCostMs: 1.7,
557
+ maxDispatchesPerFrame: 2,
558
+ maxJobsPerDispatch: 128,
559
+ cadenceDivisor: 1,
560
+ workgroupScale: 1,
561
+ maxQueueDepth: 256
562
+ }
563
+ }
564
+ ),
565
+ suggestedAllocationIds: ["lighting.volumetrics.froxel-grid"]
566
+ },
567
+ volumetricShadow: {
568
+ domain: "volumetrics",
569
+ importance: "high",
570
+ levels: buildWorkerBudgetLevels(
571
+ "lighting.volumetrics.volumetricShadow",
572
+ lightingWorkerQueueClass,
573
+ {
574
+ low: {
575
+ estimatedCostMs: 0.5,
576
+ maxDispatchesPerFrame: 1,
577
+ maxJobsPerDispatch: 24,
578
+ cadenceDivisor: 2,
579
+ workgroupScale: 0.5,
580
+ maxQueueDepth: 64
581
+ },
582
+ medium: {
583
+ estimatedCostMs: 0.9,
584
+ maxDispatchesPerFrame: 1,
585
+ maxJobsPerDispatch: 48,
586
+ cadenceDivisor: 1,
587
+ workgroupScale: 0.75,
588
+ maxQueueDepth: 128
589
+ },
590
+ high: {
591
+ estimatedCostMs: 1.3,
592
+ maxDispatchesPerFrame: 1,
593
+ maxJobsPerDispatch: 96,
594
+ cadenceDivisor: 1,
595
+ workgroupScale: 1,
596
+ maxQueueDepth: 192
597
+ }
598
+ }
599
+ ),
600
+ suggestedAllocationIds: ["lighting.volumetrics.shadow-history"]
601
+ }
602
+ }
603
+ },
604
+ hdri: {
605
+ suggestedAllocationIds: [
606
+ "lighting.hdri.cubemap",
607
+ "lighting.hdri.prefilter",
608
+ "lighting.hdri.brdf-lut"
609
+ ],
610
+ jobs: {
611
+ irradianceConvolution: {
612
+ domain: "lighting",
613
+ importance: "medium",
614
+ levels: buildWorkerBudgetLevels(
615
+ "lighting.hdri.irradianceConvolution",
616
+ lightingWorkerQueueClass,
617
+ {
618
+ low: {
619
+ estimatedCostMs: 0.3,
620
+ maxDispatchesPerFrame: 1,
621
+ maxJobsPerDispatch: 8,
622
+ cadenceDivisor: 3,
623
+ workgroupScale: 0.5,
624
+ maxQueueDepth: 16
625
+ },
626
+ medium: {
627
+ estimatedCostMs: 0.5,
628
+ maxDispatchesPerFrame: 1,
629
+ maxJobsPerDispatch: 16,
630
+ cadenceDivisor: 2,
631
+ workgroupScale: 0.75,
632
+ maxQueueDepth: 32
633
+ },
634
+ high: {
635
+ estimatedCostMs: 0.8,
636
+ maxDispatchesPerFrame: 1,
637
+ maxJobsPerDispatch: 32,
638
+ cadenceDivisor: 1,
639
+ workgroupScale: 1,
640
+ maxQueueDepth: 48
641
+ }
642
+ }
643
+ ),
644
+ suggestedAllocationIds: ["lighting.hdri.cubemap"]
645
+ },
646
+ specularPrefilter: {
647
+ domain: "lighting",
648
+ importance: "medium",
649
+ levels: buildWorkerBudgetLevels(
650
+ "lighting.hdri.specularPrefilter",
651
+ lightingWorkerQueueClass,
652
+ {
653
+ low: {
654
+ estimatedCostMs: 0.4,
655
+ maxDispatchesPerFrame: 1,
656
+ maxJobsPerDispatch: 8,
657
+ cadenceDivisor: 3,
658
+ workgroupScale: 0.5,
659
+ maxQueueDepth: 16
660
+ },
661
+ medium: {
662
+ estimatedCostMs: 0.7,
663
+ maxDispatchesPerFrame: 1,
664
+ maxJobsPerDispatch: 16,
665
+ cadenceDivisor: 2,
666
+ workgroupScale: 0.75,
667
+ maxQueueDepth: 32
668
+ },
669
+ high: {
670
+ estimatedCostMs: 1,
671
+ maxDispatchesPerFrame: 1,
672
+ maxJobsPerDispatch: 32,
673
+ cadenceDivisor: 1,
674
+ workgroupScale: 1,
675
+ maxQueueDepth: 48
676
+ }
677
+ }
678
+ ),
679
+ suggestedAllocationIds: ["lighting.hdri.prefilter"]
680
+ },
681
+ brdfLut: {
682
+ domain: "lighting",
683
+ importance: "low",
684
+ levels: buildWorkerBudgetLevels(
685
+ "lighting.hdri.brdfLut",
686
+ lightingWorkerQueueClass,
687
+ {
688
+ low: {
689
+ estimatedCostMs: 0.2,
690
+ maxDispatchesPerFrame: 1,
691
+ maxJobsPerDispatch: 4,
692
+ cadenceDivisor: 3,
693
+ workgroupScale: 0.5,
694
+ maxQueueDepth: 8
695
+ },
696
+ medium: {
697
+ estimatedCostMs: 0.4,
698
+ maxDispatchesPerFrame: 1,
699
+ maxJobsPerDispatch: 8,
700
+ cadenceDivisor: 2,
701
+ workgroupScale: 0.75,
702
+ maxQueueDepth: 16
703
+ },
704
+ high: {
705
+ estimatedCostMs: 0.6,
706
+ maxDispatchesPerFrame: 1,
707
+ maxJobsPerDispatch: 16,
708
+ cadenceDivisor: 1,
709
+ workgroupScale: 1,
710
+ maxQueueDepth: 24
711
+ }
712
+ }
713
+ ),
714
+ suggestedAllocationIds: ["lighting.hdri.brdf-lut"]
715
+ }
716
+ }
717
+ }
718
+ };
719
+ var lightingWorkerDagSpecs = {
720
+ hybrid: {
721
+ directLighting: { priority: 4, dependencies: [] },
722
+ screenTrace: { priority: 3, dependencies: [] },
723
+ radianceCache: { priority: 4, dependencies: ["directLighting"] },
724
+ finalGather: { priority: 2, dependencies: ["radianceCache", "screenTrace"] },
725
+ reflectionResolve: {
726
+ priority: 1,
727
+ dependencies: ["screenTrace", "finalGather"]
728
+ }
729
+ },
730
+ pathtracer: {
731
+ pathTrace: { priority: 4, dependencies: [] },
732
+ accumulate: { priority: 3, dependencies: ["pathTrace"] },
733
+ denoise: { priority: 2, dependencies: ["accumulate"] }
734
+ },
735
+ volumetrics: {
736
+ volumetricShadow: { priority: 3, dependencies: [] },
737
+ froxelIntegrate: { priority: 2, dependencies: ["volumetricShadow"] }
738
+ },
739
+ hdri: {
740
+ irradianceConvolution: { priority: 3, dependencies: [] },
741
+ specularPrefilter: { priority: 3, dependencies: [] },
742
+ brdfLut: {
743
+ priority: 2,
744
+ dependencies: ["irradianceConvolution", "specularPrefilter"]
745
+ }
746
+ }
747
+ };
748
+ function buildWorkerManifestJob(techniqueName, job) {
749
+ const spec = lightingWorkerSpecPresets[techniqueName].jobs[job.key];
750
+ const dag = lightingWorkerDagSpecs[techniqueName][job.key];
751
+ const dependencies = dag.dependencies.map(
752
+ (dependency) => `lighting.${techniqueName}.${dependency}`
753
+ );
754
+ return Object.freeze({
755
+ key: job.key,
756
+ label: job.label,
757
+ worker: Object.freeze({
758
+ jobType: job.label,
759
+ queueClass: lightingWorkerQueueClass,
760
+ priority: dag.priority,
761
+ dependencies: Object.freeze(dependencies),
762
+ schedulerMode: "dag"
763
+ }),
764
+ performance: Object.freeze({
765
+ id: job.label,
766
+ jobType: job.label,
767
+ queueClass: lightingWorkerQueueClass,
768
+ domain: spec.domain,
769
+ authority: "visual",
770
+ importance: spec.importance,
771
+ levels: spec.levels
772
+ }),
773
+ debug: Object.freeze({
774
+ owner: lightingDebugOwner,
775
+ queueClass: lightingWorkerQueueClass,
776
+ jobType: job.label,
777
+ tags: Object.freeze([
778
+ "lighting",
779
+ techniqueName,
780
+ job.key,
781
+ spec.domain
782
+ ]),
783
+ suggestedAllocationIds: Object.freeze([...spec.suggestedAllocationIds])
784
+ })
785
+ });
786
+ }
787
+ function buildLightingWorkerManifest(name, technique) {
788
+ const spec = lightingWorkerSpecPresets[name];
789
+ return Object.freeze({
790
+ schemaVersion: 1,
791
+ owner: lightingDebugOwner,
792
+ technique: name,
793
+ description: technique.description,
794
+ queueClass: lightingWorkerQueueClass,
795
+ schedulerMode: "dag",
796
+ suggestedAllocationIds: Object.freeze([...spec.suggestedAllocationIds]),
797
+ jobs: Object.freeze(
798
+ technique.jobs.map((job) => buildWorkerManifestJob(name, job))
799
+ )
800
+ });
801
+ }
802
+ var lightingWorkerManifests = Object.freeze(
803
+ Object.fromEntries(
804
+ Object.entries(lightingTechniques).map(([name, technique]) => [
805
+ name,
806
+ buildLightingWorkerManifest(name, technique)
807
+ ])
808
+ )
809
+ );
160
810
  function getTechniqueJob(technique, key) {
161
811
  const job = technique.jobs.find((entry) => entry.key === key);
162
812
  if (!job) {
@@ -183,6 +833,31 @@ function getLightingProfile(name = defaultLightingProfile) {
183
833
  }
184
834
  return profile;
185
835
  }
836
+ function getLightingTechniqueWorkerManifest(name = defaultLightingTechnique) {
837
+ const manifest = lightingWorkerManifests[name];
838
+ if (!manifest) {
839
+ const available = lightingTechniqueNames.join(", ");
840
+ throw new Error(
841
+ `Unknown lighting technique "${name}". Available: ${available}.`
842
+ );
843
+ }
844
+ return manifest;
845
+ }
846
+ function getLightingProfileWorkerManifest(name = defaultLightingProfile) {
847
+ const profile = getLightingProfile(name);
848
+ const techniques = profile.techniques.map(
849
+ (techniqueName) => getLightingTechniqueWorkerManifest(techniqueName)
850
+ );
851
+ return Object.freeze({
852
+ schemaVersion: 1,
853
+ owner: lightingDebugOwner,
854
+ profile: profile.name,
855
+ description: profile.description,
856
+ schedulerMode: "dag",
857
+ techniques: Object.freeze(techniques),
858
+ jobs: Object.freeze(techniques.flatMap((technique) => technique.jobs))
859
+ });
860
+ }
186
861
  var defaultTechnique = getLightingTechnique(defaultLightingTechnique);
187
862
  var lightingPreludeWgslUrl = defaultTechnique.preludeUrl;
188
863
  var lightingJobLabels = Object.freeze(
@@ -271,6 +946,19 @@ async function loadLightingTechniqueJobs(techniqueName, options = {}) {
271
946
  }));
272
947
  return { preludeWgsl, jobs };
273
948
  }
949
+ async function loadLightingTechniqueWorkerBundle(techniqueName = defaultLightingTechnique, options = {}) {
950
+ const technique = getLightingTechnique(techniqueName);
951
+ const { preludeWgsl, jobs } = await loadLightingTechniqueJobs(
952
+ technique.name,
953
+ options
954
+ );
955
+ return {
956
+ technique: technique.name,
957
+ preludeWgsl,
958
+ jobs,
959
+ workerManifest: getLightingTechniqueWorkerManifest(technique.name)
960
+ };
961
+ }
274
962
  async function loadLightingPreludeWgsl(options = {}) {
275
963
  const { fetcher } = options ?? {};
276
964
  return loadTechniquePrelude(defaultTechnique, fetcher);
@@ -295,12 +983,28 @@ async function loadLightingProfile(profileName, options = {}) {
295
983
  );
296
984
  return { profile, techniques };
297
985
  }
986
+ async function loadLightingProfileWorkerPlan(profileName = defaultLightingProfile, options = {}) {
987
+ const profile = getLightingProfile(profileName);
988
+ const techniques = await Promise.all(
989
+ profile.techniques.map(
990
+ (techniqueName) => loadLightingTechniqueWorkerBundle(techniqueName, options)
991
+ )
992
+ );
993
+ return {
994
+ profile,
995
+ techniques,
996
+ workerManifest: getLightingProfileWorkerManifest(profile.name)
997
+ };
998
+ }
298
999
  // Annotate the CommonJS export names for ESM import in node:
299
1000
  0 && (module.exports = {
300
1001
  defaultLightingProfile,
301
1002
  defaultLightingTechnique,
302
1003
  getLightingProfile,
1004
+ getLightingProfileWorkerManifest,
303
1005
  getLightingTechnique,
1006
+ getLightingTechniqueWorkerManifest,
1007
+ lightingDebugOwner,
304
1008
  lightingJobLabels,
305
1009
  lightingJobs,
306
1010
  lightingPreludeWgslUrl,
@@ -308,11 +1012,15 @@ async function loadLightingProfile(profileName, options = {}) {
308
1012
  lightingProfiles,
309
1013
  lightingTechniqueNames,
310
1014
  lightingTechniques,
1015
+ lightingWorkerManifests,
1016
+ lightingWorkerQueueClass,
311
1017
  loadLightingJobs,
312
1018
  loadLightingPreludeWgsl,
313
1019
  loadLightingProfile,
1020
+ loadLightingProfileWorkerPlan,
314
1021
  loadLightingTechniqueJobWgsl,
315
1022
  loadLightingTechniqueJobs,
316
- loadLightingTechniquePreludeWgsl
1023
+ loadLightingTechniquePreludeWgsl,
1024
+ loadLightingTechniqueWorkerBundle
317
1025
  });
318
1026
  //# sourceMappingURL=index.cjs.map