@flighthq/effects-wgpu 0.3.0 → 0.3.1-next.1041.35b950c

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.
Files changed (49) hide show
  1. package/dist/enableWgpuRenderEffectGuards.d.ts +5 -0
  2. package/dist/enableWgpuRenderEffectGuards.d.ts.map +1 -0
  3. package/dist/enableWgpuRenderEffectGuards.js +63 -0
  4. package/dist/enableWgpuRenderEffectGuards.js.map +1 -0
  5. package/dist/wgpuBevelEffect.d.ts.map +1 -1
  6. package/dist/wgpuBevelEffect.js +13 -7
  7. package/dist/wgpuBevelEffect.js.map +1 -1
  8. package/dist/wgpuConvolutionEffect.d.ts.map +1 -1
  9. package/dist/wgpuConvolutionEffect.js +8 -4
  10. package/dist/wgpuConvolutionEffect.js.map +1 -1
  11. package/dist/wgpuDropShadowEffect.d.ts.map +1 -1
  12. package/dist/wgpuDropShadowEffect.js +3 -1
  13. package/dist/wgpuDropShadowEffect.js.map +1 -1
  14. package/dist/wgpuEffectTintShader.d.ts.map +1 -1
  15. package/dist/wgpuEffectTintShader.js +13 -13
  16. package/dist/wgpuEffectTintShader.js.map +1 -1
  17. package/dist/wgpuGradientBevelEffect.d.ts.map +1 -1
  18. package/dist/wgpuGradientBevelEffect.js +3 -8
  19. package/dist/wgpuGradientBevelEffect.js.map +1 -1
  20. package/dist/wgpuGradientGlowEffect.js +1 -1
  21. package/dist/wgpuGradientGlowEffect.js.map +1 -1
  22. package/dist/wgpuInnerGlowEffect.d.ts.map +1 -1
  23. package/dist/wgpuInnerGlowEffect.js +8 -8
  24. package/dist/wgpuInnerGlowEffect.js.map +1 -1
  25. package/dist/wgpuInnerShadowEffect.d.ts.map +1 -1
  26. package/dist/wgpuInnerShadowEffect.js +8 -8
  27. package/dist/wgpuInnerShadowEffect.js.map +1 -1
  28. package/dist/wgpuOuterGlowEffect.js +1 -1
  29. package/dist/wgpuOuterGlowEffect.js.map +1 -1
  30. package/dist/wgpuRenderEffectPipeline.d.ts +2 -1
  31. package/dist/wgpuRenderEffectPipeline.d.ts.map +1 -1
  32. package/dist/wgpuRenderEffectPipeline.js +16 -1
  33. package/dist/wgpuRenderEffectPipeline.js.map +1 -1
  34. package/dist/wgpuRenderEffectRegistry.d.ts.map +1 -1
  35. package/dist/wgpuRenderEffectRegistry.js +6 -3
  36. package/dist/wgpuRenderEffectRegistry.js.map +1 -1
  37. package/dist/wgpuRenderTextureEffect.d.ts +4 -1
  38. package/dist/wgpuRenderTextureEffect.d.ts.map +1 -1
  39. package/dist/wgpuRenderTextureEffect.js +60 -3
  40. package/dist/wgpuRenderTextureEffect.js.map +1 -1
  41. package/dist/wgpuScreenSpaceFogEffect.js +1 -1
  42. package/dist/wgpuScreenSpaceFogEffect.js.map +1 -1
  43. package/package.json +13 -6
  44. package/src/enableWgpuRenderEffectGuards.test.ts +169 -0
  45. package/src/wgpuInnerGlowEffect.test.ts +1 -1
  46. package/src/wgpuInnerShadowEffect.test.ts +1 -1
  47. package/src/wgpuRenderEffectPipeline.test.ts +31 -0
  48. package/src/wgpuRenderEffectRegistry.test.ts +21 -1
  49. package/src/wgpuRenderTextureEffect.test.ts +57 -2
@@ -11,11 +11,15 @@ import {
11
11
  isWgpuRenderTextureReady,
12
12
  writeWgpuRenderTextureTarget,
13
13
  } from '@flighthq/render-wgpu/contract';
14
- import type { WgpuRenderEffectRunner } from '@flighthq/types/contract';
14
+ import type { RenderEffect, WgpuRenderEffectRunner } from '@flighthq/types/contract';
15
15
 
