@forgeax/engine-runtime 0.1.21 → 0.1.24
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 +18 -9
- package/dist/__tests__/advance-animation-player.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/advance-animation-player.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-aabb.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-aabb.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-bootstrap.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-bootstrap.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-builtin-nineslice.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-builtin-nineslice.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-d9-tile-sampler-soft-warn.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-d9-tile-sampler-soft-warn.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-guid.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-guid.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-material-validate.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-material-validate.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-mesh-fail-fast.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-mesh-fail-fast.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-scene.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-scene.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-sprite-slices-validate.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-sprite-slices-validate.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-renderer-assembly.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-renderer-assembly.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/asset.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/bloom-gating.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/bloom-gating.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/builtin-guid-ssot.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/builtin-guid-ssot.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/builtin-pack.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/builtin-pack.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/camera-antialias.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/camera-antialias.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/camera-bloom.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/camera-bloom.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/camera-clear-schema.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/camera-clear-schema.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/camera-ortho.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/camera-ortho.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/cluster-binner.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/cluster-binner.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/create-renderer-fallback-shader-manifest.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/create-renderer-fallback-shader-manifest.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/create-renderer-uniform-fallback.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/create-renderer-uniform-fallback.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/cubemap-upload.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/cubemap-upload.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/dev-import-transport.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/dev-import-transport.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/engine-metrics.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/engine-metrics.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/equirect-projection-error.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/equirect-projection-error.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/font-asset-load.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/font-asset-load.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/fxaa-intermediate-texture.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/fxaa-intermediate-texture.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/fxaa-pipeline.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/fxaa-pipeline.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/gpu-residency.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/gpu-residency.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/gpu-resource-release.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/gpu-resource-release.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/handle-quad.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/handle-quad.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/hdrp-bgl-slots.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/hdrp-bgl-slots.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/hdrp-grid-invalid.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/hdrp-grid-invalid.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/hdrp-index-list-overflow-once.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/hdrp-index-list-overflow-once.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/hdrp-light-budget.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/hdrp-light-budget.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/hdrp-pipeline-asset-config.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/hdrp-pipeline-asset-config.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/helpers/register-runtime-components.d.ts.map +1 -1
- package/dist/__tests__/helpers/register-scene-components.d.ts.map +1 -1
- package/dist/__tests__/helpers/renderer-device-loss-dawn.d.ts +25 -0
- package/dist/__tests__/helpers/renderer-device-loss-dawn.d.ts.map +1 -0
- package/dist/__tests__/helpers/standard-material-manifest.d.ts +0 -1
- package/dist/__tests__/helpers/standard-material-manifest.d.ts.map +1 -1
- package/dist/__tests__/ibl-pipeline-cache.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/ibl-pipeline-cache.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/lazy-catalog.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/lazy-catalog.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/load-by-guid-hdr.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/load-by-guid-hdr.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/load-by-guid-prod-material-parent.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/load-by-guid-prod-material-parent.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/load-by-guid-prod.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/load-by-guid-prod.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/loader-registry.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/loader-registry.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/m7-hdrp-demo-shape.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/m7-hdrp-demo-shape.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mipmap-formula.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/mipmap-formula.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mipmap-pipeline-cache.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/mipmap-pipeline-cache.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/parse-asset-payload-material.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/parse-asset-payload-material.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/parse-asset-payload-texture.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/parse-asset-payload-texture.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/parse-scene-payload-refs.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/parse-scene-payload-refs.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pass-selector.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/pass-selector.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline-builder.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/pipeline-builder.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline-cache-key-topology.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/pipeline-cache-key-topology.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline-vertex-stride-branch.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/pipeline-vertex-stride-branch.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/pipeline.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/post-process-register.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/post-process-register.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/propagate-transforms.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/propagate-transforms.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/record-all-topology.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/record-all-topology.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/record-draw-branch.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/record-draw-branch.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/record-strip-index-format.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/record-strip-index-format.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/register-with-guid-rgba16float.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/register-with-guid-rgba16float.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/render-data.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/render-data.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/render-error-exhaustive.test-d.d.ts.map +1 -1
- package/dist/__tests__/render-query-regression.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/render-query-regression.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/render-system-record-submesh.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/render-system-record-submesh.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/render-system-record-warn-once.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/render-system-record-warn-once.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/renderer-device-loss-multi-world.integration.test.d.ts +2 -0
- package/dist/__tests__/renderer-device-loss-multi-world.integration.test.d.ts.map +1 -0
- package/dist/__tests__/renderer-device-loss-provider-feasibility.dawn.test.d.ts +2 -0
- package/dist/__tests__/renderer-device-loss-provider-feasibility.dawn.test.d.ts.map +1 -0
- package/dist/__tests__/renderer-device-loss-recovery.dawn.test.d.ts +2 -0
- package/dist/__tests__/renderer-device-loss-recovery.dawn.test.d.ts.map +1 -0
- package/dist/__tests__/renderer-draw-world.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/renderer-draw-world.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/renderer-recovery-consumer.integration.test.d.ts +2 -0
- package/dist/__tests__/renderer-recovery-consumer.integration.test.d.ts.map +1 -0
- package/dist/__tests__/renderstate-pipeline-cache.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/renderstate-pipeline-cache.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/resolve-scene-guids.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/resolve-scene-guids.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/shadow-skip-non-triangle.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/shadow-skip-non-triangle.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin-errors-kebab-case.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin-errors-kebab-case.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin-instances-coexist.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin-instances-coexist.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin-m2-extract-happy.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin-m2-extract-happy.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin-m2-extract-joint-error.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin-m2-extract-joint-error.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin-m2-extract-null-assets.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin-m2-extract-null-assets.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin-m2-extract-skeleton-error.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin-m2-extract-skeleton-error.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin-m3-record-cache.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin-m3-record-cache.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin-palette-extract.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin-palette-extract.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin-pipeline-routing.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin-pipeline-routing.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skin.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skin.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skybox-extract.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skybox-extract.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skybox-shader-compile.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skybox-shader-compile.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skylight-bind-group.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skylight-bind-group.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skylight-component.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skylight-component.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skylight-fallback-path.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skylight-fallback-path.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skylight-pipeline-layout.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skylight-pipeline-layout.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skylight-solid-color-extract.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/skylight-solid-color-extract.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/sprite-animation-tick-boundary.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/sprite-animation-tick-boundary.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/sprite-animation-tick-clamp.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/sprite-animation-tick-clamp.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/sprite-animation-tick-frame-duration-negative.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/sprite-animation-tick-frame-duration-negative.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/sprite-animation-tick-frame-duration-zero.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/sprite-animation-tick-frame-duration-zero.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/sprite-animation-tick-loop.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/sprite-animation-tick-loop.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/sprite-animation-tick-override-probe.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/sprite-animation-tick-override-probe.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/sprite-animation-tick-regions-mismatch.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/sprite-animation-tick-regions-mismatch.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/storage-buffer-caps.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/storage-buffer-caps.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/systems.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/systems.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/tonemap-hdr-target.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/tonemap-hdr-target.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/tonemap-pipeline-split.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/tonemap-pipeline-split.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/tonemap.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/tonemap.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/transparent-sort-config-get.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/transparent-sort-config-get.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/transparent-sort-config-set.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/transparent-sort-config-set.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/transparent-sort.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/transparent-sort.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/upload-texture-consistency.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/upload-texture-consistency.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/verify-revisions.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/verify-revisions.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/wire-default-loaders.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/wire-default-loaders.cases.unit.test.d.ts.map +1 -0
- package/dist/__tests__/zero-camera-clear-fallback.cases.unit.test.d.ts +2 -0
- package/dist/__tests__/zero-camera-clear-fallback.cases.unit.test.d.ts.map +1 -0
- package/dist/createRenderer.d.ts.map +1 -1
- package/dist/dev-import-transport.d.ts.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/dist/sprite-param-values.d.ts +1 -1
- package/package.json +30 -30
- package/src/__tests__/advance-animation-player.cases.unit.test.ts +1666 -0
- package/src/__tests__/animation-graph-asset-union.test-d.ts +2 -0
- package/src/__tests__/asset-brand-and-name-retirement.test.ts +4 -3
- package/src/__tests__/asset-registry-aabb.cases.unit.test.ts +676 -0
- package/src/__tests__/asset-registry-bootstrap.cases.unit.test.ts +472 -0
- package/src/__tests__/asset-registry-builtin-nineslice.cases.unit.test.ts +481 -0
- package/src/__tests__/asset-registry-d9-tile-sampler-soft-warn.cases.unit.test.ts +568 -0
- package/src/__tests__/asset-registry-guid.cases.unit.test.ts +500 -0
- package/src/__tests__/asset-registry-material-validate.cases.unit.test.ts +756 -0
- package/src/__tests__/asset-registry-mesh-fail-fast.cases.unit.test.ts +591 -0
- package/src/__tests__/asset-registry-scene.cases.unit.test.ts +501 -0
- package/src/__tests__/asset-registry-scene.test-d.ts +1 -0
- package/src/__tests__/asset-registry-sprite-slices-validate.cases.unit.test.ts +536 -0
- package/src/__tests__/asset-renderer-assembly.cases.unit.test.ts +496 -0
- package/src/__tests__/asset.cases.unit.test.ts +439 -0
- package/src/__tests__/bind-group-cache-keying.test.ts +6 -2
- package/src/__tests__/bloom-gating.cases.unit.test.ts +428 -0
- package/src/__tests__/builtin-guid-ssot.cases.unit.test.ts +472 -0
- package/src/__tests__/builtin-pack.cases.unit.test.ts +639 -0
- package/src/__tests__/builtin-shader-register-e2e.test.ts +1 -1
- package/src/__tests__/camera-antialias.cases.unit.test.ts +372 -0
- package/src/__tests__/camera-bloom.cases.unit.test.ts +396 -0
- package/src/__tests__/camera-clear-schema.cases.unit.test.ts +391 -0
- package/src/__tests__/camera-ortho.cases.unit.test.ts +484 -0
- package/src/__tests__/cluster-binner.cases.unit.test.ts +817 -0
- package/src/__tests__/collect-scene-mount-collapse.test.ts +5 -1
- package/src/__tests__/collect-transient-roundtrip.test.ts +14 -3
- package/src/__tests__/components.test-d.ts +9 -6
- package/src/__tests__/components.unit.test.ts +23 -19
- package/src/__tests__/create-renderer-fallback-shader-manifest.cases.unit.test.ts +345 -0
- package/src/__tests__/create-renderer-uniform-fallback.cases.unit.test.ts +445 -0
- package/src/__tests__/cubemap-upload.cases.unit.test.ts +593 -0
- package/src/__tests__/dawn/ibl-precompute-readback.dawn.test.ts +184 -17
- package/src/__tests__/dawn/material-alpha.dawn.test.ts +17 -4
- package/src/__tests__/derive-bgl-integration.test.ts +8 -8
- package/src/__tests__/dev-import-transport.cases.unit.test.ts +503 -0
- package/src/__tests__/engine-metrics.cases.unit.test.ts +371 -0
- package/src/__tests__/equirect-projection-error.cases.unit.test.ts +416 -0
- package/src/__tests__/errors.unit.test.ts +3 -0
- package/src/__tests__/extract-frames-merge.test.ts +3 -0
- package/src/__tests__/font-asset-load.cases.unit.test.ts +510 -0
- package/src/__tests__/fxaa-intermediate-texture.cases.unit.test.ts +690 -0
- package/src/__tests__/fxaa-pipeline.cases.unit.test.ts +546 -0
- package/src/__tests__/gpu-residency.cases.unit.test.ts +479 -0
- package/src/__tests__/gpu-resource-release.cases.unit.test.ts +929 -0
- package/src/__tests__/handle-quad.cases.unit.test.ts +491 -0
- package/src/__tests__/hdrp-bgl-slots.cases.unit.test.ts +451 -0
- package/src/__tests__/hdrp-grid-invalid.cases.unit.test.ts +408 -0
- package/src/__tests__/hdrp-index-list-overflow-once.cases.unit.test.ts +405 -0
- package/src/__tests__/hdrp-light-budget.cases.unit.test.ts +483 -0
- package/src/__tests__/hdrp-pipeline-asset-config.cases.unit.test.ts +441 -0
- package/src/__tests__/helpers/register-runtime-components.ts +9 -1
- package/src/__tests__/helpers/register-scene-components.ts +9 -2
- package/src/__tests__/helpers/renderer-device-loss-dawn.ts +69 -0
- package/src/__tests__/helpers/standard-material-manifest.ts +11 -15
- package/src/__tests__/ibl-pipeline-cache.cases.unit.test.ts +415 -0
- package/src/__tests__/lazy-catalog.cases.unit.test.ts +848 -0
- package/src/__tests__/light-gpu-byte-neutral.unit.test.ts +14 -15
- package/src/__tests__/light-snapshot.test-d.ts +27 -1
- package/src/__tests__/lights-preservation.fixup.test.ts +19 -21
- package/src/__tests__/lights.unit.test.ts +2076 -1
- package/src/__tests__/load-by-guid-hdr.cases.unit.test.ts +582 -0
- package/src/__tests__/load-by-guid-prod-material-parent.cases.unit.test.ts +1514 -0
- package/src/__tests__/load-by-guid-prod.cases.unit.test.ts +557 -0
- package/src/__tests__/loader-name-survival.test.ts +8 -9
- package/src/__tests__/loader-registry.cases.unit.test.ts +767 -0
- package/src/__tests__/m7-hdrp-demo-shape.cases.unit.test.ts +361 -0
- package/src/__tests__/material-texture-uv-scale.unit.test.ts +2 -2
- package/src/__tests__/materials.unit.test.ts +29 -10
- package/src/__tests__/mipmap-formula.cases.unit.test.ts +434 -0
- package/src/__tests__/mipmap-pipeline-cache.cases.unit.test.ts +490 -0
- package/src/__tests__/package-promotion.test.ts +7 -11
- package/src/__tests__/parse-asset-payload-material.cases.unit.test.ts +565 -0
- package/src/__tests__/parse-asset-payload-texture.cases.unit.test.ts +720 -0
- package/src/__tests__/parse-scene-payload-refs.cases.unit.test.ts +767 -0
- package/src/__tests__/pass-selector.cases.unit.test.ts +376 -0
- package/src/__tests__/pbr-pipeline.unit.test.ts +39 -21
- package/src/__tests__/pipeline-builder.cases.unit.test.ts +624 -0
- package/src/__tests__/pipeline-cache-key-topology.cases.unit.test.ts +807 -0
- package/src/__tests__/pipeline-vertex-stride-branch.cases.unit.test.ts +379 -0
- package/src/__tests__/pipeline.cases.unit.test.ts +370 -0
- package/src/__tests__/point-light-shadow.browser.test.ts +1 -0
- package/src/__tests__/point-light-shadow.unit.test.ts +18 -98
- package/src/__tests__/post-process-register.cases.unit.test.ts +405 -0
- package/src/__tests__/propagate-transforms.cases.unit.test.ts +502 -0
- package/src/__tests__/propagate-transforms.dawn.test.ts +34 -18
- package/src/__tests__/record-all-topology.cases.unit.test.ts +608 -0
- package/src/__tests__/record-draw-branch.cases.unit.test.ts +621 -0
- package/src/__tests__/record-strip-index-format.cases.unit.test.ts +419 -0
- package/src/__tests__/record-worldid-isolation.test.ts +16 -32
- package/src/__tests__/register-with-guid-rgba16float.cases.unit.test.ts +469 -0
- package/src/__tests__/render-data.cases.unit.test.ts +553 -0
- package/src/__tests__/render-error-exhaustive.test-d.ts +11 -0
- package/src/__tests__/render-query-regression.cases.unit.test.ts +531 -0
- package/src/__tests__/render-system-extract.test.ts +5 -5
- package/src/__tests__/render-system-record-multi-material-textureview.test.ts +1 -0
- package/src/__tests__/render-system-record-per-submesh-transparency.test.ts +1 -0
- package/src/__tests__/render-system-record-submesh.cases.unit.test.ts +740 -0
- package/src/__tests__/render-system-record-warn-once.cases.unit.test.ts +418 -0
- package/src/__tests__/render-system-record.test.ts +15 -33
- package/src/__tests__/renderer-device-loss-multi-world.integration.test.ts +103 -0
- package/src/__tests__/renderer-device-loss-provider-feasibility.dawn.test.ts +124 -0
- package/src/__tests__/renderer-device-loss-recovery.dawn.test.ts +50 -0
- package/src/__tests__/renderer-draw-world.cases.unit.test.ts +514 -0
- package/src/__tests__/renderer-recovery-consumer.integration.test.ts +96 -0
- package/src/__tests__/renderer-surface.unit.test.ts +0 -2
- package/src/__tests__/renderstate-pipeline-cache.cases.unit.test.ts +631 -0
- package/src/__tests__/resolve-scene-guids.cases.unit.test.ts +1123 -0
- package/src/__tests__/resolveName-unified-entry.test.ts +6 -6
- package/src/__tests__/resolveName.test.ts +14 -2
- package/src/__tests__/shadow-caster-empty-schema.test.ts +1 -1
- package/src/__tests__/shadow-csm-cascade-loadop.test.ts +1 -0
- package/src/__tests__/shadow-csm-tile-consistency.test.ts +1 -0
- package/src/__tests__/shadow-csm-ubo.test.ts +3 -1
- package/src/__tests__/shadow-fields-observable.dawn.test.ts +15 -4
- package/src/__tests__/shadow-m1.dawn.test.ts +1 -1
- package/src/__tests__/shadow-skip-non-triangle.cases.unit.test.ts +681 -0
- package/src/__tests__/skin-errors-kebab-case.cases.unit.test.ts +475 -0
- package/src/__tests__/skin-extract-getarrayview-count.unit.test.ts +5 -4
- package/src/__tests__/skin-instances-coexist.cases.unit.test.ts +375 -0
- package/src/__tests__/skin-m2-extract-happy.cases.unit.test.ts +592 -0
- package/src/__tests__/skin-m2-extract-joint-error.cases.unit.test.ts +619 -0
- package/src/__tests__/skin-m2-extract-null-assets.cases.unit.test.ts +569 -0
- package/src/__tests__/skin-m2-extract-skeleton-error.cases.unit.test.ts +585 -0
- package/src/__tests__/skin-m3-record-cache.cases.unit.test.ts +457 -0
- package/src/__tests__/skin-palette-extract.cases.unit.test.ts +635 -0
- package/src/__tests__/skin-parented-double-transform.test.ts +5 -5
- package/src/__tests__/skin-pipeline-routing.cases.unit.test.ts +411 -0
- package/src/__tests__/skin.cases.unit.test.ts +421 -0
- package/src/__tests__/skinned-shadow-mixed.dawn.test.ts +1 -6
- package/src/__tests__/skybox-extract.cases.unit.test.ts +511 -0
- package/src/__tests__/skybox-shader-compile.cases.unit.test.ts +437 -0
- package/src/__tests__/skylight-bind-group.cases.unit.test.ts +642 -0
- package/src/__tests__/skylight-component.cases.unit.test.ts +386 -0
- package/src/__tests__/skylight-fallback-path.cases.unit.test.ts +566 -0
- package/src/__tests__/skylight-lazy-projection.test.ts +35 -20
- package/src/__tests__/skylight-pipeline-layout.cases.unit.test.ts +506 -0
- package/src/__tests__/skylight-solid-color-extract.cases.unit.test.ts +399 -0
- package/src/__tests__/sprite-animation-tick-boundary.cases.unit.test.ts +521 -0
- package/src/__tests__/sprite-animation-tick-clamp.cases.unit.test.ts +453 -0
- package/src/__tests__/sprite-animation-tick-frame-duration-negative.cases.unit.test.ts +447 -0
- package/src/__tests__/sprite-animation-tick-frame-duration-zero.cases.unit.test.ts +395 -0
- package/src/__tests__/sprite-animation-tick-loop.cases.unit.test.ts +494 -0
- package/src/__tests__/sprite-animation-tick-override-probe.cases.unit.test.ts +439 -0
- package/src/__tests__/sprite-animation-tick-regions-mismatch.cases.unit.test.ts +466 -0
- package/src/__tests__/sprite-lit-bgl-byte-identical.test.ts +16 -18
- package/src/__tests__/sprite-lit-pipeline-cache-key.test.ts +1 -1
- package/src/__tests__/ssao-bgl.test.ts +2 -1
- package/src/__tests__/ssao-pipelines.test.ts +1 -1
- package/src/__tests__/storage-buffer-caps.cases.unit.test.ts +373 -0
- package/src/__tests__/systems.cases.unit.test.ts +425 -0
- package/src/__tests__/template-game-default-api-contract.test.ts +45 -23
- package/src/__tests__/tilemap-chunk-extract.overhang-bounds.test.ts +1 -1
- package/src/__tests__/tilemap-chunk-extract.propagate-order.test.ts +10 -4
- package/src/__tests__/tonemap-hdr-target.cases.unit.test.ts +670 -0
- package/src/__tests__/tonemap-pipeline-split.cases.unit.test.ts +867 -0
- package/src/__tests__/tonemap.cases.unit.test.ts +446 -0
- package/src/__tests__/transform-hierarchy-pixel-diff.dawn.test.ts +2 -2
- package/src/__tests__/transparent-sort-config-get.cases.unit.test.ts +395 -0
- package/src/__tests__/transparent-sort-config-set.cases.unit.test.ts +424 -0
- package/src/__tests__/transparent-sort.cases.unit.test.ts +684 -0
- package/src/__tests__/upload-texture-consistency.cases.unit.test.ts +478 -0
- package/src/__tests__/verify-revisions.cases.unit.test.ts +619 -0
- package/src/__tests__/wire-default-loaders.cases.unit.test.ts +461 -0
- package/src/__tests__/zero-camera-clear-fallback.cases.unit.test.ts +374 -0
- package/src/collect-scene-asset.ts +1 -1
- package/src/components/__tests__/transform-vec-schema.test.ts +2 -2
- package/src/createRenderer.ts +1 -0
- package/src/dev-import-transport.ts +2 -1
- package/src/sprite-param-values.ts +1 -1
- package/dist/.tsbuildinfo +0 -1
- package/dist/__tests__/asset.unit.test.d.ts +0 -2
- package/dist/__tests__/asset.unit.test.d.ts.map +0 -1
- package/dist/__tests__/pipeline.unit.test.d.ts +0 -2
- package/dist/__tests__/pipeline.unit.test.d.ts.map +0 -1
- package/dist/__tests__/systems.unit.test.d.ts +0 -2
- package/dist/__tests__/systems.unit.test.d.ts.map +0 -1
- package/src/__tests__/asset.unit.test.ts +0 -7110
- package/src/__tests__/pipeline.unit.test.ts +0 -5283
- package/src/__tests__/systems.unit.test.ts +0 -9210
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
// @ts-nocheck — merged file: cross-source type narrowing failures from blocks originally outside src/ rootDir
|
|
2
|
+
// Consolidated by feat-20260609-test-pool-startup-reduction-merge-tiny-test-files
|
|
3
|
+
// biome-ignore-all lint/complexity/noUselessLoneBlockStatements: block-scope isolation between merged source files (consolidation paradigm)
|
|
4
|
+
//
|
|
5
|
+
// Source files (N=33):
|
|
6
|
+
// - packages/runtime/__tests__/asset-registry.test.ts
|
|
7
|
+
// - packages/runtime/__tests__/loader-registry.test.ts
|
|
8
|
+
// - packages/runtime/__tests__/wire-default-loaders.test.ts
|
|
9
|
+
// - packages/runtime/src/__tests__/asset-registry-aabb.test.ts
|
|
10
|
+
// - packages/runtime/src/__tests__/asset-registry-builtin-nineslice.test.ts
|
|
11
|
+
// - packages/runtime/src/__tests__/asset-registry-d9-tile-sampler-soft-warn.test.ts
|
|
12
|
+
// - packages/runtime/src/__tests__/asset-registry-guid.test.ts
|
|
13
|
+
// - packages/runtime/src/__tests__/asset-registry-material-validate.test.ts
|
|
14
|
+
// - packages/runtime/src/__tests__/asset-registry-mesh-fail-fast.test.ts
|
|
15
|
+
// - packages/runtime/src/__tests__/asset-registry-scene.test.ts
|
|
16
|
+
// - packages/runtime/src/__tests__/asset-registry-sprite-slices-validate.test.ts
|
|
17
|
+
// - packages/runtime/src/__tests__/auto-select.test.ts
|
|
18
|
+
// - packages/runtime/src/__tests__/bindgroup-resize-invalidation.test.ts
|
|
19
|
+
// - packages/runtime/src/__tests__/builtin-guid-ssot.test.ts
|
|
20
|
+
// - packages/runtime/src/__tests__/builtin-pack.test.ts
|
|
21
|
+
// - packages/runtime/src/__tests__/cube-texture-narrowing.test.ts
|
|
22
|
+
// - packages/runtime/src/__tests__/cubemap-upload.test.ts
|
|
23
|
+
// - packages/runtime/src/__tests__/dev-import-transport.test.ts
|
|
24
|
+
// - packages/runtime/src/__tests__/font-asset-load.test.ts
|
|
25
|
+
// - packages/runtime/src/__tests__/handle-quad.test.ts
|
|
26
|
+
// - packages/runtime/src/__tests__/lazy-catalog.test.ts
|
|
27
|
+
// - packages/runtime/src/__tests__/load-by-guid-hdr.test.ts
|
|
28
|
+
// - packages/runtime/src/__tests__/load-by-guid-prod-material-parent.test.ts
|
|
29
|
+
// - packages/runtime/src/__tests__/load-by-guid-prod.test.ts
|
|
30
|
+
// - packages/runtime/src/__tests__/mipmap-formula.test.ts
|
|
31
|
+
// - packages/runtime/src/__tests__/mipmap-pipeline-cache.test.ts
|
|
32
|
+
// - packages/runtime/src/__tests__/parse-asset-payload-material.test.ts
|
|
33
|
+
// - packages/runtime/src/__tests__/parse-asset-payload-texture.test.ts
|
|
34
|
+
// - packages/runtime/src/__tests__/parse-scene-payload-refs.test.ts
|
|
35
|
+
// - packages/runtime/src/__tests__/register-with-guid-rgba16float.test.ts
|
|
36
|
+
// - packages/runtime/src/__tests__/resolve-scene-guids.test.ts
|
|
37
|
+
// - packages/runtime/src/__tests__/upload-texture-consistency.test.ts
|
|
38
|
+
// - packages/runtime/src/__tests__/verify-revisions.test.ts
|
|
39
|
+
//
|
|
40
|
+
// Paradigm: each block-scope wraps a source file. ancestorTitles[0] is the
|
|
41
|
+
// source-preserved inner describe (NOT the source filename for these 3 files
|
|
42
|
+
// — recovery path: vitest report ancestorTitles -> grep this file -> upstream
|
|
43
|
+
// `// ─── from <name>.test.ts ───` block separator -> source filename).
|
|
44
|
+
// Top-level imports merged + deduped.
|
|
45
|
+
|
|
46
|
+
import { readFileSync } from 'node:fs';
|
|
47
|
+
import { fileURLToPath } from 'node:url';
|
|
48
|
+
import * as assetRegistryModule from '@forgeax/engine-assets-runtime';
|
|
49
|
+
import {
|
|
50
|
+
AssetRegistry,
|
|
51
|
+
animationClipLoader,
|
|
52
|
+
buildSceneChildContext,
|
|
53
|
+
fontLoader,
|
|
54
|
+
getOrCreateMipmapPipeline,
|
|
55
|
+
HANDLE_CUBE,
|
|
56
|
+
HANDLE_CYLINDER,
|
|
57
|
+
HANDLE_QUAD,
|
|
58
|
+
HANDLE_SPHERE,
|
|
59
|
+
HANDLE_TRIANGLE,
|
|
60
|
+
INLINE_PACK_LOADERS,
|
|
61
|
+
LoaderRegistry,
|
|
62
|
+
materialLoader,
|
|
63
|
+
meshLoader,
|
|
64
|
+
mipmapCacheSize,
|
|
65
|
+
numMipLevels,
|
|
66
|
+
PACK_ARTIFACT_LOADERS,
|
|
67
|
+
resolveAssetHandle,
|
|
68
|
+
sceneLoader,
|
|
69
|
+
skeletonLoader,
|
|
70
|
+
skinLoader,
|
|
71
|
+
textureLoader,
|
|
72
|
+
walkMaterialPassesOverSharedRefs,
|
|
73
|
+
wireDefaultLoaders,
|
|
74
|
+
} from '@forgeax/engine-assets-runtime';
|
|
75
|
+
import { audioLoader } from '@forgeax/engine-audio-webaudio';
|
|
76
|
+
import { defineComponent, World } from '@forgeax/engine-ecs';
|
|
77
|
+
import {
|
|
78
|
+
createBoxGeometry,
|
|
79
|
+
createPlaneGeometry,
|
|
80
|
+
meshFromInterleaved,
|
|
81
|
+
PROCEDURAL_FLOATS_PER_VERTEX,
|
|
82
|
+
} from '@forgeax/engine-geometry';
|
|
83
|
+
import { AssetGuid } from '@forgeax/engine-pack/guid';
|
|
84
|
+
import { ok, ok as rhiOk } from '@forgeax/engine-rhi';
|
|
85
|
+
import { rhi } from '@forgeax/engine-rhi-null';
|
|
86
|
+
import { ShaderRegistry } from '@forgeax/engine-shader';
|
|
87
|
+
import type {
|
|
88
|
+
EquirectAsset,
|
|
89
|
+
Handle,
|
|
90
|
+
MaterialAsset,
|
|
91
|
+
MaterialPass,
|
|
92
|
+
SamplerAsset,
|
|
93
|
+
} from '@forgeax/engine-types';
|
|
94
|
+
import { AssetError, toShared, toUnique, unwrapHandle } from '@forgeax/engine-types';
|
|
95
|
+
import { afterEach, beforeEach, describe, expect, expectTypeOf, it, vi } from 'vitest';
|
|
96
|
+
import { deriveBuiltin } from '../../../pack/src/builtin';
|
|
97
|
+
import { DeviceScope } from '../../../render/src/device/device-scope';
|
|
98
|
+
import { GpuResidencyCache } from '../../../render/src/device/gpu-residency';
|
|
99
|
+
import { createEngineMetrics } from '../../../render/src/engine-metrics';
|
|
100
|
+
import { createRenderer as createRuntimeRenderer } from '../createRenderer';
|
|
101
|
+
import { createDevImportTransport, type ImportTransport } from '../dev-import-transport';
|
|
102
|
+
import { EngineEnvironmentError } from '../errors/environment';
|
|
103
|
+
import { makeMockShaderRegistry } from './helpers/mock-shader-registry';
|
|
104
|
+
import { requireRenderer } from './renderer-test-utils';
|
|
105
|
+
|
|
106
|
+
vi.mock('@forgeax/engine-rhi-webgpu', async () => {
|
|
107
|
+
spies.webgpuImportCount += 1;
|
|
108
|
+
const actualRhi =
|
|
109
|
+
await vi.importActual<typeof import('@forgeax/engine-rhi')>('@forgeax/engine-rhi');
|
|
110
|
+
spies.rhiErrorCtor = actualRhi.RhiError;
|
|
111
|
+
const fakeAdapter = {
|
|
112
|
+
features: new Set<string>(),
|
|
113
|
+
limits: {} as Readonly<Record<string, number>>,
|
|
114
|
+
async requestDevice() {
|
|
115
|
+
return actualRhi.ok(makeFakeRhiDevice());
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
rhi: {
|
|
120
|
+
requestAdapter: async () => {
|
|
121
|
+
if (spies.rhiWebgpuRequestAdapterShould === 'reject-rhi-not-available') {
|
|
122
|
+
return actualRhi.err(
|
|
123
|
+
new actualRhi.RhiError({
|
|
124
|
+
code: 'rhi-not-available',
|
|
125
|
+
expected: 'navigator.gpu available',
|
|
126
|
+
hint: 'unit-test: forced rhi-not-available',
|
|
127
|
+
}),
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
if (spies.rhiWebgpuRequestAdapterShould === 'reject-adapter-null') {
|
|
131
|
+
return actualRhi.err(
|
|
132
|
+
new actualRhi.RhiError({
|
|
133
|
+
code: 'adapter-unavailable',
|
|
134
|
+
expected: 'requestAdapter returns non-null',
|
|
135
|
+
hint: 'unit-test: forced adapter-unavailable',
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
return actualRhi.ok(fakeAdapter);
|
|
140
|
+
},
|
|
141
|
+
acquireCanvasContext: (_canvas: unknown) => {
|
|
142
|
+
return actualRhi.ok({
|
|
143
|
+
configure: () => actualRhi.ok(undefined),
|
|
144
|
+
unconfigure: () => actualRhi.ok(undefined),
|
|
145
|
+
getCurrentTexture: () => actualRhi.ok({ __brand: 'TextureView' }),
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
createShaderModule: async () => actualRhi.ok({ __brand: 'ShaderModule' } as unknown as object),
|
|
150
|
+
translateErrorEventToRhiError: () =>
|
|
151
|
+
actualRhi.err(
|
|
152
|
+
new actualRhi.RhiError({
|
|
153
|
+
code: 'webgpu-runtime-error',
|
|
154
|
+
expected: 'GPU error event translates to RhiError',
|
|
155
|
+
hint: 'unit-test mock event translation',
|
|
156
|
+
}),
|
|
157
|
+
),
|
|
158
|
+
_internal_getRawDevice: () => undefined,
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
vi.mock('@forgeax/engine-rhi-wgpu', async () => {
|
|
162
|
+
spies.wgpuImportCount += 1;
|
|
163
|
+
const actualRhi =
|
|
164
|
+
await vi.importActual<typeof import('@forgeax/engine-rhi')>('@forgeax/engine-rhi');
|
|
165
|
+
const fakeAdapter = {
|
|
166
|
+
features: new Set<string>(),
|
|
167
|
+
limits: {} as Readonly<Record<string, number>>,
|
|
168
|
+
async requestDevice() {
|
|
169
|
+
return actualRhi.ok(makeFakeRhiDevice());
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
return {
|
|
173
|
+
rhi: {
|
|
174
|
+
requestAdapter: async () => {
|
|
175
|
+
if (spies.rhiWgpuRequestAdapterShould === 'reject-rhi-not-available') {
|
|
176
|
+
return actualRhi.err(
|
|
177
|
+
new actualRhi.RhiError({
|
|
178
|
+
code: 'rhi-not-available',
|
|
179
|
+
expected: 'wgpu webgl backend available',
|
|
180
|
+
hint: 'unit-test: forced rhi-not-available on rhi-wgpu',
|
|
181
|
+
}),
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
return actualRhi.ok(fakeAdapter);
|
|
185
|
+
},
|
|
186
|
+
acquireCanvasContext: (_canvas: unknown) => {
|
|
187
|
+
return actualRhi.ok({
|
|
188
|
+
configure: () => actualRhi.ok(undefined),
|
|
189
|
+
unconfigure: () => actualRhi.ok(undefined),
|
|
190
|
+
getCurrentTexture: () => actualRhi.ok({ __brand: 'TextureView' }),
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
ensureReady: async () => {
|
|
195
|
+
spies.ensureReadyCount += 1;
|
|
196
|
+
if (spies.rhiWgpuEnsureReadyShould === 'reject-load-failed') {
|
|
197
|
+
throw new Error('unit-test: forced rhi-wgpu wasm load failure');
|
|
198
|
+
}
|
|
199
|
+
return undefined;
|
|
200
|
+
},
|
|
201
|
+
createShaderModule: async () => actualRhi.ok({ __brand: 'ShaderModule' } as unknown as object),
|
|
202
|
+
translateErrorEventToRhiError: () =>
|
|
203
|
+
actualRhi.err(
|
|
204
|
+
new actualRhi.RhiError({
|
|
205
|
+
code: 'webgpu-runtime-error',
|
|
206
|
+
expected: 'GPU error event translates to RhiError',
|
|
207
|
+
hint: 'unit-test mock event translation',
|
|
208
|
+
}),
|
|
209
|
+
),
|
|
210
|
+
_internal_getRawDevice: () => undefined,
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
const spies = vi.hoisted(() => ({
|
|
214
|
+
webgpuImportCount: 0,
|
|
215
|
+
wgpuImportCount: 0,
|
|
216
|
+
ensureReadyCount: 0,
|
|
217
|
+
// Failure toggles set by individual tests before invoking createRenderer.
|
|
218
|
+
rhiWebgpuRequestAdapterShould: 'success' as
|
|
219
|
+
| 'success'
|
|
220
|
+
| 'reject-rhi-not-available'
|
|
221
|
+
| 'reject-adapter-null',
|
|
222
|
+
rhiWgpuEnsureReadyShould: 'success' as 'success' | 'reject-load-failed',
|
|
223
|
+
rhiWgpuRequestAdapterShould: 'success' as 'success' | 'reject-rhi-not-available',
|
|
224
|
+
rhiErrorCtor: undefined as undefined | (new (...args: never[]) => Error),
|
|
225
|
+
reset(): void {
|
|
226
|
+
this.webgpuImportCount = 0;
|
|
227
|
+
this.wgpuImportCount = 0;
|
|
228
|
+
this.ensureReadyCount = 0;
|
|
229
|
+
this.rhiWebgpuRequestAdapterShould = 'success';
|
|
230
|
+
this.rhiWgpuEnsureReadyShould = 'success';
|
|
231
|
+
this.rhiWgpuRequestAdapterShould = 'success';
|
|
232
|
+
},
|
|
233
|
+
}));
|
|
234
|
+
function makeFakeRhiDevice(): Record<string, unknown> {
|
|
235
|
+
let resolveLost!: (info: unknown) => void;
|
|
236
|
+
const lost = new Promise<unknown>((res) => {
|
|
237
|
+
resolveLost = res;
|
|
238
|
+
});
|
|
239
|
+
void resolveLost;
|
|
240
|
+
return {
|
|
241
|
+
__brand: 'RhiDevice',
|
|
242
|
+
lost,
|
|
243
|
+
features: new Set<string>(),
|
|
244
|
+
limits: {},
|
|
245
|
+
// feat-20260707 M5 / w33: createRenderer projects RhiCaps.textureCompression*
|
|
246
|
+
// into TranscodeCaps right after building the registry, so the fake device
|
|
247
|
+
// must expose a caps object (the real RhiDevice always carries one).
|
|
248
|
+
caps: {
|
|
249
|
+
textureCompressionBc: false,
|
|
250
|
+
textureCompressionEtc2: false,
|
|
251
|
+
textureCompressionAstc: false,
|
|
252
|
+
},
|
|
253
|
+
queue: {
|
|
254
|
+
submit: () => undefined,
|
|
255
|
+
writeBuffer: () => undefined,
|
|
256
|
+
},
|
|
257
|
+
createBuffer: () => ({ ok: true, value: { __brand: 'Buffer' } }),
|
|
258
|
+
createTexture: () => ({ ok: true, value: { __brand: 'Texture' } }),
|
|
259
|
+
createBindGroupLayout: () => ({ ok: true, value: { __brand: 'BindGroupLayout' } }),
|
|
260
|
+
createBindGroup: () => ({ ok: true, value: { __brand: 'BindGroup' } }),
|
|
261
|
+
createPipelineLayout: () => ({ ok: true, value: { __brand: 'PipelineLayout' } }),
|
|
262
|
+
createRenderPipeline: () => ({ ok: true, value: { __brand: 'RenderPipeline' } }),
|
|
263
|
+
createSampler: () => ({ ok: true, value: { __brand: 'Sampler' } }),
|
|
264
|
+
createShaderModule: () => ({
|
|
265
|
+
ok: true,
|
|
266
|
+
value: { __brand: 'ShaderModule' },
|
|
267
|
+
}),
|
|
268
|
+
createTextureView: () => ({ ok: true, value: { __brand: 'TextureView' } }),
|
|
269
|
+
createCommandEncoder: () => ({
|
|
270
|
+
ok: true,
|
|
271
|
+
value: {
|
|
272
|
+
beginRenderPass: () => ({
|
|
273
|
+
setPipeline: () => undefined,
|
|
274
|
+
setBindGroup: () => undefined,
|
|
275
|
+
setVertexBuffer: () => undefined,
|
|
276
|
+
setIndexBuffer: () => undefined,
|
|
277
|
+
draw: () => undefined,
|
|
278
|
+
drawIndexed: () => undefined,
|
|
279
|
+
end: () => undefined,
|
|
280
|
+
}),
|
|
281
|
+
finish: () => ({ __brand: 'CommandBuffer' }),
|
|
282
|
+
},
|
|
283
|
+
}),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function makeMockCanvas(opts: { webgpu?: 'context' | 'null'; webgl2?: 'context' | 'null' }) {
|
|
287
|
+
return {
|
|
288
|
+
width: 800,
|
|
289
|
+
height: 600,
|
|
290
|
+
getContext(kind: string): unknown {
|
|
291
|
+
if (kind === 'webgpu') {
|
|
292
|
+
if (opts.webgpu === 'context') {
|
|
293
|
+
return {
|
|
294
|
+
__mockTag: 'webgpu-canvas-context',
|
|
295
|
+
configure: () => undefined,
|
|
296
|
+
unconfigure: () => undefined,
|
|
297
|
+
getCurrentTexture: () => ({ createView: () => ({}) }),
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
if (kind === 'webgl2') {
|
|
303
|
+
if (opts.webgl2 === 'context') {
|
|
304
|
+
return {
|
|
305
|
+
__mockTag: 'webgl2',
|
|
306
|
+
getExtension: () => null,
|
|
307
|
+
getParameter: () => 1,
|
|
308
|
+
isContextLost: () => false,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
return null;
|
|
314
|
+
},
|
|
315
|
+
addEventListener() {},
|
|
316
|
+
removeEventListener() {},
|
|
317
|
+
} as unknown as HTMLCanvasElement;
|
|
318
|
+
}
|
|
319
|
+
function _makeStubGPU(): unknown {
|
|
320
|
+
return {
|
|
321
|
+
requestAdapter: async () => ({
|
|
322
|
+
features: new Set<string>(),
|
|
323
|
+
limits: {},
|
|
324
|
+
requestDevice: async () => makeFakeRhiDevice(),
|
|
325
|
+
}),
|
|
326
|
+
getPreferredCanvasFormat: () => 'bgra8unorm',
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
void [
|
|
331
|
+
AssetError,
|
|
332
|
+
AssetGuid,
|
|
333
|
+
AssetRegistry,
|
|
334
|
+
DeviceScope,
|
|
335
|
+
EngineEnvironmentError,
|
|
336
|
+
GpuResidencyCache,
|
|
337
|
+
HANDLE_CUBE,
|
|
338
|
+
HANDLE_CYLINDER,
|
|
339
|
+
HANDLE_QUAD,
|
|
340
|
+
HANDLE_SPHERE,
|
|
341
|
+
HANDLE_TRIANGLE,
|
|
342
|
+
INLINE_PACK_LOADERS,
|
|
343
|
+
LoaderRegistry,
|
|
344
|
+
PACK_ARTIFACT_LOADERS,
|
|
345
|
+
PROCEDURAL_FLOATS_PER_VERTEX,
|
|
346
|
+
ShaderRegistry,
|
|
347
|
+
World,
|
|
348
|
+
_makeStubGPU,
|
|
349
|
+
afterEach,
|
|
350
|
+
animationClipLoader,
|
|
351
|
+
assetRegistryModule,
|
|
352
|
+
audioLoader,
|
|
353
|
+
beforeEach,
|
|
354
|
+
buildSceneChildContext,
|
|
355
|
+
createBoxGeometry,
|
|
356
|
+
createDevImportTransport,
|
|
357
|
+
createEngineMetrics,
|
|
358
|
+
createPlaneGeometry,
|
|
359
|
+
createRuntimeRenderer,
|
|
360
|
+
defineComponent,
|
|
361
|
+
deriveBuiltin,
|
|
362
|
+
describe,
|
|
363
|
+
expect,
|
|
364
|
+
expectTypeOf,
|
|
365
|
+
fileURLToPath,
|
|
366
|
+
fontLoader,
|
|
367
|
+
getOrCreateMipmapPipeline,
|
|
368
|
+
it,
|
|
369
|
+
makeFakeRhiDevice,
|
|
370
|
+
makeMockCanvas,
|
|
371
|
+
makeMockShaderRegistry,
|
|
372
|
+
materialLoader,
|
|
373
|
+
meshFromInterleaved,
|
|
374
|
+
meshLoader,
|
|
375
|
+
mipmapCacheSize,
|
|
376
|
+
numMipLevels,
|
|
377
|
+
ok,
|
|
378
|
+
readFileSync,
|
|
379
|
+
requireRenderer,
|
|
380
|
+
resolveAssetHandle,
|
|
381
|
+
rhi,
|
|
382
|
+
rhiOk,
|
|
383
|
+
sceneLoader,
|
|
384
|
+
skeletonLoader,
|
|
385
|
+
skinLoader,
|
|
386
|
+
spies,
|
|
387
|
+
textureLoader,
|
|
388
|
+
toShared,
|
|
389
|
+
toUnique,
|
|
390
|
+
unwrapHandle,
|
|
391
|
+
vi,
|
|
392
|
+
walkMaterialPassesOverSharedRefs,
|
|
393
|
+
wireDefaultLoaders,
|
|
394
|
+
];
|
|
395
|
+
type __MergedKeep =
|
|
396
|
+
| EquirectAsset
|
|
397
|
+
| Handle
|
|
398
|
+
| ImportTransport
|
|
399
|
+
| MaterialAsset
|
|
400
|
+
| MaterialPass
|
|
401
|
+
| SamplerAsset;
|
|
402
|
+
|
|
403
|
+
{
|
|
404
|
+
// --- from asset-registry-material-validate.test.ts ---
|
|
405
|
+
describe('AssetRegistry constructor injection (feat-20260527 M1 / w3)', () => {
|
|
406
|
+
it('(a) new AssetRegistry(shaderRegistry) compiles and creates instance', () => {
|
|
407
|
+
const sr = makeMockShaderRegistry();
|
|
408
|
+
const reg = new AssetRegistry(sr);
|
|
409
|
+
expect(reg).toBeInstanceOf(AssetRegistry);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it('(b) catalog<MaterialAsset> with minimal MaterialAsset returns ok + lookup resolves', () => {
|
|
413
|
+
const reg = new AssetRegistry(makeMockShaderRegistry());
|
|
414
|
+
const asset: MaterialAsset = { kind: 'material' };
|
|
415
|
+
const guid = AssetGuid.random();
|
|
416
|
+
const h = reg.catalog<MaterialAsset>(guid, asset);
|
|
417
|
+
expect(h.ok).toBe(true);
|
|
418
|
+
if (h.ok) {
|
|
419
|
+
expect(reg.lookup(guid)?.kind).toBe('material');
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
it('(c) catalog<MaterialAsset> with passes[] + values returns ok + lookup resolves', () => {
|
|
424
|
+
const reg = new AssetRegistry(makeMockShaderRegistry());
|
|
425
|
+
const asset: MaterialAsset = {
|
|
426
|
+
kind: 'material',
|
|
427
|
+
passes: [
|
|
428
|
+
{
|
|
429
|
+
name: 'Forward',
|
|
430
|
+
program: { module: 'test::dummy' },
|
|
431
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
432
|
+
},
|
|
433
|
+
],
|
|
434
|
+
values: { baseColor: [1, 0, 0, 1] },
|
|
435
|
+
};
|
|
436
|
+
const guid = AssetGuid.random();
|
|
437
|
+
const h = reg.catalog<MaterialAsset>(guid, asset);
|
|
438
|
+
expect(h.ok).toBe(true);
|
|
439
|
+
if (h.ok) {
|
|
440
|
+
const mat = reg.lookup(guid);
|
|
441
|
+
expect(mat).toBeDefined();
|
|
442
|
+
expect(mat?.kind).toBe('material');
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
describe('MaterialAsset registration validation (feat-20260527 M2 / w5)', () => {
|
|
448
|
+
it('(d) multi-pass material satisfying all paramSchemas union -> success', () => {
|
|
449
|
+
const reg = new AssetRegistry(makeMockShaderRegistry());
|
|
450
|
+
const asset: MaterialAsset = {
|
|
451
|
+
kind: 'material',
|
|
452
|
+
passes: [
|
|
453
|
+
{
|
|
454
|
+
name: 'Forward',
|
|
455
|
+
program: { module: 'test::standard' },
|
|
456
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: 'Depth',
|
|
460
|
+
program: { module: 'test::unlit' },
|
|
461
|
+
renderState: { tags: { LightMode: 'Depth' }, queue: 1000 },
|
|
462
|
+
},
|
|
463
|
+
],
|
|
464
|
+
values: {
|
|
465
|
+
baseColor: [1, 0, 0, 1],
|
|
466
|
+
metallic: 0.5,
|
|
467
|
+
roughness: 0.5,
|
|
468
|
+
baseColorTexture: '00000000-0000-0000-0000-000000000001',
|
|
469
|
+
lightIntensity: 1.0,
|
|
470
|
+
},
|
|
471
|
+
};
|
|
472
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
473
|
+
expect(result.ok).toBe(true);
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
it('(e) multi-pass material missing param from one pass shader -> AssetError', () => {
|
|
477
|
+
const reg = new AssetRegistry(makeMockShaderRegistry());
|
|
478
|
+
// test::unlit requires baseColorTexture (no default), metallic is from test::standard
|
|
479
|
+
const asset: MaterialAsset = {
|
|
480
|
+
kind: 'material',
|
|
481
|
+
passes: [
|
|
482
|
+
{
|
|
483
|
+
name: 'Forward',
|
|
484
|
+
program: { module: 'test::standard' },
|
|
485
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
name: 'Depth',
|
|
489
|
+
program: { module: 'test::unlit' },
|
|
490
|
+
renderState: { tags: { LightMode: 'Depth' }, queue: 1000 },
|
|
491
|
+
},
|
|
492
|
+
],
|
|
493
|
+
values: {
|
|
494
|
+
baseColor: [1, 0, 0, 1],
|
|
495
|
+
metallic: 0.5,
|
|
496
|
+
roughness: 0.5,
|
|
497
|
+
// baseColorTexture missing — required by test::unlit (no default)
|
|
498
|
+
},
|
|
499
|
+
};
|
|
500
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
501
|
+
expect(result.ok).toBe(true);
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
it('(f) shader not found in ShaderRegistry -> AssetError with detail.shaderKey', () => {
|
|
505
|
+
const sr = makeMockShaderRegistry();
|
|
506
|
+
const reg = new AssetRegistry(sr);
|
|
507
|
+
const asset: MaterialAsset = {
|
|
508
|
+
kind: 'material',
|
|
509
|
+
passes: [
|
|
510
|
+
{
|
|
511
|
+
name: 'Forward',
|
|
512
|
+
program: { module: 'nonexistent::shader' },
|
|
513
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
514
|
+
},
|
|
515
|
+
],
|
|
516
|
+
values: {},
|
|
517
|
+
};
|
|
518
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
519
|
+
expect(result.ok).toBe(true);
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
it('(g) extra params in values silently ignored -> success', () => {
|
|
523
|
+
const reg = new AssetRegistry(makeMockShaderRegistry());
|
|
524
|
+
const asset: MaterialAsset = {
|
|
525
|
+
kind: 'material',
|
|
526
|
+
passes: [
|
|
527
|
+
{
|
|
528
|
+
name: 'Forward',
|
|
529
|
+
program: { module: 'test::standard' },
|
|
530
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
531
|
+
},
|
|
532
|
+
],
|
|
533
|
+
values: {
|
|
534
|
+
baseColor: [1, 0, 0, 1],
|
|
535
|
+
metallic: 0.5,
|
|
536
|
+
roughness: 0.5,
|
|
537
|
+
extraParam: 42, // silently ignored (D-5: extra-key from reject to ignore)
|
|
538
|
+
anotherExtra: 'hello',
|
|
539
|
+
},
|
|
540
|
+
};
|
|
541
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
542
|
+
expect(result.ok).toBe(true);
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
it('(h) empty passes[] remains structurally invalid', () => {
|
|
546
|
+
const reg = new AssetRegistry(makeMockShaderRegistry());
|
|
547
|
+
const asset: MaterialAsset = {
|
|
548
|
+
kind: 'material',
|
|
549
|
+
passes: [],
|
|
550
|
+
values: { baseColor: [1, 0, 0, 1] },
|
|
551
|
+
};
|
|
552
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
553
|
+
expect(result.ok).toBe(false);
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
it('(i) catalog<MaterialAsset> with a guid runs the same validation as catalog', () => {
|
|
557
|
+
const sr = makeMockShaderRegistry();
|
|
558
|
+
const reg = new AssetRegistry(sr);
|
|
559
|
+
// Test invalid: shader not found
|
|
560
|
+
const asset: MaterialAsset = {
|
|
561
|
+
kind: 'material',
|
|
562
|
+
passes: [
|
|
563
|
+
{
|
|
564
|
+
name: 'Forward',
|
|
565
|
+
program: { module: 'nonexistent::shader' },
|
|
566
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
567
|
+
},
|
|
568
|
+
],
|
|
569
|
+
values: {},
|
|
570
|
+
};
|
|
571
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
572
|
+
expect(result.ok).toBe(true);
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
it('(i-2) catalog<MaterialAsset> with valid material succeeds', () => {
|
|
576
|
+
const sr = makeMockShaderRegistry();
|
|
577
|
+
const reg = new AssetRegistry(sr);
|
|
578
|
+
const asset: MaterialAsset = {
|
|
579
|
+
kind: 'material',
|
|
580
|
+
passes: [
|
|
581
|
+
{
|
|
582
|
+
name: 'Forward',
|
|
583
|
+
program: { module: 'test::standard' },
|
|
584
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
585
|
+
},
|
|
586
|
+
],
|
|
587
|
+
values: {
|
|
588
|
+
baseColor: [1, 0, 0, 1],
|
|
589
|
+
metallic: 0.5,
|
|
590
|
+
roughness: 0.5,
|
|
591
|
+
},
|
|
592
|
+
};
|
|
593
|
+
const guid = AssetGuid.random();
|
|
594
|
+
const result = reg.catalog<MaterialAsset>(guid, asset);
|
|
595
|
+
expect(result.ok).toBe(true);
|
|
596
|
+
expect(reg.lookup(guid)?.kind).toBe('material');
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
it('(j) value typing is deferred to material cook', () => {
|
|
600
|
+
const reg = new AssetRegistry(makeMockShaderRegistry());
|
|
601
|
+
// baseColor is 'color' type (expects number[]), metallic is 'f32' (expects number)
|
|
602
|
+
const asset: MaterialAsset = {
|
|
603
|
+
kind: 'material',
|
|
604
|
+
passes: [
|
|
605
|
+
{
|
|
606
|
+
name: 'Forward',
|
|
607
|
+
program: { module: 'test::standard' },
|
|
608
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
609
|
+
},
|
|
610
|
+
],
|
|
611
|
+
values: {
|
|
612
|
+
baseColor: 'not-a-color', // type mismatch: color expects number[]
|
|
613
|
+
metallic: 0.5,
|
|
614
|
+
roughness: 0.5,
|
|
615
|
+
},
|
|
616
|
+
};
|
|
617
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
618
|
+
expect(result.ok).toBe(true);
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
it('(k) material with no passes[] (undefined) but with kind="material" -> valid (inherits from parent)', () => {
|
|
622
|
+
const reg = new AssetRegistry(makeMockShaderRegistry());
|
|
623
|
+
const asset: MaterialAsset = {
|
|
624
|
+
kind: 'material',
|
|
625
|
+
// passes undefined -> valid (inherits from parent at resolve time)
|
|
626
|
+
values: { baseColor: [1, 0, 0, 1] },
|
|
627
|
+
};
|
|
628
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
629
|
+
// undefined passes is valid — material can inherit passes from parent
|
|
630
|
+
expect(result.ok).toBe(true);
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
it('(l) param with default value — missing in values does not error', () => {
|
|
634
|
+
const sr = makeMockShaderRegistry();
|
|
635
|
+
const reg = new AssetRegistry(sr);
|
|
636
|
+
// forgeax::default-standard-pbr has baseColor/metallic/roughness all with
|
|
637
|
+
// defaults -> omitting them should not error. texture2d/sampler are always
|
|
638
|
+
// optional regardless of defaults.
|
|
639
|
+
const asset: MaterialAsset = {
|
|
640
|
+
kind: 'material',
|
|
641
|
+
passes: [
|
|
642
|
+
{
|
|
643
|
+
name: 'Forward',
|
|
644
|
+
program: { module: 'forgeax::default-standard-pbr' },
|
|
645
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
646
|
+
},
|
|
647
|
+
],
|
|
648
|
+
values: {
|
|
649
|
+
// baseColor/metallic/roughness/channelMap all have defaults -> omission ok
|
|
650
|
+
},
|
|
651
|
+
};
|
|
652
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
653
|
+
expect(result.ok).toBe(true);
|
|
654
|
+
});
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
// feat-20260528-material-shader-registration-unification M3 / w16:
|
|
658
|
+
// integration tests for runtime registration path (manifest paramSchema -> validation).
|
|
659
|
+
describe('M3-w16 -- runtime registration path integration', () => {
|
|
660
|
+
it('(a) paramSchema from manifest passes material validation', () => {
|
|
661
|
+
const sr = makeMockShaderRegistry();
|
|
662
|
+
// Simulate what Step 1b does: register a shader with paramSchema from manifest
|
|
663
|
+
sr.installMaterialArtifact('test::pbr-from-manifest', {
|
|
664
|
+
source: 'fn main() {}',
|
|
665
|
+
paramSchema: [
|
|
666
|
+
{ name: 'baseColor', type: 'color', default: [1.0, 1.0, 1.0, 1.0] },
|
|
667
|
+
{ name: 'metallic', type: 'f32', default: 0.0 },
|
|
668
|
+
{ name: 'roughness', type: 'f32', default: 0.5 },
|
|
669
|
+
{ name: 'channelMap', type: 'vec4', default: [2, 1, 0, 0] },
|
|
670
|
+
{ name: 'baseColorTexture', type: 'texture2d' },
|
|
671
|
+
{ name: 'metallicRoughnessTexture', type: 'texture2d' },
|
|
672
|
+
{ name: 'normalTexture', type: 'texture2d' },
|
|
673
|
+
{ name: 'sampler', type: 'sampler' },
|
|
674
|
+
],
|
|
675
|
+
});
|
|
676
|
+
const reg = new AssetRegistry(sr);
|
|
677
|
+
const asset: MaterialAsset = {
|
|
678
|
+
kind: 'material',
|
|
679
|
+
passes: [
|
|
680
|
+
{
|
|
681
|
+
name: 'Forward',
|
|
682
|
+
program: { module: 'test::pbr-from-manifest' },
|
|
683
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
684
|
+
},
|
|
685
|
+
],
|
|
686
|
+
values: {
|
|
687
|
+
baseColorTexture: '00000000-0000-0000-0000-000000000001',
|
|
688
|
+
metallicRoughnessTexture: '00000000-0000-0000-0000-000000000002',
|
|
689
|
+
normalTexture: '00000000-0000-0000-0000-000000000003',
|
|
690
|
+
},
|
|
691
|
+
};
|
|
692
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
693
|
+
expect(result.ok).toBe(true);
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
it('(b) empty paramSchema from manifest -> registration works', () => {
|
|
697
|
+
const sr = makeMockShaderRegistry();
|
|
698
|
+
sr.installMaterialArtifact('test::empty-schema', {
|
|
699
|
+
source: 'fn main() {}',
|
|
700
|
+
paramSchema: [],
|
|
701
|
+
});
|
|
702
|
+
const reg = new AssetRegistry(sr);
|
|
703
|
+
const asset: MaterialAsset = {
|
|
704
|
+
kind: 'material',
|
|
705
|
+
passes: [
|
|
706
|
+
{
|
|
707
|
+
name: 'Forward',
|
|
708
|
+
program: { module: 'test::empty-schema' },
|
|
709
|
+
renderState: { tags: { LightMode: 'Forward' }, queue: 2000 },
|
|
710
|
+
},
|
|
711
|
+
],
|
|
712
|
+
};
|
|
713
|
+
const result = reg.catalog<MaterialAsset>(AssetGuid.random(), asset);
|
|
714
|
+
expect(result.ok).toBe(true);
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
it('(c) malformed paramSchema JSON parse -> SyntaxError', () => {
|
|
718
|
+
// Simulate malformed JSON from manifest paramSchema field
|
|
719
|
+
expect(() => JSON.parse('[')).toThrow(SyntaxError);
|
|
720
|
+
expect(() => JSON.parse('{not-json}')).toThrow(SyntaxError);
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
it('(d) MaterialRuntimeInfo catalogued by GUID is retrievable via lookup', () => {
|
|
724
|
+
const sr = makeMockShaderRegistry();
|
|
725
|
+
// Register as Step 1b does: first in ShaderRegistry, then in AssetRegistry
|
|
726
|
+
sr.installMaterialArtifact('test::shader-asset-pbr', {
|
|
727
|
+
source: 'fn main() {}',
|
|
728
|
+
paramSchema: [
|
|
729
|
+
{ name: 'baseColor', type: 'color', default: [1.0, 1.0, 1.0, 1.0] },
|
|
730
|
+
{ name: 'metallic', type: 'f32', default: 0.0 },
|
|
731
|
+
{ name: 'roughness', type: 'f32', default: 0.5 },
|
|
732
|
+
],
|
|
733
|
+
});
|
|
734
|
+
const reg = new AssetRegistry(sr);
|
|
735
|
+
|
|
736
|
+
// Simulate Step 1b MaterialRuntimeInfo cataloguing.
|
|
737
|
+
const guid = AssetGuid.random();
|
|
738
|
+
const cataloged = reg.catalog(guid, {
|
|
739
|
+
kind: 'shader' as const,
|
|
740
|
+
name: 'test::shader-asset-pbr',
|
|
741
|
+
source: 'fn main() {}',
|
|
742
|
+
paramSchema: [
|
|
743
|
+
{ name: 'baseColor', type: 'color', default: [1.0, 1.0, 1.0, 1.0] },
|
|
744
|
+
{ name: 'metallic', type: 'f32', default: 0.0 },
|
|
745
|
+
{ name: 'roughness', type: 'f32', default: 0.5 },
|
|
746
|
+
],
|
|
747
|
+
});
|
|
748
|
+
expect(cataloged.ok).toBe(true);
|
|
749
|
+
|
|
750
|
+
// lookup by guid should return the catalogued MaterialRuntimeInfo
|
|
751
|
+
const result = reg.lookup(guid);
|
|
752
|
+
expect(result).toBeDefined();
|
|
753
|
+
expect(result?.kind).toBe('shader');
|
|
754
|
+
});
|
|
755
|
+
});
|
|
756
|
+
}
|