@plasius/gpu-lighting 0.1.6 → 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.js CHANGED
@@ -115,6 +115,649 @@ var lightingProfiles = Object.freeze(
115
115
  );
116
116
  var lightingProfileNames = Object.freeze(Object.keys(lightingProfiles));
117
117
  var defaultLightingProfile = "realtime";
118
+ var lightingWorkerQueueClass = "lighting";
119
+ var lightingDebugOwner = "lighting";
120
+ function buildWorkerBudgetLevels(jobType, queueClass, presets) {
121
+ return Object.freeze([
122
+ Object.freeze({
123
+ id: "low",
124
+ estimatedCostMs: presets.low.estimatedCostMs,
125
+ config: Object.freeze({
126
+ maxDispatchesPerFrame: presets.low.maxDispatchesPerFrame,
127
+ maxJobsPerDispatch: presets.low.maxJobsPerDispatch,
128
+ cadenceDivisor: presets.low.cadenceDivisor,
129
+ workgroupScale: presets.low.workgroupScale,
130
+ maxQueueDepth: presets.low.maxQueueDepth,
131
+ metadata: Object.freeze({
132
+ owner: lightingDebugOwner,
133
+ queueClass,
134
+ jobType,
135
+ quality: "low"
136
+ })
137
+ })
138
+ }),
139
+ Object.freeze({
140
+ id: "medium",
141
+ estimatedCostMs: presets.medium.estimatedCostMs,
142
+ config: Object.freeze({
143
+ maxDispatchesPerFrame: presets.medium.maxDispatchesPerFrame,
144
+ maxJobsPerDispatch: presets.medium.maxJobsPerDispatch,
145
+ cadenceDivisor: presets.medium.cadenceDivisor,
146
+ workgroupScale: presets.medium.workgroupScale,
147
+ maxQueueDepth: presets.medium.maxQueueDepth,
148
+ metadata: Object.freeze({
149
+ owner: lightingDebugOwner,
150
+ queueClass,
151
+ jobType,
152
+ quality: "medium"
153
+ })
154
+ })
155
+ }),
156
+ Object.freeze({
157
+ id: "high",
158
+ estimatedCostMs: presets.high.estimatedCostMs,
159
+ config: Object.freeze({
160
+ maxDispatchesPerFrame: presets.high.maxDispatchesPerFrame,
161
+ maxJobsPerDispatch: presets.high.maxJobsPerDispatch,
162
+ cadenceDivisor: presets.high.cadenceDivisor,
163
+ workgroupScale: presets.high.workgroupScale,
164
+ maxQueueDepth: presets.high.maxQueueDepth,
165
+ metadata: Object.freeze({
166
+ owner: lightingDebugOwner,
167
+ queueClass,
168
+ jobType,
169
+ quality: "high"
170
+ })
171
+ })
172
+ })
173
+ ]);
174
+ }
175
+ var lightingWorkerSpecPresets = {
176
+ hybrid: {
177
+ suggestedAllocationIds: [
178
+ "lighting.hybrid.radiance-cache",
179
+ "lighting.hybrid.reflection-history",
180
+ "lighting.hybrid.shadow-atlas"
181
+ ],
182
+ jobs: {
183
+ directLighting: {
184
+ domain: "lighting",
185
+ importance: "high",
186
+ levels: buildWorkerBudgetLevels(
187
+ "lighting.hybrid.directLighting",
188
+ lightingWorkerQueueClass,
189
+ {
190
+ low: {
191
+ estimatedCostMs: 0.5,
192
+ maxDispatchesPerFrame: 1,
193
+ maxJobsPerDispatch: 64,
194
+ cadenceDivisor: 2,
195
+ workgroupScale: 0.5,
196
+ maxQueueDepth: 128
197
+ },
198
+ medium: {
199
+ estimatedCostMs: 0.9,
200
+ maxDispatchesPerFrame: 1,
201
+ maxJobsPerDispatch: 128,
202
+ cadenceDivisor: 1,
203
+ workgroupScale: 0.75,
204
+ maxQueueDepth: 256
205
+ },
206
+ high: {
207
+ estimatedCostMs: 1.2,
208
+ maxDispatchesPerFrame: 2,
209
+ maxJobsPerDispatch: 256,
210
+ cadenceDivisor: 1,
211
+ workgroupScale: 1,
212
+ maxQueueDepth: 512
213
+ }
214
+ }
215
+ ),
216
+ suggestedAllocationIds: ["lighting.hybrid.shadow-atlas"]
217
+ },
218
+ screenTrace: {
219
+ domain: "reflections",
220
+ importance: "high",
221
+ levels: buildWorkerBudgetLevels(
222
+ "lighting.hybrid.screenTrace",
223
+ lightingWorkerQueueClass,
224
+ {
225
+ low: {
226
+ estimatedCostMs: 0.8,
227
+ maxDispatchesPerFrame: 1,
228
+ maxJobsPerDispatch: 32,
229
+ cadenceDivisor: 3,
230
+ workgroupScale: 0.4,
231
+ maxQueueDepth: 96
232
+ },
233
+ medium: {
234
+ estimatedCostMs: 1.5,
235
+ maxDispatchesPerFrame: 1,
236
+ maxJobsPerDispatch: 96,
237
+ cadenceDivisor: 2,
238
+ workgroupScale: 0.7,
239
+ maxQueueDepth: 192
240
+ },
241
+ high: {
242
+ estimatedCostMs: 2.2,
243
+ maxDispatchesPerFrame: 2,
244
+ maxJobsPerDispatch: 192,
245
+ cadenceDivisor: 1,
246
+ workgroupScale: 1,
247
+ maxQueueDepth: 384
248
+ }
249
+ }
250
+ ),
251
+ suggestedAllocationIds: ["lighting.hybrid.reflection-history"]
252
+ },
253
+ radianceCache: {
254
+ domain: "lighting",
255
+ importance: "high",
256
+ levels: buildWorkerBudgetLevels(
257
+ "lighting.hybrid.radianceCache",
258
+ lightingWorkerQueueClass,
259
+ {
260
+ low: {
261
+ estimatedCostMs: 0.7,
262
+ maxDispatchesPerFrame: 1,
263
+ maxJobsPerDispatch: 32,
264
+ cadenceDivisor: 2,
265
+ workgroupScale: 0.5,
266
+ maxQueueDepth: 96
267
+ },
268
+ medium: {
269
+ estimatedCostMs: 1.2,
270
+ maxDispatchesPerFrame: 1,
271
+ maxJobsPerDispatch: 64,
272
+ cadenceDivisor: 1,
273
+ workgroupScale: 0.75,
274
+ maxQueueDepth: 192
275
+ },
276
+ high: {
277
+ estimatedCostMs: 1.8,
278
+ maxDispatchesPerFrame: 2,
279
+ maxJobsPerDispatch: 128,
280
+ cadenceDivisor: 1,
281
+ workgroupScale: 1,
282
+ maxQueueDepth: 256
283
+ }
284
+ }
285
+ ),
286
+ suggestedAllocationIds: ["lighting.hybrid.radiance-cache"]
287
+ },
288
+ finalGather: {
289
+ domain: "lighting",
290
+ importance: "critical",
291
+ levels: buildWorkerBudgetLevels(
292
+ "lighting.hybrid.finalGather",
293
+ lightingWorkerQueueClass,
294
+ {
295
+ low: {
296
+ estimatedCostMs: 1,
297
+ maxDispatchesPerFrame: 1,
298
+ maxJobsPerDispatch: 48,
299
+ cadenceDivisor: 2,
300
+ workgroupScale: 0.5,
301
+ maxQueueDepth: 128
302
+ },
303
+ medium: {
304
+ estimatedCostMs: 1.8,
305
+ maxDispatchesPerFrame: 1,
306
+ maxJobsPerDispatch: 96,
307
+ cadenceDivisor: 1,
308
+ workgroupScale: 0.75,
309
+ maxQueueDepth: 256
310
+ },
311
+ high: {
312
+ estimatedCostMs: 2.6,
313
+ maxDispatchesPerFrame: 2,
314
+ maxJobsPerDispatch: 192,
315
+ cadenceDivisor: 1,
316
+ workgroupScale: 1,
317
+ maxQueueDepth: 384
318
+ }
319
+ }
320
+ ),
321
+ suggestedAllocationIds: [
322
+ "lighting.hybrid.radiance-cache",
323
+ "lighting.hybrid.reflection-history"
324
+ ]
325
+ },
326
+ reflectionResolve: {
327
+ domain: "reflections",
328
+ importance: "high",
329
+ levels: buildWorkerBudgetLevels(
330
+ "lighting.hybrid.reflectionResolve",
331
+ lightingWorkerQueueClass,
332
+ {
333
+ low: {
334
+ estimatedCostMs: 0.4,
335
+ maxDispatchesPerFrame: 1,
336
+ maxJobsPerDispatch: 32,
337
+ cadenceDivisor: 2,
338
+ workgroupScale: 0.5,
339
+ maxQueueDepth: 96
340
+ },
341
+ medium: {
342
+ estimatedCostMs: 0.8,
343
+ maxDispatchesPerFrame: 1,
344
+ maxJobsPerDispatch: 64,
345
+ cadenceDivisor: 1,
346
+ workgroupScale: 0.75,
347
+ maxQueueDepth: 192
348
+ },
349
+ high: {
350
+ estimatedCostMs: 1.2,
351
+ maxDispatchesPerFrame: 1,
352
+ maxJobsPerDispatch: 128,
353
+ cadenceDivisor: 1,
354
+ workgroupScale: 1,
355
+ maxQueueDepth: 256
356
+ }
357
+ }
358
+ ),
359
+ suggestedAllocationIds: ["lighting.hybrid.reflection-history"]
360
+ }
361
+ }
362
+ },
363
+ pathtracer: {
364
+ suggestedAllocationIds: [
365
+ "lighting.pathtracer.path-state",
366
+ "lighting.pathtracer.accumulation",
367
+ "lighting.pathtracer.denoise-history"
368
+ ],
369
+ jobs: {
370
+ pathTrace: {
371
+ domain: "lighting",
372
+ importance: "critical",
373
+ levels: buildWorkerBudgetLevels(
374
+ "lighting.pathtracer.pathTrace",
375
+ lightingWorkerQueueClass,
376
+ {
377
+ low: {
378
+ estimatedCostMs: 1.2,
379
+ maxDispatchesPerFrame: 1,
380
+ maxJobsPerDispatch: 16,
381
+ cadenceDivisor: 3,
382
+ workgroupScale: 0.45,
383
+ maxQueueDepth: 48
384
+ },
385
+ medium: {
386
+ estimatedCostMs: 2.3,
387
+ maxDispatchesPerFrame: 1,
388
+ maxJobsPerDispatch: 32,
389
+ cadenceDivisor: 2,
390
+ workgroupScale: 0.7,
391
+ maxQueueDepth: 96
392
+ },
393
+ high: {
394
+ estimatedCostMs: 3.8,
395
+ maxDispatchesPerFrame: 2,
396
+ maxJobsPerDispatch: 64,
397
+ cadenceDivisor: 1,
398
+ workgroupScale: 1,
399
+ maxQueueDepth: 128
400
+ }
401
+ }
402
+ ),
403
+ suggestedAllocationIds: ["lighting.pathtracer.path-state"]
404
+ },
405
+ accumulate: {
406
+ domain: "lighting",
407
+ importance: "medium",
408
+ levels: buildWorkerBudgetLevels(
409
+ "lighting.pathtracer.accumulate",
410
+ lightingWorkerQueueClass,
411
+ {
412
+ low: {
413
+ estimatedCostMs: 0.4,
414
+ maxDispatchesPerFrame: 1,
415
+ maxJobsPerDispatch: 16,
416
+ cadenceDivisor: 2,
417
+ workgroupScale: 0.5,
418
+ maxQueueDepth: 32
419
+ },
420
+ medium: {
421
+ estimatedCostMs: 0.8,
422
+ maxDispatchesPerFrame: 1,
423
+ maxJobsPerDispatch: 32,
424
+ cadenceDivisor: 1,
425
+ workgroupScale: 0.75,
426
+ maxQueueDepth: 64
427
+ },
428
+ high: {
429
+ estimatedCostMs: 1.1,
430
+ maxDispatchesPerFrame: 1,
431
+ maxJobsPerDispatch: 64,
432
+ cadenceDivisor: 1,
433
+ workgroupScale: 1,
434
+ maxQueueDepth: 96
435
+ }
436
+ }
437
+ ),
438
+ suggestedAllocationIds: ["lighting.pathtracer.accumulation"]
439
+ },
440
+ denoise: {
441
+ domain: "post-processing",
442
+ importance: "high",
443
+ levels: buildWorkerBudgetLevels(
444
+ "lighting.pathtracer.denoise",
445
+ lightingWorkerQueueClass,
446
+ {
447
+ low: {
448
+ estimatedCostMs: 0.4,
449
+ maxDispatchesPerFrame: 1,
450
+ maxJobsPerDispatch: 16,
451
+ cadenceDivisor: 2,
452
+ workgroupScale: 0.5,
453
+ maxQueueDepth: 32
454
+ },
455
+ medium: {
456
+ estimatedCostMs: 0.9,
457
+ maxDispatchesPerFrame: 1,
458
+ maxJobsPerDispatch: 32,
459
+ cadenceDivisor: 1,
460
+ workgroupScale: 0.75,
461
+ maxQueueDepth: 64
462
+ },
463
+ high: {
464
+ estimatedCostMs: 1.4,
465
+ maxDispatchesPerFrame: 1,
466
+ maxJobsPerDispatch: 64,
467
+ cadenceDivisor: 1,
468
+ workgroupScale: 1,
469
+ maxQueueDepth: 96
470
+ }
471
+ }
472
+ ),
473
+ suggestedAllocationIds: ["lighting.pathtracer.denoise-history"]
474
+ }
475
+ }
476
+ },
477
+ volumetrics: {
478
+ suggestedAllocationIds: [
479
+ "lighting.volumetrics.froxel-grid",
480
+ "lighting.volumetrics.shadow-history"
481
+ ],
482
+ jobs: {
483
+ froxelIntegrate: {
484
+ domain: "volumetrics",
485
+ importance: "high",
486
+ levels: buildWorkerBudgetLevels(
487
+ "lighting.volumetrics.froxelIntegrate",
488
+ lightingWorkerQueueClass,
489
+ {
490
+ low: {
491
+ estimatedCostMs: 0.6,
492
+ maxDispatchesPerFrame: 1,
493
+ maxJobsPerDispatch: 32,
494
+ cadenceDivisor: 2,
495
+ workgroupScale: 0.5,
496
+ maxQueueDepth: 96
497
+ },
498
+ medium: {
499
+ estimatedCostMs: 1.1,
500
+ maxDispatchesPerFrame: 1,
501
+ maxJobsPerDispatch: 64,
502
+ cadenceDivisor: 1,
503
+ workgroupScale: 0.75,
504
+ maxQueueDepth: 192
505
+ },
506
+ high: {
507
+ estimatedCostMs: 1.7,
508
+ maxDispatchesPerFrame: 2,
509
+ maxJobsPerDispatch: 128,
510
+ cadenceDivisor: 1,
511
+ workgroupScale: 1,
512
+ maxQueueDepth: 256
513
+ }
514
+ }
515
+ ),
516
+ suggestedAllocationIds: ["lighting.volumetrics.froxel-grid"]
517
+ },
518
+ volumetricShadow: {
519
+ domain: "volumetrics",
520
+ importance: "high",
521
+ levels: buildWorkerBudgetLevels(
522
+ "lighting.volumetrics.volumetricShadow",
523
+ lightingWorkerQueueClass,
524
+ {
525
+ low: {
526
+ estimatedCostMs: 0.5,
527
+ maxDispatchesPerFrame: 1,
528
+ maxJobsPerDispatch: 24,
529
+ cadenceDivisor: 2,
530
+ workgroupScale: 0.5,
531
+ maxQueueDepth: 64
532
+ },
533
+ medium: {
534
+ estimatedCostMs: 0.9,
535
+ maxDispatchesPerFrame: 1,
536
+ maxJobsPerDispatch: 48,
537
+ cadenceDivisor: 1,
538
+ workgroupScale: 0.75,
539
+ maxQueueDepth: 128
540
+ },
541
+ high: {
542
+ estimatedCostMs: 1.3,
543
+ maxDispatchesPerFrame: 1,
544
+ maxJobsPerDispatch: 96,
545
+ cadenceDivisor: 1,
546
+ workgroupScale: 1,
547
+ maxQueueDepth: 192
548
+ }
549
+ }
550
+ ),
551
+ suggestedAllocationIds: ["lighting.volumetrics.shadow-history"]
552
+ }
553
+ }
554
+ },
555
+ hdri: {
556
+ suggestedAllocationIds: [
557
+ "lighting.hdri.cubemap",
558
+ "lighting.hdri.prefilter",
559
+ "lighting.hdri.brdf-lut"
560
+ ],
561
+ jobs: {
562
+ irradianceConvolution: {
563
+ domain: "lighting",
564
+ importance: "medium",
565
+ levels: buildWorkerBudgetLevels(
566
+ "lighting.hdri.irradianceConvolution",
567
+ lightingWorkerQueueClass,
568
+ {
569
+ low: {
570
+ estimatedCostMs: 0.3,
571
+ maxDispatchesPerFrame: 1,
572
+ maxJobsPerDispatch: 8,
573
+ cadenceDivisor: 3,
574
+ workgroupScale: 0.5,
575
+ maxQueueDepth: 16
576
+ },
577
+ medium: {
578
+ estimatedCostMs: 0.5,
579
+ maxDispatchesPerFrame: 1,
580
+ maxJobsPerDispatch: 16,
581
+ cadenceDivisor: 2,
582
+ workgroupScale: 0.75,
583
+ maxQueueDepth: 32
584
+ },
585
+ high: {
586
+ estimatedCostMs: 0.8,
587
+ maxDispatchesPerFrame: 1,
588
+ maxJobsPerDispatch: 32,
589
+ cadenceDivisor: 1,
590
+ workgroupScale: 1,
591
+ maxQueueDepth: 48
592
+ }
593
+ }
594
+ ),
595
+ suggestedAllocationIds: ["lighting.hdri.cubemap"]
596
+ },
597
+ specularPrefilter: {
598
+ domain: "lighting",
599
+ importance: "medium",
600
+ levels: buildWorkerBudgetLevels(
601
+ "lighting.hdri.specularPrefilter",
602
+ lightingWorkerQueueClass,
603
+ {
604
+ low: {
605
+ estimatedCostMs: 0.4,
606
+ maxDispatchesPerFrame: 1,
607
+ maxJobsPerDispatch: 8,
608
+ cadenceDivisor: 3,
609
+ workgroupScale: 0.5,
610
+ maxQueueDepth: 16
611
+ },
612
+ medium: {
613
+ estimatedCostMs: 0.7,
614
+ maxDispatchesPerFrame: 1,
615
+ maxJobsPerDispatch: 16,
616
+ cadenceDivisor: 2,
617
+ workgroupScale: 0.75,
618
+ maxQueueDepth: 32
619
+ },
620
+ high: {
621
+ estimatedCostMs: 1,
622
+ maxDispatchesPerFrame: 1,
623
+ maxJobsPerDispatch: 32,
624
+ cadenceDivisor: 1,
625
+ workgroupScale: 1,
626
+ maxQueueDepth: 48
627
+ }
628
+ }
629
+ ),
630
+ suggestedAllocationIds: ["lighting.hdri.prefilter"]
631
+ },
632
+ brdfLut: {
633
+ domain: "lighting",
634
+ importance: "low",
635
+ levels: buildWorkerBudgetLevels(
636
+ "lighting.hdri.brdfLut",
637
+ lightingWorkerQueueClass,
638
+ {
639
+ low: {
640
+ estimatedCostMs: 0.2,
641
+ maxDispatchesPerFrame: 1,
642
+ maxJobsPerDispatch: 4,
643
+ cadenceDivisor: 3,
644
+ workgroupScale: 0.5,
645
+ maxQueueDepth: 8
646
+ },
647
+ medium: {
648
+ estimatedCostMs: 0.4,
649
+ maxDispatchesPerFrame: 1,
650
+ maxJobsPerDispatch: 8,
651
+ cadenceDivisor: 2,
652
+ workgroupScale: 0.75,
653
+ maxQueueDepth: 16
654
+ },
655
+ high: {
656
+ estimatedCostMs: 0.6,
657
+ maxDispatchesPerFrame: 1,
658
+ maxJobsPerDispatch: 16,
659
+ cadenceDivisor: 1,
660
+ workgroupScale: 1,
661
+ maxQueueDepth: 24
662
+ }
663
+ }
664
+ ),
665
+ suggestedAllocationIds: ["lighting.hdri.brdf-lut"]
666
+ }
667
+ }
668
+ }
669
+ };
670
+ var lightingWorkerDagSpecs = {
671
+ hybrid: {
672
+ directLighting: { priority: 4, dependencies: [] },
673
+ screenTrace: { priority: 3, dependencies: [] },
674
+ radianceCache: { priority: 4, dependencies: ["directLighting"] },
675
+ finalGather: { priority: 2, dependencies: ["radianceCache", "screenTrace"] },
676
+ reflectionResolve: {
677
+ priority: 1,
678
+ dependencies: ["screenTrace", "finalGather"]
679
+ }
680
+ },
681
+ pathtracer: {
682
+ pathTrace: { priority: 4, dependencies: [] },
683
+ accumulate: { priority: 3, dependencies: ["pathTrace"] },
684
+ denoise: { priority: 2, dependencies: ["accumulate"] }
685
+ },
686
+ volumetrics: {
687
+ volumetricShadow: { priority: 3, dependencies: [] },
688
+ froxelIntegrate: { priority: 2, dependencies: ["volumetricShadow"] }
689
+ },
690
+ hdri: {
691
+ irradianceConvolution: { priority: 3, dependencies: [] },
692
+ specularPrefilter: { priority: 3, dependencies: [] },
693
+ brdfLut: {
694
+ priority: 2,
695
+ dependencies: ["irradianceConvolution", "specularPrefilter"]
696
+ }
697
+ }
698
+ };
699
+ function buildWorkerManifestJob(techniqueName, job) {
700
+ const spec = lightingWorkerSpecPresets[techniqueName].jobs[job.key];
701
+ const dag = lightingWorkerDagSpecs[techniqueName][job.key];
702
+ const dependencies = dag.dependencies.map(
703
+ (dependency) => `lighting.${techniqueName}.${dependency}`
704
+ );
705
+ return Object.freeze({
706
+ key: job.key,
707
+ label: job.label,
708
+ worker: Object.freeze({
709
+ jobType: job.label,
710
+ queueClass: lightingWorkerQueueClass,
711
+ priority: dag.priority,
712
+ dependencies: Object.freeze(dependencies),
713
+ schedulerMode: "dag"
714
+ }),
715
+ performance: Object.freeze({
716
+ id: job.label,
717
+ jobType: job.label,
718
+ queueClass: lightingWorkerQueueClass,
719
+ domain: spec.domain,
720
+ authority: "visual",
721
+ importance: spec.importance,
722
+ levels: spec.levels
723
+ }),
724
+ debug: Object.freeze({
725
+ owner: lightingDebugOwner,
726
+ queueClass: lightingWorkerQueueClass,
727
+ jobType: job.label,
728
+ tags: Object.freeze([
729
+ "lighting",
730
+ techniqueName,
731
+ job.key,
732
+ spec.domain
733
+ ]),
734
+ suggestedAllocationIds: Object.freeze([...spec.suggestedAllocationIds])
735
+ })
736
+ });
737
+ }
738
+ function buildLightingWorkerManifest(name, technique) {
739
+ const spec = lightingWorkerSpecPresets[name];
740
+ return Object.freeze({
741
+ schemaVersion: 1,
742
+ owner: lightingDebugOwner,
743
+ technique: name,
744
+ description: technique.description,
745
+ queueClass: lightingWorkerQueueClass,
746
+ schedulerMode: "dag",
747
+ suggestedAllocationIds: Object.freeze([...spec.suggestedAllocationIds]),
748
+ jobs: Object.freeze(
749
+ technique.jobs.map((job) => buildWorkerManifestJob(name, job))
750
+ )
751
+ });
752
+ }
753
+ var lightingWorkerManifests = Object.freeze(
754
+ Object.fromEntries(
755
+ Object.entries(lightingTechniques).map(([name, technique]) => [
756
+ name,
757
+ buildLightingWorkerManifest(name, technique)
758
+ ])
759
+ )
760
+ );
118
761
  function getTechniqueJob(technique, key) {
119
762
  const job = technique.jobs.find((entry) => entry.key === key);
120
763
  if (!job) {
@@ -141,6 +784,31 @@ function getLightingProfile(name = defaultLightingProfile) {
141
784
  }
142
785
  return profile;
143
786
  }
787
+ function getLightingTechniqueWorkerManifest(name = defaultLightingTechnique) {
788
+ const manifest = lightingWorkerManifests[name];
789
+ if (!manifest) {
790
+ const available = lightingTechniqueNames.join(", ");
791
+ throw new Error(
792
+ `Unknown lighting technique "${name}". Available: ${available}.`
793
+ );
794
+ }
795
+ return manifest;
796
+ }
797
+ function getLightingProfileWorkerManifest(name = defaultLightingProfile) {
798
+ const profile = getLightingProfile(name);
799
+ const techniques = profile.techniques.map(
800
+ (techniqueName) => getLightingTechniqueWorkerManifest(techniqueName)
801
+ );
802
+ return Object.freeze({
803
+ schemaVersion: 1,
804
+ owner: lightingDebugOwner,
805
+ profile: profile.name,
806
+ description: profile.description,
807
+ schedulerMode: "dag",
808
+ techniques: Object.freeze(techniques),
809
+ jobs: Object.freeze(techniques.flatMap((technique) => technique.jobs))
810
+ });
811
+ }
144
812
  var defaultTechnique = getLightingTechnique(defaultLightingTechnique);
145
813
  var lightingPreludeWgslUrl = defaultTechnique.preludeUrl;
146
814
  var lightingJobLabels = Object.freeze(
@@ -229,6 +897,19 @@ async function loadLightingTechniqueJobs(techniqueName, options = {}) {
229
897
  }));
