@forgeax/engine-render-graph 0.1.32 → 0.1.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/engine-render-graph",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -22,12 +22,12 @@
22
22
  "LICENSE"
23
23
  ],
24
24
  "dependencies": {
25
- "@forgeax/engine-rhi": "0.1.32",
26
- "@forgeax/engine-types": "0.1.32",
25
+ "@forgeax/engine-rhi": "0.1.33",
26
+ "@forgeax/engine-types": "0.1.33",
27
27
  "@webgpu/types": "^0.1.71"
28
28
  },
29
29
  "devDependencies": {
30
- "@forgeax/engine-rhi-null": "0.1.32"
30
+ "@forgeax/engine-rhi-null": "0.1.33"
31
31
  },
32
32
  "forgeax": {
33
33
  "metrics": {
@@ -327,16 +327,19 @@ import { RenderGraph } from '../graph.js';
327
327
  g.addResource('fxaaIntermediate', { kind: 'texture', lifetime: 'transient' });
328
328
  g.addResource('hdrColor', { kind: 'texture', lifetime: 'transient' });
329
329
  g.addResource('hdrComposited', { kind: 'texture', lifetime: 'transient' });
330
- g.addResource('bloomBright', { kind: 'texture', lifetime: 'transient' });
331
- g.addResource('bloomBlurH', { kind: 'texture', lifetime: 'transient' });
332
- g.addResource('bloomBlurV', { kind: 'texture', lifetime: 'transient' });
330
+ g.addResource('bloomDownsample0', { kind: 'texture', lifetime: 'transient' });
331
+ g.addResource('bloomDownsample1', { kind: 'texture', lifetime: 'transient' });
332
+ g.addResource('bloomUpsample0', { kind: 'texture', lifetime: 'transient' });
333
333
  g.addPass('shadow', { reads: [], writes: ['shadowDepth'] });
334
334
  g.addPass('main', { reads: ['shadowDepth'], writes: ['hdrColor', 'depth'] });
335
- g.addPass('bloom-bright', { reads: ['hdrColor'], writes: ['bloomBright'] });
336
- g.addPass('bloom-blur-h', { reads: ['bloomBright'], writes: ['bloomBlurH'] });
337
- g.addPass('bloom-blur-v', { reads: ['bloomBlurH'], writes: ['bloomBlurV'] });
335
+ g.addPass('bloom-downsample-0', { reads: ['hdrColor'], writes: ['bloomDownsample0'] });
336
+ g.addPass('bloom-downsample-1', {
337
+ reads: ['bloomDownsample0'],
338
+ writes: ['bloomDownsample1'],
339
+ });
340
+ g.addPass('bloom-upsample-0', { reads: ['bloomDownsample1'], writes: ['bloomUpsample0'] });
338
341
  g.addPass('bloom-composite', {
339
- reads: ['hdrColor', 'bloomBlurV'],
342
+ reads: ['hdrColor', 'bloomUpsample0'],
340
343
  writes: ['hdrComposited'],
341
344
  });
342
345
  g.addPass('tonemap', { reads: ['hdrComposited'], writes: [] });
@@ -350,11 +353,11 @@ import { RenderGraph } from '../graph.js';
350
353
  const g = new RenderGraph();
351
354
  g.addResource('hdrColor', { kind: 'texture', lifetime: 'transient' });
352
355
  g.addResource('hdrComposited', { kind: 'texture', lifetime: 'transient' });
353
- g.addResource('bloomBlurV', { kind: 'texture', lifetime: 'transient' });
356
+ g.addResource('bloomUpsample0', { kind: 'texture', lifetime: 'transient' });
354
357
  g.addPass('main', { reads: [], writes: ['hdrColor'] });
355
- g.addPass('blur-v', { reads: [], writes: ['bloomBlurV'] });
358
+ g.addPass('bloom-upsample-0', { reads: [], writes: ['bloomUpsample0'] });
356
359
  g.addPass('bloom-composite', {
357
- reads: ['hdrColor', 'bloomBlurV'],
360
+ reads: ['hdrColor', 'bloomUpsample0'],
358
361
  writes: ['hdrComposited'],
359
362
  });
360
363
  g.addPass('tonemap', { reads: ['hdrComposited'], writes: [] });
@@ -368,19 +371,22 @@ import { RenderGraph } from '../graph.js';
368
371
  expect(compIdx).toBeLessThan(tonemapIdx);
369
372
  });
