@flighthq/effects-wgpu 0.5.1-next.799.62ef0c7 → 0.5.1-next.820.97b3830
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/README.md +2 -2
- package/package.json +10 -10
- package/src/wgpuColorLutPass.test.ts +19 -1
- package/src/wgpuGradientBevelEffect.test.ts +19 -1
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/effects-wgpu`. The `
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/effects-wgpu@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/effects-wgpu@0.5.1-next.820.97b3830](https://github.com/flighthq/flight/tree/97b3830e843209d92da169e02a52c0574efe5c09/packages/effects-wgpu)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/97b3830e843209d92da169e02a52c0574efe5c09/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/effects-wgpu",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.820.97b3830",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/adjustments": "0.5.1-next.
|
|
42
|
-
"@flighthq/color": "0.5.1-next.
|
|
43
|
-
"@flighthq/effects": "0.5.1-next.
|
|
44
|
-
"@flighthq/entity": "0.5.1-next.
|
|
45
|
-
"@flighthq/geometry": "0.5.1-next.
|
|
46
|
-
"@flighthq/log": "0.5.1-next.
|
|
47
|
-
"@flighthq/render-wgpu": "0.5.1-next.
|
|
48
|
-
"@flighthq/registry": "0.5.1-next.
|
|
49
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/adjustments": "0.5.1-next.820.97b3830",
|
|
42
|
+
"@flighthq/color": "0.5.1-next.820.97b3830",
|
|
43
|
+
"@flighthq/effects": "0.5.1-next.820.97b3830",
|
|
44
|
+
"@flighthq/entity": "0.5.1-next.820.97b3830",
|
|
45
|
+
"@flighthq/geometry": "0.5.1-next.820.97b3830",
|
|
46
|
+
"@flighthq/log": "0.5.1-next.820.97b3830",
|
|
47
|
+
"@flighthq/render-wgpu": "0.5.1-next.820.97b3830",
|
|
48
|
+
"@flighthq/registry": "0.5.1-next.820.97b3830",
|
|
49
|
+
"@flighthq/types": "0.5.1-next.820.97b3830"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@webgpu/types": "^0.1.70"
|
|
@@ -34,17 +34,28 @@ const recorded = {
|
|
|
34
34
|
uniforms: [] as number[][],
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
let restoreEffectVertexWgsl: (() => void) | null = null;
|
|
38
|
+
|
|
37
39
|
// The WebGPU flag enums are type-level only in @webgpu/types, so jsdom has no runtime values for the
|
|
38
40
|
// usage and visibility bits this module ORs together.
|
|
39
41
|
beforeAll(() => installWgpuMock());
|
|
40
42
|
|
|
41
43
|
beforeEach(() => {
|
|
42
44
|
vi.spyOn(wgpuEffectPassModule, 'getWgpuEffectPassState').mockReturnValue(passState as never);
|
|
45
|
+
const original = Object.getOwnPropertyDescriptor(wgpuEffectPassModule, 'EFFECT_VERTEX_WGSL');
|
|
43
46
|
// eslint-disable-next-line no-import-assign -- replacing a non-function export for test; works on Vite SSR namespaces
|
|
44
47
|
Object.defineProperty(wgpuEffectPassModule, 'EFFECT_VERTEX_WGSL', { value: 'VERTEX_WGSL\n', configurable: true });
|
|
48
|
+
restoreEffectVertexWgsl = () => {
|
|
49
|
+
// eslint-disable-next-line no-import-assign -- restoring the original descriptor captured above
|
|
50
|
+
if (original !== undefined) Object.defineProperty(wgpuEffectPassModule, 'EFFECT_VERTEX_WGSL', original);
|
|
51
|
+
};
|
|
45
52
|
});
|
|
46
53
|
|
|
47
|
-
afterEach(() =>
|
|
54
|
+
afterEach(() => {
|
|
55
|
+
restoreEffectVertexWgsl?.();
|
|
56
|
+
restoreEffectVertexWgsl = null;
|
|
57
|
+
vi.restoreAllMocks();
|
|
58
|
+
});
|
|
48
59
|
|
|
49
60
|
function createHarness(): {
|
|
50
61
|
createTexture: ReturnType<typeof vi.fn>;
|
|
@@ -253,3 +264,10 @@ describe('applyColorLutPassToWgpu', () => {
|
|
|
253
264
|
expect(recorded.shaderCode[0]).toContain('0.5 / uni.u_size');
|
|
254
265
|
});
|
|
255
266
|
});
|
|
267
|
+
|
|
268
|
+
describe('EFFECT_VERTEX_WGSL namespace stub', () => {
|
|
269
|
+
it('is restored after each test, so it cannot leak to other files', () => {
|
|
270
|
+
restoreEffectVertexWgsl?.();
|
|
271
|
+
expect(wgpuEffectPassModule.EFFECT_VERTEX_WGSL).toContain('struct VertexOut');
|
|
272
|
+
});
|
|
273
|
+
});
|
|
@@ -54,14 +54,21 @@ const passState = {
|
|
|
54
54
|
}),
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
let restoreEffectVertexWgsl: (() => void) | null = null;
|
|
58
|
+
|
|
57
59
|
beforeAll(() => installWgpuMock());
|
|
58
60
|
|
|
59
61
|
beforeEach(() => {
|
|
60
62
|
vi.spyOn(wgpuEffectPassModule, 'clearWgpuEffectTarget').mockImplementation((() =>
|
|
61
63
|
recorded.calls.push('clear')) as never);
|
|
62
64
|
vi.spyOn(wgpuEffectPassModule, 'getWgpuEffectPassState').mockReturnValue(passState as never);
|
|
65
|
+
const original = Object.getOwnPropertyDescriptor(wgpuEffectPassModule, 'EFFECT_VERTEX_WGSL');
|
|
63
66
|
// eslint-disable-next-line no-import-assign -- replacing a non-function export for test; works on Vite SSR namespaces
|
|
64
67
|
Object.defineProperty(wgpuEffectPassModule, 'EFFECT_VERTEX_WGSL', { value: 'VERTEX\n', configurable: true });
|
|
68
|
+
restoreEffectVertexWgsl = () => {
|
|
69
|
+
// eslint-disable-next-line no-import-assign -- restoring the original descriptor captured above
|
|
70
|
+
if (original !== undefined) Object.defineProperty(wgpuEffectPassModule, 'EFFECT_VERTEX_WGSL', original);
|
|
71
|
+
};
|
|
65
72
|
|
|
66
73
|
vi.spyOn(wgpuEffectBlitShaderModule, 'applyWgpuEffectBlitPass').mockImplementation(((
|
|
67
74
|
_state: unknown,
|
|
@@ -106,7 +113,11 @@ beforeEach(() => {
|
|
|
106
113
|
recorded.released.push(target)) as never);
|
|
107
114
|
});
|
|
108
115
|
|
|
109
|
-
afterEach(() =>
|
|
116
|
+
afterEach(() => {
|
|
117
|
+
restoreEffectVertexWgsl?.();
|
|
118
|
+
restoreEffectVertexWgsl = null;
|
|
119
|
+
vi.restoreAllMocks();
|
|
120
|
+
});
|
|
110
121
|
|
|
111
122
|
const SOURCE_WIDTH = 100;
|
|
112
123
|
const SOURCE_HEIGHT = 50;
|
|
@@ -257,6 +268,13 @@ describe('defaultWgpuGradientBevelEffectRunner', () => {
|
|
|
257
268
|
});
|
|
258
269
|
});
|
|
259
270
|
|
|
271
|
+
describe('EFFECT_VERTEX_WGSL namespace stub', () => {
|
|
272
|
+
it('is restored after each test, so it cannot leak to other files', () => {
|
|
273
|
+
restoreEffectVertexWgsl?.();
|
|
274
|
+
expect(wgpuEffectPassModule.EFFECT_VERTEX_WGSL).toContain('struct VertexOut');
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
260
278
|
describe('registerWgpuGradientBevelEffect', () => {
|
|
261
279
|
it('makes the runner resolvable for the GradientBevelEffect kind', async () => {
|
|
262
280
|
const state = await createWgpuRenderStateForTest();
|