16
16
  import { defaultWgpuBlurEffectRunner } from './wgpuBlurEffect';
17
17
  import { getWgpuRenderEffectRunner, registerWgpuRenderEffect } from './wgpuRenderEffectRegistry';
18
- import { applyWgpuRenderEffectsToRenderTexture } from './wgpuRenderTextureEffect';
18
+ import {
19
+ applyWgpuRenderEffectsToRenderTexture,
20
+ explainWgpuRenderEffectApplication,
21
+ setWgpuRenderEffectApplicationGuard,
22
+ } from './wgpuRenderTextureEffect';
19
23
 
20
24
  beforeAll(() => installWgpuMock());
21
25
 
@@ -81,6 +85,32 @@ describe('applyWgpuRenderEffectsToRenderTexture', () => {
81
85
  });
82
86
  });
83
87
 
88
+ describe('explainWgpuRenderEffectApplication', () => {
89
+ it('names the unregistered kinds and the status, as plain data with no message text', async () => {
90
+ const state = await createWgpuRenderStateForTest();
91
+ const pool = createWgpuRenderTexturePool();
92
+ const source = acquireWgpuRenderTexture(state, pool, { width: 8, height: 8 });
93
+ const dest = acquireWgpuRenderTexture(state, pool, { width: 8, height: 8 });
94
+ writeWgpuRenderTextureTarget(state, source, () => {});
95
+ registerWgpuRenderEffect(state, 'test.explain-registered', (() => {}) as WgpuRenderEffectRunner);
96
+
97
+ const explanation = explainWgpuRenderEffectApplication(state, source, dest, [
98
+ { kind: 'test.explain-registered' },
99
+ { kind: 'test.explain-missing' },
100
+ ] as unknown as Readonly<RenderEffect>[]);
101
+
102
+ expect(explanation).toMatchObject({
103
+ registeredCount: 1,
104
+ requestedCount: 2,
105
+ status: 'partial-registration',
106
+ unregisteredKinds: ['test.explain-missing'],
107
+ });
108
+ // No resolvability field: WGPU has no resolver half to registration, so a field mirroring GL's
109
+ // unresolvedIndexes could never be non-empty. Its absence is the contract, not an omission.
110
+ expect('unresolvedIndexes' in explanation).toBe(false);
111
+ });
112
+ });
113
+
84
114
  describe('offscreen effect registration snapshots', () => {
85
115
  it('copies runners at derivation and requires explicit re-copy for later runners', async () => {
86
116
  const screen = await createWgpuRenderStateForTest();
@@ -97,3 +127,28 @@ describe('offscreen effect registration snapshots', () => {
97
127
  expect(getWgpuRenderEffectRunner(offscreen, 'acme.Later')).toBe(later);
98
128
  });
99
129
  });
130
+
131
+ describe('setWgpuRenderEffectApplicationGuard', () => {
132
+ it('reports each failed application to the installed guard, and goes silent again when cleared', async () => {
133
+ const state = await createWgpuRenderStateForTest();
134
+ const pool = createWgpuRenderTexturePool();
135
+ const source = acquireWgpuRenderTexture(state, pool, { width: 8, height: 8 });
136
+ const dest = acquireWgpuRenderTexture(state, pool, { width: 8, height: 8 });
137
+ const scratch = acquireWgpuRenderTexture(state, pool, { width: 8, height: 8 });
138
+ writeWgpuRenderTextureTarget(state, source, () => {});
139
+ const seen: string[] = [];
140
+ const chain = [{ kind: 'test.seam-missing' }] as unknown as Readonly<RenderEffect>[];
141
+
142
+ setWgpuRenderEffectApplicationGuard(state, (_state, explanation) => seen.push(explanation.status));
143
+ applyWgpuRenderEffectsToRenderTexture(state, pool, source, dest, scratch, chain);
144
+
145
+ expect(seen).toEqual(['unregistered-effects']);
146
+
147
+ // Clearing must restore the original silence exactly: the seam is the only path by which a dropped
148
+ // chain is observable, so a stale guard is the difference between a diagnostic and a leak.
149
+ setWgpuRenderEffectApplicationGuard(state, null);
150
+ applyWgpuRenderEffectsToRenderTexture(state, pool, source, dest, scratch, chain);
151
+
152
+ expect(seen).toEqual(['unregistered-effects']);
153
+ });
154
+ });