-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
859 lines (813 loc) · 41.1 KB
/
Copy pathmise.toml
File metadata and controls
859 lines (813 loc) · 41.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
[tool_alias]
ols = "github:DanielGavin/ols"
odinfmt = "github:DanielGavin/ols"
[tools]
node = "24"
odin = { version = "dev-2026-07", exe = "odin" }
ols = { version = "dev-2026-05", rename_exe = "ols" }
odinfmt = { version = "dev-2026-05", rename_exe = "odinfmt" }
pnpm = "10"
python = "3.13"
[tasks.fmt]
description = "Format all Odin source files"
run = '''
odinfmt src -w
odinfmt examples -w
'''
[tasks.fmt-audit]
description = "Report Odin formatting drift without changing files"
run = '''
find src examples -name '*.odin' -exec sh -c '
tmp="${TMPDIR:-/tmp}/scrapbot-odinfmt-$$"
for file do
cp "$file" "$tmp"
odinfmt "$tmp" -config:odinfmt.json -w
if ! cmp -s "$file" "$tmp"; then
echo "Odin formatting required: $file" >&2
fi
done
rm -f "$tmp"
' sh {} +
'''
[tasks.fmt-staged]
description = "Check staged Odin files with odinfmt"
run = "node tools/check_staged_odin_format.mjs"
[tasks.setup]
description = "Install project tools, source dependencies, external fixtures, and Git hooks"
run = '''
mise install
mise run icon-tools
mise run wgpu
git submodule update --init --recursive
node tools/setup_external_assets.mjs
git config --local core.hooksPath .githooks
'''
[tasks.icon-tools]
description = "Install the pinned SVG normalizer and validate msdf-atlas-gen 1.4.0"
sources = [
"tools/compile_icon_set.py",
"tools/icon_compiler_requirements.txt",
"tools/scrapbot-iconc",
]
outputs = [
".scrapbot/tools/icon-compiler/.scrapbot-ready",
"bin/scrapbot-iconc",
]
run = '''
ICON_ENV=".scrapbot/tools/icon-compiler"
python -m venv "$ICON_ENV"
"$ICON_ENV/bin/python" -m pip install --disable-pip-version-check \
--requirement tools/icon_compiler_requirements.txt
touch "$ICON_ENV/.scrapbot-ready"
mkdir -p bin
ln -sfn ../tools/scrapbot-iconc bin/scrapbot-iconc
MSDF_ATLAS_GEN="${SCRAPBOT_MSDF_ATLAS_GEN:-msdf-atlas-gen}"
if ! command -v "$MSDF_ATLAS_GEN" >/dev/null 2>&1; then
echo "msdf-atlas-gen 1.4.0 is required; install it or set SCRAPBOT_MSDF_ATLAS_GEN" >&2
exit 1
fi
case "$("$MSDF_ATLAS_GEN" -version 2>&1 | head -n 1)" in
"MSDF-Atlas-Gen v1.4.0") ;;
*)
echo "msdf-atlas-gen 1.4.0 is required" >&2
exit 1
;;
esac
'''
[tasks.builtin-icons]
description = "Regenerate the embedded built-in icon atlas and symbol metadata"
depends = ["icon-tools"]
sources = [
"tools/generate_builtin_icons.py",
"tools/compile_icon_set.py",
"src/scrapbot/resources/assets/builtin-icons/**/*.svg",
]
outputs = [
"src/scrapbot/resources/assets/builtin_icons_mtsdf.bin",
"src/scrapbot/resources/builtin_icon_data.odin",
]
run = "python tools/generate_builtin_icons.py"
[tasks.setup-assets]
description = "Download and verify pinned external development fixtures"
run = "node tools/setup_external_assets.mjs"
[tasks.archive-assets]
description = "Generate the Impossible Archive GLB (pass --preset small, showcase, or unhinged)"
run = 'node tools/generate_impossible_archive.mjs "$@"'
[tasks.archive-profile]
description = "Generate and profile the Impossible Archive showcase"
depends = ["build"]
run = '''
node tools/generate_impossible_archive.mjs --preset showcase
ARCHIVE_PROFILE="${TMPDIR:-/tmp}/scrapbot-impossible-archive-profile"
bin/scrapbot profile examples/impossible-archive --warmup 60 --frames 240 --resolution 1600x900 --out "$ARCHIVE_PROFILE" --json
echo "Impossible Archive profile: $ARCHIVE_PROFILE"
'''
[tasks.test-impossible-archive]
description = "Generate, import, and run the Impossible Archive development preset"
depends = ["build"]
run = '''
node tools/generate_impossible_archive.mjs --preset small --check
node tools/generate_impossible_archive.mjs --preset small
bin/scrapbot check examples/impossible-archive --json
bin/scrapbot run examples/impossible-archive --backend null --headless --no-hot-reload --frames 3 --json
'''
[tasks.check-assets]
description = "Verify that pinned external development fixtures are installed"
run = "node tools/setup_external_assets.mjs --check"
[tasks.test-gltf]
description = "Import and validate the pinned real-world glTF fixture"
depends = ["build"]
run = "node tools/test_external_gltf.mjs"
[tasks.test-gltf-gpu]
description = "Import and render the pinned real-world glTF fixture"
depends = ["build"]
run = 'node tools/test_external_gltf.mjs --framegrab "${TMPDIR:-/tmp}/scrapbot-damaged-helmet.png"'
[tasks.test-sponza]
description = "Import and validate the pinned Khronos Sponza fixture"
depends = ["build"]
run = "node tools/test_external_sponza.mjs"
[tasks.test-sponza-gpu]
description = "Import and render the pinned Khronos Sponza fixture"
depends = ["build"]
run = 'node tools/test_external_sponza.mjs --framegrab "${TMPDIR:-/tmp}/scrapbot-sponza.png"'
[tasks.test-virtual-wilds]
description = "Import and validate the pinned Poly Haven virtual-geometry fixture"
depends = ["build"]
run = "node tools/test_external_virtual_wilds.mjs"
[tasks.test-virtual-wilds-gpu]
description = "Import and verify a stable multi-frame Virtual Wilds stream"
depends = ["build"]
run = 'node tools/test_external_virtual_wilds.mjs --sequence-out "${TMPDIR:-/tmp}/scrapbot-virtual-wilds-sequence"'
[tasks.build]
description = "Build the Scrapbot CLI when its optimized binary is stale"
depends = ["luau", "cgltf", "meshoptimizer", "wgpu", "icon-tools"]
sources = [
"mise.toml",
"src/**/*",
"third_party/luau/build/release/*.a",
"third_party/meshoptimizer/build/release/libmeshoptimizer.a",
]
outputs = ["bin/scrapbot"]
run = '''
mkdir -p bin
LUAU_LIBS="third_party/luau/build/release"
case "$(uname -s)" in
Darwin)
LUAU_LINK_FLAGS="-Wl,-force_load,$LUAU_LIBS/libluaucompiler.a -Wl,-force_load,$LUAU_LIBS/libluauast.a -Wl,-force_load,$LUAU_LIBS/libluaubytecode.a -Wl,-force_load,$LUAU_LIBS/libluauvm.a -Wl,-force_load,$LUAU_LIBS/libluaucommon.a -Wl,-force_load,third_party/meshoptimizer/build/release/libmeshoptimizer.a -lc++"
;;
Linux)
LUAU_LINK_FLAGS="-Wl,--whole-archive $LUAU_LIBS/libluaucompiler.a $LUAU_LIBS/libluauast.a $LUAU_LIBS/libluaubytecode.a $LUAU_LIBS/libluauvm.a $LUAU_LIBS/libluaucommon.a third_party/meshoptimizer/build/release/libmeshoptimizer.a -Wl,--no-whole-archive -lstdc++ -lpthread"
;;
*)
echo "unsupported Luau link platform: $(uname -s)" >&2
exit 1
;;
esac
odin build src/scrapbot_cli -out:bin/scrapbot -o:speed -extra-linker-flags:"$LUAU_LINK_FLAGS"
'''
[tasks.build-dev]
description = "Build the Scrapbot CLI for fast development iteration when stale"
depends = ["luau", "cgltf", "meshoptimizer", "wgpu", "icon-tools"]
sources = [
"mise.toml",
"src/**/*",
"third_party/luau/build/release/*.a",
"third_party/meshoptimizer/build/release/libmeshoptimizer.a",
]
outputs = ["bin/scrapbot-dev"]
run = '''
mkdir -p bin
LUAU_LIBS="third_party/luau/build/release"
case "$(uname -s)" in
Darwin)
LUAU_LINK_FLAGS="-Wl,-force_load,$LUAU_LIBS/libluaucompiler.a -Wl,-force_load,$LUAU_LIBS/libluauast.a -Wl,-force_load,$LUAU_LIBS/libluaubytecode.a -Wl,-force_load,$LUAU_LIBS/libluauvm.a -Wl,-force_load,$LUAU_LIBS/libluaucommon.a -Wl,-force_load,third_party/meshoptimizer/build/release/libmeshoptimizer.a -lc++"
;;
Linux)
LUAU_LINK_FLAGS="-Wl,--whole-archive $LUAU_LIBS/libluaucompiler.a $LUAU_LIBS/libluauast.a $LUAU_LIBS/libluaubytecode.a $LUAU_LIBS/libluauvm.a $LUAU_LIBS/libluaucommon.a third_party/meshoptimizer/build/release/libmeshoptimizer.a -Wl,--no-whole-archive -lstdc++ -lpthread"
;;
*)
echo "unsupported Luau link platform: $(uname -s)" >&2
exit 1
;;
esac
odin build src/scrapbot_cli -out:bin/scrapbot-dev -o:minimal -extra-linker-flags:"$LUAU_LINK_FLAGS"
'''
[tasks.build-release]
description = "Build the Scrapbot CLI for distribution"
depends = ["build"]
run = "cp bin/scrapbot bin/scrapbot-release"
[tasks.benchmark-profiles]
description = "Compare development and performance optimization profiles"
depends = ["build-dev", "build"]
run = "node tools/benchmark_profiles.mjs \"$@\""
[tasks.benchmark-native-queries]
description = "Stress retained native query chunks with a high-churn emitter"
depends = ["build"]
run = "node tools/benchmark_native_queries.mjs \"$@\""
[tasks.profile-analyze]
description = "Summarize or compare Scrapbot render profile reports"
run = "node tools/analyze_render_profile.mjs \"$@\""
[tasks.frame-sequence-sheet]
description = "Build contact and difference sheets from a profile capture-range directory"
run = 'node tools/make_frame_sequence_sheet.mjs "$@"'
[tasks.profile-sweep]
description = "Profile one project across a bounded resolution matrix"
run = "node tools/profile_resolution_sweep.mjs \"$@\""
[tasks.profile-features]
description = "Profile isolated camera and post-processing feature costs"
run = "node tools/profile_feature_sweep.mjs \"$@\""
[tasks.gpu-benchmarks]
description = "Build a representative multi-resolution GPU benchmark bundle"
depends = ["build"]
run = "node tools/run_gpu_benchmarks.mjs \"$@\""
[tasks.gpu-benchmark-compare]
description = "Compare two compatible GPU benchmark bundles"
run = "node tools/compare_gpu_benchmarks.mjs \"$@\""
[tasks.luau]
description = "Build embedded Luau"
run = '''
test -d third_party/luau/VM || { echo "third_party/luau missing; run git submodule update --init --recursive"; exit 1; }
make -C third_party/luau config=release CXXFLAGS="-g -Wall -O2 -DNDEBUG -fno-math-errno -std=c++17 -ICommon/include -IVM/include -IAst/include -IBytecode/include -ICompiler/include -DLUA_USE_LONGJMP=1 -DLUA_API='extern \"C\"' -DLUACODE_API='extern \"C\"'" build/release/libluauvm.a build/release/libluaucompiler.a build/release/libluauast.a build/release/libluaubytecode.a build/release/libluaucommon.a
'''
[tasks.cgltf]
description = "Build Odin's pinned cgltf vendor library when absent"
run = '''
CGLTF_ROOT="$(odin root)/vendor/cgltf"
case "$(uname -s)" in
Darwin) CGLTF_LIB="$CGLTF_ROOT/lib/darwin/cgltf.a" ;;
Linux) CGLTF_LIB="$CGLTF_ROOT/lib/cgltf.a" ;;
*) echo "unsupported cgltf build platform: $(uname -s)" >&2; exit 1 ;;
esac
if [ ! -f "$CGLTF_LIB" ]; then
make -C "$CGLTF_ROOT/src"
fi
'''
[tasks.meshoptimizer]
description = "Build the pinned meshoptimizer library for offline meshlet generation"
sources = ["third_party/meshoptimizer/src/**/*", "third_party/meshoptimizer/Makefile", "native/clusterlod/clusterlod.cpp"]
outputs = ["third_party/meshoptimizer/build/release/libmeshoptimizer.a"]
run = '''
make -C third_party/meshoptimizer config=release build/release/libmeshoptimizer.a
mkdir -p third_party/meshoptimizer/build/release/scrapbot
${CXX:-c++} -O3 -std=c++11 -Ithird_party/meshoptimizer/src -c native/clusterlod/clusterlod.cpp -o third_party/meshoptimizer/build/release/scrapbot/clusterlod.o
ar rcs third_party/meshoptimizer/build/release/libmeshoptimizer.a third_party/meshoptimizer/build/release/scrapbot/clusterlod.o
'''
[tasks.wgpu]
description = "Install Odin's pinned wgpu-native vendor library when absent"
run = '''
WGPU_VERSION="v29.0.1.1"
case "$(uname -s):$(uname -m)" in
Darwin:arm64) WGPU_PACKAGE="wgpu-macos-aarch64-release" ;;
Darwin:x86_64) WGPU_PACKAGE="wgpu-macos-x86_64-release" ;;
Linux:aarch64|Linux:arm64) WGPU_PACKAGE="wgpu-linux-aarch64-release" ;;
Linux:x86_64) WGPU_PACKAGE="wgpu-linux-x86_64-release" ;;
*) echo "unsupported wgpu-native host: $(uname -s) $(uname -m)" >&2; exit 1 ;;
esac
WGPU_LIB_DIR="$(odin root)/vendor/wgpu/lib"
WGPU_PACKAGE_DIR="$WGPU_LIB_DIR/$WGPU_PACKAGE"
case "$(uname -s)" in
Darwin) WGPU_LIBRARY="$WGPU_PACKAGE_DIR/lib/libwgpu_native.a" ;;
Linux) WGPU_LIBRARY="$WGPU_PACKAGE_DIR/lib/libwgpu_native.a" ;;
esac
if [ ! -f "$WGPU_LIBRARY" ]; then
WGPU_DOWNLOAD="${TMPDIR:-/tmp}/$WGPU_PACKAGE.zip"
mkdir -p "$WGPU_PACKAGE_DIR"
curl --fail --location --retry 3 \
"https://github.com/gfx-rs/wgpu-native/releases/download/$WGPU_VERSION/$WGPU_PACKAGE.zip" \
--output "$WGPU_DOWNLOAD"
unzip -q -o "$WGPU_DOWNLOAD" -d "$WGPU_PACKAGE_DIR"
rm -f "$WGPU_DOWNLOAD"
fi
test -f "$WGPU_LIBRARY"
'''
[tasks.scrapbot]
description = "Build and run the Scrapbot CLI"
depends = ["build"]
run = "bin/scrapbot \"$@\""
[tasks.luau-workspace-types]
description = "Refresh repository-wide Luau declarations from every example project"
depends = ["build"]
run = '''
node tools/generate_impossible_archive.mjs --preset small
for project in assets asteroids ecs-showcase ecs-stress impossible-archive minimal ui-showcase; do
bin/scrapbot check "examples/$project"
done
node tools/generate_workspace_luau_types.mjs
'''
[tasks.test]
description = "Run all local checks and smoke tests"
depends = ["build"]
run = '''
python tools/test_icon_compiler.py
python tools/generate_builtin_icons.py --check
node tools/generate_impossible_archive.mjs --preset small --check
node tools/generate_impossible_archive.mjs --preset small
LUAU_LIBS="third_party/luau/build/release"
case "$(uname -s)" in
Darwin)
LUAU_LINK_FLAGS="-Wl,-force_load,$LUAU_LIBS/libluaucompiler.a -Wl,-force_load,$LUAU_LIBS/libluauast.a -Wl,-force_load,$LUAU_LIBS/libluaubytecode.a -Wl,-force_load,$LUAU_LIBS/libluauvm.a -Wl,-force_load,$LUAU_LIBS/libluaucommon.a -Wl,-force_load,third_party/meshoptimizer/build/release/libmeshoptimizer.a -lc++"
;;
Linux)
LUAU_LINK_FLAGS="-Wl,--whole-archive $LUAU_LIBS/libluaucompiler.a $LUAU_LIBS/libluauast.a $LUAU_LIBS/libluaubytecode.a $LUAU_LIBS/libluauvm.a $LUAU_LIBS/libluaucommon.a third_party/meshoptimizer/build/release/libmeshoptimizer.a -Wl,--no-whole-archive -lstdc++ -lpthread"
;;
*)
echo "unsupported Luau link platform: $(uname -s)" >&2
exit 1
;;
esac
odin check src/scrapbot -no-entry-point
odin test src/scrapbot -all-packages -extra-linker-flags:"$LUAU_LINK_FLAGS"
bin/scrapbot --version
bin/scrapbot check examples/minimal
bin/scrapbot check examples/assets
bin/scrapbot check examples/ecs-showcase
bin/scrapbot check examples/ui-showcase
bin/scrapbot check examples/ecs-stress
bin/scrapbot check examples/asteroids
bin/scrapbot check examples/clustered-lights
bin/scrapbot check examples/impossible-archive
node examples/clustered-lights/generate-scene.mjs --check
node tools/generate_workspace_luau_types.mjs --check
node --test tools/test_gpu_offscreen.test.mjs
node --test tools/gpu_benchmarks.test.mjs
node --test tools/png_rgba.test.mjs
bin/scrapbot run examples/minimal --backend null --headless --no-hot-reload --frames 1
bin/scrapbot run examples/ui-showcase --backend null --headless --no-hot-reload --frames 1
bin/scrapbot run examples/ui-showcase --backend null --editor --headless --no-hot-reload --frames 180 --ui-script tests/fixtures/ui/enum-inspector.json --json
bin/scrapbot run examples/ecs-showcase --backend null --editor --headless --no-hot-reload --frames 180 --ui-script tests/fixtures/ui/entity-reference-inspector.json --json
bin/scrapbot run examples/ecs-showcase --backend null --editor --headless --no-hot-reload --frames 180 --ui-script tests/fixtures/ui/nested-inspector.json --json
bin/scrapbot run examples/ecs-showcase --backend null --editor --headless --no-hot-reload --frames 120 --ui-script tests/fixtures/ui/editor-panel-edge-split.json --json
bin/scrapbot run examples/ecs-showcase --backend null --editor --headless --no-hot-reload --frames 120 --ui-script tests/fixtures/ui/performance-diagnostics.json --json
bin/scrapbot run examples/asteroids --backend null --headless --no-hot-reload --frames 5
STRESS_JSON="$(bin/scrapbot run examples/ecs-stress --backend null --headless --no-hot-reload --frames 180 --runtime-stats --json)"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.runtime_stats;
const query = stats?.native_queries;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
result.result.entities < 1000 || result.result.draw_batches < 4 ||
query?.plan_builds < 1 || query.plan_hits <= query.plan_builds ||
query.entities < query.chunks) {
console.error("unexpected ECS stress example diagnostics");
process.exit(1);
}
' "$STRESS_JSON"
CHECK_JSON="$(bin/scrapbot check examples/minimal --json)"
case "$CHECK_JSON" in
'{"schema_version":1,"command":"check","ok":true,'*) ;;
*) echo "unexpected check JSON: $CHECK_JSON" >&2; exit 1 ;;
esac
RUN_JSON="$(bin/scrapbot run examples/minimal --backend null --headless --no-hot-reload --frames 1 --json)"
case "$RUN_JSON" in
'{"schema_version":1,"command":"run","ok":true,'*) ;;
*) echo "unexpected run JSON: $RUN_JSON" >&2; exit 1 ;;
esac
RUNTIME_STATS_JSON="$(bin/scrapbot run examples/minimal --backend null --headless --no-hot-reload --frames 120 --runtime-stats --json)"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.runtime_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
!stats?.enabled || stats.frames !== 120 || stats.early_update_ns_per_frame <= 0 ||
stats.late_update_ns_per_frame <= 0 ||
stats.cpu_growth_ratio <= 0 || stats.allocator_final_bytes > 65536) {
console.error("unexpected runtime stats JSON");
process.exit(1);
}
' "$RUNTIME_STATS_JSON"
node tools/runtime_soak.mjs examples/ecs-showcase 2000
UNBOUNDED_STATS_JSON="$(bin/scrapbot run examples/minimal --backend wgpu --window --runtime-stats --json || true)"
node -e '
const result = JSON.parse(process.argv[1]);
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== false ||
result.diagnostics?.[0]?.code !== "SCRAPBOT_ARGUMENT_ERROR") {
console.error("unexpected unbounded runtime stats diagnostic");
process.exit(1);
}
' "$UNBOUNDED_STATS_JSON"
BUILD_JSON="$(bin/scrapbot build examples/minimal --json)"
case "$BUILD_JSON" in
'{"schema_version":1,"command":"build","ok":true,'*) ;;
*) echo "unexpected build JSON: $BUILD_JSON" >&2; exit 1 ;;
esac
case "$(uname -s)-$(uname -m)" in
Darwin-arm64) PACKAGE_EXE="examples/minimal/build/darwin_arm64/minimal-example" ;;
Darwin-x86_64) PACKAGE_EXE="examples/minimal/build/darwin_amd64/minimal-example" ;;
Linux-aarch64) PACKAGE_EXE="examples/minimal/build/linux_arm64/minimal-example" ;;
Linux-x86_64) PACKAGE_EXE="examples/minimal/build/linux_amd64/minimal-example" ;;
*) echo "unsupported package smoke host" >&2; exit 1 ;;
esac
PACKAGE_RUN_JSON="$("$PACKAGE_EXE" --backend null --frames 1 --json)"
case "$PACKAGE_RUN_JSON" in
'{"schema_version":1,"command":"run","ok":true,'*) ;;
*) echo "unexpected packaged run JSON: $PACKAGE_RUN_JSON" >&2; exit 1 ;;
esac
'''
[tasks.test-soak]
description = "Run the lifecycle-heavy CPU/RAM growth soak"
depends = ["build"]
run = "node tools/runtime_soak.mjs"
[tasks.test-gpu]
description = "Verify WGPU visibility paths and deterministic material output"
depends = ["build", "test-virtual-geometry-gpu", "test-virtual-geometry-transforms-gpu"]
run = '''
COMPUTE_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-compute.png"
CPU_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-cpu.png"
UI_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-ui.png"
RESPONSIVE_UI_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-responsive-ui.png"
RESPONSIVE_UI_DUMP="${TMPDIR:-/tmp}/scrapbot-gpu-responsive-ui.json"
OVERLAY_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-editor-overlay.png"
OVERLAY_DUMP="${TMPDIR:-/tmp}/scrapbot-gpu-editor-overlay.json"
ATMOSPHERE_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-world-environment.png"
ATMOSPHERE_BASELINE_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-world-environment-baseline.png"
ATMOSPHERE_DUMP="${TMPDIR:-/tmp}/scrapbot-gpu-world-environment.json"
LOD_COMPUTE_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-lod-compute.png"
LOD_CPU_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-lod-cpu.png"
MESHLET_VISIBILITY_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-meshlet-visibility.png"
HIZ_DEBUG_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-hiz-debug.png"
OCCLUSION_DEBUG_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-occlusion-debug.png"
TRANSFORM_COMPUTE_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-transform-compute.png"
TRANSFORM_CPU_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-transform-cpu.png"
MASK_FRAME="${TMPDIR:-/tmp}/scrapbot-gltf-mask.png"
LIGHTING_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-lighting.png"
PBR_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-pbr-materials.png"
TAA_FRAME_A="${TMPDIR:-/tmp}/scrapbot-gpu-taa-a.png"
TAA_FRAME_B="${TMPDIR:-/tmp}/scrapbot-gpu-taa-b.png"
CLUSTER_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-cluster-capacity.png"
CLUSTER_PAUSED_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-cluster-paused.png"
CLUSTER_STOPPED_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-cluster-stopped.png"
CLUSTER_RESTART_FRAME="${TMPDIR:-/tmp}/scrapbot-gpu-cluster-restart.png"
trap 'rm -f "$COMPUTE_FRAME" "$CPU_FRAME" "$UI_FRAME" "$RESPONSIVE_UI_FRAME" "$RESPONSIVE_UI_DUMP" "$OVERLAY_FRAME" "$OVERLAY_DUMP" "$ATMOSPHERE_FRAME" "$ATMOSPHERE_BASELINE_FRAME" "$ATMOSPHERE_DUMP" "$LOD_COMPUTE_FRAME" "$LOD_CPU_FRAME" "$MESHLET_VISIBILITY_FRAME" "$HIZ_DEBUG_FRAME" "$OCCLUSION_DEBUG_FRAME" "$TRANSFORM_COMPUTE_FRAME" "$TRANSFORM_CPU_FRAME" "$MASK_FRAME" "$LIGHTING_FRAME" "$PBR_FRAME" "$TAA_FRAME_A" "$TAA_FRAME_B" "$CLUSTER_FRAME" "$CLUSTER_PAUSED_FRAME" "$CLUSTER_STOPPED_FRAME" "$CLUSTER_RESTART_FRAME"' EXIT
COMPUTE_JSON="$(bin/scrapbot run tests/fixtures/gpu-driven --headless --no-hot-reload --frames 20 --framegrab "$COMPUTE_FRAME" --json)"
CPU_JSON="$(bin/scrapbot run tests/fixtures/gpu-driven --headless --no-hot-reload --cpu-culling --frames 20 --framegrab "$CPU_FRAME" --json)"
UI_JSON="$(bin/scrapbot run examples/ecs-showcase --headless --editor --no-hot-reload --frames 2 --framegrab "$UI_FRAME" --json)"
RESPONSIVE_UI_JSON="$(bin/scrapbot run examples/ui-showcase --headless --no-hot-reload --frames 90 --ui-script tests/fixtures/ui/responsive-canvas-showcase.json --ui-dump "$RESPONSIVE_UI_DUMP" --framegrab "$RESPONSIVE_UI_FRAME" --json)"
OVERLAY_JSON="$(bin/scrapbot run examples/ecs-showcase --headless --editor --no-hot-reload --frames 60 --ui-script tests/fixtures/ui/editor-overlay-lifecycle.json --ui-dump "$OVERLAY_DUMP" --framegrab "$OVERLAY_FRAME" --json)"
ATMOSPHERE_BASELINE_JSON="$(bin/scrapbot run examples/ecs-showcase --headless --editor --no-hot-reload --frames 80 --ui-script tests/fixtures/ui/world-environment-baseline.json --framegrab "$ATMOSPHERE_BASELINE_FRAME" --json)"
ATMOSPHERE_JSON="$(bin/scrapbot run examples/ecs-showcase --headless --editor --no-hot-reload --frames 80 --ui-script tests/fixtures/ui/world-environment.json --ui-dump "$ATMOSPHERE_DUMP" --framegrab "$ATMOSPHERE_FRAME" --json)"
LOD_COMPUTE_JSON="$(bin/scrapbot run tests/fixtures/gpu-lod --headless --no-hot-reload --frames 5 --framegrab "$LOD_COMPUTE_FRAME" --json)"
LOD_CPU_JSON="$(bin/scrapbot run tests/fixtures/gpu-lod --headless --no-hot-reload --cpu-culling --frames 5 --framegrab "$LOD_CPU_FRAME" --json)"
MESHLET_VISIBILITY_JSON="$(bin/scrapbot run examples/ecs-showcase --headless --editor --no-hot-reload --frames 20 --ui-script tests/fixtures/ui/game-debug-visibility.json --framegrab "$MESHLET_VISIBILITY_FRAME" --json)"
HIZ_DEBUG_JSON="$(bin/scrapbot run examples/ecs-showcase --headless --editor --no-hot-reload --frames 60 --ui-script tests/fixtures/ui/game-debug-hiz.json --framegrab "$HIZ_DEBUG_FRAME" --json)"
OCCLUSION_DEBUG_JSON="$(bin/scrapbot run tests/fixtures/gpu-driven --headless --editor --no-hot-reload --frames 60 --ui-script tests/fixtures/ui/game-debug-occlusion.json --framegrab "$OCCLUSION_DEBUG_FRAME" --json)"
TRANSFORM_COMPUTE_JSON="$(bin/scrapbot run examples/minimal --headless --no-hot-reload --frames 20 --framegrab "$TRANSFORM_COMPUTE_FRAME" --json)"
TRANSFORM_CPU_JSON="$(bin/scrapbot run examples/minimal --headless --no-hot-reload --cpu-culling --frames 20 --framegrab "$TRANSFORM_CPU_FRAME" --json)"
MASK_JSON="$(bin/scrapbot run tests/fixtures/gltf-materials --headless --no-hot-reload --frames 2 --framegrab "$MASK_FRAME" --json)"
LIGHTING_JSON="$(bin/scrapbot run tests/fixtures/gpu-lighting --headless --no-hot-reload --frames 2 --framegrab "$LIGHTING_FRAME" --json)"
PBR_JSON="$(bin/scrapbot run examples/pbr-materials --headless --no-hot-reload --frames 8 --framegrab "$PBR_FRAME" --json)"
TAA_JSON_A="$(bin/scrapbot run examples/pbr-materials --headless --no-hot-reload --frames 47 --framegrab "$TAA_FRAME_A" --json)"
TAA_JSON_B="$(bin/scrapbot run examples/pbr-materials --headless --no-hot-reload --frames 48 --framegrab "$TAA_FRAME_B" --json)"
CLUSTER_JSON="$(bin/scrapbot run examples/clustered-lights --headless --editor --no-hot-reload --frames 10 --framegrab "$CLUSTER_FRAME" --json)"
CLUSTER_PAUSED_JSON="$(bin/scrapbot run examples/clustered-lights --headless --editor --no-hot-reload --frames 40 --ui-script tests/fixtures/ui/clustered-lights-paused.json --framegrab "$CLUSTER_PAUSED_FRAME" --json)"
CLUSTER_STOPPED_JSON="$(bin/scrapbot run examples/clustered-lights --headless --editor --no-hot-reload --frames 20 --ui-script tests/fixtures/ui/clustered-lights-stopped.json --framegrab "$CLUSTER_STOPPED_FRAME" --json)"
CLUSTER_RESTART_JSON="$(bin/scrapbot run examples/clustered-lights --headless --editor --no-hot-reload --frames 30 --ui-script tests/fixtures/ui/clustered-lights-restart.json --framegrab "$CLUSTER_RESTART_FRAME" --json)"
node -e '
const result = JSON.parse(process.argv[1]);
const dump = JSON.parse(require("node:fs").readFileSync(process.argv[2], "utf8"));
const hud = dump.nodes?.find((node) => node.name === "HUD");
const arcade = dump.nodes?.find((node) => node.name === "Arcade Theme");
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
result.result?.render_stats?.ui_project_vertex_rebuilds < 1 ||
hud?.screen_rect?.x !== 28 || hud?.screen_rect?.y !== 60 ||
arcade?.screen_rect?.x !== 662 || arcade?.screen_rect?.y !== 60) {
console.error("responsive UI canvas smoke failed");
process.exit(1);
}
' "$RESPONSIVE_UI_JSON" "$RESPONSIVE_UI_DUMP"
node -e '
for (const [label, raw, expectedCompute] of [["compute", process.argv[1], true], ["cpu", process.argv[2], false]]) {
const result = JSON.parse(raw);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
!stats?.gpu_driven || stats.compute_culling !== expectedCompute ||
!stats.clustered_lighting || stats.shadow_cascades !== 4 ||
stats.cluster_count !== 3456 || stats.cluster_max_lights !== 256 ||
stats.cluster_dispatches < 1 ||
result.result.renderables <= 64 || stats.instance_capacity < 100000 ||
result.result.draw_batches <= 64 || stats.draw_capacity < result.result.draw_batches ||
stats.draw_submissions < 1 || stats.draw_submissions > stats.draw_batches ||
stats.draw_database_rebuilds < 1 || stats.instance_slots <= 64 ||
stats.geometry_vertex_arena_capacity_bytes < stats.geometry_vertex_arena_resident_bytes ||
stats.geometry_index_arena_capacity_bytes < stats.geometry_index_arena_resident_bytes ||
stats.geometry_vertex_arena_resident_bytes <= 0 ||
stats.geometry_index_arena_resident_bytes <= 0 ||
stats.geometry_arena_uploads < 1 || stats.geometry_arena_upload_bytes <= 0 ||
stats.instance_uploads < 1 ||
stats.instance_uploads - stats.instance_transform_uploads >= 10 ||
stats.instance_upload_bytes <= 0 || stats.frustum_culled_instances < 1 ||
stats.visible_batches < 1 || stats.visible_batches > stats.draw_batches ||
(expectedCompute && (stats.meshlet_draws < 1 ||
stats.visible_meshlet_draws > stats.meshlet_draws)) ||
(!expectedCompute && stats.visible_meshlet_draws !== 0)) {
console.error(`unexpected ${label} GPU renderer diagnostics`);
process.exit(1);
}
if (expectedCompute && (!stats.hiz_valid || stats.hiz_mip_count < 2 ||
stats.occlusion_culled_instances < 1 ||
stats.visible_instances >= stats.frustum_candidates)) {
console.error("GPU Hi-Z visibility did not reject the occluded fixture instances");
process.exit(1);
}
if (stats.gpu_timestamps_supported && (!stats.gpu_timestamps_valid ||
stats.gpu_frame_ms <= 0 || stats.gpu_scene_ms <= 0 ||
stats.gpu_scene_ms > stats.gpu_frame_ms ||
(expectedCompute && stats.gpu_cull_ms <= 0) ||
stats.gpu_depth_ms <= 0 || stats.gpu_world_ms <= 0)) {
console.error("supported GPU timestamp queries did not publish completed pass timings");
process.exit(1);
}
if (!stats.gpu_timestamps_supported && stats.gpu_timestamps_valid) {
console.error("GPU timestamps cannot be valid when the adapter does not support them");
process.exit(1);
}
}
' "$COMPUTE_JSON" "$CPU_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
!stats?.clustered_lighting || stats.shadow_cascades !== 4 ||
stats.cluster_count !== 3456 || stats.cluster_max_lights !== 256 ||
stats.clustered_point_lights !== 17 || stats.cluster_dispatches < 1 ||
stats.shadow_visible_instances < 1) {
console.error("GPU clustered lighting and cascaded shadow fixture did not exercise the expected paths");
process.exit(1);
}
' "$LIGHTING_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
!stats?.clustered_lighting || stats.cluster_count !== 3456 ||
stats.clustered_point_lights !== 320 ||
stats.cluster_max_lights !== 512 ||
stats.cluster_dispatches < 1) {
console.error("dense clustered lighting fixture exceeded the per-cluster index budget");
process.exit(1);
}
' "$CLUSTER_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
!stats?.hiz_occlusion || !stats.hiz_valid ||
stats.frustum_candidates < 451 ||
stats.frustum_candidates > result.result.renderables ||
stats.visible_instances + stats.occlusion_culled_instances !== stats.frustum_candidates ||
stats.visible_instances < 300 ||
stats.occlusion_culled_instances < 1) {
console.error("paused editor Hi-Z did not preserve near-field architecture while rejecting hidden bounds");
process.exit(1);
}
' "$CLUSTER_PAUSED_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
result.result?.renderables !== 135 || result.result.draw_batches !== 3 ||
stats?.clustered_point_lights !== 0 || stats.instance_slots !== 135) {
console.error("stopped clustered lighting scene did not retain its authored architecture");
process.exit(1);
}
' "$CLUSTER_STOPPED_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
result.result?.renderables !== 455 || result.result.draw_batches !== 15 ||
stats?.clustered_point_lights !== 320 || stats.cluster_dispatches < 1 ||
stats.instance_slots !== 455) {
console.error("runtime-built clustered lighting scene did not reconstruct after Stop and Play");
process.exit(1);
}
' "$CLUSTER_RESTART_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
stats?.ui_vertex_rebuilds !== 1 || stats.ui_vertex_uploads !== 1 ||
stats.ui_project_vertex_rebuilds !== 0 || stats.ui_editor_vertex_rebuilds !== 1 ||
stats.ui_overlay_vertex_rebuilds !== 0 ||
stats.ui_vertex_upload_bytes <= 0) {
console.error("unexpected retained UI renderer diagnostics");
process.exit(1);
}
' "$UI_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
stats?.draw_database_rebuilds > 1 || stats.ui_project_vertex_rebuilds !== 0 ||
stats.ui_editor_vertex_rebuilds < 1 || stats.ui_editor_vertex_rebuilds >= 10 ||
stats.ui_overlay_vertex_rebuilds >= 10 ||
(stats.gpu_timestamps_supported && (!stats.gpu_timestamps_valid ||
stats.gpu_scene_ms <= 0 || stats.gpu_frame_ms < stats.gpu_scene_ms))) {
console.error("editor overlay lifecycle did not complete cleanly");
process.exit(1);
}
' "$OVERLAY_JSON"
node -e '
for (const raw of process.argv.slice(1)) {
const result = JSON.parse(raw);
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
result.result?.render_stats?.ui_editor_vertex_rebuilds < 1) {
console.error("world environment inspector did not complete cleanly");
process.exit(1);
}
}
' "$ATMOSPHERE_BASELINE_JSON" "$ATMOSPHERE_JSON"
if cmp -s "$ATMOSPHERE_BASELINE_FRAME" "$ATMOSPHERE_FRAME"; then
echo "world environment inspector edit did not change rendered pixels" >&2
exit 1
fi
node -e '
for (const [label, raw, expectedCompute] of [["compute", process.argv[1], true], ["cpu", process.argv[2], false]]) {
const result = JSON.parse(raw);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
stats?.compute_culling !== expectedCompute || result.result.draw_batches !== 3 ||
stats.visible_instances !== 3 || stats.lod0_visible_instances !== 1 ||
stats.lod1_visible_instances !== 1 || stats.lod2_visible_instances !== 1 ||
stats.lod3_visible_instances !== 0) {
console.error(`unexpected ${label} GPU LOD diagnostics`);
process.exit(1);
}
}
' "$LOD_COMPUTE_JSON" "$LOD_CPU_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
const rejected =
stats?.frustum_culled_meshlets +
stats?.cone_culled_meshlets +
stats?.occlusion_culled_meshlets;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
!stats?.meshlet_culling || stats.meshlet_debug_records <= 0 ||
stats.visible_batches < 1 || stats.visible_batches > stats.draw_batches ||
stats.visible_meshlet_draws < 1 ||
stats.visible_meshlet_draws > stats.meshlet_draws ||
stats.meshlet_debug_records < rejected ||
stats.gpu_ambient_occlusion_ms !== 0 ||
stats.gpu_screen_space_reflections_ms !== 0 ||
stats.gpu_volumetric_fog_ms !== 0 ||
stats.gpu_bloom_ms !== 0 ||
stats.gpu_automatic_exposure_ms !== 0) {
console.error("meshlet visibility debug stream did not cover GPU rejection results");
process.exit(1);
}
' "$MESHLET_VISIBILITY_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
!stats?.hiz_valid || stats.hiz_mip_count <= 3 ||
stats.gpu_ambient_occlusion_ms !== 0 ||
stats.gpu_screen_space_reflections_ms !== 0 ||
stats.gpu_volumetric_fog_ms !== 0 ||
stats.gpu_bloom_ms !== 0 ||
stats.gpu_automatic_exposure_ms !== 0) {
console.error("Hi-Z debug view did not expose a retained pyramid mip directly");
process.exit(1);
}
' "$HIZ_DEBUG_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
!stats?.hiz_occlusion || !stats.hiz_valid ||
stats.hiz_occlusion_status !== 5 ||
stats.meshlet_debug_records <= 0 ||
stats.occlusion_culled_instances + stats.occlusion_culled_meshlets <= 0 ||
stats.gpu_ambient_occlusion_ms !== 0 ||
stats.gpu_screen_space_reflections_ms !== 0 ||
stats.gpu_volumetric_fog_ms !== 0 ||
stats.gpu_bloom_ms !== 0 ||
stats.gpu_automatic_exposure_ms !== 0) {
console.error("occlusion query debug view did not preserve classified Hi-Z evidence");
process.exit(1);
}
' "$OCCLUSION_DEBUG_JSON"
node -e '
for (const [label, raw, expectedCompute] of [["compute", process.argv[1], true], ["cpu", process.argv[2], false]]) {
const result = JSON.parse(raw);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
stats?.compute_culling !== expectedCompute ||
(expectedCompute && (stats.instance_expand_dispatches < 1 ||
stats.instance_expanded_slots < result.result.renderables ||
stats.instance_transform_uploads < 1 || stats.instance_transform_upload_bytes <= 0)) ||
(!expectedCompute && (stats.instance_expand_dispatches !== 0 ||
stats.instance_transform_uploads !== 0 || stats.instance_upload_bytes <= 0))) {
console.error(`unexpected ${label} GPU transform diagnostics`);
process.exit(1);
}
}
' "$TRANSFORM_COMPUTE_JSON" "$TRANSFORM_CPU_JSON"
node -e '
const result = JSON.parse(process.argv[1]);
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
result.result?.renderables !== 1 || result.result.draw_batches !== 1) {
console.error("masked double-sided glTF material did not render through one batch");
process.exit(1);
}
' "$MASK_JSON"
node tools/assert_png_close.mjs "$COMPUTE_FRAME" "$CPU_FRAME"
node tools/assert_png_psnr.mjs "$LOD_COMPUTE_FRAME" "$LOD_CPU_FRAME" 44
node tools/assert_png_close.mjs "$TRANSFORM_COMPUTE_FRAME" "$TRANSFORM_CPU_FRAME" 1 128
node tools/assert_png_psnr.mjs "$TAA_FRAME_A" "$TAA_FRAME_B" 42
node tools/assert_png_variance.mjs "$COMPUTE_FRAME"
node tools/assert_png_variance.mjs "$LOD_COMPUTE_FRAME"
node tools/assert_png_variance.mjs "$TRANSFORM_COMPUTE_FRAME"
node tools/assert_png_variance.mjs "$MASK_FRAME"
node tools/assert_png_variance.mjs "$CLUSTER_PAUSED_FRAME"
node tools/assert_png_variance.mjs "$CLUSTER_STOPPED_FRAME"
node tools/assert_png_variance.mjs "$CLUSTER_RESTART_FRAME"
node tools/assert_png_variance.mjs "$OCCLUSION_DEBUG_FRAME"
node tools/assert_png_contract.mjs "$PBR_FRAME" tests/fixtures/visual/pbr-materials.json
'''
[tasks.test-gpu-offscreen]
description = "Run the bounded artifact-preserving offscreen WGPU acceptance gate"
depends = ["build"]
run = 'node tools/test_gpu_offscreen.mjs "$@"'
[tasks.test-virtual-geometry-gpu]
description = "Exercise bounded virtual-geometry streaming under residency pressure"
depends = ["build"]
run = '''
FRAME="${TMPDIR:-/tmp}/scrapbot-virtual-geometry-pressure.png"
trap 'rm -f "$FRAME"' EXIT
RESULT="$(bin/scrapbot run tests/fixtures/gpu-virtual-geometry-pressure --headless --no-hot-reload --frames 320 --framegrab "$FRAME" --json)"
node -e '
const result = JSON.parse(process.argv[1]);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
!stats?.virtual_geometry || stats.virtual_geometry_pages < 3 ||
stats.virtual_geometry_resident_pages >= stats.virtual_geometry_pages ||
stats.virtual_geometry_page_feedback < 1 ||
stats.virtual_geometry_group_uploads < 2 ||
stats.virtual_geometry_prefetch_group_uploads < 1 ||
stats.virtual_geometry_prefetch_hits < 1 ||
stats.virtual_geometry_group_evictions < 1 ||
stats.virtual_geometry_page_evictions < stats.virtual_geometry_group_evictions ||
stats.virtual_geometry_page_upload_bytes <= 0) {
console.error("virtual geometry pressure fixture did not predict, stream, hit, and evict complete groups");
console.error(JSON.stringify(stats, null, 2));
process.exit(1);
}
' "$RESULT"
node tools/assert_png_variance.mjs "$FRAME"
node tools/test_render_sequence.mjs \
--project tests/fixtures/gpu-virtual-geometry-pressure \
--warmup 0 --frames 80 --capture-range 31:56 \
--resolution 960x540 --require-transition \
--out "${TMPDIR:-/tmp}/scrapbot-virtual-geometry-transition"
'''
[tasks.test-virtual-geometry-transforms-gpu]
description = "Reject meshlet holes under non-uniform instance transforms"
depends = ["build"]
run = '''
GPU_FRAME="${TMPDIR:-/tmp}/scrapbot-virtual-geometry-transforms-gpu.png"
CPU_FRAME="${TMPDIR:-/tmp}/scrapbot-virtual-geometry-transforms-cpu.png"
SEQUENCE_DIR="${TMPDIR:-/tmp}/scrapbot-virtual-geometry-transforms-sequence"
trap 'rm -f "$GPU_FRAME" "$CPU_FRAME"' EXIT
GPU_JSON="$(bin/scrapbot run tests/fixtures/gpu-virtual-geometry-transforms --headless --no-hot-reload --frames 90 --framegrab "$GPU_FRAME" --json)"
CPU_JSON="$(bin/scrapbot run tests/fixtures/gpu-virtual-geometry-transforms --headless --no-hot-reload --cpu-culling --frames 90 --framegrab "$CPU_FRAME" --json)"
node -e '
for (const [label, raw, expectedCompute] of [["gpu", process.argv[1], true], ["cpu", process.argv[2], false]]) {
const result = JSON.parse(raw);
const stats = result.result?.render_stats;
if (result.schema_version !== 1 || result.command !== "run" || result.ok !== true ||
result.result?.renderables !== 3 || stats?.compute_culling !== expectedCompute ||
(expectedCompute && (stats?.virtual_geometry_clusters < 3 ||
stats?.cone_culled_meshlets !== 0))) {
console.error(`unexpected ${label} virtual-geometry transform diagnostics`);
console.error(JSON.stringify(result, null, 2));
process.exit(1);
}
}
' "$GPU_JSON" "$CPU_JSON"
node tools/assert_png_psnr.mjs "$GPU_FRAME" "$CPU_FRAME" 55
node tools/test_render_sequence.mjs \
--project tests/fixtures/gpu-virtual-geometry-transforms \
--warmup 0 --frames 96 --capture-range 72:80 \
--resolution 960x540 --stable-frontier \
--out "$SEQUENCE_DIR"
'''
[tasks.test-sanitize]
description = "Run Odin tests with AddressSanitizer on Linux"
depends = ["luau", "cgltf", "meshoptimizer"]
run = '''
LUAU_LIBS="third_party/luau/build/release"
case "$(uname -s)" in
Darwin)
echo "AddressSanitizer is skipped on macOS because the current Odin/Apple sanitizer runtimes are incompatible"
exit 0
;;
Linux)
LUAU_LINK_FLAGS="-Wl,--whole-archive $LUAU_LIBS/libluaucompiler.a $LUAU_LIBS/libluauast.a $LUAU_LIBS/libluaubytecode.a $LUAU_LIBS/libluauvm.a $LUAU_LIBS/libluaucommon.a third_party/meshoptimizer/build/release/libmeshoptimizer.a -Wl,--no-whole-archive -lstdc++ -lpthread"
;;
*)
echo "unsupported sanitizer platform: $(uname -s)" >&2
exit 1
;;
esac
odin test src/scrapbot -all-packages -sanitize:address -extra-linker-flags:"$LUAU_LINK_FLAGS -fsanitize=address"
'''