370
373
 
371
- it('preserves bloom chain order: bright < blur-h < blur-v < composite', () => {
374
+ it('preserves bloom chain order: downsample-0 < downsample-1 < upsample-0 < composite', () => {
372
375
  const g = new RenderGraph();
373
376
  g.addResource('hdrColor', { kind: 'texture', lifetime: 'transient' });
374
377
  g.addResource('hdrComposited', { kind: 'texture', lifetime: 'transient' });
375
- g.addResource('bloomBright', { kind: 'texture', lifetime: 'transient' });
376
- g.addResource('bloomBlurH', { kind: 'texture', lifetime: 'transient' });
377
- g.addResource('bloomBlurV', { kind: 'texture', lifetime: 'transient' });
378
+ g.addResource('bloomDownsample0', { kind: 'texture', lifetime: 'transient' });
379
+ g.addResource('bloomDownsample1', { kind: 'texture', lifetime: 'transient' });
380
+ g.addResource('bloomUpsample0', { kind: 'texture', lifetime: 'transient' });
378
381
  g.addPass('main', { reads: [], writes: ['hdrColor'] });
379
- g.addPass('bloom-bright', { reads: ['hdrColor'], writes: ['bloomBright'] });
380
- g.addPass('bloom-blur-h', { reads: ['bloomBright'], writes: ['bloomBlurH'] });
381
- g.addPass('bloom-blur-v', { reads: ['bloomBlurH'], writes: ['bloomBlurV'] });
382
+ g.addPass('bloom-downsample-0', { reads: ['hdrColor'], writes: ['bloomDownsample0'] });
383
+ g.addPass('bloom-downsample-1', {
384
+ reads: ['bloomDownsample0'],
385
+ writes: ['bloomDownsample1'],
386
+ });
387
+ g.addPass('bloom-upsample-0', { reads: ['bloomDownsample1'], writes: ['bloomUpsample0'] });
382
388
  g.addPass('bloom-composite', {
383
- reads: ['hdrColor', 'bloomBlurV'],
389
+ reads: ['hdrColor', 'bloomUpsample0'],
384
390
  writes: ['hdrComposited'],
385
391
  });
386
392
 
@@ -388,35 +394,38 @@ import { RenderGraph } from '../graph.js';
388
394
  expect(r.ok).toBe(true);
389
395
  if (!r.ok) return;
390
396
  const order = r.value.passes.map((p) => p.name);
391
- const brightIdx = order.indexOf('bloom-bright');
392
- const blurHIdx = order.indexOf('bloom-blur-h');
393
- const blurVIdx = order.indexOf('bloom-blur-v');
397
+ const downsample0Idx = order.indexOf('bloom-downsample-0');
398
+ const downsample1Idx = order.indexOf('bloom-downsample-1');
399
+ const upsample0Idx = order.indexOf('bloom-upsample-0');
394
400
  const compIdx = order.indexOf('bloom-composite');
395
- expect(brightIdx).toBeLessThan(blurHIdx);
396
- expect(blurHIdx).toBeLessThan(blurVIdx);
397
- expect(blurVIdx).toBeLessThan(compIdx);
401
+ expect(downsample0Idx).toBeLessThan(downsample1Idx);
402
+ expect(downsample1Idx).toBeLessThan(upsample0Idx);
403
+ expect(upsample0Idx).toBeLessThan(compIdx);
398
404
  });
399
405
 
400
406
  it('uses hdrComposited to make the temporal version explicit', () => {
401
- // bloom-bright reads the hdrColor version written by main.
402
- // bloom-composite reads hdrColor + bloomBlurV, writes hdrComposited.
407
+ // bloom-downsample-0 reads the hdrColor version written by main.
408
+ // bloom-composite reads hdrColor + bloomUpsample0, writes hdrComposited.
403
409
  // tonemap reads hdrComposited.
404
- // The chain: main -> bloom-bright -> blur-h -> blur-v -> composite -> tonemap.
410
+ // The chain: main -> downsample-0 -> downsample-1 -> upsample-0 -> composite -> tonemap.
405
411
  // The hdrComposited resource name makes the post-composite version explicit while keeping the real
406
412
  // GPU texture the same hdrColor slot (composite writes in-place, tonemap
407
413
  // reads from it).
408
414
  const g = new RenderGraph();
409
415
  g.addResource('hdrColor', { kind: 'texture', lifetime: 'transient' });
410
416
  g.addResource('hdrComposited', { kind: 'texture', lifetime: 'transient' });
411
- g.addResource('bloomBright', { kind: 'texture', lifetime: 'transient' });
412
- g.addResource('bloomBlurH', { kind: 'texture', lifetime: 'transient' });
413
- g.addResource('bloomBlurV', { kind: 'texture', lifetime: 'transient' });
417
+ g.addResource('bloomDownsample0', { kind: 'texture', lifetime: 'transient' });
418
+ g.addResource('bloomDownsample1', { kind: 'texture', lifetime: 'transient' });
419
+ g.addResource('bloomUpsample0', { kind: 'texture', lifetime: 'transient' });
414
420
  g.addPass('main', { reads: [], writes: ['hdrColor'] });
415
- g.addPass('bloom-bright', { reads: ['hdrColor'], writes: ['bloomBright'] });
416
- g.addPass('bloom-blur-h', { reads: ['bloomBright'], writes: ['bloomBlurH'] });
417
- g.addPass('bloom-blur-v', { reads: ['bloomBlurH'], writes: ['bloomBlurV'] });
421
+ g.addPass('bloom-downsample-0', { reads: ['hdrColor'], writes: ['bloomDownsample0'] });
422
+ g.addPass('bloom-downsample-1', {
423
+ reads: ['bloomDownsample0'],
424
+ writes: ['bloomDownsample1'],
425
+ });
426
+ g.addPass('bloom-upsample-0', { reads: ['bloomDownsample1'], writes: ['bloomUpsample0'] });
418
427
  g.addPass('bloom-composite', {
419
- reads: ['hdrColor', 'bloomBlurV'],
428
+ reads: ['hdrColor', 'bloomUpsample0'],
420
429
  writes: ['hdrComposited'],
421
430
  });
422
431
  g.addPass('tonemap', { reads: ['hdrComposited'], writes: [] });
@@ -425,14 +434,14 @@ import { RenderGraph } from '../graph.js';
425
434
  expect(r.ok).toBe(true);
426
435
  if (!r.ok) return;
427
436
  const order = r.value.passes.map((p) => p.name);
428
- const brightIdx = order.indexOf('bloom-bright');
429
- const blurHIdx = order.indexOf('bloom-blur-h');
430
- const blurVIdx = order.indexOf('bloom-blur-v');
437
+ const downsample0Idx = order.indexOf('bloom-downsample-0');
438
+ const downsample1Idx = order.indexOf('bloom-downsample-1');
439
+ const upsample0Idx = order.indexOf('bloom-upsample-0');
431
440
  const compIdx = order.indexOf('bloom-composite');
432
441
  const tmapIdx = order.indexOf('tonemap');
433
- expect(brightIdx).toBeLessThan(blurHIdx);
434
- expect(blurHIdx).toBeLessThan(blurVIdx);
435
- expect(blurVIdx).toBeLessThan(compIdx);
442
+ expect(downsample0Idx).toBeLessThan(downsample1Idx);
443
+ expect(downsample1Idx).toBeLessThan(upsample0Idx);
444
+ expect(upsample0Idx).toBeLessThan(compIdx);
436
445
  expect(compIdx).toBeLessThan(tmapIdx);
437
446
  });
438
447
  });