230
898
  return { preludeWgsl, jobs };
231
899
  }
900
+ async function loadLightingTechniqueWorkerBundle(techniqueName = defaultLightingTechnique, options = {}) {
901
+ const technique = getLightingTechnique(techniqueName);
902
+ const { preludeWgsl, jobs } = await loadLightingTechniqueJobs(
903
+ technique.name,
904
+ options
905
+ );
906
+ return {
907
+ technique: technique.name,
908
+ preludeWgsl,
909
+ jobs,
910
+ workerManifest: getLightingTechniqueWorkerManifest(technique.name)
911
+ };
912
+ }
232
913
  async function loadLightingPreludeWgsl(options = {}) {
233
914
  const { fetcher } = options ?? {};
234
915
  return loadTechniquePrelude(defaultTechnique, fetcher);
@@ -253,11 +934,27 @@ async function loadLightingProfile(profileName, options = {}) {
253
934
  );
254
935
  return { profile, techniques };
255
936
  }
937
+ async function loadLightingProfileWorkerPlan(profileName = defaultLightingProfile, options = {}) {
938
+ const profile = getLightingProfile(profileName);
939
+ const techniques = await Promise.all(
940
+ profile.techniques.map(
941
+ (techniqueName) => loadLightingTechniqueWorkerBundle(techniqueName, options)
942
+ )
943
+ );
944
+ return {
945
+ profile,
946
+ techniques,
947
+ workerManifest: getLightingProfileWorkerManifest(profile.name)
948
+ };
949
+ }
256
950
  export {
257
951
  defaultLightingProfile,
258
952
  defaultLightingTechnique,
259
953
  getLightingProfile,
954
+ getLightingProfileWorkerManifest,
260
955
  getLightingTechnique,
956
+ getLightingTechniqueWorkerManifest,
957
+ lightingDebugOwner,
261
958
  lightingJobLabels,
262
959
  lightingJobs,
263
960
  lightingPreludeWgslUrl,
@@ -265,11 +962,15 @@ export {
265
962
  lightingProfiles,
266
963
  lightingTechniqueNames,
267
964
  lightingTechniques,
965
+ lightingWorkerManifests,
966
+ lightingWorkerQueueClass,
268
967
  loadLightingJobs,
269
968
  loadLightingPreludeWgsl,
270
969
  loadLightingProfile,
970
+ loadLightingProfileWorkerPlan,
271
971
  loadLightingTechniqueJobWgsl,
272
972
  loadLightingTechniqueJobs,
273
- loadLightingTechniquePreludeWgsl
973
+ loadLightingTechniquePreludeWgsl,
974
+ loadLightingTechniqueWorkerBundle
274
975
  };
275
976
  //# sourceMappingURL=index.js.map