@forgeax/engine-render 0.1.19 → 0.1.20
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/.tsbuildinfo +1 -1
- package/dist/assembly/factory.d.ts +16 -5
- package/dist/assembly/factory.d.ts.map +1 -1
- package/dist/{chunk-RJRUS55L.mjs → chunk-4XINDLAY.mjs} +267 -186
- package/dist/chunk-4XINDLAY.mjs.map +1 -0
- package/dist/{chunk-YTQ5C7YQ.mjs → chunk-CDTWTHZR.mjs} +176 -8
- package/dist/chunk-CDTWTHZR.mjs.map +1 -0
- package/dist/{chunk-IPXCABEP.mjs → chunk-M2MP4ZOU.mjs} +2 -2
- package/dist/chunk-M2MP4ZOU.mjs.map +1 -0
- package/dist/{chunk-LOSO4CTV.mjs → chunk-TBQJOK2L.mjs} +67 -3
- package/dist/chunk-TBQJOK2L.mjs.map +1 -0
- package/dist/components/light-helpers.d.ts.map +1 -1
- package/dist/components/spot-light.d.ts +12 -0
- package/dist/components/spot-light.d.ts.map +1 -1
- package/dist/construct-renderer.mjs +2281 -164
- package/dist/construct-renderer.mjs.map +1 -1
- package/dist/device/gpu-residency.d.ts +19 -2
- package/dist/device/gpu-residency.d.ts.map +1 -1
- package/dist/errors/render.d.ts +69 -1
- package/dist/errors/render.d.ts.map +1 -1
- package/dist/gpu-usage.d.ts +2 -0
- package/dist/gpu-usage.d.ts.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal.mjs +1 -1
- package/dist/light-buffer-layout.d.ts +20 -12
- package/dist/light-buffer-layout.d.ts.map +1 -1
- package/dist/pbr-pipeline.d.ts +6 -3
- package/dist/pbr-pipeline.d.ts.map +1 -1
- package/dist/pipeline/standard-forward-lane.d.ts.map +1 -1
- package/dist/pipeline/standard-pipeline.d.ts.map +1 -1
- package/dist/pipeline/standard-profile.d.ts +13 -0
- package/dist/pipeline/standard-profile.d.ts.map +1 -1
- package/dist/record/frame-lighting.d.ts +2 -0
- package/dist/record/frame-lighting.d.ts.map +1 -1
- package/dist/record/frame-snapshot.d.ts +37 -1
- package/dist/record/frame-snapshot.d.ts.map +1 -1
- package/dist/record/frame-targets.d.ts.map +1 -1
- package/dist/record/frame.d.ts +3 -2
- package/dist/record/frame.d.ts.map +1 -1
- package/dist/record/gpu-timing.d.ts +32 -0
- package/dist/record/gpu-timing.d.ts.map +1 -0
- package/dist/record/main-pass-material.d.ts +1 -1
- package/dist/record/main-pass-material.d.ts.map +1 -1
- package/dist/record/render-context.d.ts +5 -1
- package/dist/record/render-context.d.ts.map +1 -1
- package/dist/record/shadow-pass.d.ts.map +1 -1
- package/dist/record/typed-frame-graph.d.ts +11 -3
- package/dist/record/typed-frame-graph.d.ts.map +1 -1
- package/dist/render-contract.d.ts +66 -1
- package/dist/render-contract.d.ts.map +1 -1
- package/dist/render-data.d.ts +10 -6
- package/dist/render-data.d.ts.map +1 -1
- package/dist/render-pipeline.d.ts +36 -0
- package/dist/render-pipeline.d.ts.map +1 -1
- package/dist/render-system-extract.d.ts +55 -3
- package/dist/render-system-extract.d.ts.map +1 -1
- package/dist/render-system.d.ts +7 -1
- package/dist/render-system.d.ts.map +1 -1
- package/dist/renderer-inspect.d.ts +29 -0
- package/dist/renderer-inspect.d.ts.map +1 -0
- package/dist/scene/render-scene.d.ts.map +1 -1
- package/dist/temporal/frame.d.ts +44 -0
- package/dist/temporal/frame.d.ts.map +1 -0
- package/dist/temporal/index.mjs +3 -3
- package/dist/typed-render-graph-primitives.d.ts +6 -1
- package/dist/typed-render-graph-primitives.d.ts.map +1 -1
- package/dist/typed-shadow-atlas.d.ts +10 -0
- package/dist/typed-shadow-atlas.d.ts.map +1 -0
- package/dist/typed-shadow-passes.d.ts.map +1 -1
- package/dist/volume/capability.d.ts +57 -0
- package/dist/volume/capability.d.ts.map +1 -0
- package/dist/volume/component.d.ts +61 -0
- package/dist/volume/component.d.ts.map +1 -0
- package/dist/volume/extract.d.ts +11 -0
- package/dist/volume/extract.d.ts.map +1 -0
- package/dist/volume/inspection.d.ts +38 -0
- package/dist/volume/inspection.d.ts.map +1 -0
- package/dist/volume/passes.d.ts +38 -0
- package/dist/volume/passes.d.ts.map +1 -0
- package/dist/volume/recovery.d.ts +38 -0
- package/dist/volume/recovery.d.ts.map +1 -0
- package/dist/volume/resources.d.ts +57 -0
- package/dist/volume/resources.d.ts.map +1 -0
- package/dist/volume/temporal.d.ts +35 -0
- package/dist/volume/temporal.d.ts.map +1 -0
- package/package.json +20 -20
- package/src/__tests__/ktx2-basis-gpu-consumer.dawn.test.ts +14 -14
- package/src/__tests__/mesh-buffer-usage-surface.unit.test.ts +1 -1
- package/src/__tests__/render-error-code-owner.test-d.ts +5 -0
- package/src/__tests__/renderer-factory-material-contract.unit.test.ts +28 -0
- package/src/__tests__/renderer-frame-transaction.integration.test.ts +1 -1
- package/src/__tests__/skinned-shadow-caster.test.ts +21 -0
- package/src/__tests__/standard-profile-oracle.unit.test.ts +7 -5
- package/src/__tests__/volume-optics-oracle.unit.test.ts +85 -0
- package/src/__tests__/volumetric-fog-budget-recovery.integration.test.ts +655 -0
- package/src/__tests__/volumetric-fog-component.unit.test.ts +71 -0
- package/src/__tests__/volumetric-fog-composite-stage-readback.dawn.test.ts +376 -0
- package/src/__tests__/volumetric-fog-errors.unit.test.ts +51 -0
- package/src/__tests__/volumetric-fog-inspection.unit.test.ts +77 -0
- package/src/__tests__/volumetric-fog-light-capability.unit.test.ts +19 -0
- package/src/__tests__/volumetric-fog-light-consumers.integration.test.ts +18 -0
- package/src/__tests__/volumetric-fog-light-errors.unit.test.ts +17 -0
- package/src/__tests__/volumetric-fog-light-topology.unit.test.ts +21 -0
- package/src/__tests__/volumetric-fog-light-transaction.integration.test.ts +53 -0
- package/src/__tests__/volumetric-fog-m9-watcher.integration.test.ts +27 -0
- package/src/__tests__/volumetric-fog-point-light-owner.integration.test.ts +44 -0
- package/src/__tests__/volumetric-fog-point-spot-accumulation.integration.test.ts +49 -0
- package/src/__tests__/volumetric-fog-point-spot-contract.unit.test.ts +28 -0
- package/src/__tests__/volumetric-fog-point-spot-lkg.integration.test.ts +65 -0
- package/src/__tests__/volumetric-fog-point-spot-selection.integration.test.ts +49 -0
- package/src/__tests__/volumetric-fog-point-spot-temporal.unit.test.ts +55 -0
- package/src/__tests__/volumetric-fog-projector-contract.unit.test.ts +22 -0
- package/src/__tests__/volumetric-fog-projector-inspection.unit.test.ts +12 -0
- package/src/__tests__/volumetric-fog-projector-surface-volume.integration.test.ts +11 -0
- package/src/__tests__/volumetric-fog-projector-transaction.integration.test.ts +26 -0
- package/src/__tests__/volumetric-fog-recovery.integration.test.ts +47 -0
- package/src/__tests__/volumetric-fog-selected-light-resolution.integration.test.ts +63 -0
- package/src/__tests__/volumetric-fog-spot-closure.integration.test.ts +26 -0
- package/src/__tests__/volumetric-fog-spot-contract.test-d.ts +21 -0
- package/src/__tests__/volumetric-fog-spot-contract.unit.test.ts +27 -0
- package/src/__tests__/volumetric-fog-spot-frame-optics.integration.test.ts +14 -0
- package/src/__tests__/volumetric-fog-spot-optics.integration.test.ts +29 -0
- package/src/__tests__/volumetric-fog-stage-readback.dawn.test.ts +550 -0
- package/src/__tests__/volumetric-fog-temporal-selected-light.unit.test.ts +33 -0
- package/src/__tests__/volumetric-fog-temporal.unit.test.ts +45 -0
- package/src/__tests__/volumetric-fog-topology.unit.test.ts +237 -0
- package/src/__tests__/volumetric-fog-transparent.integration.test.ts +27 -0
- package/src/assembly/factory.ts +271 -15
- package/src/components/light-helpers.ts +4 -0
- package/src/components/spot-light.ts +22 -3
- package/src/device/gpu-residency.ts +168 -58
- package/src/errors/render.ts +119 -1
- package/src/gpu-usage.ts +2 -0
- package/src/index.ts +38 -1
- package/src/light-buffer-layout.ts +59 -26
- package/src/pbr-pipeline.ts +33 -10
- package/src/pipeline/standard-forward-lane.ts +20 -0
- package/src/pipeline/standard-pipeline.ts +20 -0
- package/src/pipeline/standard-profile.ts +23 -0
- package/src/record/frame-lighting.ts +103 -89
- package/src/record/frame-snapshot.ts +41 -1
- package/src/record/frame-targets.ts +6 -2
- package/src/record/frame.ts +908 -5
- package/src/record/gpu-timing.ts +224 -0
- package/src/record/main-pass-material.ts +6 -2
- package/src/record/render-context.ts +5 -0
- package/src/record/shadow-pass.ts +87 -38
- package/src/record/typed-frame-graph.ts +143 -8
- package/src/render-contract.ts +72 -0
- package/src/render-data.ts +50 -22
- package/src/render-pipeline.ts +44 -0
- package/src/render-system-extract.ts +329 -3
- package/src/render-system.ts +79 -0
- package/src/renderer-inspect.ts +66 -0
- package/src/scene/render-scene.ts +2 -0
- package/src/temporal/frame.ts +128 -0
- package/src/transmission/__tests__/standard-transmission.dawn.test.ts +2 -3
- package/src/typed-render-graph-primitives.ts +32 -2
- package/src/typed-shadow-atlas.ts +17 -0
- package/src/typed-shadow-passes.ts +6 -5
- package/src/volume/capability.ts +173 -0
- package/src/volume/component.ts +110 -0
- package/src/volume/extract.ts +21 -0
- package/src/volume/inspection.ts +78 -0
- package/src/volume/passes.ts +680 -0
- package/src/volume/recovery.ts +86 -0
- package/src/volume/resources.ts +236 -0
- package/src/volume/temporal.ts +89 -0
- package/dist/chunk-IPXCABEP.mjs.map +0 -1
- package/dist/chunk-LOSO4CTV.mjs.map +0 -1
- package/dist/chunk-RJRUS55L.mjs.map +0 -1
- package/dist/chunk-YTQ5C7YQ.mjs.map +0 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { volumetricFogTopology } from '../volume/passes';
|
|
5
|
+
import { deriveVolumetricFogResolvedExtent } from '../volume/resources';
|
|
6
|
+
|
|
7
|
+
const pipelineSource = readFileSync(
|
|
8
|
+
fileURLToPath(new URL('../pipeline/standard-pipeline.ts', import.meta.url)),
|
|
9
|
+
'utf8',
|
|
10
|
+
);
|
|
11
|
+
const shaderSource = (name: string): string =>
|
|
12
|
+
readFileSync(
|
|
13
|
+
fileURLToPath(new URL(`../../../shader/src/volume/${name}`, import.meta.url)),
|
|
14
|
+
'utf8',
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
describe('volumetric fog RenderGraph topology', () => {
|
|
18
|
+
it('uses the official quarter-resolution high-quality resolve lane', () => {
|
|
19
|
+
expect(deriveVolumetricFogResolvedExtent({ width: 1920, height: 1080 }, 4)).toEqual({
|
|
20
|
+
width: 480,
|
|
21
|
+
height: 270,
|
|
22
|
+
depth: 1,
|
|
23
|
+
});
|
|
24
|
+
expect(deriveVolumetricFogResolvedExtent({ width: 1920, height: 1080 }, 16)).toEqual({
|
|
25
|
+
width: 240,
|
|
26
|
+
height: 135,
|
|
27
|
+
depth: 1,
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('keeps denoise soft while retaining depth-boundary rejection', () => {
|
|
32
|
+
const composite = shaderSource('volume-composite.wgsl');
|
|
33
|
+
expect(composite).toContain('abs(neighbor_depth - center_depth)');
|
|
34
|
+
expect(composite).toContain('abs(neighbor.a - center.a) * 6.0');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('uses the pinned twelve-step ray integration while retaining packed visibility depth', () => {
|
|
38
|
+
const integrate = shaderSource('volume-integrate.wgsl');
|
|
39
|
+
expect(integrate).toContain('let ray_step_count = 12u;');
|
|
40
|
+
expect(integrate).toContain('for (var step = 0u; step < ray_step_count; step = step + 1u)');
|
|
41
|
+
expect(integrate).toContain('let visibility_depth = max(textureNumLayers(froxel) * 4u, 1u);');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('keeps the Beer-Lambert extinction input physically non-negative', () => {
|
|
45
|
+
const integrate = shaderSource('volume-integrate.wgsl');
|
|
46
|
+
expect(integrate).toContain(
|
|
47
|
+
'let density_value = max(volume_scattering_density(world_position, frame_index), 0.0);',
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('keeps the authored path to four ordered passes and two history slots', () => {
|
|
52
|
+
const topology = volumetricFogTopology(true);
|
|
53
|
+
expect(topology.passes).toEqual([
|
|
54
|
+
'volume-inject',
|
|
55
|
+
'volume-integrate',
|
|
56
|
+
'volume-temporal',
|
|
57
|
+
'volume-composite',
|
|
58
|
+
]);
|
|
59
|
+
expect(topology.resources).toEqual([
|
|
60
|
+
'volume-froxel',
|
|
61
|
+
'volume-resolved-current',
|
|
62
|
+
'volume-history',
|
|
63
|
+
'volume-temporal',
|
|
64
|
+
]);
|
|
65
|
+
expect(topology.colorInput).toBe('linear-hdr');
|
|
66
|
+
expect(topology.depthInput).toBe('scene-depth');
|
|
67
|
+
expect(topology.passes).not.toContain('apply_fog');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('packs four logical visibility slices per rgba8 array texel', () => {
|
|
71
|
+
const resources = readFileSync(
|
|
72
|
+
fileURLToPath(new URL('../volume/resources.ts', import.meta.url)),
|
|
73
|
+
'utf8',
|
|
74
|
+
);
|
|
75
|
+
const passes = readFileSync(
|
|
76
|
+
fileURLToPath(new URL('../volume/passes.ts', import.meta.url)),
|
|
77
|
+
'utf8',
|
|
78
|
+
);
|
|
79
|
+
expect(resources).toContain("VOLUME_FROXEL_FORMAT = 'rgba8unorm'");
|
|
80
|
+
expect(passes).toContain('format: VOLUME_FROXEL_FORMAT');
|
|
81
|
+
expect(shaderSource('volume-inject.wgsl')).toContain(
|
|
82
|
+
'texture_storage_2d_array<rgba8unorm, write>',
|
|
83
|
+
);
|
|
84
|
+
expect(shaderSource('volume-inject.wgsl')).not.toContain('var density : texture_3d');
|
|
85
|
+
expect(shaderSource('volume-integrate.wgsl')).toContain('texture_2d_array<f32>');
|
|
86
|
+
expect(shaderSource('volume-integrate.wgsl')).toContain('texture_3d<f32>');
|
|
87
|
+
expect(shaderSource('volume-integrate.wgsl')).toContain('slice_group');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('uploads the camera depth convention consumed by volume CSM selection', () => {
|
|
91
|
+
const viewUbo = readFileSync(
|
|
92
|
+
fileURLToPath(new URL('../record/view-ubo.ts', import.meta.url)),
|
|
93
|
+
'utf8',
|
|
94
|
+
);
|
|
95
|
+
expect(viewUbo).toContain('viewPayload[228] = camera.near');
|
|
96
|
+
expect(viewUbo).toContain('viewPayload[229] = camera.far');
|
|
97
|
+
expect(viewUbo).toContain("camera.projection === 'orthographic' ? 1 : 0");
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('does not allocate or schedule volume work when fog is off', () => {
|
|
101
|
+
expect(volumetricFogTopology(false)).toEqual({
|
|
102
|
+
passes: [],
|
|
103
|
+
resources: [],
|
|
104
|
+
colorInput: 'linear-hdr',
|
|
105
|
+
depthInput: 'scene-depth',
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('places the integrated volume before tone mapping in Standard pipeline source', () => {
|
|
110
|
+
expect(pipelineSource).toContain('volume-composite');
|
|
111
|
+
expect(pipelineSource).toContain('tone mapping');
|
|
112
|
+
expect(pipelineSource.indexOf('volume-composite')).toBeLessThan(
|
|
113
|
+
pipelineSource.indexOf('tone mapping'),
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('encodes real volume work and non-constant optical semantics', () => {
|
|
118
|
+
const passes = readFileSync(
|
|
119
|
+
fileURLToPath(new URL('../volume/passes.ts', import.meta.url)),
|
|
120
|
+
'utf8',
|
|
121
|
+
);
|
|
122
|
+
expect(passes).toContain('pass.dispatchWorkgroups(dispatchX, dispatchY, packedLayers)');
|
|
123
|
+
expect(passes).toContain('pass.dispatchWorkgroups(resolvedDispatchX, resolvedDispatchY, 1)');
|
|
124
|
+
expect(passes).toContain('resolvedExtent');
|
|
125
|
+
expect(passes).toContain('pass.draw(3)');
|
|
126
|
+
expect(shaderSource('volume-inject.wgsl')).not.toContain('scene_depth');
|
|
127
|
+
expect(shaderSource('volume-inject.wgsl')).not.toContain('depth_weight');
|
|
128
|
+
expect(shaderSource('volume-inject.wgsl')).not.toContain('scene_world');
|
|
129
|
+
expect(shaderSource('volume-inject.wgsl')).toContain('fn volume_cascade');
|
|
130
|
+
expect(shaderSource('volume-inject.wgsl')).toContain('fn ray_box_interval');
|
|
131
|
+
expect(shaderSource('volume-inject.wgsl')).toContain('view.inverseViewProj');
|
|
132
|
+
expect(shaderSource('volume-inject.wgsl')).not.toContain('textureSampleLevel(density');
|
|
133
|
+
expect(shaderSource('volume-inject.wgsl')).toContain('stratified32');
|
|
134
|
+
expect(shaderSource('volume-inject.wgsl')).toContain('dither_unorm8');
|
|
135
|
+
expect(shaderSource('volume-integrate.wgsl')).toContain('exp(-sigma_scale');
|
|
136
|
+
expect(shaderSource('volume-integrate.wgsl')).toContain('textureSampleLevel(froxel');
|
|
137
|
+
expect(shaderSource('volume-integrate.wgsl')).toContain('textureStore(resolved');
|
|
138
|
+
expect(shaderSource('volume-temporal.wgsl')).toContain('var lower');
|
|
139
|
+
expect(shaderSource('volume-temporal.wgsl')).toContain('fn bilinear');
|
|
140
|
+
expect(shaderSource('volume-integrate.wgsl')).not.toContain('previous_ndc.z');
|
|
141
|
+
expect(shaderSource('volume-composite.wgsl')).toContain('textureSampleLevel');
|
|
142
|
+
expect(shaderSource('volume-composite.wgsl')).toContain('edge_aware_resolved_volume');
|
|
143
|
+
expect(shaderSource('volume-composite.wgsl')).toContain('textureDimensions(resolved_volume)');
|
|
144
|
+
expect(passes).toContain("{ resource: inputs.density, usage: 'sampled-read' }");
|
|
145
|
+
expect(passes).toContain("viewDimension: '2d-array'");
|
|
146
|
+
expect(shaderSource('volume-composite.wgsl')).toContain('linear_scene_depth');
|
|
147
|
+
expect(shaderSource('volume-composite.wgsl')).toContain('depth_weight');
|
|
148
|
+
expect(shaderSource('volume-temporal.wgsl')).toContain('temporalPreviousViewProj');
|
|
149
|
+
expect(shaderSource('volume-temporal.wgsl')).toContain('fn reproject_uv');
|
|
150
|
+
expect(shaderSource('volume-temporal.wgsl')).toContain(
|
|
151
|
+
'temporalPreviousViewProj * vec4<f32>(world, 1.0)',
|
|
152
|
+
);
|
|
153
|
+
expect(shaderSource('volume-temporal.wgsl')).toContain('var lower');
|
|
154
|
+
expect(shaderSource('volume-composite.wgsl')).not.toContain('/ 64.0');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('uses fixed logical-slice centers for injection and integration', () => {
|
|
158
|
+
const inject = shaderSource('volume-inject.wgsl');
|
|
159
|
+
const integrate = shaderSource('volume-integrate.wgsl');
|
|
160
|
+
expect(inject).toContain('(f32(logical_slice) + 0.5) / f32(logical_depth)');
|
|
161
|
+
expect(inject).not.toContain('depth_phase');
|
|
162
|
+
expect(integrate).toContain('fn stratified32');
|
|
163
|
+
expect(integrate).toContain('segment_start + segment_length * depth_phase');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('keeps temporal history graph-owned and slot-selectable', () => {
|
|
167
|
+
const passes = readFileSync(
|
|
168
|
+
fileURLToPath(new URL('../volume/passes.ts', import.meta.url)),
|
|
169
|
+
'utf8',
|
|
170
|
+
);
|
|
171
|
+
const frameSource = readFileSync(
|
|
172
|
+
fileURLToPath(new URL('../record/frame.ts', import.meta.url)),
|
|
173
|
+
'utf8',
|
|
174
|
+
);
|
|
175
|
+
expect(passes).toContain('historyReadSlot');
|
|
176
|
+
expect(passes).toContain('historyWriteSlot');
|
|
177
|
+
expect(passes).toContain("usage: 'sampled-storage-read-write'");
|
|
178
|
+
expect(passes).not.toContain('temporalInit');
|
|
179
|
+
expect(passes).not.toContain('volume_temporal_init');
|
|
180
|
+
expect(passes).not.toContain('textureStore(volume_history');
|
|
181
|
+
expect(frameSource).toContain('volumetricFogHistoryGraph');
|
|
182
|
+
expect(frameSource).toContain('volumetricFogHistorySlot');
|
|
183
|
+
expect(frameSource).toContain('volumetricFogHistorySignature');
|
|
184
|
+
expect(frameSource).toContain('activeVolumetricFogSignature');
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('advances temporal history only after the accepted queue submit', () => {
|
|
188
|
+
const recordSource = readFileSync(
|
|
189
|
+
fileURLToPath(new URL('../record/frame.ts', import.meta.url)),
|
|
190
|
+
'utf8',
|
|
191
|
+
);
|
|
192
|
+
const submitSource = readFileSync(
|
|
193
|
+
fileURLToPath(new URL('../record/typed-frame-graph.ts', import.meta.url)),
|
|
194
|
+
'utf8',
|
|
195
|
+
);
|
|
196
|
+
expect(recordSource).toContain('temporalFrameTransaction.stage');
|
|
197
|
+
expect(recordSource).toContain('volumetricFogParamsPendingSlot');
|
|
198
|
+
expect(recordSource).toContain('volumetricFogParamsAcceptedSlot');
|
|
199
|
+
expect(recordSource).toContain('hasVolumetricFogCapability');
|
|
200
|
+
expect(submitSource).toContain('device.queue.submit([preparedCommand.command])');
|
|
201
|
+
expect(submitSource).toContain('commitTemporalGpuSubmit(stagedGpuState)');
|
|
202
|
+
expect(submitSource.indexOf('device.queue.submit([preparedCommand.command])')).toBeLessThan(
|
|
203
|
+
submitSource.indexOf('commitTemporalGpuSubmit(stagedGpuState)'),
|
|
204
|
+
);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('requires the manifest-owned shader bundle in addition to compute/storage caps', async () => {
|
|
208
|
+
const { hasVolumetricFogCapability } = await import('../volume/capability');
|
|
209
|
+
expect(hasVolumetricFogCapability({ compute: true, storageTexture: true }, {})).toBe(true);
|
|
210
|
+
expect(hasVolumetricFogCapability({ compute: true, storageTexture: true }, undefined)).toBe(
|
|
211
|
+
false,
|
|
212
|
+
);
|
|
213
|
+
expect(hasVolumetricFogCapability({ compute: false, storageTexture: true }, {})).toBe(false);
|
|
214
|
+
expect(hasVolumetricFogCapability({ compute: true, storageTexture: false }, {})).toBe(false);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('clears device-bound volume parameter slots during recovery without destroying old handles', () => {
|
|
218
|
+
const renderSystemSource = readFileSync(
|
|
219
|
+
fileURLToPath(new URL('../render-system.ts', import.meta.url)),
|
|
220
|
+
'utf8',
|
|
221
|
+
);
|
|
222
|
+
const recoverStart = renderSystemSource.indexOf('resetForRecover(): void {');
|
|
223
|
+
expect(recoverStart).toBeGreaterThanOrEqual(0);
|
|
224
|
+
const recoverEnd = renderSystemSource.indexOf(
|
|
225
|
+
'restorePostProcessResources(): void',
|
|
226
|
+
recoverStart,
|
|
227
|
+
);
|
|
228
|
+
expect(recoverEnd).toBeGreaterThan(recoverStart);
|
|
229
|
+
const recoverSource = renderSystemSource.slice(recoverStart, recoverEnd);
|
|
230
|
+
expect(recoverSource).toContain('frameState.volumetricFogParamsBuffers = [null, null]');
|
|
231
|
+
expect(recoverSource).toContain('frameState.volumetricFogParamsPendingSlot = null');
|
|
232
|
+
expect(recoverSource).toContain('frameState.volumetricFogParamsAcceptedSlot = null');
|
|
233
|
+
expect(recoverSource).toContain('frameState.volumetricFogAcceptedParams = undefined');
|
|
234
|
+
expect(recoverSource).toContain('frameState.volumetricFogPendingParams = undefined');
|
|
235
|
+
expect(recoverSource).not.toContain('destroyBuffer(buffer)');
|
|
236
|
+
});
|
|
237
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { resolveIntegratedVolumeConsumer } from '../volume/capability';
|
|
3
|
+
|
|
4
|
+
describe('volumetric fog shared consumer contract', () => {
|
|
5
|
+
it('provides one integrated volume to opaque and transparent consumers', () => {
|
|
6
|
+
const resource = {
|
|
7
|
+
identity: 'volume-integrated',
|
|
8
|
+
format: 'rgba16float',
|
|
9
|
+
stage: 'resolved' as const,
|
|
10
|
+
} as const;
|
|
11
|
+
for (const consumer of ['opaque', 'transparent', 'sprite', 'vfx'] as const) {
|
|
12
|
+
expect(resolveIntegratedVolumeConsumer(resource, consumer)).toEqual({
|
|
13
|
+
consumer,
|
|
14
|
+
resource,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('does not let a custom consumer own volume device or history', () => {
|
|
20
|
+
const result = resolveIntegratedVolumeConsumer(
|
|
21
|
+
{ identity: 'volume-integrated', format: 'rgba16float', stage: 'resolved' } as const,
|
|
22
|
+
'custom',
|
|
23
|
+
);
|
|
24
|
+
expect(result).not.toHaveProperty('device');
|
|
25
|
+
expect(result).not.toHaveProperty('history');
|
|
26
|
+
});
|
|
27
|
+
});
|