@carbonenginejs/runtime 0.1.0-alpha.0 → 0.1.0-alpha.2
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 +58 -125
- package/dist/audio/index.js +8 -1
- package/dist/audio/index.js.map +1 -1
- package/dist/audio/trinity/audio/AudActionLog/AudActionLogCB.js +84 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionLogCB.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecord.js +14 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecord.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordExecuteActionOnPlayingID.js +26 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordExecuteActionOnPlayingID.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordPostEvent.js +27 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordPostEvent.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetRTPC.js +27 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetRTPC.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetState.js +25 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetState.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetSwitch.js +26 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetSwitch.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/IAudActionLog.js +58 -0
- package/dist/audio/trinity/audio/AudActionLog/IAudActionLog.js.map +1 -0
- package/dist/audio/trinity/audio/AudManager.js +1 -1
- package/dist/audio/trinity/audio/AudManager.js.map +1 -1
- package/dist/audio/trinity/audio/{AudObstructionOcclusion.js → AudObstructionOcclusion/AudObstructionOcclusion.js} +8 -52
- package/dist/audio/trinity/audio/AudObstructionOcclusion/AudObstructionOcclusion.js.map +1 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/EmitterState.js +17 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/EmitterState.js.map +1 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/FadingValue.js +46 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/FadingValue.js.map +1 -0
- package/dist/audio/trinity/index.js +8 -1
- package/dist/audio/trinity/index.js.map +1 -1
- package/dist/character/CjsCharacterAppearanceConstruction.js +5 -0
- package/dist/character/CjsCharacterAppearanceConstruction.js.map +1 -1
- package/dist/character/CjsCharacterAppearanceManager.js +14 -0
- package/dist/character/CjsCharacterAppearanceManager.js.map +1 -1
- package/dist/character/CjsCharacterFoundationConstruction.js +5 -0
- package/dist/character/CjsCharacterFoundationConstruction.js.map +1 -1
- package/dist/character/CjsCharacterTexturePolicy.js +5 -0
- package/dist/character/CjsCharacterTexturePolicy.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesAppearanceAL.js +17 -0
- package/dist/character/gles/CjsCharacterGlesAppearanceAL.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesAtlasRenderer.js +2 -0
- package/dist/character/gles/CjsCharacterGlesAtlasRenderer.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesFoundationTranslator.js +5 -0
- package/dist/character/gles/CjsCharacterGlesFoundationTranslator.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesLegacyConstructionTranslator.js +5 -0
- package/dist/character/gles/CjsCharacterGlesLegacyConstructionTranslator.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesMorphDeformation.js +2 -0
- package/dist/character/gles/CjsCharacterGlesMorphDeformation.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesPaletteCompatibility.js +5 -0
- package/dist/character/gles/CjsCharacterGlesPaletteCompatibility.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesTriangleCoverage.js +5 -0
- package/dist/character/gles/CjsCharacterGlesTriangleCoverage.js.map +1 -1
- package/dist/character/webgl2/CjsCharacterWebgl2EffectRouter.js +9 -0
- package/dist/character/webgl2/CjsCharacterWebgl2EffectRouter.js.map +1 -1
- package/dist/global/blue/CjsScriptCallback.js +142 -0
- package/dist/global/blue/CjsScriptCallback.js.map +1 -0
- package/dist/global/blue/index.js +2 -0
- package/dist/global/blue/index.js.map +1 -0
- package/dist/global/consts/renderContext/formats.js +51 -1
- package/dist/global/consts/renderContext/formats.js.map +1 -1
- package/dist/global/consts/renderContext/index.js +2 -2
- package/dist/global/consts/renderContext/renderStates.js +16 -1
- package/dist/global/consts/renderContext/renderStates.js.map +1 -1
- package/dist/global/contracts/index.js +0 -1
- package/dist/global/contracts/index.js.map +1 -1
- package/dist/global/index.js +4 -3
- package/dist/global/index.js.map +1 -1
- package/dist/global/math/index.js +2 -0
- package/dist/global/math/index.js.map +1 -1
- package/dist/global/math/mesh.js +70 -16
- package/dist/global/math/mesh.js.map +1 -1
- package/dist/global/math/noise.js +47 -68
- package/dist/global/math/noise.js.map +1 -1
- package/dist/global/math/pool.js +18 -3
- package/dist/global/math/pool.js.map +1 -1
- package/dist/global/math/random.js +52 -0
- package/dist/global/math/random.js.map +1 -0
- package/dist/global/math/tri3.js +18 -4
- package/dist/global/math/tri3.js.map +1 -1
- package/dist/global/schema/CjsSchema.js +20 -2
- package/dist/global/schema/CjsSchema.js.map +1 -1
- package/dist/global/schema/hydration.js +14 -0
- package/dist/global/schema/hydration.js.map +1 -1
- package/dist/global/utils/bytes.js +22 -4
- package/dist/global/utils/bytes.js.map +1 -1
- package/dist/global/utils/checksum.js +80 -0
- package/dist/global/utils/checksum.js.map +1 -0
- package/dist/global/utils/errors/CjsCancellationError.js +36 -0
- package/dist/global/utils/errors/CjsCancellationError.js.map +1 -0
- package/dist/global/utils/errors/CjsError.js +21 -52
- package/dist/global/utils/errors/CjsError.js.map +1 -1
- package/dist/global/utils/errors/abort.js +1 -1
- package/dist/global/utils/errors/abort.js.map +1 -1
- package/dist/global/utils/errors/index.js +2 -1
- package/dist/global/utils/errors/index.js.map +1 -1
- package/dist/global/utils/index.js +4 -2
- package/dist/global/utils/index.js.map +1 -1
- package/dist/index.js +95 -35
- package/dist/index.js.map +1 -1
- package/dist/input/Tr2MainWindow.js +7 -9
- package/dist/input/Tr2MainWindow.js.map +1 -1
- package/dist/resource/CjsResMan.js +33 -39
- package/dist/resource/CjsResMan.js.map +1 -1
- package/dist/resource/CjsResource.js +19 -5
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/audio/AudioGeometryResData.js +22 -27
- package/dist/resource/audio/AudioGeometryResData.js.map +1 -1
- package/dist/resource/audio/CjsAudioRes.js +4 -5
- package/dist/resource/audio/CjsAudioRes.js.map +1 -1
- package/dist/resource/format/CjsBitReader.js +263 -0
- package/dist/resource/format/CjsBitReader.js.map +1 -0
- package/dist/resource/format/CjsByteReader.js +130 -125
- package/dist/resource/format/CjsByteReader.js.map +1 -1
- package/dist/resource/format/CjsFormat.js +11 -4
- package/dist/resource/format/CjsFormat.js.map +1 -1
- package/dist/resource/format/CjsFormatError.js +37 -1
- package/dist/resource/format/CjsFormatError.js.map +1 -1
- package/dist/resource/format/CjsResourceProbe.js +41 -37
- package/dist/resource/format/CjsResourceProbe.js.map +1 -1
- package/dist/resource/format/carbonRecordGuard.js +33 -0
- package/dist/resource/format/carbonRecordGuard.js.map +1 -0
- package/dist/resource/format/imageSignatures.js +202 -0
- package/dist/resource/format/imageSignatures.js.map +1 -0
- package/dist/resource/format/index.js +2 -1
- package/dist/resource/format/index.js.map +1 -1
- package/dist/resource/format/jsonPolicies.js +180 -0
- package/dist/resource/format/jsonPolicies.js.map +1 -0
- package/dist/resource/formats/black/core/helpers.js +18 -29
- package/dist/resource/formats/black/core/helpers.js.map +1 -1
- package/dist/resource/formats/bnk/CjsBnkFormat.js +4 -3
- package/dist/resource/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/resource/formats/bnk/core/WwiseCursor.js +218 -0
- package/dist/resource/formats/bnk/core/WwiseCursor.js.map +1 -0
- package/dist/resource/formats/bnk/core/busNodes.js +2 -1
- package/dist/resource/formats/bnk/core/busNodes.js.map +1 -1
- package/dist/resource/formats/bnk/core/effectNodes.js +2 -1
- package/dist/resource/formats/bnk/core/effectNodes.js.map +1 -1
- package/dist/resource/formats/bnk/core/eventAction.js +15 -93
- package/dist/resource/formats/bnk/core/eventAction.js.map +1 -1
- package/dist/resource/formats/bnk/core/globalSettings.js +19 -94
- package/dist/resource/formats/bnk/core/globalSettings.js.map +1 -1
- package/dist/resource/formats/bnk/core/helpers.js +2 -48
- package/dist/resource/formats/bnk/core/helpers.js.map +1 -1
- package/dist/resource/formats/bnk/core/musicNodes.js +42 -134
- package/dist/resource/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/resource/formats/bnk/core/nodeBase.js +20 -111
- package/dist/resource/formats/bnk/core/nodeBase.js.map +1 -1
- package/dist/resource/formats/bnk/core/sfxNodes.js +2 -1
- package/dist/resource/formats/bnk/core/sfxNodes.js.map +1 -1
- package/dist/resource/formats/cmf/CjsCmfFormat.js +242 -228
- package/dist/resource/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/resource/formats/cmf/core/binary.js +54 -60
- package/dist/resource/formats/cmf/core/binary.js.map +1 -1
- package/dist/resource/formats/dds/CjsDdsFormat.js +5 -3
- package/dist/resource/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/resource/formats/dds/core/bc6h.js +16 -18
- package/dist/resource/formats/dds/core/bc6h.js.map +1 -1
- package/dist/resource/formats/dds/core/bc7.js +28 -24
- package/dist/resource/formats/dds/core/bc7.js.map +1 -1
- package/dist/resource/formats/dds/core/helpers.js +7 -133
- package/dist/resource/formats/dds/core/helpers.js.map +1 -1
- package/dist/resource/formats/dxbc/CjsDxbcFormat.js +3 -2
- package/dist/resource/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/resource/formats/dxbc/core/helpers.js +4 -32
- package/dist/resource/formats/dxbc/core/helpers.js.map +1 -1
- package/dist/resource/formats/fbx/CjsFbxFormat.js +11 -0
- package/dist/resource/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/resource/formats/fbx/core/helpers.js +18 -12
- package/dist/resource/formats/fbx/core/helpers.js.map +1 -1
- package/dist/resource/formats/flac/CjsFlacFormat.js +4 -9
- package/dist/resource/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/resource/formats/flac/core/helpers.js +1 -62
- package/dist/resource/formats/flac/core/helpers.js.map +1 -1
- package/dist/resource/formats/gif/CjsGifFormat.js +4 -9
- package/dist/resource/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/resource/formats/gif/core/helpers.js +1 -63
- package/dist/resource/formats/gif/core/helpers.js.map +1 -1
- package/dist/resource/formats/gltf/CjsGltfFormat.js +4 -3
- package/dist/resource/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/resource/formats/gltf/core/helpers.js +3 -19
- package/dist/resource/formats/gltf/core/helpers.js.map +1 -1
- package/dist/resource/formats/gr2/CjsGr2Format.js +105 -92
- package/dist/resource/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/resource/formats/gr2/core/container.js +1 -10
- package/dist/resource/formats/gr2/core/container.js.map +1 -1
- package/dist/resource/formats/gr2/core/helpers.js +24 -35
- package/dist/resource/formats/gr2/core/helpers.js.map +1 -1
- package/dist/resource/formats/gr2/core/shared.js +193 -189
- package/dist/resource/formats/gr2/core/shared.js.map +1 -1
- package/dist/resource/formats/hlsl/CjsHlslFormat.js +4 -3
- package/dist/resource/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/resource/formats/hlsl/core/helpers.js +1 -30
- package/dist/resource/formats/hlsl/core/helpers.js.map +1 -1
- package/dist/resource/formats/jpeg/CjsJpegFormat.js +5 -3
- package/dist/resource/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/resource/formats/jpeg/core/helpers.js +7 -134
- package/dist/resource/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/resource/formats/mp3/CjsMp3Format.js +4 -9
- package/dist/resource/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/resource/formats/mp3/core/helpers.js +1 -64
- package/dist/resource/formats/mp3/core/helpers.js.map +1 -1
- package/dist/resource/formats/mp4/CjsMp4Format.js +4 -9
- package/dist/resource/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/resource/formats/mp4/core/helpers.js +1 -73
- package/dist/resource/formats/mp4/core/helpers.js.map +1 -1
- package/dist/resource/formats/obj/CjsObjFormat.js +4 -3
- package/dist/resource/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/resource/formats/obj/core/helpers.js +93 -115
- package/dist/resource/formats/obj/core/helpers.js.map +1 -1
- package/dist/resource/formats/ogg/CjsOggFormat.js +4 -3
- package/dist/resource/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/resource/formats/ogg/core/helpers.js +1 -15
- package/dist/resource/formats/ogg/core/helpers.js.map +1 -1
- package/dist/resource/formats/ogg/core/vorbis.js +138 -144
- package/dist/resource/formats/ogg/core/vorbis.js.map +1 -1
- package/dist/resource/formats/pickle/CjsPickleFormat.js +83 -114
- package/dist/resource/formats/pickle/CjsPickleFormat.js.map +1 -1
- package/dist/resource/formats/png/CjsPngFormat.js +5 -3
- package/dist/resource/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/resource/formats/png/core/helpers.js +13 -152
- package/dist/resource/formats/png/core/helpers.js.map +1 -1
- package/dist/resource/formats/png/core/writer.js +3 -27
- package/dist/resource/formats/png/core/writer.js.map +1 -1
- package/dist/resource/formats/red/core/helpers.js +19 -29
- package/dist/resource/formats/red/core/helpers.js.map +1 -1
- package/dist/resource/formats/stl/CjsStlFormat.js +158 -147
- package/dist/resource/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/resource/formats/stl/core/helpers.js +44 -66
- package/dist/resource/formats/stl/core/helpers.js.map +1 -1
- package/dist/resource/formats/tga/CjsTgaFormat.js +5 -3
- package/dist/resource/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/resource/formats/tga/core/helpers.js +7 -153
- package/dist/resource/formats/tga/core/helpers.js.map +1 -1
- package/dist/resource/formats/vta/CjsVtaFormat.js +4 -3
- package/dist/resource/formats/vta/CjsVtaFormat.js.map +1 -1
- package/dist/resource/formats/vta/core/helpers.js +1 -17
- package/dist/resource/formats/vta/core/helpers.js.map +1 -1
- package/dist/resource/formats/wav/CjsWavFormat.js +4 -3
- package/dist/resource/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/resource/formats/wav/core/helpers.js +1 -15
- package/dist/resource/formats/wav/core/helpers.js.map +1 -1
- package/dist/resource/formats/webgl/CjsWebglFormat.js +4 -3
- package/dist/resource/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +69 -9
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +12 -3
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
- package/dist/resource/formats/webgl/core/helpers.js +39 -68
- package/dist/resource/formats/webgl/core/helpers.js.map +1 -1
- package/dist/resource/formats/webgpu/CjsWebgpuFormat.js +4 -3
- package/dist/resource/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/resource/formats/webgpu/core/helpers.js +4 -30
- package/dist/resource/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/resource/formats/webm/CjsWebmFormat.js +4 -9
- package/dist/resource/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/resource/formats/webm/core/helpers.js +1 -73
- package/dist/resource/formats/webm/core/helpers.js.map +1 -1
- package/dist/resource/formats/webp/CjsWebpFormat.js +4 -9
- package/dist/resource/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/resource/formats/webp/core/helpers.js +1 -62
- package/dist/resource/formats/webp/core/helpers.js.map +1 -1
- package/dist/resource/formats/wem/CjsWemFormat.js +4 -3
- package/dist/resource/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/resource/formats/wem/core/bitStream.js +83 -106
- package/dist/resource/formats/wem/core/bitStream.js.map +1 -1
- package/dist/resource/formats/wem/core/codebookLibrary.js +52 -52
- package/dist/resource/formats/wem/core/codebookLibrary.js.map +1 -1
- package/dist/resource/formats/wem/core/helpers.js +1 -15
- package/dist/resource/formats/wem/core/helpers.js.map +1 -1
- package/dist/resource/formats/wem/core/wemToOgg.js +67 -67
- package/dist/resource/formats/wem/core/wemToOgg.js.map +1 -1
- package/dist/resource/geometry/MeshDecalData.js +23 -25
- package/dist/resource/geometry/MeshDecalData.js.map +1 -1
- package/dist/resource/geometry/MeshDecalLodData.js +14 -23
- package/dist/resource/geometry/MeshDecalLodData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryRes.js +299 -284
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResAreaData.js +30 -31
- package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResJointData.js +16 -24
- package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResLodData.js +50 -41
- package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResMeshData.js +32 -32
- package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResSkeletonData.js +14 -23
- package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -1
- package/dist/resource/geometry/TriJointBinding.js +16 -24
- package/dist/resource/geometry/TriJointBinding.js.map +1 -1
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js +22 -27
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -1
- package/dist/resource/geometry/TriRtGeometryConstants.js +50 -41
- package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -1
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js +12 -22
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js +30 -31
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -1
- package/dist/resource/index.js +1 -1
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +16 -17
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +26 -28
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +24 -25
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +21 -22
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +25 -26
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +69 -72
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +17 -18
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +42 -43
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2RenderStateSetup.js +26 -5
- package/dist/resource/shader/reflection/Tr2RenderStateSetup.js.map +1 -1
- package/dist/resource/shader/reflection/carbonRecordFields.js +87 -90
- package/dist/resource/shader/reflection/carbonRecordFields.js.map +1 -1
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +32 -34
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +1 -6
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
- package/dist/resource/texture/Tr2TextureLodManager.js +35 -27
- package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -1
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js +16 -24
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePackChannel.js +16 -24
- package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipeline.js +24 -20
- package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineParams.js +14 -23
- package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +18 -25
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +11 -16
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +14 -23
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +12 -22
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js +38 -26
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -1
- package/dist/resource/worker/CjsResManMainThreadLoader.js +2 -5
- package/dist/resource/worker/CjsResManMainThreadLoader.js.map +1 -1
- package/dist/resource/worker/CjsResManWorkerLoader.js +6 -7
- package/dist/resource/worker/CjsResManWorkerLoader.js.map +1 -1
- package/dist/resource/worker/protocol.js +18 -1
- package/dist/resource/worker/protocol.js.map +1 -1
- package/dist/sof/EveSOF.js +2 -222
- package/dist/sof/EveSOF.js.map +1 -1
- package/dist/sof/SofDocumentBuilder.js +205 -0
- package/dist/sof/SofDocumentBuilder.js.map +1 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeNotFound.js +16 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeNotFound.js.map +1 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeUnknown.js +16 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeUnknown.js.map +1 -0
- package/dist/sof/faction/EveSOFDataFactionColorSet.js +3 -27
- package/dist/sof/faction/EveSOFDataFactionColorSet.js.map +1 -1
- package/dist/sof/faction/index.js +3 -1
- package/dist/sof/faction/index.js.map +1 -1
- package/dist/sof/generic/ErrSOFAreaShaderNotFound.js +18 -0
- package/dist/sof/generic/ErrSOFAreaShaderNotFound.js.map +1 -0
- package/dist/sof/generic/ErrSOFDecalShaderNotFound.js +18 -0
- package/dist/sof/generic/ErrSOFDecalShaderNotFound.js.map +1 -0
- package/dist/sof/generic/ErrSOFMaterialPrefixNotFound.js +21 -0
- package/dist/sof/generic/ErrSOFMaterialPrefixNotFound.js.map +1 -0
- package/dist/sof/generic/ErrSOFPatternMaterialPrefixNotFound.js +21 -0
- package/dist/sof/generic/ErrSOFPatternMaterialPrefixNotFound.js.map +1 -0
- package/dist/sof/generic/EveSOFDataGeneric.js +5 -69
- package/dist/sof/generic/EveSOFDataGeneric.js.map +1 -1
- package/dist/sof/generic/index.js +5 -1
- package/dist/sof/generic/index.js.map +1 -1
- package/dist/sof/index.js +23 -7
- package/dist/sof/index.js.map +1 -1
- package/dist/sof/pattern/ErrSOFProjectionNotFound.js +20 -0
- package/dist/sof/pattern/ErrSOFProjectionNotFound.js.map +1 -0
- package/dist/sof/pattern/EveSOFDataPattern.js +2 -17
- package/dist/sof/pattern/EveSOFDataPattern.js.map +1 -1
- package/dist/sof/pattern/index.js +2 -1
- package/dist/sof/pattern/index.js.map +1 -1
- package/dist/sof/shared/ErrSOFAreaTypeNotFound.js +16 -0
- package/dist/sof/shared/ErrSOFAreaTypeNotFound.js.map +1 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeNotFound.js +16 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeNotFound.js.map +1 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeUnknown.js +16 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeUnknown.js.map +1 -0
- package/dist/sof/shared/EveSOFDataArea.js +2 -13
- package/dist/sof/shared/EveSOFDataArea.js.map +1 -1
- package/dist/sof/shared/EveSOFDataLogoSet.js +3 -27
- package/dist/sof/shared/EveSOFDataLogoSet.js.map +1 -1
- package/dist/sof/shared/EveSOFDataParameter.js +2 -146
- package/dist/sof/shared/EveSOFDataParameter.js.map +1 -1
- package/dist/sof/shared/EveSOFDataParameterBool.js +40 -0
- package/dist/sof/shared/EveSOFDataParameterBool.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterColor.js +36 -0
- package/dist/sof/shared/EveSOFDataParameterColor.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterFloat.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterFloat.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterInt.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterInt.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterVector2.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterVector2.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterVector3.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterVector3.js.map +1 -0
- package/dist/sof/shared/{EveSOFDataSpotlightAttachment.js → EveSOFDataSpotLightAttachment.js} +1 -1
- package/dist/sof/shared/{EveSOFDataSpotlightAttachment.js.map → EveSOFDataSpotLightAttachment.js.map} +1 -1
- package/dist/sof/shared/index.js +13 -4
- package/dist/sof/shared/index.js.map +1 -1
- package/dist/sof/sofDocumentValues.js +33 -0
- package/dist/sof/sofDocumentValues.js.map +1 -0
- package/dist/trinity/controllers/ITr2Controller/ITr2ActionController.js +168 -0
- package/dist/trinity/controllers/ITr2Controller/ITr2ActionController.js.map +1 -0
- package/dist/trinity/controllers/{ITr2Controller.js → ITr2Controller/ITr2Controller.js} +2 -134
- package/dist/trinity/controllers/ITr2Controller/ITr2Controller.js.map +1 -0
- package/dist/trinity/controllers/Tr2Controller.js +2 -1
- package/dist/trinity/controllers/Tr2Controller.js.map +1 -1
- package/dist/trinity/controllers/Tr2ControllerReference.js +2 -1
- package/dist/trinity/controllers/Tr2ControllerReference.js.map +1 -1
- package/dist/trinity/controllers/action/ITr2ControllerAction.js +2 -1
- package/dist/trinity/controllers/action/ITr2ControllerAction.js.map +1 -1
- package/dist/trinity/controllers/action/Tr2ActionSpawnParticles.js +10 -9
- package/dist/trinity/controllers/action/Tr2ActionSpawnParticles.js.map +1 -1
- package/dist/trinity/controllers/expression/CjsControllerExpressionCompileError.js +26 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionCompileError.js.map +1 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionEvaluateError.js +24 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionEvaluateError.js.map +1 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionParser.js +387 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionParser.js.map +1 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionProgram.js +4 -1011
- package/dist/trinity/controllers/expression/CjsControllerExpressionProgram.js.map +1 -1
- package/dist/trinity/controllers/expression/expressionRuntime.js +605 -0
- package/dist/trinity/controllers/expression/expressionRuntime.js.map +1 -0
- package/dist/trinity/controllers/index.js +5 -2
- package/dist/trinity/controllers/index.js.map +1 -1
- package/dist/trinity/controllers/state/ITr2StateMachineStateFinalizer.js +2 -1
- package/dist/trinity/controllers/state/ITr2StateMachineStateFinalizer.js.map +1 -1
- package/dist/trinity/controllers/timeline/Tr2TimelineController.js +2 -1
- package/dist/trinity/controllers/timeline/Tr2TimelineController.js.map +1 -1
- package/dist/trinity/core/ITr2Updateable.js +2 -1
- package/dist/trinity/core/ITr2Updateable.js.map +1 -1
- package/dist/trinity/core/Tr2Blitter.js +6 -3
- package/dist/trinity/core/Tr2Blitter.js.map +1 -1
- package/dist/trinity/core/Tr2Denoiser.js +256 -0
- package/dist/trinity/core/Tr2Denoiser.js.map +1 -0
- package/dist/trinity/core/Tr2GpuResourcePool/GpuResourceHandle.js +115 -0
- package/dist/trinity/core/Tr2GpuResourcePool/GpuResourceHandle.js.map +1 -0
- package/dist/trinity/core/Tr2GpuResourcePool/TextureSize2D.js +79 -0
- package/dist/trinity/core/Tr2GpuResourcePool/TextureSize2D.js.map +1 -0
- package/dist/trinity/core/{Tr2GpuResourcePool.js → Tr2GpuResourcePool/Tr2GpuResourcePool.js} +63 -151
- package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js.map +1 -0
- package/dist/trinity/core/{Tr2QuadRenderer.js → Tr2QuadRenderer/Tr2QuadRenderer.js} +8 -30
- package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRenderer.js.map +1 -0
- package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRendererEffectRecord.js +38 -0
- package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRendererEffectRecord.js.map +1 -0
- package/dist/trinity/core/Tr2RenderUtils.js +20 -3
- package/dist/trinity/core/Tr2RenderUtils.js.map +1 -1
- package/dist/trinity/core/Tr2Renderer.js +146 -1
- package/dist/trinity/core/Tr2Renderer.js.map +1 -1
- package/dist/trinity/core/Tr2ShadowMap.js +135 -14
- package/dist/trinity/core/Tr2ShadowMap.js.map +1 -1
- package/dist/trinity/core/{Tr2TextureArray.js → Tr2TextureArray/Tr2TextureArray.js} +3 -58
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js.map +1 -0
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArrayElement.js +61 -0
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArrayElement.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/DefaultKeyGenerator.js +26 -0
- package/dist/trinity/core/batch/TriRenderBatch/DefaultKeyGenerator.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/EffectKeyGenerator.js +29 -0
- package/dist/trinity/core/batch/TriRenderBatch/EffectKeyGenerator.js.map +1 -0
- package/dist/trinity/core/batch/{ITriRenderBatchAccumulator.js → TriRenderBatch/ITriRenderBatchAccumulator.js} +30 -30
- package/dist/trinity/core/batch/TriRenderBatch/ITriRenderBatchAccumulator.js.map +1 -0
- package/dist/trinity/core/batch/{Tr2RenderBatch.js → TriRenderBatch/Tr2RenderBatch.js} +81 -154
- package/dist/trinity/core/batch/TriRenderBatch/Tr2RenderBatch.js.map +1 -0
- package/dist/trinity/core/batch/{TriRenderBatchAccumulator.js → TriRenderBatch/TriRenderBatchAccumulator.js} +7 -38
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAccumulator.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlock.js +61 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlock.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlocksWithSharedMaterial.js +40 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlocksWithSharedMaterial.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatchMap.js +6 -1
- package/dist/trinity/core/batch/TriRenderBatchMap.js.map +1 -1
- package/dist/trinity/core/context/Tr2RenderContext.js +75 -57
- package/dist/trinity/core/context/Tr2RenderContext.js.map +1 -1
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityEvent.js +67 -0
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityEvent.js.map +1 -0
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityResults.js +50 -0
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityResults.js.map +1 -0
- package/dist/trinity/core/device/Tr2DepthStencil.js +186 -13
- package/dist/trinity/core/device/Tr2DepthStencil.js.map +1 -1
- package/dist/trinity/core/device/{Tr2RingBuffer.js → Tr2RingBuffer/Tr2RingBuffer.js} +27 -79
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js.map +1 -0
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBufferOffsets.js +114 -0
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBufferOffsets.js.map +1 -0
- package/dist/trinity/core/device/{Tr2SuballocatedBuffer.js → Tr2SuballocatedBuffer/Tr2SuballocatedBuffer.js} +5 -59
- package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBuffer.js.map +1 -0
- package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBufferAllocation.js +80 -0
- package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBufferAllocation.js.map +1 -0
- package/dist/trinity/core/index.js +42 -15
- package/dist/trinity/core/index.js.map +1 -1
- package/dist/trinity/core/lighting/Tr2LightManager.js +6 -1
- package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
- package/dist/trinity/core/mesh/{ITr2ImpostorSource.js → ITr2ImpostorSource/ITr2ImpostorSource.js} +6 -28
- package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSource.js.map +1 -0
- package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSourceImpostorHash.js +32 -0
- package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSourceImpostorHash.js.map +1 -0
- package/dist/trinity/core/mesh/{ITr2InstanceData.js → ITr2InstanceData/ITr2InstanceData.js} +5 -29
- package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceData.js.map +1 -0
- package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceDataInstanceData.js +33 -0
- package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceDataInstanceData.js.map +1 -0
- package/dist/trinity/core/mesh/Tr2DirectInstanceData.js +2 -1
- package/dist/trinity/core/mesh/Tr2DirectInstanceData.js.map +1 -1
- package/dist/trinity/core/mesh/Tr2MeshBase.js +7 -1
- package/dist/trinity/core/mesh/Tr2MeshBase.js.map +1 -1
- package/dist/trinity/core/mesh/Tr2RuntimeInstanceData.js +2 -1
- package/dist/trinity/core/mesh/Tr2RuntimeInstanceData.js.map +1 -1
- package/dist/trinity/core/mesh/TriGeometryResAllocations.js +6 -2
- package/dist/trinity/core/mesh/TriGeometryResAllocations.js.map +1 -1
- package/dist/trinity/core/rawData/CjsConstantLayout.js +196 -0
- package/dist/trinity/core/rawData/CjsConstantLayout.js.map +1 -0
- package/dist/trinity/core/rawData/CjsPerFrameLayouts.js +8 -3
- package/dist/trinity/core/rawData/CjsPerFrameLayouts.js.map +1 -1
- package/dist/trinity/core/rawData/CjsPerObjectLayouts.js +40 -732
- package/dist/trinity/core/rawData/CjsPerObjectLayouts.js.map +1 -1
- package/dist/trinity/core/rawData/layouts/CjsEveBasicLayout.js +34 -0
- package/dist/trinity/core/rawData/layouts/CjsEveBasicLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveBoosterSetLayout.js +69 -0
- package/dist/trinity/core/rawData/layouts/CjsEveBoosterSetLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBoosterSetLayout.js +59 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBoosterSetLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBulletStormLayout.js +37 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBulletStormLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildSpherePinLayout.js +44 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildSpherePinLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveLensflareLayout.js +31 -0
- package/dist/trinity/core/rawData/layouts/CjsEveLensflareLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveMissileWarheadLayout.js +29 -0
- package/dist/trinity/core/rawData/layouts/CjsEveMissileWarheadLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEvePerObjectLayout.js +39 -0
- package/dist/trinity/core/rawData/layouts/CjsEvePerObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSceneStaticParticlesLayout.js +30 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSceneStaticParticlesLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectDecalLayout.js +78 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectDecalLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectLayout.js +169 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpacePerObjectLayout.js +107 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpacePerObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpherePinLayout.js +44 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpherePinLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveStretch2Layout.js +34 -0
- package/dist/trinity/core/rawData/layouts/CjsEveStretch2Layout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveTurretSetLayout.js +82 -0
- package/dist/trinity/core/rawData/layouts/CjsEveTurretSetLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsTr2PerObjectLayout.js +42 -0
- package/dist/trinity/core/rawData/layouts/CjsTr2PerObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveBasicPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveBasicPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveBoosterSetPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveBoosterSetPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBoosterSetPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBoosterSetPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBulletStormPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBulletStormPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildSpherePinPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildSpherePinPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveDecalPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveDecalPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveLensflarePerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveLensflarePerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveMissileWarheadPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveMissileWarheadPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveSceneStaticParticlesPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveSceneStaticParticlesPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveSpherePinPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveSpherePinPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveTurretSetPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveTurretSetPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/StretchPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/StretchPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/{Tr2PerObjectData.js → perObjectData/Tr2PerObjectData.js} +110 -62
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataPSBuffer.js +104 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataPSBuffer.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataStandard.js +87 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataStandard.js.map +1 -0
- package/dist/trinity/core/variable/TriVariable.js +83 -83
- package/dist/trinity/core/variable/TriVariable.js.map +1 -1
- package/dist/trinity/core/vertex/{Tr2VertexDefinition.js → Tr2VertexDefinition/Tr2VertexDefinition.js} +4 -20
- package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinition.js.map +1 -0
- package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinitionItem.js +29 -0
- package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinitionItem.js.map +1 -0
- package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js +116 -36
- package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js.map +1 -1
- package/dist/trinity/curves/curve/Tr2CurveRandomAxisRotation.js +50 -92
- package/dist/trinity/curves/curve/Tr2CurveRandomAxisRotation.js.map +1 -1
- package/dist/trinity/eve/EveModularObjectModifier.js +9 -5
- package/dist/trinity/eve/EveModularObjectModifier.js.map +1 -1
- package/dist/trinity/eve/IEveInheritPropertiesOwner.js +2 -1
- package/dist/trinity/eve/IEveInheritPropertiesOwner.js.map +1 -1
- package/dist/trinity/eve/IEveSpaceObject2.js +2 -1
- package/dist/trinity/eve/IEveSpaceObject2.js.map +1 -1
- package/dist/trinity/eve/IEveTransform.js +2 -1
- package/dist/trinity/eve/IEveTransform.js.map +1 -1
- package/dist/trinity/eve/attachment/banner/EveBannerSet.js +2 -2
- package/dist/trinity/eve/attachment/banner/EveBannerSet.js.map +1 -1
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2.js +109 -133
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2.js.map +1 -1
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Item.js +40 -0
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Item.js.map +1 -0
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Renderable.js +1 -1
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Renderable.js.map +1 -1
- package/dist/trinity/eve/attachment/decal/DecalMeshCache.js +2 -14
- package/dist/trinity/eve/attachment/decal/DecalMeshCache.js.map +1 -1
- package/dist/trinity/eve/attachment/decal/DecalMeshCacheMeshBuffers.js +18 -0
- package/dist/trinity/eve/attachment/decal/DecalMeshCacheMeshBuffers.js.map +1 -0
- package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js +1 -1
- package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js.map +1 -1
- package/dist/trinity/eve/attachment/haze/EveHazeSet.js +1 -1
- package/dist/trinity/eve/attachment/haze/EveHazeSet.js.map +1 -1
- package/dist/trinity/eve/attachment/plane/EvePlaneSet.js +1 -1
- package/dist/trinity/eve/attachment/plane/EvePlaneSet.js.map +1 -1
- package/dist/trinity/eve/attachment/spotlight/EveSpotlightSet.js +2 -2
- package/dist/trinity/eve/attachment/spotlight/EveSpotlightSet.js.map +1 -1
- package/dist/trinity/eve/attachment/sprite/EveSpriteLineSet.js +1 -1
- package/dist/trinity/eve/attachment/sprite/EveSpriteLineSet.js.map +1 -1
- package/dist/trinity/eve/attachment/sprite/EveSpriteSet.js +4 -2
- package/dist/trinity/eve/attachment/sprite/EveSpriteSet.js.map +1 -1
- package/dist/trinity/eve/attachment/turrets/EveTurretSet.js +143 -139
- package/dist/trinity/eve/attachment/turrets/EveTurretSet.js.map +1 -1
- package/dist/trinity/eve/camera/EveCamera.js +1 -1
- package/dist/trinity/eve/camera/EveCamera.js.map +1 -1
- package/dist/trinity/eve/child/EveChildBoosterSet.js +12 -1
- package/dist/trinity/eve/child/EveChildBoosterSet.js.map +1 -1
- package/dist/trinity/eve/child/EveChildCloud2.js +178 -151
- package/dist/trinity/eve/child/EveChildCloud2.js.map +1 -1
- package/dist/trinity/eve/child/EveChildContainer.js +141 -141
- package/dist/trinity/eve/child/EveChildContainer.js.map +1 -1
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js +87 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js.map +1 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshArea.js +46 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshArea.js.map +1 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshInstance.js +35 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshInstance.js.map +1 -0
- package/dist/trinity/eve/child/{EveChildInstancedMeshes.js → EveChildInstancedMeshes/EveChildInstancedMeshes.js} +42 -163
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js.map +1 -0
- package/dist/trinity/eve/child/EveChildMesh.js +218 -218
- package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
- package/dist/trinity/eve/child/EveChildPartData/EveChildPartData.js +53 -0
- package/dist/trinity/eve/child/EveChildPartData/EveChildPartData.js.map +1 -0
- package/dist/trinity/eve/child/{EveChildPartData.js → EveChildPartData/EveChildPartDataPartData.js} +9 -45
- package/dist/trinity/eve/child/EveChildPartData/EveChildPartDataPartData.js.map +1 -0
- package/dist/trinity/eve/child/EveChildParticleSystem.js +30 -29
- package/dist/trinity/eve/child/EveChildParticleSystem.js.map +1 -1
- package/dist/trinity/eve/child/EveChildTransform.js +5 -0
- package/dist/trinity/eve/child/EveChildTransform.js.map +1 -1
- package/dist/trinity/eve/child/EveChildTurret.js +7 -0
- package/dist/trinity/eve/child/EveChildTurret.js.map +1 -1
- package/dist/trinity/eve/index.js +10 -4
- package/dist/trinity/eve/index.js.map +1 -1
- package/dist/trinity/eve/lights/Tr2Light.js +5 -0
- package/dist/trinity/eve/lights/Tr2Light.js.map +1 -1
- package/dist/trinity/eve/overlays/overlayBatches.js +6 -1
- package/dist/trinity/eve/overlays/overlayBatches.js.map +1 -1
- package/dist/trinity/eve/particles/static/EveSceneStaticParticles.js +4 -4
- package/dist/trinity/eve/particles/static/EveSceneStaticParticles.js.map +1 -1
- package/dist/trinity/eve/renderable/stretch/EveStretch2.js +76 -71
- package/dist/trinity/eve/renderable/stretch/EveStretch2.js.map +1 -1
- package/dist/trinity/eve/renderable/stretch/EveStretch3.js +1 -1
- package/dist/trinity/eve/renderable/stretch/EveStretch3.js.map +1 -1
- package/dist/trinity/eve/spaceObject/EveShip2.js +3 -3
- package/dist/trinity/eve/spaceObject/EveShip2.js.map +1 -1
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +408 -407
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
- package/dist/trinity/eve/ui/EveTacticalOverlay.js +1 -1
- package/dist/trinity/eve/ui/EveTacticalOverlay.js.map +1 -1
- package/dist/trinity/eve/ui/lines/EveCurveLineSet.js +9 -9
- package/dist/trinity/eve/ui/lines/EveCurveLineSet.js.map +1 -1
- package/dist/trinity/eve/ui/lines/EveLineSet.js +27 -25
- package/dist/trinity/eve/ui/lines/EveLineSet.js.map +1 -1
- package/dist/trinity/eve/ui/tacticalOverlay/EveTacticalTrails.js +3 -2
- package/dist/trinity/eve/ui/tacticalOverlay/EveTacticalTrails.js.map +1 -1
- package/dist/trinity/generated/index.js +0 -1
- package/dist/trinity/generated/index.js.map +1 -1
- package/dist/trinity/generated/trinityCore/index.js +0 -1
- package/dist/trinity/generated/trinityCore/index.js.map +1 -1
- package/dist/trinity/index.js +59 -23
- package/dist/trinity/index.js.map +1 -1
- package/dist/trinity/particle/{ITr2GenericEmitter.js → ITr2GenericEmitter/ITr2GenericEmitter.js} +4 -32
- package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitter.js.map +1 -0
- package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitterUpdateArguments.js +36 -0
- package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitterUpdateArguments.js.map +1 -0
- package/dist/trinity/particle/Tr2ParticleSystem.js +4 -2
- package/dist/trinity/particle/Tr2ParticleSystem.js.map +1 -1
- package/dist/trinity/particle/element/Tr2ParticleElementData.js +15 -4
- package/dist/trinity/particle/element/Tr2ParticleElementData.js.map +1 -1
- package/dist/trinity/particle/emitter/Tr2DynamicEmitter.js +21 -20
- package/dist/trinity/particle/emitter/Tr2DynamicEmitter.js.map +1 -1
- package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js +23 -22
- package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js.map +1 -1
- package/dist/trinity/particle/emitter/Tr2StaticEmitter.js +14 -13
- package/dist/trinity/particle/emitter/Tr2StaticEmitter.js.map +1 -1
- package/dist/trinity/particle/index.js +2 -1
- package/dist/trinity/particle/index.js.map +1 -1
- package/dist/trinity/renderJob/step/TriStepPushRenderTarget.js +7 -1
- package/dist/trinity/renderJob/step/TriStepPushRenderTarget.js.map +1 -1
- package/dist/trinity/shader/Tr2Effect.js +131 -58
- package/dist/trinity/shader/Tr2Effect.js.map +1 -1
- package/dist/trinity/shader/Tr2EffectStateManager.js +17 -5
- package/dist/trinity/shader/Tr2EffectStateManager.js.map +1 -1
- package/dist/trinity/shader/Tr2Material.js +21 -4
- package/dist/trinity/shader/Tr2Material.js.map +1 -1
- package/dist/trinity/shader/material/Tr2EffectPassParameters.js +4 -1
- package/dist/trinity/shader/material/Tr2EffectPassParameters.js.map +1 -1
- package/dist/trinity/shader/parameter/Tr2GeometryBufferParameter.js +2 -2
- package/dist/trinity/shader/parameter/Tr2GeometryBufferParameter.js.map +1 -1
- package/dist/trinityal/Tr2BufferAL/Tr2BufferDescriptionAL.js +79 -0
- package/dist/trinityal/Tr2BufferAL/Tr2BufferDescriptionAL.js.map +1 -0
- package/dist/trinityal/{Tr2DeviceResourceAL.js → Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js} +77 -79
- package/dist/trinityal/Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js.map +1 -0
- package/dist/trinityal/Tr2DeviceResourceAL/Tr2DeviceResourceAL.js +24 -0
- package/dist/trinityal/Tr2DeviceResourceAL/Tr2DeviceResourceAL.js.map +1 -0
- package/dist/trinityal/Tr2DrawUPHelper.js +2 -1
- package/dist/trinityal/Tr2DrawUPHelper.js.map +1 -1
- package/dist/trinityal/Tr2HalHelperStructures/Tr2MsaaDesc.js +45 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2MsaaDesc.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SamplerDescription.js +154 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SamplerDescription.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SubresourceData.js +48 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SubresourceData.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureCoordBox.js +75 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureCoordBox.js.map +1 -0
- package/dist/trinityal/{Tr2HalHelperStructures.js → Tr2HalHelperStructures/Tr2TextureSubresource.js} +11 -115
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2Viewport.js +51 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2Viewport.js.map +1 -0
- package/dist/trinityal/{Tr2RenderPassAL.js → Tr2RenderPassAL/Tr2ColorAttachment.js} +5 -28
- package/dist/trinityal/Tr2RenderPassAL/Tr2ColorAttachment.js.map +1 -0
- package/dist/trinityal/Tr2RenderPassAL/Tr2DepthAttachment.js +38 -0
- package/dist/trinityal/Tr2RenderPassAL/Tr2DepthAttachment.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2RegisterMapAL.js +80 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2RegisterMapAL.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetAL.js +76 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetAL.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetALStub.js +96 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetALStub.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetDescriptionAL.js +196 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetDescriptionAL.js.map +1 -0
- package/dist/trinityal/index.js +22 -9
- package/dist/trinityal/index.js.map +1 -1
- package/dist/trinityal/stub/Tr2BufferALStub.js +86 -141
- package/dist/trinityal/stub/Tr2BufferALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2CapsALStub.js +17 -0
- package/dist/trinityal/stub/Tr2CapsALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2ConstantBufferALStub.js +57 -41
- package/dist/trinityal/stub/Tr2ConstantBufferALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2FenceALStub.js +18 -2
- package/dist/trinityal/stub/Tr2FenceALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2GpuTimerALStub.js +97 -0
- package/dist/trinityal/stub/Tr2GpuTimerALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2OcclusionQueryALStub.js +124 -0
- package/dist/trinityal/stub/Tr2OcclusionQueryALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2PipelineStatsQueryALStub/Tr2PipelineStatsQueryALStub.js +146 -0
- package/dist/trinityal/stub/Tr2PipelineStatsQueryALStub/Tr2PipelineStatsQueryALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2BindlessResourcesAL.js +28 -0
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2BindlessResourcesAL.js.map +1 -0
- package/dist/trinityal/stub/{Tr2RenderContextALStub.js → Tr2RenderContextALStub/Tr2RenderContextALStub.js} +70 -75
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2SamplerStateALStub.js +47 -31
- package/dist/trinityal/stub/Tr2SamplerStateALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2ShaderALStub.js +61 -45
- package/dist/trinityal/stub/Tr2ShaderALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2ShaderProgramALStub.js +51 -33
- package/dist/trinityal/stub/Tr2ShaderProgramALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2SwapChainALStub.js +61 -45
- package/dist/trinityal/stub/Tr2SwapChainALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2TextureALStub.js +188 -171
- package/dist/trinityal/stub/Tr2TextureALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2VertexLayoutALStub.js +43 -27
- package/dist/trinityal/stub/Tr2VertexLayoutALStub.js.map +1 -1
- package/dist/trinityal/stub/{Tr2VideoAdapterInfoALStub.js → Tr2VideoAdapterInfoStub.js} +16 -1
- package/dist/trinityal/stub/Tr2VideoAdapterInfoStub.js.map +1 -0
- package/dist/trinityal/stub/index.js +8 -4
- package/dist/trinityal/stub/index.js.map +1 -1
- package/dist/trinityal/vertexLayoutMatch.js +2 -2
- package/dist/trinityal/vertexLayoutMatch.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuBufferAL.js +105 -90
- package/dist/trinityal/webgpu/CjsWebgpuBufferAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuCapsAL.js +17 -0
- package/dist/trinityal/webgpu/CjsWebgpuCapsAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuConstantBufferAL.js +15 -0
- package/dist/trinityal/webgpu/CjsWebgpuConstantBufferAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuDevice.js +2 -2
- package/dist/trinityal/webgpu/CjsWebgpuDevice.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +900 -938
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js +56 -60
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuSamplerStateAL.js +16 -1
- package/dist/trinityal/webgpu/CjsWebgpuSamplerStateAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js +100 -379
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js +330 -0
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js.map +1 -0
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +15 -0
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
- package/dist/trinityal/webgpu/core/{constantArena.js → CjsWebgpuConstantArena.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuConstantArena.js.map +1 -0
- package/dist/trinityal/webgpu/core/{batchGroups.js → CjsWebgpuEncodeState.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuEncodeState.js.map +1 -0
- package/dist/trinityal/webgpu/core/{perFrameSource.js → CjsWebgpuPerFrameSource.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuPerFrameSource.js.map +1 -0
- package/dist/trinityal/webgpu/core/{pipelineCache.js → CjsWebgpuPipelineCache.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuPipelineCache.js.map +1 -0
- package/dist/trinityal/webgpu/core/{psoDescription.js → CjsWebgpuPsoDescription.js} +2 -2
- package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js.map +1 -0
- package/dist/trinityal/webgpu/core/{renderTarget.js → CjsWebgpuRenderTarget.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuRenderTarget.js.map +1 -0
- package/dist/trinityal/webgpu/core/{samplerSource.js → CjsWebgpuSamplerSource.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuSamplerSource.js.map +1 -0
- package/dist/trinityal/webgpu/core/{textureSource.js → CjsWebgpuTextureSource.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuTextureSource.js.map +1 -0
- package/dist/trinityal/webgpu/core/{trinityBatchDispatcher.js → CjsWebgpuTrinityBatchDispatcher.js} +4 -4
- package/dist/trinityal/webgpu/core/CjsWebgpuTrinityBatchDispatcher.js.map +1 -0
- package/dist/trinityal/webgpu/core/{trinityBatchResolver.js → CjsWebgpuTrinityBatchResolver.js} +81 -81
- package/dist/trinityal/webgpu/core/CjsWebgpuTrinityBatchResolver.js.map +1 -0
- package/dist/trinityal/webgpu/core/{trinityPassEncoder.js → CjsWebgpuTrinityPassEncoder.js} +2 -2
- package/dist/trinityal/webgpu/core/CjsWebgpuTrinityPassEncoder.js.map +1 -0
- package/dist/trinityal/webgpu/core/{workQueue.js → CjsWebgpuWorkQueue.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js.map +1 -0
- package/dist/trinityal/webgpu/internal.js +12 -11
- package/dist/trinityal/webgpu/internal.js.map +1 -1
- package/docs/audio/reference/classes/trinity.md +44 -34
- package/docs/character/architecture.md +276 -0
- package/docs/character/reference/character-appearance-plans.md +30 -66
- package/docs/character/reference/prepared-libraries.md +14 -30
- package/docs/global/reference/api.md +2 -1
- package/docs/global/reference/classes/README.md +53 -71
- package/docs/global/reference/classes/dropped.md +16 -0
- package/docs/resource/README.md +19 -15
- package/docs/resource/architecture.md +9 -2
- package/docs/resource/concepts/format-capabilities.md +124 -80
- package/docs/resource/concepts/shared-format-helpers.md +94 -0
- package/docs/resource/formats/README.md +230 -224
- package/docs/resource/formats/bitknit2.md +221 -0
- package/docs/resource/formats/carbon-effect-container.md +184 -269
- package/docs/resource/formats/gr2.md +6 -1
- package/docs/resource/formats/schemabound.md +28 -48
- package/docs/resource/formats/static.md +70 -97
- package/docs/resource/formats/webgl/carbon-constant-layouts.md +8 -8
- package/docs/resource/formats/webgl/decl-io.md +165 -256
- package/docs/resource/formats/webgl/memory-structured.md +64 -142
- package/docs/resource/formats/webgl/texture-sample.md +109 -138
- package/docs/resource/formats/webgpu/formats/carbon-webgpu.md +38 -69
- package/docs/resource/formats/webgpu/guides/effect-packaging.md +54 -116
- package/docs/resource/formats/webgpu/reference/api.md +64 -67
- package/docs/resource/formats/webgpu/reference/wgsl-compatibility.md +158 -345
- package/docs/resource/reference/classes/core.md +256 -236
- package/docs/resource/reference/classes/formats.md +1668 -1672
- package/docs/resource/reference/workers.md +4 -2
- package/docs/sof/reference/classes/core.md +1 -1
- package/docs/sof/reference/classes/faction.md +2 -2
- package/docs/sof/reference/classes/generic.md +4 -4
- package/docs/sof/reference/classes/pattern.md +1 -1
- package/docs/sof/reference/classes/shared.md +10 -10
- package/docs/trinity/architecture.md +55 -44
- package/docs/trinity/concepts/generated-class-lifecycle.md +10 -15
- package/docs/trinity/reference/classes/curves-and-utilities.md +496 -506
- package/docs/trinity/reference/classes/dropped.md +0 -189
- package/docs/trinity/reference/classes/eve-runtime.md +8 -8
- package/docs/trinity/reference/classes/generated.md +0 -10
- package/docs/trinity/reference/classes/particle.md +2 -2
- package/docs/trinity/reference/classes/trinity-core.md +1554 -1256
- package/docs/trinity/reference/implementation-status.md +50 -75
- package/docs/trinity/reference/main-semantic-extraction.md +13 -17
- package/docs/trinityal/reference/classes/README.md +77 -27
- package/docs/trinityal/reference/classes/dropped.md +92 -0
- package/docs/trinityal/webgpu/README.md +3 -1
- package/docs/trinityal/webgpu/architecture.md +121 -228
- package/docs/trinityal/webgpu/reference/api.md +5 -5
- package/docs/trinityal/webgpu/reference/classes/README.md +13 -13
- package/format-notices/gr2/NOTICE +18 -12
- package/format-notices/gr2/THIRD-PARTY-NOTICES.md +5 -5
- package/package.json +4 -1
- package/dist/audio/trinity/audio/AudActionLog.js +0 -173
- package/dist/audio/trinity/audio/AudActionLog.js.map +0 -1
- package/dist/audio/trinity/audio/AudObstructionOcclusion.js.map +0 -1
- package/dist/global/contracts/CjsScriptCallback.js +0 -94
- package/dist/global/contracts/CjsScriptCallback.js.map +0 -1
- package/dist/trinity/controllers/ITr2Controller.js.map +0 -1
- package/dist/trinity/core/Tr2GpuResourcePool.js.map +0 -1
- package/dist/trinity/core/Tr2QuadRenderer.js.map +0 -1
- package/dist/trinity/core/Tr2TextureArray.js.map +0 -1
- package/dist/trinity/core/batch/ITriRenderBatchAccumulator.js.map +0 -1
- package/dist/trinity/core/batch/Tr2RenderBatch.js.map +0 -1
- package/dist/trinity/core/batch/TriRenderBatchAccumulator.js.map +0 -1
- package/dist/trinity/core/context/CjsShadowMapExecutor.js +0 -43
- package/dist/trinity/core/context/CjsShadowMapExecutor.js.map +0 -1
- package/dist/trinity/core/context/CjsVolumetricsExecutor.js +0 -64
- package/dist/trinity/core/context/CjsVolumetricsExecutor.js.map +0 -1
- package/dist/trinity/core/context/Tr2VisibilityResults.js +0 -109
- package/dist/trinity/core/context/Tr2VisibilityResults.js.map +0 -1
- package/dist/trinity/core/device/Tr2RingBuffer.js.map +0 -1
- package/dist/trinity/core/device/Tr2SuballocatedBuffer.js.map +0 -1
- package/dist/trinity/core/mesh/ITr2ImpostorSource.js.map +0 -1
- package/dist/trinity/core/mesh/ITr2InstanceData.js.map +0 -1
- package/dist/trinity/core/rawData/Tr2PerObjectData.js.map +0 -1
- package/dist/trinity/core/rawData/constantLayout.js +0 -175
- package/dist/trinity/core/rawData/constantLayout.js.map +0 -1
- package/dist/trinity/core/vertex/Tr2VertexDefinition.js.map +0 -1
- package/dist/trinity/eve/child/EveChildInstancedMeshes.js.map +0 -1
- package/dist/trinity/eve/child/EveChildPartData.js.map +0 -1
- package/dist/trinity/generated/trinityCore/Tr2Denoiser.js +0 -47
- package/dist/trinity/generated/trinityCore/Tr2Denoiser.js.map +0 -1
- package/dist/trinity/particle/ITr2GenericEmitter.js.map +0 -1
- package/dist/trinityal/Tr2DeviceResourceAL.js.map +0 -1
- package/dist/trinityal/Tr2HalHelperStructures.js.map +0 -1
- package/dist/trinityal/Tr2RenderPassAL.js.map +0 -1
- package/dist/trinityal/Tr2ResourceSetAL.js +0 -419
- package/dist/trinityal/Tr2ResourceSetAL.js.map +0 -1
- package/dist/trinityal/Tr2SamplerDescription.js +0 -72
- package/dist/trinityal/Tr2SamplerDescription.js.map +0 -1
- package/dist/trinityal/stub/Tr2QueryALStub.js +0 -326
- package/dist/trinityal/stub/Tr2QueryALStub.js.map +0 -1
- package/dist/trinityal/stub/Tr2RenderContextALStub.js.map +0 -1
- package/dist/trinityal/stub/Tr2VideoAdapterInfoALStub.js.map +0 -1
- package/dist/trinityal/webgpu/core/batchGroups.js.map +0 -1
- package/dist/trinityal/webgpu/core/constantArena.js.map +0 -1
- package/dist/trinityal/webgpu/core/perFrameSource.js.map +0 -1
- package/dist/trinityal/webgpu/core/pipelineCache.js.map +0 -1
- package/dist/trinityal/webgpu/core/psoDescription.js.map +0 -1
- package/dist/trinityal/webgpu/core/renderTarget.js.map +0 -1
- package/dist/trinityal/webgpu/core/samplerSource.js.map +0 -1
- package/dist/trinityal/webgpu/core/textureSource.js.map +0 -1
- package/dist/trinityal/webgpu/core/trinityBatchDispatcher.js.map +0 -1
- package/dist/trinityal/webgpu/core/trinityBatchResolver.js.map +0 -1
- package/dist/trinityal/webgpu/core/trinityPassEncoder.js.map +0 -1
- package/dist/trinityal/webgpu/core/workQueue.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchGroups.js","sources":["../../../../../src/trinityal/webgpu/core/batchGroups.js"],"sourcesContent":["// Source: trinity/trinity/Tr2RenderContext.cpp:462-537\n// `RenderBatchGroup` is a METHOD, so this file is MODELLED ON the class that\n// declares it rather than replicating one: what it ports is the state that\n// method keeps across a group - what the encoder already has bound - and\n// there is no class surface to compare against.\n// Source: trinity/trinity/TriRenderBatch.cpp (CanBeBinned)\n//\n// Carbon hoists per GROUP what does not change across a run of batches -\n// standard states for the rendering mode, the shader state interface taken from\n// the MATERIAL rather than the batch's own shader pointer, technique index,\n// pass count, vertex declaration, both stream sources and the index buffer -\n// then applies the pass, then does only material constants, per-object\n// constants, topology and the draw per batch. This dispatcher did all of it per\n// batch, which is what made groupCount and the GDPR partition mean nothing.\n//\n// TWO DELIBERATE DEVIATIONS FROM CARBON, both from the engine-backends plan's\n// decision 3.\n//\n// 1. THE INDEX BUFFER IS PART OF THE PREDICATE. Carbon's CanBeBinned compares\n// shader, vertex declaration, index stride, both vertex streams and\n// rendering mode - and NOT the index buffer - while RenderBatchGroup then\n// binds and branches on the FIRST batch's index buffer. That is sound only\n// because all Carbon geometry is suballocated from one process-global\n// buffer, so any two binnable batches necessarily share it. An engine that\n// gives each geometry its own buffer breaks it SILENTLY, drawing the first\n// batch's indices for every batch in the run. We are that engine.\n//\n// 2. RUNS ARE DERIVED HERE, NOT CONSUMED FROM A PRECOMPUTED PARTITION. Carbon\n// stamps groupCount during Finalize; its split loop advances past the\n// boundary element without re-checking it, and its correctness depends on\n// the sort order and the equivalence predicate agreeing with nothing\n// validating that they do. Deriving runs from the batches actually being\n// encoded cannot disagree with itself.\n//\n// Ordering is never changed here. Sorting belongs to Trinity, and reordering at\n// encode time would break the golden-image comparison the two engines are meant\n// to be judged by. This only finds runs of ADJACENT batches that already agree.\n//\n// The WebGPU translation of Carbon's group key: a render pipeline already folds\n// the shader program, render states, vertex layout and topology into one\n// object, so pipeline identity carries most of CanBeBinned by construction.\n// What it does not carry is which buffers are bound, so the vertex buffers and\n// the index buffer are compared explicitly. Bind groups stay per batch: they\n// are where per-object data lives, and that is exactly what varies within a\n// group.\n\nimport { CjsSchema } from \"#schema\";\n\n/**\n * Whether two prepared draws may share one hoisted binding run.\n *\n * Compares only what a run hoists. Anything set per batch - bind groups, draw\n * arguments - is deliberately absent, because differing there is the normal\n * case inside a group rather than a reason to split one.\n */\nexport function CanShareBindings(first, second)\n{\n if (!first || !second) return false;\n if (first === second) return true;\n if (first.livePipeline !== second.livePipeline) return false;\n if (first.indexed !== second.indexed) return false;\n if (!sameVertexBuffers(first.vertexBuffers, second.vertexBuffers)) return false;\n\n // Decision 3's correction. Two batches on the same pipeline and vertex\n // streams still draw different indices, and Carbon's own predicate would\n // have said yes here.\n return sameIndexBuffer(first.indexed, first.indexBuffer, second.indexBuffer);\n}\n\n\n/**\n * Derives runs of adjacent prepared batches that share hoistable state.\n *\n * Returns one entry per run with its start, end and length, in encode order.\n * Every batch appears in exactly one run, and a run of one is normal - it means\n * that batch shares nothing with its neighbours, not that grouping failed.\n */\nexport function DeriveBatchGroups(batches, resolveDraw = handle => handle?.draw)\n{\n const groups = [];\n const list = batches ?? [];\n let start = 0;\n\n for (let index = 1; index <= list.length; index += 1)\n {\n const isEnd = index === list.length;\n const shares = !isEnd && CanShareBindings(resolveDraw(list[index - 1]), resolveDraw(list[index]));\n\n if (isEnd || !shares)\n {\n if (index > start) groups.push({ start, end: index, length: index - start });\n start = index;\n }\n }\n\n return groups;\n}\n\n\n/**\n * A per-pass record of what is already bound, so a run's second and later\n * batches skip the sets their first batch performed.\n *\n * Bound to ONE pass encoder and fails loudly if reused with another: WebGPU\n * pass state does not survive a pass boundary, so a state object leaking\n * across passes would silently skip a set that genuinely had to happen. That\n * failure would appear as geometry drawn with a previous pass's buffers, which\n * is exactly the class of bug this file exists to prevent.\n */\nexport class CjsWebgpuEncodeState\n{\n _pass = null;\n\n _pipeline = null;\n\n _vertexBuffers = null;\n\n _indexBuffer = null;\n\n _bindGroups = [];\n\n /** Binds this state to a pass, rejecting a second one. */\n Require(pass)\n {\n if (this._pass === null) this._pass = pass;\n else if (this._pass !== pass)\n {\n const error = new Error(\"CjsWebgpuEncodeState: encode state belongs to another render pass\");\n error.code = \"CJS_WEBGPU_ENCODE_STATE_INVALID\";\n throw error;\n }\n return this;\n }\n\n /** Whether the pipeline needs setting, recording it when it does. */\n NeedsPipeline(pipeline)\n {\n if (this._pipeline === pipeline) return false;\n this._pipeline = pipeline;\n return true;\n }\n\n /** Whether the vertex buffers need setting, recording them when they do. */\n NeedsVertexBuffers(entries)\n {\n if (sameVertexBuffers(this._vertexBuffers, entries)) return false;\n this._vertexBuffers = entries;\n return true;\n }\n\n /** Whether the index buffer needs setting, recording it when it does. */\n NeedsIndexBuffer(entry)\n {\n if (sameIndexBuffer(true, this._indexBuffer, entry)) return false;\n this._indexBuffer = entry;\n return true;\n }\n\n /** Whether one bind group needs setting, recording it when it does. */\n NeedsBindGroup(index, bindGroup)\n {\n if (this._bindGroups[index] === bindGroup) return false;\n this._bindGroups[index] = bindGroup;\n return true;\n }\n}\n\n\nfunction sameVertexBuffers(first, second)\n{\n if (first === second) return true;\n if (!first || !second || first.length !== second.length) return false;\n\n for (let index = 0; index < first.length; index += 1)\n {\n const a = first[index];\n const b = second[index];\n if (a.slot !== b.slot || a.buffer !== b.buffer) return false;\n if ((a.offset ?? 0) !== (b.offset ?? 0) || a.size !== b.size) return false;\n }\n\n return true;\n}\n\n\nfunction sameIndexBuffer(indexed, first, second)\n{\n if (!indexed) return true;\n if (first === second) return true;\n if (!first || !second) return false;\n\n return first.buffer === second.buffer\n && first.format === second.format\n && (first.offset ?? 0) === (second.offset ?? 0)\n && first.size === second.size;\n}\n\n\n// DECLARED AS A CALL, NOT A DECORATOR. The abstraction layer is imported\n// straight from source by its tests - `#trinityal/...` resolves to `src/` - and\n// raw Node cannot parse decorator syntax, so a decorator here breaks every test\n// that reaches this file without a build first. `CjsSchema.define` is the same\n// metadata through the door the schema already provides for exactly this, and\n// it keeps the layer free of the decorator chain it has never carried.\nCjsSchema.define(CjsWebgpuEncodeState, { className: \"CjsWebgpuEncodeState\", modelledOn: \"Tr2RenderContextBase\" });\n"],"names":["CanShareBindings","first","second","livePipeline","indexed","sameVertexBuffers","vertexBuffers","sameIndexBuffer","indexBuffer","DeriveBatchGroups","batches","resolveDraw","handle","draw","groups","list","start","index","length","isEnd","shares","push","end","CjsWebgpuEncodeState","_pass","_pipeline","_vertexBuffers","_indexBuffer","_bindGroups","Require","pass","error","Error","code","NeedsPipeline","pipeline","NeedsVertexBuffers","entries","NeedsIndexBuffer","entry","NeedsBindGroup","bindGroup","a","b","slot","buffer","offset","size","format","CjsSchema","define","className","modelledOn"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,CAAC,CAACI,MAAM,IAAI,CAAC,OAAOH,CAAC,CAACG,MAAM,IAAI,CAAC,CAAC,IAAIJ,CAAC,CAACK,IAAI,KAAKJ,CAAC,CAACI,IAAI,EAAE,OAAO,KAAK;AAC5E,EAAA;AAEA,EAAA,OAAO,IAAI;AACb;AAGA,SAASxC,eAAeA,CAACH,OAAO,EAAEH,KAAK,EAAEC,MAAM,EAC/C;AACE,EAAA,IAAI,CAACE,OAAO,EAAE,OAAO,IAAI;AACzB,EAAA,IAAIH,KAAK,KAAKC,MAAM,EAAE,OAAO,IAAI;AACjC,EAAA,IAAI,CAACD,KAAK,IAAI,CAACC,MAAM,EAAE,OAAO,KAAK;AAEnC,EAAA,OAAOD,KAAK,CAAC4C,MAAM,KAAK3C,MAAM,CAAC2C,MAAM,IAChC5C,KAAK,CAAC+C,MAAM,KAAK9C,MAAM,CAAC8C,MAAM,IAC9B,CAAC/C,KAAK,CAAC6C,MAAM,IAAI,CAAC,OAAO5C,MAAM,CAAC4C,MAAM,IAAI,CAAC,CAAC,IAC5C7C,KAAK,CAAC8C,IAAI,KAAK7C,MAAM,CAAC6C,IAAI;AACjC;;AAGA;AACA;AACA;AACA;AACA;AACA;AACAE,SAAS,CAACC,MAAM,CAAC3B,oBAAoB,EAAE;AAAE4B,EAAAA,SAAS,EAAE,sBAAsB;AAAEC,EAAAA,UAAU,EAAE;AAAuB,CAAC,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constantArena.js","sources":["../../../../../src/trinityal/webgpu/core/constantArena.js"],"sourcesContent":["// Source: trinity/trinityal/metal/MetalUtils.h\n// trinity/trinityal/metal/MetalUtils.mm:375-440\n//\n// Carbon's per-frame constant arena. Metal's `SetConstants` does not write into\n// a buffer the constant buffer owns; it copies the bytes into a page of this\n// allocator and binds `(page, offset)` (`MetalWorkQueue.mm:2396-2440`), and the\n// allocator is reset at the start of every frame (`MetalContext.mm:473`). That\n// is what gives each draw its own snapshot: a buffer locked three times and\n// drawn three times lands in three regions, and the three draws read three\n// different offsets.\n//\n// WHY THIS IS NOT OPTIONAL HERE. `queue.writeBuffer` into one GPUBuffer per\n// constant buffer executes before the frame's command buffer is submitted, so\n// every draw recorded in the frame would read the LAST write - every object\n// drawn with the last object's transform. The arena is the fix Carbon already\n// has, and the bind is a dynamic offset, which is WebGPU's spelling of Metal's\n// `setVertexBufferOffset:` (`MetalWorkQueue.mm:2656-2659`).\n//\n// Pages are 2 MiB, as Carbon's are, and allocations are aligned to the larger\n// of Carbon's 256 and the device's `minUniformBufferOffsetAlignment`, which a\n// dynamic offset must be a multiple of.\n\n\nimport { CjsSchema } from \"#schema\";\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuConstantArena: ${message}`);\n error.code = \"CJS_WEBGPU_CONSTANT_ARENA_INVALID\";\n throw error;\n}\n\n\n/** `CONST_PAGE_SIZE` */\nexport const CONST_PAGE_SIZE = 2 * 1024 * 1024;\n\n/** `CONST_ALIGNMENT` */\nexport const CONST_ALIGNMENT = 256;\n\n\n/**\n * A per-frame arena of `GPUBuffer` pages that constant buffers are suballocated\n * into when they are bound.\n */\nexport class CjsWebgpuConstantArena\n{\n /** m_pages: one `GPUBuffer` per page, created on first use. */\n m_pages = [];\n\n /** The current page index and the offset the next allocation takes. */\n m_page = 0;\n\n m_offset = 0;\n\n /** m_totalUploadedSize, for a stats line. */\n m_totalUploadedSize = 0;\n\n m_webgpu = null;\n\n m_alignment = CONST_ALIGNMENT;\n\n /**\n * @param {object} webgpu The `CjsWebgpuDevice`.\n */\n constructor(webgpu)\n {\n if (!webgpu) fail(\"a device is required\");\n\n this.m_webgpu = webgpu;\n\n const limit = webgpu.GetDevice()?.limits?.minUniformBufferOffsetAlignment;\n\n if (Number.isInteger(limit) && limit > CONST_ALIGNMENT) this.m_alignment = limit;\n }\n\n /** Carbon's `Reset`: the next frame starts at page zero, offset zero. */\n Reset()\n {\n this.m_page = 0;\n this.m_offset = 0;\n this.m_totalUploadedSize = 0;\n }\n\n /**\n * Copies bytes into the arena and says where they landed.\n *\n * @param {Uint8Array} bytes The constants; may be shorter than `size`.\n * @param {number} size Bytes to reserve, at least the bytes' length.\n * @returns {{page: number, offset: number, size: number}} The region.\n */\n Allocate(bytes, size = bytes.byteLength)\n {\n const reserved = Math.ceil(Math.max(size, bytes.byteLength, 1) / this.m_alignment) * this.m_alignment;\n\n if (reserved > CONST_PAGE_SIZE) fail(`a constant buffer of ${size} bytes does not fit a ${CONST_PAGE_SIZE}-byte page`);\n\n if (this.m_offset + reserved > CONST_PAGE_SIZE)\n {\n this.m_totalUploadedSize += this.m_offset;\n this.m_page += 1;\n this.m_offset = 0;\n }\n\n const page = this.GetPage(this.m_page);\n const offset = this.m_offset;\n\n this.m_offset += reserved;\n\n // `writeBuffer` wants a four-byte-aligned length; the reserve is.\n this.m_webgpu.GetDevice().queue.writeBuffer(page, offset, bytes, 0, bytes.byteLength & ~3);\n\n return { page: this.m_page, offset, size: reserved };\n }\n\n /**\n * The `GPUBuffer` for a page, created on first use.\n *\n * @param {number} page The page index.\n * @returns {object} The buffer.\n */\n GetPage(page)\n {\n if (!this.m_pages[page]) this._CreatePage(page);\n\n return this.m_pages[page];\n }\n\n /**\n * Allocates one page's `GPUBuffer`, Carbon's `CreatePage`\n * (`MetalUtils.mm:432-439`).\n *\n * Carbon calls it from `Allocate` when the offset runs past the page and the\n * next page has never been made; ours is reached through `GetPage`, which is\n * the same \"make it if it is not there\" with one caller instead of two.\n *\n * @param {number} index The page index.\n * @returns {void}\n */\n _CreatePage(index)\n {\n const usage = this.m_webgpu.GetBufferUsage();\n\n this.m_pages[index] = this.m_webgpu.GetDevice().createBuffer({\n label: `Constant buffer page ${index}`,\n size: CONST_PAGE_SIZE,\n usage: usage.UNIFORM | usage.COPY_DST\n });\n }\n\n /** Bytes allocated this frame so far. */\n GetTotalUploadedSize()\n {\n return this.m_totalUploadedSize + this.m_offset;\n }\n\n /** Releases every page. */\n Destroy()\n {\n for (const page of this.m_pages) page?.destroy?.();\n\n this.m_pages = [];\n this.Reset();\n }\n}\n\n\n// DECLARED AS A CALL, NOT A DECORATOR. The abstraction layer is imported\n// straight from source by its tests - `#trinityal/...` resolves to `src/` - and\n// raw Node cannot parse decorator syntax, so a decorator here breaks every test\n// that reaches this file without a build first. `CjsSchema.define` is the same\n// metadata through the door the schema already provides for exactly this, and\n// it keeps the layer free of the decorator chain it has never carried.\nCjsSchema.define(CjsWebgpuConstantArena, { className: \"CjsWebgpuConstantArena\", carbon: \"ConstantBufferAllocator\" });\n"],"names":["fail","message","error","Error","code","CONST_PAGE_SIZE","CONST_ALIGNMENT","CjsWebgpuConstantArena","m_pages","m_page","m_offset","m_totalUploadedSize","m_webgpu","m_alignment","constructor","webgpu","limit","GetDevice","limits","minUniformBufferOffsetAlignment","Number","isInteger","Reset","Allocate","bytes","size","byteLength","reserved","Math","ceil","max","page","GetPage","offset","queue","writeBuffer","_CreatePage","index","usage","GetBufferUsage","createBuffer","label","UNIFORM","COPY_DST","GetTotalUploadedSize","Destroy","destroy","CjsSchema","define","className","carbon"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,wBAAA,EAA2BF,OAAO,EAAE,CAAC;EAC7DC,KAAK,CAACE,IAAI,GAAG,mCAAmC;AAChD,EAAA,MAAMF,KAAK;AACb;;AAGA;MACaG,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG;;AAE1C;AACO,MAAMC,eAAe,GAAG;;AAG/B;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,CACnC;AACE;AACAC,EAAAA,OAAO,GAAG,EAAE;;AAEZ;AACAC,EAAAA,MAAM,GAAG,CAAC;AAEVC,EAAAA,QAAQ,GAAG,CAAC;;AAEZ;AACAC,EAAAA,m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,mBAAmB,GAAG,IAAI,CAACD,QAAQ;AACjD,EAAA;;AAEA;AACAmC,EAAAA,OAAOA,GACP;IACE,KAAK,MAAMd,IAAI,IAAI,IAAI,CAACvB,OAAO,EAAEuB,IAAI,EAAEe,OAAO,IAAI;IAElD,IAAI,CAACtC,OAAO,GAAG,EAAE;IACjB,IAAI,CAACc,KAAK,EAAE;AACd,EAAA;AACF;;AAGA;AACA;AACA;AACA;AACA;AACA;AACAyB,SAAS,CAACC,MAAM,CAACzC,sBAAsB,EAAE;AAAE0C,EAAAA,SAAS,EAAE,wBAAwB;AAAEC,EAAAA,MAAM,EAAE;AAA0B,CAAC,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"perFrameSource.js","sources":["../../../../../src/trinityal/webgpu/core/perFrameSource.js"],"sourcesContent":["// The scene's per-frame constants, for the two registers Carbon reserves.\n//\n// Short because everything it needs already exists. EveSpaceScene owns the two\n// records (`m_perFrameVS`/`m_perFramePS`), EveSpaceSceneRenderDriver already\n// fills them each frame in Carbon's order - PS then VS - and RawData extends\n// CjsConstantPayload, so the packed bytes are one call away. What was missing\n// was only the join: nothing carried them from the scene to a binding.\n//\n// b1 and b2 are not optional decoration. Every v5 shader binds both, so a hull\n// cannot be drawn without them, which is why the resolver refuses rather than\n// leaving them empty.\n//\n// The records are PERSISTENT and scene-owned, not leased per draw\n// (`RawData.create`), so this hands back a live view rather than a copy: two\n// batches in one frame read the same bytes, which is the point of a per-frame\n// buffer.\nimport { PER_FRAME_PS, PER_FRAME_VS } from \"#trinity/core/Tr2Renderer\";\n\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuPerFrameSource: ${message}`);\n error.code = \"CJS_WEBGPU_PER_FRAME_SOURCE_INVALID\";\n throw error;\n}\n\n\n/** Supplies the per-frame constant registers from one scene. */\nexport class CjsWebgpuPerFrameSource\n{\n _scene;\n\n /**\n * @param {object} scene Scene owning the per-frame records.\n */\n constructor(scene)\n {\n if (!scene) fail(\"a scene is required; nothing else owns per-frame data\");\n\n this._scene = scene;\n }\n\n /**\n * The packed bytes for one per-frame register.\n *\n * @param {number} slot Constant-buffer register, 1 or 2.\n * @returns {ArrayBufferView} The scene's packed record.\n */\n Resolve(slot)\n {\n // A scene HAS both accessors; only the slot number is in question.\n const record = slot === PER_FRAME_VS\n ? this._scene.GetPerFrameVSData()\n : (slot === PER_FRAME_PS ? this._scene.GetPerFramePSData() : null);\n\n if (!record)\n {\n fail(`b${slot} is not a per-frame register, or the scene holds no record for it`);\n }\n\n const data = record.GetData();\n\n // A record that packs to nothing would bind an empty buffer and draw a\n // black frame, which reads as a lighting bug rather than a missing upload.\n if (!ArrayBuffer.isView(data)) fail(`the scene's b${slot} record did not pack to a typed array`);\n\n return data;\n }\n\n /**\n * A resolver hook bound to this source.\n *\n * @returns {Function} `(slot) => ArrayBufferView`\n */\n ResolvePerFrame()\n {\n return (slot) => this.Resolve(slot);\n }\n}\n"],"names":["fail","message","error","Error","code","CjsWebgpuPerFrameSource","_scene","constructor","scene","Resolve","slot","record","PER_FRAME_VS","GetPerFrameVSData","PER_FRAME_PS","GetPerFramePSData","data","GetData","ArrayBuffer","isView","ResolvePerFrame"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,yBAAA,EAA4BF,OAAO,EAAE,CAAC;EAC9DC,KAAK,CAACE,IAAI,GAAG,qCAAqC;AAClD,EAAA,MAAMF,KAAK;AACb;;AAGA;AACO,MAAMG,uBAAuB,CACpC;EACEC,MAAM;;AAEN;AACF;AACA;EACEC,WAAWA,CAACC,KAAK,EACjB;AACE,IAAA,IAAI,CAACA,KAAK,EAAER,IAAI,CAAC,uDAAuD,CAAC;IAEzE,IAAI,CAACM,MAAM,GAAGE,KAAK;AACrB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACC,IAAI,EACZ;AACE;IACA,MAAMC,MAAM,GAAGD,IAAI,KAAKE,YAAY,GAChC,IAAI,CAACN,MAAM,CAACO,iBAAiB,EAAE,GAC9BH,IAAI,KAAKI,YAAY,GAAG,IAAI,CAACR,MAAM,CAACS,iBAAiB,EAAE,GAAG,IAAK;IAEpE,IAAI,CAACJ,MAAM,EACX;AACEX,MAAAA,IAAI,CAAC,CAAA,CAAA,EAAIU,IAAI,CAAA,iEAAA,CAAmE,CAAC;AACnF,IAAA;AAEA,IAAA,MAAMM,IAAI,GAAGL,MAAM,CAACM,OAAO,EAAE;;AAE7B;AACA;AACA,IAAA,IAAI,CAACC,WAAW,CAACC,MAAM,CAACH,IAAI,CAAC,EAAEhB,IAAI,CAAC,CAAA,aAAA,EAAgBU,IAAI,uCAAuC,CAAC;AAEhG,IAAA,OAAOM,IAAI;AACb,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACEI,EAAAA,eAAeA,GACf;AACE,IAAA,OAAQV,IAAI,IAAK,IAAI,CAACD,OAAO,CAACC,IAAI,CAAC;AACrC,EAAA;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipelineCache.js","sources":["../../../../../src/trinityal/webgpu/core/pipelineCache.js"],"sourcesContent":["// The Stage B pipeline cache, which this engine did not have.\r\n//\r\n// The engine-backends plan splits effect realization the way Carbon splits it.\r\n// Stage A is program identity and dedup, backend-independent, and\r\n// The runtime resource layer already has it in `passUnitSignature` and `unit.sha256`.\r\n// Stage B is the pipeline object itself, backend-owned, and its key differs per\r\n// backend: DX12 keys an ID3D12PipelineState on a dirty-tracked PSODescription,\r\n// Metal on a combined hash of device, functions, vertex descriptor and\r\n// attachments, and DX11 has no monolithic object but four caches including an\r\n// input-layout cache keyed on the vertex shader's input signature.\r\n//\r\n// This device had none. Every PreparePipeline call created fresh shader\r\n// modules, bind-group layouts and a pipeline layout, and recorded the result in\r\n// a WeakMap keyed by the handle object it had just made - which caches nothing,\r\n// because a fresh handle never hits.\r\n//\r\n// KEYS ARE EXACT, NOT HASHED. Carbon's Metal cache is keyed on a hash value\r\n// with no equality recheck, so a collision silently returns the WRONG pipeline;\r\n// DX12 rechecks. Rather than hash and recheck, the key here is the canonical\r\n// serialization itself, so two different pipelines cannot collide in the first\r\n// place and there is nothing to recheck. That is only affordable because a\r\n// recipe is a small POD block; it is why the program half is named by the\r\n// caller instead.\r\n//\r\n// A CALLER THAT CANNOT NAME ITS PROGRAM GETS NO CACHE. Shader source is far too\r\n// large to serialize into a key on every call, and this package has no\r\n// dependency to hash it with. So the identity is supplied - the composed path\r\n// already has one from the runtime resource layer - and an unnamed pipeline is prepared\r\n// uncached, which is never wrong, only slower. Guessing an identity from the\r\n// descriptor's `key` would be worse than no cache: \"Main.pass0\" is the most\r\n// common pass name in the corpus and never dedupes across effects, so it would\r\n// hand back another effect's pipeline.\r\n//\r\n// EVERYTHING IS GENERATION-BOUND. Carbon's registry handles are indices that go\r\n// stale wholesale on device reset. Ours are garbage-collected objects, so a\r\n// stale entry would keep a dead device's pipeline alive and hand it out; each\r\n// entry records the generation it was built for and a mismatch misses.\r\n\r\nfunction fail(message)\r\n{\r\n const error = new Error(`CjsWebgpuPipelineCache: ${message}`);\r\n error.code = \"CJS_WEBGPU_PIPELINE_CACHE_INVALID\";\r\n throw error;\r\n}\r\n\r\n\r\n/**\r\n * Canonically serializes a value so two structurally equal inputs produce the\r\n * same string regardless of property order.\r\n *\r\n * Object key order is normalized because a recipe assembled by different code\r\n * paths is the same recipe, and treating `{topology, cullMode}` as different\r\n * from `{cullMode, topology}` would miss every such hit.\r\n */\r\nexport function CanonicalKey(value)\r\n{\r\n if (value === null || value === undefined) return String(value);\r\n if (typeof value !== \"object\") return `${typeof value}:${String(value)}`;\r\n if (Array.isArray(value)) return `[${value.map(CanonicalKey).join(\",\")}]`;\r\n\r\n const entries = Object.keys(value)\r\n .filter(name => value[name] !== undefined)\r\n .sort()\r\n .map(name => `${name}=${CanonicalKey(value[name])}`);\r\n\r\n return `{${entries.join(\",\")}}`;\r\n}\r\n\r\n\r\n/**\r\n * A generation-bound cache of asynchronously built pipeline objects.\r\n *\r\n * In-flight builds are cached as promises, so two callers racing for the same\r\n * pipeline share one build rather than each creating a GPU object and one\r\n * silently winning. That matters more here than in Carbon: pipeline creation is\r\n * asynchronous on this backend and a frame legitimately prepares many at once.\r\n */\r\nexport class CjsWebgpuPipelineCache\r\n{\r\n _entries = new Map();\r\n\r\n /** How many entries are held, for diagnostics and tests. */\r\n get size()\r\n {\r\n return this._entries.size;\r\n }\r\n\r\n /**\r\n * Returns the cached value for a key, building it when absent.\r\n *\r\n * `key` must be a stable exact identity; `null` or `undefined` bypasses the\r\n * cache entirely and simply builds, which is what an unnamed pipeline gets.\r\n * A failed build is not retained, so a transient device error does not\r\n * poison the key forever.\r\n */\r\n async Resolve(key, generation, build)\r\n {\r\n if (typeof build !== \"function\") fail(\"a build function is required\");\r\n if (key === null || key === undefined) return build();\r\n\r\n const entry = this._entries.get(key);\r\n if (entry)\r\n {\r\n if (entry.generation === generation) return entry.value;\r\n // A pipeline built for a device that is gone is not repairable, and\r\n // handing it back would use a dead GPU object.\r\n this._entries.delete(key);\r\n }\r\n\r\n const value = build();\r\n this._entries.set(key, { generation, value });\r\n\r\n try\r\n {\r\n return await value;\r\n }\r\n catch (error)\r\n {\r\n if (this._entries.get(key)?.value === value) this._entries.delete(key);\r\n throw error;\r\n }\r\n }\r\n\r\n /** Drops entries not built for the given generation. */\r\n Prune(generation)\r\n {\r\n for (const [ key, entry ] of this._entries)\r\n {\r\n if (entry.generation !== generation) this._entries.delete(key);\r\n }\r\n return this;\r\n }\r\n\r\n /** Drops every entry, as a device reset requires. */\r\n Clear()\r\n {\r\n this._entries.clear();\r\n return this;\r\n }\r\n}\r\n\r\n\r\n/**\r\n * The Stage B key for a render pipeline: the prepared program's identity plus\r\n * the recipe's POD block.\r\n *\r\n * Returns null when the program has no identity, which is how an unnamed\r\n * pipeline declines the cache rather than being keyed on its recipe alone -\r\n * two different programs share a recipe constantly.\r\n */\r\nexport function RenderPipelineKey(programIdentity, recipe)\r\n{\r\n if (programIdentity === null || programIdentity === undefined) return null;\r\n\r\n const identity = CanonicalKey(programIdentity);\r\n\r\n // AN OBJECT THAT CANONICALISES TO NOTHING IS NOT AN IDENTITY. `Object.keys`\r\n // does not see private fields, so a class instance whose state is entirely\r\n // private - `CjsWebgpuShaderProgramAL` is exactly that - yields `{}` and\r\n // passes the null guard above. Every such program would then key\r\n // IDENTICALLY, which is the collision the comment above says must not\r\n // happen: two different programs share a recipe constantly.\r\n //\r\n // Declining the cache is the documented behaviour for a program with no\r\n // identity, so that is what this does rather than inventing one. A backend\r\n // that wants its pipelines cached gives its programs a real identity.\r\n if (identity === \"{}\") return null;\r\n\r\n return `${identity}|${CanonicalKey(recipe ?? null)}`;\r\n}\r\n"],"names":["fail","message","error","Error","code","CanonicalKey","value","undefined","String","Array","isArray","map","join","entries","Object","keys","filter","name","sort","CjsWebgpuPipelineCache","_entries","Map","size","Resolve","key","generation","build","entry","get","delete","set","Prune","Clear","clear","RenderPipelineKey","programIdentity","recipe","identity"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,wBAAA,EAA2BF,OAAO,EAAE,CAAC;EAC7DC,KAAK,CAACE,IAAI,GAAG,mCAAmC;AAChD,EAAA,MAAMF,KAAK;AACb;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAACC,KAAK,EAClC;AACE,EAAA,IAAIA,KAAK,KAAK,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,EAAE,OAAO,IAAI;AAE1E,EAAA,MAAM8B,QAAQ,GAAGhC,YAAY,CAAC8B,eAAe,CAAC;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,IAAIE,QAAQ,KAAK,IAAI,EAAE,OAAO,IAAI;EAElC,OAAO,CAAA,EAAGA,QAAQ,CAAA,CAAA,EAAIhC,YAAY,CAAC+B,MAAM,IAAI,IAAI,CAAC,CAAA,CAAE;AACtD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"psoDescription.js","sources":["../../../../../src/trinityal/webgpu/core/psoDescription.js"],"sourcesContent":["// Source: trinity/trinityal/dx12/util/PsoDescription.h\n// trinity/trinityal/dx12/util/PsoDescription.cpp\n// trinity/trinityal/dx12/Tr2RenderContextDx12.cpp (the setters and SetAllState)\n//\n// The pipeline description a draw resolves, and the fourth piece of the\n// immediate-draw route.\n//\n// WHAT CARBON DOES. Its backend does not assemble a pipeline per draw. The\n// setters describe one incrementally and mark it dirty\n// (`Tr2RenderContextDx12.cpp:315-338`: each compares before dirtying, so a\n// redundant apply costs nothing), and the draw resolves it:\n//\n// m_psoDescription.UpdateHash(); // cpp:793\n// auto found = m_ownerDevice->m_pipelineStates.find( m_psoDescription );\n// if( found != end ) return found->second;\n// m_psoDescription.CreatePipelineState( device, pipelineState );\n// m_ownerDevice->m_pipelineStates[ m_psoDescription ] = pipelineState;\n//\n// THE CACHE IS ON THE DEVICE, NOT THE CONTEXT (`Tr2PrimaryRenderContextDx12.h:319`),\n// which is why two contexts drawing the same material share one pipeline. Ours\n// is `CjsWebgpuPipelineCache`, already on `CjsWebgpuDevice` and already serving\n// the batch path - this describes, and hands the description to that.\n//\n// Carbon's fields, and where each lives here:\n//\n// m_vertexLayout -> vertexBufferLayouts, from the bound layout\n// m_shaderProgram -> shaderProgram, a CjsWebgpuShaderProgramAL\n// m_topologyType -> topology, mapped through the AL's own table\n// m_blendDesc }\n// m_rasterizerDesc } all three -> renderStateSetup + overrides, which\n// m_depthStencilDesc } `GetWebgpuRecipe` projects. WebGPU folds state into\n// a pipeline at creation, so the three descriptors\n// are one projection rather than three structs.\n// m_renderTargetFormats -> colorFormats\n// m_depthStencilFormat -> depthFormat\n// m_sampleDesc -> sampleCount\n// m_vertexStreamMask -> derived from vertexBufferLayouts\n//\n// THE PROJECTION IS NOT REIMPLEMENTED HERE. `Tr2RenderStateSetup.GetWebgpuRecipe`\n// already turns an interpreted setup into WebGPU state, applies the render-state\n// overrides while doing it, and refuses a fill mode WebGPU cannot rasterize. A\n// second translator is the mistake this whole lane exists to undo.\nimport { CjsSchema } from \"#schema\";\nimport { RenderPipelineKey } from \"./pipelineCache.js\";\nimport { TOPOLOGIES } from \"./topology.js\";\n\n\n/**\n * A pipeline description, filled by the abstraction layer's setters.\n *\n * Carbon's `PSODescription` is a plain struct with an `operator==` and a hash;\n * this is the same, with `GetKey` standing in for both because a canonical key\n * compares and hashes at once.\n */\nexport class CjsWebgpuPsoDescription\n{\n /** m_shaderProgram */\n shaderProgram = null;\n\n /** m_vertexLayout, as WebGPU buffer layouts. */\n vertexBufferLayouts = [];\n\n /** m_topologyType, in the abstraction layer's vocabulary. */\n topology = null;\n\n /** The authored state, projected at resolve time. */\n renderStateSetup = null;\n\n /** The state manager's overrides, applied by the projection. */\n renderStateOverrides = null;\n\n /** m_renderTargetFormats[MAX_RENDER_TARGET] */\n colorFormats = [];\n\n /** m_depthStencilFormat; null means no depth attachment. */\n depthFormat = null;\n\n /** m_sampleDesc, reduced to the one field WebGPU exposes. */\n sampleCount = 1;\n\n /**\n * Whether the description names everything a pipeline needs.\n *\n * Carbon's `GetPipelineState` returns null and `SetAllState` fails\n * (`cpp:847-851`) rather than creating a partial pipeline; this is the same\n * check, made before the attempt so the caller can say what is missing.\n *\n * @returns {string|null} What is missing, or null when complete.\n */\n GetMissing()\n {\n if (!this.shaderProgram || !this.shaderProgram.IsValid()) return \"a linked shader program\";\n if (!this.renderStateSetup) return \"a render-state setup\";\n if (this.topology === null || TOPOLOGIES[this.topology] === undefined) return \"a topology WebGPU can draw\";\n if (this.colorFormats.length === 0 && this.depthFormat === null) return \"a colour or depth attachment\";\n\n return null;\n }\n\n /**\n * The WebGPU pipeline descriptor this description resolves to.\n *\n * Carbon's `CreatePipelineState` builds a `D3D12_GRAPHICS_PIPELINE_STATE_DESC`\n * from the same fields. Ours produces the recipe shape the device's pipeline\n * factory already takes from the batch path, so both paths create pipelines\n * the same way.\n *\n * @returns {object} The recipe.\n */\n BuildRecipe()\n {\n const projected = this.renderStateSetup.GetWebgpuRecipe({\n depthFormat: this.depthFormat,\n invertedDepthTest: !!this.renderStateOverrides?.invertedDepthTest,\n invertedCullMode: !!this.renderStateOverrides?.invertedCullMode\n });\n\n return {\n ...projected,\n primitive: { ...projected.primitive, topology: TOPOLOGIES[this.topology] },\n vertex: { buffers: this.vertexBufferLayouts },\n fragment: {\n targets: this.colorFormats.map(format => ({ format, blend: projected.blend ?? undefined }))\n },\n multisample: { count: this.sampleCount }\n };\n }\n\n /**\n * The cache key, which is Carbon's `UpdateHash` plus `operator==` at once.\n *\n * Two descriptions with the same key resolve to the same pipeline, which is\n * the whole point of describing rather than assembling: a frame that draws\n * two hundred objects through one material creates one pipeline.\n *\n * @returns {string|null} The key, or null when the description is incomplete.\n */\n GetKey()\n {\n if (this.GetMissing()) return null;\n\n // A real program names itself; a stand-in keys on its own fields. Metal\n // hashes the function pointers for this (`MetalWorkQueue.mm:1610-1611`),\n // and canonicalising a program's modules would serialise device objects.\n const identity = typeof this.shaderProgram.GetIdentity === \"function\"\n ? this.shaderProgram.GetIdentity()\n : this.shaderProgram;\n\n return RenderPipelineKey(identity, this.BuildRecipe());\n }\n\n /**\n * Whether two descriptions resolve to the same pipeline.\n *\n * @param {CjsWebgpuPsoDescription} other The description to compare.\n * @returns {boolean} True when both are complete and equal.\n */\n Equals(other)\n {\n if (!other) return false;\n\n const key = this.GetKey();\n\n return key !== null && key === other.GetKey();\n }\n}\n\n\n// DECLARED AS A CALL, NOT A DECORATOR. The abstraction layer is imported\n// straight from source by its tests - `#trinityal/...` resolves to `src/` - and\n// raw Node cannot parse decorator syntax, so a decorator here breaks every test\n// that reaches this file without a build first. `CjsSchema.define` is the same\n// metadata through the door the schema already provides for exactly this, and\n// it keeps the layer free of the decorator chain it has never carried.\nCjsSchema.define(CjsWebgpuPsoDescription, { className: \"CjsWebgpuPsoDescription\", carbon: \"PSODescription\" });\n"],"names":["CjsWebgpuPsoDescription","shaderProgram","vertexBufferLayouts","topology","renderStateSetup","renderStateOverrides","colorFormats","depthFormat","sampleCount","GetMissing","IsValid","TOPOLOGIES","undefined","length","BuildRecipe","projected","GetWebgpuRecipe","invertedDepthTest","invertedCullMode","primitive","vertex","buffers","fragment","targets","map","format","blend","multisample","count","GetKey","identity","GetIdentity","RenderPipelineKey","Equals","other","key","CjsSchema","define","className","carbon"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,CACpC;AACE;AACAC,EAAAA,aAAa,GAAG,IAAI;;AAEpB;AACAC,EAAAA,mBAAmB,GAAG,EAAE;;AAExB;AACAC,EAAAA,QAAQ,GAAG,IAAI;;AAEf;AACAC,EAAAA,gBAAgB,GAAG,IAAI;;AAEvB;AACAC,EAAAA,oBAAoB,GAAG,IAAI;;AAE3B;AACAC,EAAAA,YAAY,GAAG,EAAE;;AAEjB;AACAC,EAAAA,WAAW,GAAG,IAAI;;AAElB;AACAC,EAAAA,WAAW,GAAG,CAAC;;AAEf;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,UAAUA,GACV;AACE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AA,WAAW,EAAE;QAAEC,KAAK,EAAE,IAAI,CAACpB;AAAY;KACxC;AACH,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEqB,EAAAA,MAAMA,GACN;AACE,IAAA,IAAI,IAAI,CAACpB,UAAU,EAAE,EAAE,OAAO,IAAI;;AAElC;AACA;AACA;IACA,MAAMqB,QAAQ,GAAG,OAAO,IAAI,CAAC7B,aAAa,CAAC8B,WAAW,KAAK,UAAU,GACjE,IAAI,CAAC9B,aAAa,CAAC8B,WAAW,EAAE,GAChC,IAAI,CAAC9B,aAAa;IAEtB,OAAO+B,iBAAiB,CAACF,QAAQ,EAAE,IAAI,CAAChB,WAAW,EAAE,CAAC;AACxD,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACEmB,MAAMA,CAACC,KAAK,EACZ;AACE,IAAA,IAAI,CAACA,KAAK,EAAE,OAAO,KAAK;AAExB,IAAA,MAAMC,GAAG,GAAG,IAAI,CAACN,MAAM,EAAE;IAEzB,OAAOM,GAAG,KAAK,IAAI,IAAIA,GAAG,KAAKD,KAAK,CAACL,MAAM,EAAE;AAC/C,EAAA;AACF;;AAGA;AACA;AACA;AACA;AACA;AACA;AACAO,SAAS,CAACC,MAAM,CAACrC,uBAAuB,EAAE;AAAEsC,EAAAA,SAAS,EAAE,yBAAyB;AAAEC,EAAAA,MAAM,EAAE;AAAiB,CAAC,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderTarget.js","sources":["../../../../../src/trinityal/webgpu/core/renderTarget.js"],"sourcesContent":["// Attachment and target ownership for the WebGPU backend.\r\n//\r\n// Carbon's target model is a render context that owns its swap chain and\r\n// depth-stencil surface. WebGPU's is a render-pass descriptor with FIXED\r\n// attachments, decided before the pass opens and unchangeable inside it, so\r\n// there is nothing to port line for line - the divergence table already records\r\n// this as one of the places the two backends legitimately differ in\r\n// implementation while agreeing on the frame progression.\r\n//\r\n// What this owns: canvas configuration, the depth attachment, the multisample\r\n// attachment, and their size. What it deliberately does not own: when a frame\r\n// happens, which passes exist, or what is drawn. Those belong to the executor\r\n// and to Trinity's steps.\r\n//\r\n// THREE THINGS THAT MUST FAIL LOUDLY, because each is silent otherwise.\r\n//\r\n// 1. A canvas texture view is valid for ONE frame. WebGPU replaces the texture\r\n// behind `getCurrentTexture()` at presentation, so a view cached across\r\n// frames refers to a texture that is gone. Reusing one is rejected here\r\n// rather than surfacing as a validation error from a pass whose descriptor\r\n// looks correct.\r\n// 2. Depth and colour attachments must agree on size and sample count exactly.\r\n// A stale depth attachment after a resize is the classic version of this,\r\n// and beginRenderPass reports it far from the resize that caused it.\r\n// 3. Everything is bound to a device generation. After device loss the context\r\n// must be reconfigured and every attachment recreated; an attachment from\r\n// the previous device is not repairable.\r\n//\r\n// PRESENTATION IS NOT A CALL. Carbon presents the previous frame at the top of\r\n// the next tick through Tr2RenderContextAL::Present. WebGPU has no present:\r\n// the browser presents a configured canvas after the queue submission that drew\r\n// into its current texture. So the engine-side tick wrapper has a Present step\r\n// for WebGL and genuinely nothing to do here, and that asymmetry is expected\r\n// rather than a missing port.\r\n\r\nimport { CjsWebgpuDevice } from \"../CjsWebgpuDevice.js\";\r\n\r\nfunction fail(message)\r\n{\r\n const error = new Error(`CjsWebgpuRenderTarget: ${message}`);\r\n error.code = \"CJS_WEBGPU_RENDER_TARGET_INVALID\";\r\n throw error;\r\n}\r\n\r\n\r\nfunction positiveSize(value, name)\r\n{\r\n if (!Number.isInteger(value) || value < 1)\r\n {\r\n fail(`${name} must be a positive integer`);\r\n }\r\n return value;\r\n}\r\n\r\n\r\n/** Owns a WebGPU presentation surface and its per-frame attachments. */\r\nexport class CjsWebgpuRenderTarget\r\n{\r\n _webgpu;\r\n\r\n _canvas = null;\r\n\r\n _context = null;\r\n\r\n _format = null;\r\n\r\n _alphaMode = \"opaque\";\r\n\r\n _extraUsage = 0;\r\n\r\n _sampleCount = 1;\r\n\r\n _depthFormat = null;\r\n\r\n _width = 0;\r\n\r\n _height = 0;\r\n\r\n _generation = 0;\r\n\r\n _depth = null;\r\n\r\n _multisample = null;\r\n\r\n _frame = null;\r\n\r\n _destroyed = false;\r\n\r\n /**\r\n * @param {CjsWebgpuDevice} webgpu Canonical WebGPU device.\r\n * @param {object} options Target options.\r\n * @param {object} options.canvas Canvas or OffscreenCanvas to present to.\r\n * @param {object} [options.context] Pre-acquired WebGPU canvas context.\r\n * @param {string} [options.format] Presentation format; defaults to the\r\n * browser's preferred canvas format.\r\n * @param {string} [options.alphaMode=\"opaque\"] Canvas alpha mode.\r\n * @param {number} [options.sampleCount=1] Multisample count.\r\n * @param {string} [options.depthFormat] Depth attachment format, or omitted\r\n * for a colour-only target.\r\n * @param {object} [options.textureUsage] GPUTextureUsage constants.\r\n * @param {object} [options.gpu] `navigator.gpu`-like object, for the\r\n * preferred canvas format.\r\n * @param {number} [options.extraUsage] Extra `GPUTextureUsage` bits for the\r\n * surface - `COPY_SRC` when the frame has to be read back and counted.\r\n */\r\n constructor(webgpu, options = {})\r\n {\r\n if (!(webgpu instanceof CjsWebgpuDevice))\r\n {\r\n fail(\"webgpu boundary must be a CjsWebgpuDevice\");\r\n }\r\n this._webgpu = webgpu;\r\n this._canvas = options.canvas ?? null;\r\n this._context = options.context ?? null;\r\n\r\n if (!this._context && !this._canvas) fail(\"a canvas or a context is required\");\r\n\r\n this._textureUsage = options.textureUsage || globalThis.GPUTextureUsage || null;\r\n this._gpu = options.gpu ?? globalThis.navigator?.gpu ?? null;\r\n this._alphaMode = options.alphaMode ?? \"opaque\";\r\n this._sampleCount = options.sampleCount ?? 1;\r\n this._depthFormat = options.depthFormat ?? null;\r\n this._format = options.format ?? null;\r\n this._extraUsage = options.extraUsage ?? 0;\r\n }\r\n\r\n /** The presentation format the canvas is configured with. */\r\n GetFormat()\r\n {\r\n return this._format;\r\n }\r\n\r\n /**\r\n * The depth attachment's format, or null when there is no depth.\r\n *\r\n * The field existed from the start and nothing could read it, so the value\r\n * reached a pipeline only by being passed separately into the batch\r\n * resolver's constructor. A pipeline description assembled from bound state\r\n * has no constructor to receive it, and asking the target that owns it is\r\n * both shorter and impossible to disagree with.\r\n *\r\n * @returns {string|null} A `GPUTextureFormat`, or null.\r\n */\r\n GetDepthFormat()\r\n {\r\n return this._depthFormat;\r\n }\r\n\r\n /** The current attachment size. */\r\n GetSize()\r\n {\r\n return { width: this._width, height: this._height };\r\n }\r\n\r\n // CARBON'S TEXTURE ACCESSORS, so this can BE a bound render target rather\r\n // than needing an adapter to become one. `Tr2TextureAL` answers `GetWidth`\r\n // and `GetHeight`, and the abstraction layer resets the viewport from\r\n // whatever is bound at slot zero by asking exactly those two questions\r\n // (`Tr2RenderContextMetal.mm:762-766`). Without them a target has to be\r\n // wrapped at every call site, and the first one that forgets gets a viewport\r\n // left at the previous pass's size - the 2048 shadow-map defect.\r\n\r\n /** The bound width, as `Tr2TextureAL::GetWidth` answers it. @returns {number} */\r\n GetWidth()\r\n {\r\n return this._width;\r\n }\r\n\r\n /** The bound height, as `Tr2TextureAL::GetHeight` answers it. @returns {number} */\r\n GetHeight()\r\n {\r\n return this._height;\r\n }\r\n\r\n /** The multisample count every attachment is created with. */\r\n GetSampleCount()\r\n {\r\n return this._sampleCount;\r\n }\r\n\r\n /**\r\n * Configures the canvas context and sizes every attachment.\r\n *\r\n * Idempotent for an unchanged size, format and device generation, so a caller\r\n * may invoke it each frame without recreating anything. A generation change\r\n * reconfigures unconditionally, because the previous device's configuration\r\n * does not carry over.\r\n */\r\n Configure(options = {})\r\n {\r\n this._AssertLive();\r\n\r\n const width = positiveSize(options.width ?? this._width, \"width\");\r\n const height = positiveSize(options.height ?? this._height, \"height\");\r\n const generation = this._webgpu.GetGeneration();\r\n const device = this._webgpu.GetDevice();\r\n\r\n if (!this._context)\r\n {\r\n this._context = this._canvas?.getContext?.(\"webgpu\") ?? null;\r\n if (!this._context) fail(\"the canvas does not provide a webgpu context\");\r\n }\r\n\r\n if (!this._format)\r\n {\r\n this._format = options.format\r\n ?? this._gpu?.getPreferredCanvasFormat?.()\r\n ?? fail(\"a presentation format is required when the browser reports no preferred one\");\r\n }\r\n\r\n const changed = generation !== this._generation\r\n || width !== this._width\r\n || height !== this._height;\r\n\r\n if (!changed) return this;\r\n\r\n // The canvas backing store drives the surface size, so it is set before the\r\n // context is configured rather than after.\r\n if (this._canvas)\r\n {\r\n this._canvas.width = width;\r\n this._canvas.height = height;\r\n }\r\n\r\n const usage = this._RequireUsage();\r\n\r\n // EXTRA USAGE IS THE CALLER'S TO ASK FOR, because the surface is theirs to\r\n // read. A frame that has to be counted back needs COPY_SRC, and hardcoding\r\n // RENDER_ATTACHMENT alone silently makes that impossible - the readback\r\n // fails at copy time, long after the configure that caused it. Defaults to\r\n // nothing extra, so nobody pays for a capability they did not ask for.\r\n this._context.configure({\r\n device,\r\n format: this._format,\r\n alphaMode: this._alphaMode,\r\n usage: usage.RENDER_ATTACHMENT | (this._extraUsage ?? 0)\r\n });\r\n\r\n this._width = width;\r\n this._height = height;\r\n this._generation = generation;\r\n this._ReleaseAttachments();\r\n this._CreateAttachments(device, usage);\r\n this._frame = null;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Acquires this frame's colour texture view and the matching attachments.\r\n *\r\n * A new frame invalidates the previous one. The returned record is the only\r\n * legal source of a view for the frame it belongs to.\r\n */\r\n AcquireFrame()\r\n {\r\n this._AssertLive();\r\n if (!this._context || !this._width) fail(\"Configure must run before a frame is acquired\");\r\n if (this._generation !== this._webgpu.GetGeneration())\r\n {\r\n fail(\"the device generation changed; Configure must run again before acquiring a frame\");\r\n }\r\n\r\n const texture = this._context.getCurrentTexture();\r\n if (!texture) fail(\"the canvas context returned no current texture\");\r\n\r\n if (this._frame) this._frame.valid = false;\r\n\r\n const view = texture.createView();\r\n this._frame = {\r\n valid: true,\r\n generation: this._generation,\r\n // With multisampling the pass renders into the multisample attachment and\r\n // resolves into the canvas; without it the canvas is the render target.\r\n colorView: this._multisample ? this._multisample.view : view,\r\n resolveView: this._multisample ? view : null,\r\n depthView: this._depth ? this._depth.view : null\r\n };\r\n\r\n return { ...this._frame };\r\n }\r\n\r\n /**\r\n * Builds a render-pass descriptor for an acquired frame.\r\n *\r\n * `clearColor` omitted means the colour attachment LOADS rather than clears,\r\n * which is how a second pass over the same target composites. The divergence\r\n * decision prefers attachment load operations to an explicit clear operation,\r\n * so clearing is expressed here and never as a separate draw.\r\n */\r\n CreateRenderPassDescriptor(frame, options = {})\r\n {\r\n this._AssertLive();\r\n this._AssertFrame(frame);\r\n\r\n const clearColor = options.clearColor ?? null;\r\n const colorAttachment = {\r\n view: frame.colorView,\r\n loadOp: clearColor ? \"clear\" : \"load\",\r\n storeOp: \"store\"\r\n };\r\n if (clearColor) colorAttachment.clearValue = clearColor;\r\n if (frame.resolveView) colorAttachment.resolveTarget = frame.resolveView;\r\n\r\n const descriptor = {\r\n label: options.label,\r\n colorAttachments: [ colorAttachment ]\r\n };\r\n\r\n if (frame.depthView)\r\n {\r\n const clearDepth = options.clearDepth;\r\n descriptor.depthStencilAttachment = {\r\n view: frame.depthView,\r\n depthLoadOp: clearDepth === undefined ? \"load\" : \"clear\",\r\n depthStoreOp: options.discardDepth ? \"discard\" : \"store\",\r\n ...(clearDepth === undefined ? {} : { depthClearValue: clearDepth })\r\n };\r\n }\r\n else if (options.clearDepth !== undefined)\r\n {\r\n fail(\"clearDepth was given but this target has no depth attachment\");\r\n }\r\n\r\n return descriptor;\r\n }\r\n\r\n /**\r\n * Applies viewport and scissor to an open pass.\r\n *\r\n * Both default to the whole target. WebGPU treats these as encoder state\r\n * inside a pass rather than as context state, so they are applied per pass\r\n * and never persist across one.\r\n */\r\n ApplyViewport(pass, options = {})\r\n {\r\n this._AssertLive();\r\n if (typeof pass?.setViewport !== \"function\") fail(\"a GPURenderPassEncoder is required\");\r\n\r\n const viewport = options.viewport ?? null;\r\n const scissor = options.scissor ?? null;\r\n\r\n if (viewport)\r\n {\r\n this._AssertInside(viewport, \"viewport\");\r\n pass.setViewport(\r\n viewport.x, viewport.y, viewport.width, viewport.height,\r\n viewport.minDepth ?? 0, viewport.maxDepth ?? 1\r\n );\r\n }\r\n else\r\n {\r\n pass.setViewport(0, 0, this._width, this._height, 0, 1);\r\n }\r\n\r\n if (typeof pass.setScissorRect !== \"function\") return this;\r\n\r\n if (scissor)\r\n {\r\n this._AssertInside(scissor, \"scissor\");\r\n pass.setScissorRect(scissor.x, scissor.y, scissor.width, scissor.height);\r\n }\r\n else\r\n {\r\n pass.setScissorRect(0, 0, this._width, this._height);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** Releases every attachment this target created. The canvas is the caller's. */\r\n Destroy()\r\n {\r\n if (this._destroyed) return this;\r\n this._destroyed = true;\r\n if (this._frame) this._frame.valid = false;\r\n this._frame = null;\r\n this._ReleaseAttachments();\r\n // Unconfiguring returns the surface; the canvas element itself is not ours\r\n // to remove, and a caller may configure a new target against it.\r\n this._context?.unconfigure?.();\r\n return this;\r\n }\r\n\r\n /** Creates owned multisample and depth attachments for the current size. */\r\n _CreateAttachments(device, usage)\r\n {\r\n if (this._sampleCount > 1)\r\n {\r\n const texture = device.createTexture({\r\n label: \"CjsWebgpuRenderTarget.multisample\",\r\n size: { width: this._width, height: this._height, depthOrArrayLayers: 1 },\r\n sampleCount: this._sampleCount,\r\n format: this._format,\r\n usage: usage.RENDER_ATTACHMENT\r\n });\r\n this._multisample = { texture, view: texture.createView() };\r\n }\r\n\r\n if (this._depthFormat)\r\n {\r\n // Same size and sample count as the colour attachment, which is what\r\n // beginRenderPass validates and what a stale depth texture violates.\r\n const texture = device.createTexture({\r\n label: \"CjsWebgpuRenderTarget.depth\",\r\n size: { width: this._width, height: this._height, depthOrArrayLayers: 1 },\r\n sampleCount: this._sampleCount,\r\n format: this._depthFormat,\r\n usage: usage.RENDER_ATTACHMENT\r\n });\r\n this._depth = { texture, view: texture.createView() };\r\n }\r\n }\r\n\r\n /** Destroys and forgets every owned attachment. */\r\n _ReleaseAttachments()\r\n {\r\n this._depth?.texture?.destroy?.();\r\n this._multisample?.texture?.destroy?.();\r\n this._depth = null;\r\n this._multisample = null;\r\n }\r\n\r\n /** Gets the validated texture-usage vocabulary supplied by the host. */\r\n _RequireUsage()\r\n {\r\n const usage = this._textureUsage;\r\n if (!usage || !Number.isInteger(usage.RENDER_ATTACHMENT))\r\n {\r\n fail(\"the GPUTextureUsage RENDER_ATTACHMENT constant is required\");\r\n }\r\n return usage;\r\n }\r\n\r\n /** Throws when this target has already been destroyed. */\r\n _AssertLive()\r\n {\r\n if (this._destroyed) fail(\"the render target is destroyed\");\r\n }\r\n\r\n // Ordered so the message names the actual problem. A frame invalidated by a\r\n // later acquire, a resize or a device loss is STALE, and saying \"no frame\" of\r\n // one the caller is holding sends them looking in the wrong place.\r\n /** Validates that a frame belongs to the target's current generation. */\r\n _AssertFrame(frame)\r\n {\r\n if (!frame || typeof frame !== \"object\") fail(\"a frame acquired from this target is required\");\r\n if (!this._frame || !this._frame.valid\r\n || frame.generation !== this._generation\r\n || frame.colorView !== this._frame.colorView)\r\n {\r\n fail(\"the frame is stale; a canvas texture view is valid for one frame only\");\r\n }\r\n }\r\n\r\n /** Validates that one viewport or scissor rectangle lies inside the target. */\r\n _AssertInside(rect, name)\r\n {\r\n const values = [ rect.x, rect.y, rect.width, rect.height ];\r\n if (values.some((value) => !Number.isFinite(value) || value < 0))\r\n {\r\n fail(`${name} must have non-negative finite bounds`);\r\n }\r\n if (rect.x + rect.width > this._width || rect.y + rect.height > this._height)\r\n {\r\n fail(`${name} exceeds the ${this._width}x${this._height} target`);\r\n }\r\n }\r\n}\r\n"],"names":["fail","message","error","Error","code","positiveSize","value","name","Number","isInteger","CjsWebgpuRenderTarget","_webgpu","_canvas","_context","_format","_alphaMode","_extraUsage","_sampleCount","_depthFormat","_width","_height","_generation","_depth","_multisample","_frame","_destroyed","constructor","webgpu","options","CjsWebgpuDevice","canvas","context","_textureUsage","textureUsage","globalThis","GPUTextureUsage","_gpu","gpu","navigator","alphaMode","sampleCount","depthFormat","format","extraUsage","GetFormat","GetDepthFormat","GetSize","width","height","GetWidth","GetHeight","GetSampleCount","Configure","_AssertLive","generation","GetGeneration","device","GetDevice","getContext","getPreferredCanvasFormat","changed","usage","_RequireUsage","configure","RENDER_ATTACHMENT","_ReleaseAttachments","_CreateAttachments","AcquireFrame","texture","getCurrentTexture","valid","view","createView","colorView","resolveView","depthView","CreateRenderPassDescriptor","frame","_AssertFrame","clearColor","colorAttachment","loadOp","storeOp","clearValue","resolveTarget","descriptor","label","colorAttachments","clearDepth","depthStencilAttachment","depthLoadOp","undefined","depthStoreOp","discardDepth","depthClearValue","ApplyViewport","pass","setViewport","viewport","scissor","_AssertInside","x","y","minDepth","maxDepth","setScissorRect","Destroy","unconfigure","createTexture","size","depthOrArrayLayers","destroy","rect","values","some","isFinite"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,uBAAA,EAA0BF,OAAO,EAAE,CAAC;EAC5DC,KAAK,CAACE,IAAI,GAAG,kCAAkC;AAC/C,EAAA,MAAMF,KAAK;AACb;AAGA,SAASG,YAAYA,CAACC,KAAK,EAAEC,IAAI,EACjC;EACE,IAAI,CAACC,MAAM,CAACC,SAAS,CAACH,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,EACzC;AACEN,IAAAA,IAAI,CAAC,CAAA,EAAGO,IAAI,CAAA,2BAAA,CAA6B,CAAC;AAC5C,EAAA;AACA,EAAA,OAAOD,KAAK;AACd;;AAGA;AACO,MAAMI,qBAAqB,CAClC;EACEC,OAAO;AAEPC,EAAAA,OAAO,GAAG,IAAI;AAEdC,EAAAA,QAAQ,GAAG,IA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,QAAQ,EAAE7E,IAAI,CAAC,+CAA+C,CAAC;AAC9F,IAAA,IAAI,CAAC,IAAI,CAACwB,MAAM,IAAI,CAAC,IAAI,CAACA,MAAM,CAAC8C,KAAK,IACjCO,KAAK,CAACvB,UAAU,KAAK,IAAI,CAACjC,WAAW,IACrCwD,KAAK,CAACJ,SAAS,KAAK,IAAI,CAACjD,MAAM,CAACiD,SAAS,EAC9C;MACEzE,IAAI,CAAC,uEAAuE,CAAC;AAC/E,IAAA;AACF,EAAA;;AAEA;AACAoG,EAAAA,aAAaA,CAACY,IAAI,EAAEzG,IAAI,EACxB;AACE,IAAA,MAAM0G,MAAM,GAAG,CAAED,IAAI,CAACX,CAAC,EAAEW,IAAI,CAACV,CAAC,EAAEU,IAAI,CAACjE,KAAK,EAAEiE,IAAI,CAAChE,MAAM,CAAE;AAC1D,IAAA,IAAIiE,MAAM,CAACC,IAAI,CAAE5G,KAAK,IAAK,CAACE,MAAM,CAAC2G,QAAQ,CAAC7G,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,CAAC,EAChE;AACEN,MAAAA,IAAI,CAAC,CAAA,EAAGO,IAAI,CAAA,qCAAA,CAAuC,CAAC;AACtD,IAAA;IACA,IAAIyG,IAAI,CAACX,CAAC,GAAGW,IAAI,CAACjE,KAAK,GAAG,IAAI,CAAC5B,MAAM,IAAI6F,IAAI,CAACV,CAAC,GAAGU,IAAI,CAAChE,MAAM,GAAG,IAAI,CAAC5B,OAAO,EAC5E;AACEpB,MAAAA,IAAI,CAAC,CAAA,EAAGO,IAAI,CAAA,aAAA,EAAgB,IAAI,CAACY,MAAM,CAAA,CAAA,EAAI,IAAI,CAACC,OAAO,CAAA,OAAA,CAAS,CAAC;AACnE,IAAA;AACF,EAAA;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"samplerSource.js","sources":["../../../../../src/trinityal/webgpu/core/samplerSource.js"],"sourcesContent":["// An effect's declared sampler to a realized WebGPU sampler.\n//\n// The mirror of CjsWebgpuTextureSource, and much shorter, because a sampler\n// needs nothing loaded. Its state is authored INTO the effect container and\n// arrives on the binding record itself, so resolution is synchronous and has no\n// resource path, no network and no first-frame absence.\n//\n// The one thing worth knowing is what a sampler is NOT: it is not paired with a\n// texture here. Carbon shares samplers across textures and stores the t#/s#\n// pairing only in the DXBC operands - quadv5 binds nine textures against a\n// single s0 - so a source that tried to hand out one sampler per texture would\n// be inventing a relationship the container does not express. See\n// /docs/contracts/texture-sampler-pairing.md.\nimport { CarbonSamplerDescriptor } from \"./samplerDescriptor.js\";\n\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuSamplerSource: ${message}`);\n error.code = \"CJS_WEBGPU_SAMPLER_SOURCE_INVALID\";\n throw error;\n}\n\n\n/** Resolves an effect's declared samplers against one device. */\nexport class CjsWebgpuSamplerSource\n{\n _webgpu;\n\n /** Descriptor cache key to the in-flight or settled sampler. */\n _created = new Map();\n\n /**\n * @param {object} webgpu Canonical WebGPU device.\n */\n constructor(webgpu)\n {\n if (!webgpu) fail(\"a WebGPU device is required\");\n\n this._webgpu = webgpu;\n }\n\n /**\n * The sampler for one declared binding.\n *\n * Keyed on the translated descriptor rather than on the binding's name,\n * because the name is scoped to one pass while the state is not: every pass\n * authoring the same state wants the same sampler, and s0 in two effects is\n * two different bindings that may well be one sampler.\n *\n * @param {string} name Binding name, for diagnostics.\n * @param {object} material Trinity material, unused; kept for the hook shape.\n * @param {object} binding Declared binding record carrying the authored state.\n * @returns {Promise<object>} Realized sampler handle.\n */\n async Resolve(name, material, binding)\n {\n const authored = binding?.carbon?.sampler;\n\n if (!authored)\n {\n fail(`sampler binding \"${name}\" carries no authored state, so there is nothing to translate`);\n }\n\n // Keyed BEFORE the label is attached. The label carries the binding name,\n // so keying on it would give two names with identical state two samplers,\n // which is the sharing this cache exists to do.\n const descriptor = CarbonSamplerDescriptor(authored);\n const key = JSON.stringify(descriptor);\n const existing = this._created.get(key);\n\n if (existing) return existing;\n\n const created = this._webgpu.CreateSampler({ ...descriptor, label: `effect sampler ${name}` });\n\n this._created.set(key, created);\n\n return created;\n }\n\n /**\n * A resolver hook bound to this source.\n *\n * @returns {Function} `(name, material, binding) => Promise<object>`\n */\n ResolveSampler()\n {\n return (name, material, binding) => this.Resolve(name, material, binding);\n }\n\n /** Forgets every sampler, so a device loss can rebuild them. */\n Clear()\n {\n this._created.clear();\n }\n}\n"],"names":["fail","message","error","Error","code","CjsWebgpuSamplerSource","_webgpu","_created","Map","constructor","webgpu","Resolve","name","material","binding","authored","carbon","sampler","descriptor","CarbonSamplerDescriptor","key","JSON","stringify","existing","get","created","CreateSampler","label","set","ResolveSampler","Clear","clear"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,wBAAA,EAA2BF,OAAO,EAAE,CAAC;EAC7DC,KAAK,CAACE,IAAI,GAAG,mCAAmC;AAChD,EAAA,MAAMF,KAAK;AACb;;AAGA;AACO,MAAMG,sBAAsB,CACnC;EACEC,OAAO;;AAEP;AACAC,EAAAA,QAAQ,GAAG,IAAIC,GAAG,EAAE;;AAEpB;AACF;AACA;EACEC,WAAWA,CAACC,MAAM,EAClB;AACE,IAAA,IAAI,CAACA,MAAM,EAAEV,IAAI,CAAC,6BAA6B,CAAC;IAEhD,IAAI,CAACM,OAAO,GAAGI,MAAM;AACvB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACE,EAAA,MAAMC,OAAOA,CAACC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EACrC;AACE,IAAA,MAAMC,QAAQ,GAAGD,OAAO,EAAEE,MAAM,EAAEC,OAAO;IAEzC,IAAI,CAACF,QAAQ,EACb;AACEf,MAAAA,IAAI,CAAC,CAAA,iBAAA,EAAoBY,IAAI,CAAA,6DAAA,CAA+D,CAAC;AAC/F,IAAA;;AAEA;AACA;AACA;AACA,IAAA,MAAMM,UAAU,GAAGC,uBAAuB,CAACJ,QAAQ,CAAC;AACpD,IAAA,MAAMK,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACJ,UAAU,CAAC;IACtC,MAAMK,QAAQ,GAAG,IAAI,CAAChB,QAAQ,CAACiB,GAAG,CAACJ,GAAG,CAAC;IAEvC,IAAIG,QAAQ,EAAE,OAAOA,QAAQ;AAE7B,IAAA,MAAME,OAAO,GAAG,IAAI,CAACnB,OAAO,CAACoB,aAAa,CAAC;AAAE,MAAA,GAAGR,UAAU;MAAES,KAAK,EAAE,kBAAkBf,IAAI,CAAA;AAAG,KAAC,CAAC;IAE9F,IAAI,CAACL,QAAQ,CAACqB,GAAG,CAACR,GAAG,EAAEK,OAAO,CAAC;AAE/B,IAAA,OAAOA,OAAO;AAChB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACEI,EAAAA,cAAcA,GACd;AACE,IAAA,OAAO,CAACjB,IAAI,EAAEC,QAAQ,EAAEC,OAAO,KAAK,IAAI,CAACH,OAAO,CAACC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAAC;AAC3E,EAAA;;AAEA;AACAgB,EAAAA,KAAKA,GACL;AACE,IAAA,IAAI,CAACvB,QAAQ,CAACwB,KAAK,EAAE;AACvB,EAAA;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"textureSource.js","sources":["../../../../../src/trinityal/webgpu/core/textureSource.js"],"sourcesContent":["// An effect's named texture to a realized WebGPU texture.\n//\n// This is the last link of the chain and the one that was genuinely missing.\n// Both ends already worked: the format readers decode dds, png, jpeg, tga, gif\n// and webp, and CjsWebgpuDevice realizes a published payload. Nothing joined\n// them, because `TriTextureParameter.SetResource` is never called from src, so\n// an authored texture path never became a bound texture.\n//\n// Carbon binds an already-created texture: TriTextureParameter holds\n// `m_cachedTexture` and CopyToResourceSet hands it straight to the resource-set\n// description (TriTextureParameter.cpp:177-186). Realization happened when the\n// resource loaded, long before the draw.\n//\n// A BROWSER CANNOT DO THAT, and this is the one honest deviation. A texture\n// arrives over the network, so the first frame that wants it may be earlier\n// than the frame that has it. Resolution is therefore asynchronous and\n// idempotent: the same name resolves to the same texture for the life of the\n// resource, and a caller awaits once rather than polling.\n//\n// The sRGB flag travels with the binding, not with the texture: the same bytes\n// are read as colour by one effect and as data by another, which is why Carbon\n// carries it in the resource FLAGS rather than in the texture. See\n// /docs/contracts/texture-sampler-pairing.md for why the sampler pairing cannot\n// come from here.\nimport { ResourceRequirement } from \"#resource/ResourceRequirement\";\n\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuTextureSource: ${message}`);\n error.code = \"CJS_WEBGPU_TEXTURE_SOURCE_INVALID\";\n throw error;\n}\n\n\n/** Resolves an effect's named textures against one device and resource manager. */\nexport class CjsWebgpuTextureSource\n{\n _webgpu;\n\n _resourceManager;\n\n _adapterKey;\n\n /** Resource path to the in-flight or settled realization. */\n _realized = new Map();\n\n /**\n * @param {object} webgpu Canonical WebGPU device.\n * @param {object} options Composition.\n * @param {object} options.resourceManager Loads textures by path.\n * @param {string} [options.adapterKey] Adapter slot the realization publishes into.\n */\n constructor(webgpu, options = {})\n {\n if (!webgpu) fail(\"a WebGPU device is required\");\n if (!options.resourceManager) fail(\"a resource manager is required to load textures by path\");\n\n this._webgpu = webgpu;\n this._resourceManager = options.resourceManager;\n this._adapterKey = options.adapterKey ?? \"webgpu\";\n }\n\n /**\n * The realized texture for one of an effect's named resources.\n *\n * Named rather than pathed, because the shader binds by name and only the\n * effect knows which file that name currently points at - a skin changes the\n * path and not the name.\n *\n * @param {string} name Effect resource name, as the shader declares it.\n * @param {object} material Trinity material owning the resource.\n * @returns {Promise<object>} Realized texture bundle.\n */\n async Resolve(name, material)\n {\n const parameter = material?.GetResourceByName?.(name) ?? null;\n\n if (!parameter)\n {\n fail(`effect declares no resource named \"${name}\", so nothing says which file to bind`);\n }\n\n const path = parameter.resourcePath ?? parameter.GetResourcePath?.() ?? \"\";\n\n if (!path)\n {\n fail(`effect resource \"${name}\" names no path; an unset texture cannot be bound`);\n }\n\n const existing = this._realized.get(path);\n\n // Shared rather than re-entered: two batches binding the same texture in one\n // frame is the ordinary case, and realizing it twice would allocate twice.\n if (existing) return existing;\n\n const realization = this._Realize(path, name);\n\n this._realized.set(path, realization);\n\n return realization;\n }\n\n /**\n * Loads and realizes one texture path.\n *\n * @param {string} path Resource path.\n * @param {string} name Effect resource name, for diagnostics.\n * @returns {Promise<object>} Realized bundle.\n */\n async _Realize(path, name)\n {\n const resource = this._resourceManager.GetResource(path, {\n requirement: ResourceRequirement.TEXTURE\n });\n\n if (!resource) fail(`no resource for \"${name}\" at ${JSON.stringify(path)}`);\n\n // The resource publishes its CPU payload before an adapter can be made from\n // it; a texture still in flight is not an error, it is the normal first\n // frame.\n await resource.Ready?.();\n\n return this._webgpu.RealizeRgba8Texture(resource, {\n textureKey: name,\n bundleLabel: `effect texture ${name}`,\n adapterKey: this._adapterKey\n });\n }\n\n /**\n * A resolver hook bound to this source.\n *\n * @returns {Function} `(name, material) => Promise<object>`\n */\n ResolveTexture()\n {\n return (name, material) => this.Resolve(name, material);\n }\n\n /** Forgets every realization, so a device loss can rebuild them. */\n Clear()\n {\n this._realized.clear();\n }\n}\n"],"names":["fail","message","error","Error","code","CjsWebgpuTextureSource","_webgpu","_resourceManager","_adapterKey","_realized","Map","constructor","webgpu","options","resourceManager","adapterKey","Resolve","name","material","parameter","GetResourceByName","path","resourcePath","GetResourcePath","existing","get","realization","_Realize","set","resource","GetResource","requirement","ResourceRequirement","TEXTURE","JSON","stringify","Ready","RealizeRgba8Texture","textureKey","bundleLabel","ResolveTexture","Clear","clear"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAASA,IAA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AAK,EAAE;AACxB,EAAA;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trinityBatchDispatcher.js","sources":["../../../../../src/trinityal/webgpu/core/trinityBatchDispatcher.js"],"sourcesContent":["import { CjsWebgpuDevice } from \"../CjsWebgpuDevice.js\";\nimport { CjsTrinityBatchDispatcher } from \"#trinity/core/batch/CjsTrinityBatchDispatcher\";\nimport { CjsTrinityBatchResolver } from \"#trinity/core/batch/CjsTrinityBatchResolver\";\nimport { ITriRenderBatchAccumulator } from \"#trinity/core/batch/ITriRenderBatchAccumulator\";\nimport { Tr2RenderBatch } from \"#trinity/core/batch/Tr2RenderBatch\";\nimport { TriRenderBatchMap } from \"#trinity/core/batch/TriRenderBatchMap\";\nimport { CjsWebgpuEncodeState, DeriveBatchGroups } from \"./batchGroups.js\";\n// Re-exported so existing importers keep working while this file lives; the\n// table itself moved to topology.js, which is not going away.\nimport { TOPOLOGIES } from \"./topology.js\";\n\nexport { TOPOLOGIES };\n\nconst MAX_GPU_SIZE_32 = 0xffffffff;\n\n\nconst PREPARED_BATCHES = new WeakMap();\nconst PREPARED_ACCUMULATORS = new WeakMap();\nconst PREPARED_BATCH_MAPS = new WeakMap();\nconst EMPTY_CONTEXT = Object.freeze({});\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuTrinityBatchDispatcher: ${message}`);\n error.code = \"CJS_WEBGPU_TRINITY_BATCH_INVALID\";\n throw error;\n}\n\nfunction gpuSize32(value, name, owner = \"batch\")\n{\n if (!Number.isSafeInteger(value) || value < 0 || value > MAX_GPU_SIZE_32)\n {\n fail(`${owner} ${name} must be a GPUSize32 value`);\n }\n return value;\n}\n\nfunction signedOffset32(value, name)\n{\n if (!Number.isSafeInteger(value) || value < -0x80000000 || value > 0x7fffffff)\n {\n fail(`resolved geometry draw ${name} must be a GPUSignedOffset32 value`);\n }\n return value;\n}\n\nfunction signedBaseVertex(value)\n{\n const bits = gpuSize32(value, \"baseVertexLocation\");\n return bits > 0x7fffffff ? bits - 0x100000000 : bits;\n}\n\nfunction preparationContext(value)\n{\n if (value === undefined) return EMPTY_CONTEXT;\n if (!value || typeof value !== \"object\" || Array.isArray(value))\n {\n fail(\"preparation context must be an object\");\n }\n const context = { ...value };\n if (context.batchType !== undefined\n && (!Number.isInteger(context.batchType) || context.batchType < 0))\n {\n fail(\"preparation context batchType must be a non-negative integer\");\n }\n return context;\n}\n\n/** Carbon's DEFAULT_TECHNIQUE (Tr2RenderContext.h:37). */\nconst DEFAULT_TECHNIQUE = \"Main\";\n\n/**\n * How many passes this batch's material draws, the way Carbon asks\n * (Tr2RenderContext.cpp:463-471): the material's shader state interface for the\n * technique index, then its pass count, returning zero for either miss so the\n * batch emits nothing.\n *\n * A material that cannot answer draws ONE pass. Carbon has no such material -\n * it always holds a Tr2Material - but a caller that resolves its own pipeline\n * without Trinity reflection means exactly one thing to draw, and refusing it\n * would reject the composition boundary's whole point.\n */\nfunction passCountOf(material, techniqueName)\n{\n // EXPLICIT PROBES, not hedges, and the line below already asked this way.\n // The boundary deliberately accepts a caller's own material - see the\n // paragraph above - so \"does this object answer\" is the real question here.\n const shader = typeof material.GetShaderStateInterface === \"function\"\n ? material.GetShaderStateInterface()\n : null;\n\n if (!shader || typeof shader.GetTechniqueIndex !== \"function\") return 1;\n\n const techniqueIndex = shader.GetTechniqueIndex(techniqueName);\n\n if (!Number.isInteger(techniqueIndex) || techniqueIndex < 0) return 0;\n\n return typeof shader.GetPassCount === \"function\" ? shader.GetPassCount(techniqueIndex) : 0;\n}\n\nfunction geometryDraw(value, indexed)\n{\n if (!value || typeof value !== \"object\" || Array.isArray(value))\n {\n fail(\"ResolveGeometry draw must be an object\");\n }\n if (indexed)\n {\n return {\n indexCount: gpuSize32(value.indexCount, \"indexCount\", \"resolved geometry draw\"),\n instanceCount: gpuSize32(value.instanceCount, \"instanceCount\", \"resolved geometry draw\"),\n firstIndex: gpuSize32(value.firstIndex, \"firstIndex\", \"resolved geometry draw\"),\n baseVertex: signedOffset32(value.baseVertex, \"baseVertex\"),\n firstInstance: gpuSize32(value.firstInstance, \"firstInstance\", \"resolved geometry draw\")\n };\n }\n return {\n vertexCount: gpuSize32(value.vertexCount, \"vertexCount\", \"resolved geometry draw\"),\n instanceCount: gpuSize32(value.instanceCount, \"instanceCount\", \"resolved geometry draw\"),\n firstVertex: gpuSize32(value.firstVertex, \"firstVertex\", \"resolved geometry draw\"),\n firstInstance: gpuSize32(value.firstInstance, \"firstInstance\", \"resolved geometry draw\")\n };\n}\n\nfunction batchDraw(batch, indexed)\n{\n const count = gpuSize32(batch.indexCountPerInstance, \"indexCountPerInstance\");\n const instanceCount = gpuSize32(batch.instanceCount, \"instanceCount\");\n const first = gpuSize32(batch.startIndexLocation, \"startIndexLocation\");\n const firstInstance = gpuSize32(batch.startInstanceLocation, \"startInstanceLocation\");\n if (indexed)\n {\n return {\n indexCount: count,\n instanceCount,\n firstIndex: first,\n baseVertex: signedBaseVertex(batch.baseVertexLocation),\n firstInstance\n };\n }\n return {\n vertexCount: count,\n instanceCount,\n firstVertex: first,\n firstInstance\n };\n}\n\nfunction pipelineRecipe(recipe, topology)\n{\n if (!recipe || typeof recipe !== \"object\" || Array.isArray(recipe))\n {\n fail(\"ResolveMaterial must return a pipeline recipe\");\n }\n const primitive = recipe.primitive ?? {};\n if (!primitive || typeof primitive !== \"object\" || Array.isArray(primitive))\n {\n fail(\"resolved pipeline primitive recipe must be an object\");\n }\n if (primitive.topology !== undefined && primitive.topology !== topology)\n {\n fail(`batch topology ${topology} conflicts with resolved pipeline topology ${primitive.topology}`);\n }\n return {\n ...recipe,\n primitive: {\n ...primitive,\n topology\n }\n };\n}\n\n/**\n * Engine-side adapter for canonical Trinity render batches.\n *\n * Trinity supplies transient CPU references and draw arguments. A nominal\n * composition resolver maps those references to WebGPU-owned material,\n * geometry, and binding objects.\n */\nexport class CjsWebgpuTrinityBatchDispatcher extends CjsTrinityBatchDispatcher\n{\n _webgpu;\n\n _resolver;\n\n /**\n * @param {CjsWebgpuDevice} webgpu Canonical WebGPU device.\n * @param {CjsTrinityBatchResolver} resolver Backend composition resolver.\n * @param {Function} resolver.ResolveMaterial Resolves batch material to\n * { pipeline, recipe, prepareOptions? }; receives immutable preparation\n * context as its third argument.\n * @param {Function} resolver.ResolveGeometry Resolves geometrySource to\n * { geometry, indexed, draw? }; a draw override supplies arguments derived\n * from deferred geometry areas and realized buffer packing. Receives\n * preparation context as its third argument.\n * @param {Function} resolver.ResolveBindings Resolves batch/object data to\n * { uniformData, resources }; receives preparation context as its third\n * argument.\n */\n constructor(webgpu, resolver)\n {\n super();\n if (!(webgpu instanceof CjsWebgpuDevice))\n {\n fail(\"webgpu boundary requires a CjsWebgpuDevice\");\n }\n if (!(resolver instanceof CjsTrinityBatchResolver))\n {\n fail(\"composition resolver requires a CjsTrinityBatchResolver\");\n }\n this._webgpu = webgpu;\n this._resolver = resolver;\n }\n\n /**\n * Resolves and validates one transient Trinity batch into a generation-bound\n * WebGPU draw. External geometry and resources remain owned by their\n * resolvers; the returned handle owns only its binding set.\n */\n async Prepare(batch, context = undefined)\n {\n const preparedContext = preparationContext(context);\n if (!(batch instanceof Tr2RenderBatch)) fail(\"batch must be a Tr2RenderBatch\");\n if (batch.material === null || batch.material === undefined) fail(\"batch material is required\");\n if (batch.geometrySource === null || batch.geometrySource === undefined)\n {\n fail(\"batch geometrySource is required\");\n }\n const topology = TOPOLOGIES[batch.topology];\n if (!topology) fail(`batch topology ${batch.topology} is unsupported`);\n\n // Carbon bails before touching the device when the technique is absent or\n // draws nothing (Tr2RenderContext.cpp:465-471), and so does this.\n const passCount = passCountOf(batch.material, preparedContext.techniqueName ?? DEFAULT_TECHNIQUE);\n\n if (!passCount) return null;\n\n const material = await this._resolver.ResolveMaterial(\n batch.material,\n batch,\n { ...preparedContext, passIndex: 0 }\n );\n if (!material || typeof material !== \"object\" || material.pipeline == null)\n {\n fail(\"ResolveMaterial must return a pipeline and recipe\");\n }\n const geometry = await this._resolver.ResolveGeometry(\n batch.geometrySource,\n batch,\n preparedContext\n );\n if (!geometry || typeof geometry !== \"object\" || geometry.geometry == null\n || typeof geometry.indexed !== \"boolean\")\n {\n fail(\"ResolveGeometry must return geometry and an indexed boolean\");\n }\n const drawArguments = geometry.draw === undefined\n ? batchDraw(batch, geometry.indexed)\n : geometryDraw(geometry.draw, geometry.indexed);\n\n // Carbon resolves the shader program and render states per PASS and the\n // material data per pass as well (Tr2RenderContext.cpp:472-535), so a\n // multi-pass technique yields one pipeline and one binding set per pass over\n // the same geometry and the same draw arguments.\n const passes = [];\n\n try\n {\n for (let passIndex = 0; passIndex < passCount; passIndex += 1)\n {\n const passContext = { ...preparedContext, passIndex };\n\n const perPass = passIndex === 0\n ? material\n : await this._resolver.ResolveMaterial(batch.material, batch, passContext);\n\n if (!perPass || typeof perPass !== \"object\" || perPass.pipeline == null)\n {\n fail(`ResolveMaterial must return a pipeline and recipe for pass ${passIndex}`);\n }\n\n const prepared = await this._webgpu.PreparePipeline(\n perPass.pipeline,\n perPass.prepareOptions ?? { warningsAsErrors: true }\n );\n const livePipeline = await this._webgpu.CreateRenderPipeline(\n prepared,\n pipelineRecipe(perPass.recipe, topology)\n );\n const bindings = await this._resolver.ResolveBindings(batch, batch.objectData, passContext);\n\n if (!bindings || typeof bindings !== \"object\")\n {\n fail(\"ResolveBindings must return uniformData and resources\");\n }\n\n // Recorded BEFORE the draw is made, so a rejected draw still leaves its\n // binding set owned and destroyable by the rollback below.\n const entry = {\n passIndex,\n prepared,\n livePipeline,\n bindingSet: this._webgpu.CreateBindingSet(livePipeline, {\n uniformData: bindings.uniformData,\n resources: bindings.resources\n }),\n draw: null\n };\n\n passes.push(entry);\n\n entry.draw = this._webgpu.CreateDraw(livePipeline, {\n bindingSet: entry.bindingSet,\n geometry: geometry.geometry,\n draw: drawArguments\n });\n }\n }\n catch (error)\n {\n for (const entry of passes) entry.bindingSet.Destroy();\n throw error;\n }\n\n const handle = {\n batch,\n context: preparedContext,\n passes,\n // The first pass's members stay on the handle: grouping compares draws,\n // and a single-pass batch - which is nearly all of them - reads exactly\n // as it did before passes existed.\n prepared: passes[0].prepared,\n livePipeline: passes[0].livePipeline,\n bindingSet: passes[0].bindingSet,\n draw: passes[0].draw\n };\n\n PREPARED_BATCHES.set(handle, { owner: this, destroyed: false });\n\n return handle;\n }\n\n /**\n * Encodes one prepared batch into the supplied render pass.\n *\n * `encodeState` is optional and, when given, elides the sets a previous batch\n * in the same run already performed. A caller encoding a single batch omits\n * it and every set happens.\n */\n Encode(pass, handle, encodeState = null)\n {\n const state = PREPARED_BATCHES.get(handle);\n if (!state || state.owner !== this) fail(\"prepared batch belongs to another dispatcher\");\n if (state.destroyed) fail(\"prepared batch is destroyed\");\n for (const entry of handle.passes) this._webgpu.EncodeDraw(pass, entry.draw, encodeState);\n }\n\n /** Encodes one pass of a prepared batch, for the grouped pass-major walk. */\n _EncodePass(pass, handle, passIndex, encodeState)\n {\n const entry = handle.passes[passIndex];\n\n if (entry) this._webgpu.EncodeDraw(pass, entry.draw, encodeState);\n }\n\n /**\n * Encodes a batch vector run by run, hoisting each run's shared pipeline and\n * buffer bindings to its first batch, as Carbon's RenderBatchGroup hoists\n * them to the group.\n *\n * Order is preserved exactly. Runs are found among ADJACENT batches that\n * already agree; nothing is reordered, because sorting is Trinity's and a\n * reorder here would break golden-image comparison between backends.\n */\n _EncodeGrouped(pass, batches, encodeState)\n {\n for (const group of DeriveBatchGroups(batches, handle => handle?.draw))\n {\n // PASS-MAJOR, as Carbon's RenderBatchGroup is: every batch of the group\n // draws pass 0, then every batch draws pass 1\n // (Tr2RenderContext.cpp:472-535). Encoding batch-major instead would\n // interleave a two-pass effect's passes between objects and change what\n // lands on screen.\n let passCount = 0;\n for (let index = group.start; index < group.end; index += 1)\n {\n passCount = Math.max(passCount, batches[index]?.passes?.length ?? 0);\n }\n\n for (let passIndex = 0; passIndex < passCount; passIndex += 1)\n {\n for (let index = group.start; index < group.end; index += 1)\n {\n this._EncodePass(pass, batches[index], passIndex, encodeState);\n }\n }\n }\n }\n\n /** Releases the prepared batch's owned binding set. */\n Destroy(handle)\n {\n const state = PREPARED_BATCHES.get(handle);\n if (!state || state.owner !== this) fail(\"prepared batch belongs to another dispatcher\");\n if (state.destroyed) return;\n state.destroyed = true;\n for (const entry of handle.passes) entry.bindingSet.Destroy();\n }\n\n /**\n * Snapshots and prepares both vectors of one finalized\n * canonical Trinity batch accumulator. GDPR batches retain their\n * separate identity. Both vectors are grouped at encode time; preparation\n * stays per batch, because a binding set belongs to one batch.\n */\n async PrepareAccumulator(accumulator, context = undefined)\n {\n const preparedContext = preparationContext(context);\n if (!(accumulator instanceof ITriRenderBatchAccumulator))\n {\n fail(\"accumulator must be an ITriRenderBatchAccumulator\");\n }\n const gdprBatches = accumulator.GetGdprBatches();\n const batches = accumulator.GetBatches();\n if (!Array.isArray(gdprBatches) || !Array.isArray(batches))\n {\n fail(\"accumulator batch getters must return arrays\");\n }\n if (accumulator.GetBatchCount() !== gdprBatches.length + batches.length)\n {\n fail(\"accumulator batch count does not match its batch vectors\");\n }\n\n const preparedGdprBatches = [];\n const preparedBatches = [];\n try\n {\n for (const batch of gdprBatches)\n {\n preparedGdprBatches.push(await this.Prepare(batch, preparedContext));\n }\n for (const batch of batches)\n {\n preparedBatches.push(await this.Prepare(batch, preparedContext));\n }\n const handle = {\n accumulator,\n context: preparedContext,\n gdprBatches: preparedGdprBatches.slice(),\n batches: preparedBatches.slice()\n };\n PREPARED_ACCUMULATORS.set(handle, {\n owner: this,\n destroyed: false\n });\n return handle;\n }\n catch (error)\n {\n for (let index = preparedBatches.length - 1; index >= 0; index -= 1)\n {\n this.Destroy(preparedBatches[index]);\n }\n for (let index = preparedGdprBatches.length - 1; index >= 0; index -= 1)\n {\n this.Destroy(preparedGdprBatches[index]);\n }\n throw error;\n }\n }\n\n /**\n * Encodes GDPR then ordinary prepared batches in accumulator order, grouping\n * each vector into hoisted runs.\n *\n * One encode state spans both vectors because they are encoded into one pass\n * and pass state does not reset at a vector boundary; a redundant set there\n * would be as wasteful as one inside a run.\n */\n EncodeAccumulator(pass, handle)\n {\n const state = PREPARED_ACCUMULATORS.get(handle);\n if (!state || state.owner !== this) fail(\"prepared accumulator belongs to another dispatcher\");\n if (state.destroyed) fail(\"prepared accumulator is destroyed\");\n const encodeState = new CjsWebgpuEncodeState();\n this._EncodeGrouped(pass, handle.gdprBatches, encodeState);\n this._EncodeGrouped(pass, handle.batches, encodeState);\n }\n\n /** Releases every binding set owned by a prepared accumulator. */\n DestroyAccumulator(handle)\n {\n const state = PREPARED_ACCUMULATORS.get(handle);\n if (!state || state.owner !== this) fail(\"prepared accumulator belongs to another dispatcher\");\n if (state.destroyed) return;\n state.destroyed = true;\n for (let index = handle.batches.length - 1; index >= 0; index -= 1)\n {\n this.Destroy(handle.batches[index]);\n }\n for (let index = handle.gdprBatches.length - 1; index >= 0; index -= 1)\n {\n this.Destroy(handle.gdprBatches[index]);\n }\n }\n\n /**\n * Snapshots and prepares every accumulator in one\n * canonical TriRenderBatchMap without interpreting batch-type\n * meaning or selecting render passes.\n */\n async PrepareBatchMap(batchMap)\n {\n if (!(batchMap instanceof TriRenderBatchMap))\n {\n fail(\"batch map must be a TriRenderBatchMap\");\n }\n const batchTypes = batchMap.GetBatchTypes();\n if (!Array.isArray(batchTypes)) fail(\"batch map GetBatchTypes must return an array\");\n const seen = new Set();\n for (const batchType of batchTypes)\n {\n if (!Number.isInteger(batchType) || batchType < 0)\n {\n fail(\"batch map types must be non-negative integers\");\n }\n if (seen.has(batchType)) fail(`batch map duplicates batch type ${batchType}`);\n seen.add(batchType);\n }\n\n const entries = [];\n try\n {\n for (const batchType of batchTypes)\n {\n const accumulator = batchMap.GetAccumulator(batchType);\n if (!accumulator) fail(`batch map has no accumulator for type ${batchType}`);\n entries.push({\n batchType,\n accumulator: await this.PrepareAccumulator(accumulator, { batchType })\n });\n }\n const preparedCount = entries.reduce(\n (count, entry) => count\n + entry.accumulator.gdprBatches.length\n + entry.accumulator.batches.length,\n 0\n );\n if (batchMap.GetBatchCount() !== preparedCount)\n {\n fail(\"batch map count does not match its accumulators\");\n }\n const handle = {\n batchMap,\n entries: entries.slice()\n };\n PREPARED_BATCH_MAPS.set(handle, {\n owner: this,\n destroyed: false,\n entries: new Map(entries.map((entry) => [ entry.batchType, entry ]))\n });\n return handle;\n }\n catch (error)\n {\n for (let index = entries.length - 1; index >= 0; index -= 1)\n {\n this.DestroyAccumulator(entries[index].accumulator);\n }\n throw error;\n }\n }\n\n /**\n * Encodes one prepared batch type into a caller-selected compatible render\n * pass.\n */\n EncodeBatchType(pass, handle, batchType)\n {\n const state = PREPARED_BATCH_MAPS.get(handle);\n if (!state || state.owner !== this) fail(\"prepared batch map belongs to another dispatcher\");\n if (state.destroyed) fail(\"prepared batch map is destroyed\");\n const entry = state.entries.get(batchType);\n if (!entry) fail(`prepared batch map has no batch type ${batchType}`);\n this.EncodeAccumulator(pass, entry.accumulator);\n }\n\n /** Releases every accumulator and binding set owned by a prepared batch map. */\n DestroyBatchMap(handle)\n {\n const state = PREPARED_BATCH_MAPS.get(handle);\n if (!state || state.owner !== this) fail(\"prepared batch map belongs to another dispatcher\");\n if (state.destroyed) return;\n state.destroyed = true;\n for (let index = handle.entries.length - 1; index >= 0; index -= 1)\n {\n this.DestroyAccumulator(handle.entries[index].accumulator);\n }\n }\n}\n"],"names":["MAX_GPU_SIZE_32","PREPARED_BATCHES","WeakMap","PREPARED_ACCUMULATORS","PREPARED_BATCH_MAPS","EMPTY_CONTEXT","Object","freeze","fail","message","error","Error","code","gpuSize32","value","name","owner","Number","isSafeInteger","signedOffset32","signedBaseVertex","bits","preparationContext","undefined","Array","isArray","context","batchType","isInteger","DEFAULT_TECHNIQUE","passCountOf","material","techniqueName","shader","GetShaderStateInterface","GetTechniqueIndex","techniqueIndex","GetPassCount","geometryDraw","indexed","indexCount","instanceCount","firstIndex","baseVertex","firstInstance","vertexCount","firstVertex","batchDraw","batch","count","indexCountPerInstance","first","startIndexLocation","startInstanceLocation","baseVertexLocation","pipelineRecipe","recipe","topology","primitive","CjsWebgpuTrinityBatchDispatcher","CjsTrinityBatchDispatcher","_webgpu","_resolver","constructor","webgpu","resolver","CjsWebgpuDevice","CjsTrinityBatchResolver","Prepare","preparedContext","Tr2RenderBatch","geometrySource","TOPOLOGIES","passCount","ResolveMaterial","passIndex","pipeline","geometry","ResolveGeometry","drawArguments","draw","passes","passContext","perPass","prepared","PreparePipeline","prepareOptions","warningsAsErrors","livePipeline","CreateRenderPipeline","bindings","ResolveBindings","objectData","entry","bindingSet","CreateBindingSet","uniformData","resources","push","CreateDraw","Destroy","handle","set","destroyed","Encode","pass","encodeState","state","get","EncodeDraw","_EncodePass","_EncodeGrouped","batches","group","DeriveBatchGroups","index","start","end","Math","max","length","PrepareAccumulator","accumulator","ITriRenderBatchAccumulator","gdprBatches","GetGdprBatches","GetBatches","GetBatchCount","preparedGdprBatches","preparedBatches","slice","EncodeAccumulator","CjsWebgpuEncodeState","DestroyAccumulator","PrepareBatchMap","batchMap","TriRenderBatchMap","batchTypes","GetBatchTypes","seen","Set","has","add","entries","GetAccumulator","preparedCount","reduce","Map","map","EncodeBatchType","DestroyBatchMap"],"mappings":";;;;;;;;;AAaA,MAAMA,eAAe,GAAG,UAAU;AAGlC,MAAMC,gBAAgB,GAAG,IAAIC,OAAO,EAAE;AACtC,MAAMC,qBAAqB,GAAG,IAAID,OAAO,EAAE;AAC3C,MAAME,mBAAmB,GAAG,IAAIF,OAAO,EAAE;AACzC,MAAMG,aAAa,GAAGC,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;AAEvC,SAASC,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,iCAAA,EAAoCF,OAAO,EAAE,CAAC;EACtEC,KAAK,CAACE,IAAI,GAAG,kCAAkC;AAC/C,EAAA,MAAMF,KAAK;AACb;AAEA,SAASG,SAASA,CAACC,KAAK,EAAEC,IAAI,EAAEC,KA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AAC;IAC1C,IAAI,CAACkE,KAAK,EAAErF,IAAI,CAAC,CAAA,qCAAA,EAAwCmB,SAAS,EAAE,CAAC;IACrE,IAAI,CAACwG,iBAAiB,CAAC1B,IAAI,EAAEZ,KAAK,CAAC6B,WAAW,CAAC;AACjD,EAAA;;AAEA;EACA4B,eAAeA,CAACjD,MAAM,EACtB;AACE,IAAA,MAAMM,KAAK,GAAGvG,mBAAmB,CAACwG,GAAG,CAACP,MAAM,CAAC;AAC7C,IAAA,IAAI,CAACM,KAAK,IAAIA,KAAK,CAAC3F,KAAK,KAAK,IAAI,EAAER,IAAI,CAAC,kDAAkD,CAAC;IAC5F,IAAImG,KAAK,CAACJ,SAAS,EAAE;IACrBI,KAAK,CAACJ,SAAS,GAAG,IAAI;AACtB,IAAA,KAAK,IAAIY,KAAK,GAAGd,MAAM,CAAC0C,OAAO,CAACvB,MAAM,GAAG,CAAC,EAAEL,KAAK,IAAI,CAAC,EAAEA,KAAK,IAAI,CAAC,EAClE;MACE,IAAI,CAACkB,kBAAkB,CAAChC,MAAM,CAAC0C,OAAO,CAAC5B,KAAK,CAAC,CAACO,WAAW,CAAC;AAC5D,IAAA;AACF,EAAA;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trinityBatchResolver.js","sources":["../../../../../src/trinityal/webgpu/core/trinityBatchResolver.js"],"sourcesContent":["// The concrete resolver: a Trinity batch to WebGPU pipeline, geometry and\r\n// bindings.\r\n//\r\n// Carbon has no resolver class. This boundary stands in for what Carbon does\r\n// between a sorted batch and a draw call, and the mapping is one to one:\r\n//\r\n// ResolveMaterial <- Tr2Shader::ApplyAllStateForPass (Tr2Shader.cpp:157-166)\r\n// program handle + render states for THIS pass\r\n// ResolveGeometry <- SubmitGeometry (Tr2RenderContext.cpp:82-102)\r\n// vertex declaration, streams, index buffer, draw\r\n// ResolveBindings <- Tr2Material::ApplyMaterialDataForPass (Tr2Material.cpp:209-253)\r\n// plus Tr2PerObjectData::SetPerObjectDataToDevice\r\n//\r\n// WHY A PACKAGE AND NOT THE INTERNED BYTECODE. Carbon hands a stage's bytecode\r\n// to its abstraction layer, which builds the backend object\r\n// (Tr2EffectDescription.cpp:586). Ours cannot stop there: a WGSL pipeline needs\r\n// explicit bind-group layouts, which a stage blob does not carry and D3D never\r\n// had to describe. The container's own reader produces them, so the engine\r\n// reads the SAME BYTES the resource already holds - not a second fetch - and\r\n// the package is that read.\r\n//\r\n// The recipe is the mode's standard states with the pass's overlaid, exactly as\r\n// Carbon applies them (Tr2EffectStateManager.cpp:703-720). Reading the pass\r\n// alone would produce a pipeline missing most of its state.\r\nimport { CjsTrinityBatchResolver } from \"#trinity/core/batch/CjsTrinityBatchResolver\";\r\nimport { Tr2EffectStateManager } from \"#trinity/shader\";\r\nimport { Tr2PerObjectData } from \"#trinity/core/rawData/Tr2PerObjectData\";\r\nimport { resolveBindingPlan } from \"#trinityal/vertexLayoutMatch\";\r\nimport { CarbonVertexElements } from \"#trinity/core/vertex/vertexUsage\";\r\n\r\nimport { CjsWebgpuPackage } from \"../CjsWebgpuPackage.js\";\r\nimport { EFFECT_CONSTANTS, Tr2Renderer } from \"#trinity/core/Tr2Renderer\";\r\nimport { WebgpuGeometryOptions } from \"./geometryPlan.js\";\r\nimport { MaterialLayoutFromShader, PackMaterialConstants } from \"./materialConstants.js\";\r\n\r\n\r\nfunction fail(message)\r\n{\r\n const error = new Error(`CjsWebgpuTrinityBatchResolver: ${message}`);\r\n error.code = \"CJS_WEBGPU_RESOLVER_INVALID\";\r\n throw error;\r\n}\r\n\r\n\r\n\r\n/** Resolves Trinity batches against one WebGPU device. */\r\nexport class CjsWebgpuTrinityBatchResolver extends CjsTrinityBatchResolver\r\n{\r\n _webgpu;\r\n\r\n _createPackage;\r\n\r\n _techniqueName;\r\n\r\n _targets;\r\n\r\n _depthFormat;\r\n\r\n _resolvePerFrame;\r\n\r\n _resolveTexture;\r\n\r\n _resolveSampler;\r\n\r\n _resolveStorageBuffer;\r\n\r\n /** The renderer whose register map says which constant buffer is which. */\r\n _renderer;\r\n\r\n /** Effect resource to the package read from its own container bytes. */\r\n _packages = new WeakMap();\r\n\r\n /** Geometry source identity to realized device geometry. */\r\n _geometry = new Map();\r\n\r\n /**\r\n * @param {object} webgpu Canonical WebGPU device.\r\n * @param {object} options Composition.\r\n * @param {Function} [options.CreatePackage] Turns container bytes into a\r\n * package. Injected rather than imported: the engine must not reach into a\r\n * format's internals, and a caller that already holds a package can supply\r\n * it without owning a reader.\r\n * @param {Function} [options.read] The WebGPU format's `read`, a convenience\r\n * that supplies the default CreatePackage.\r\n * @param {Array<object>} options.targets Colour attachment formats of the\r\n * pass this resolver draws into. A pipeline must declare them and the\r\n * effect cannot know them; they belong to the frame.\r\n * @param {string|null} [options.depthFormat] Depth attachment format, or null\r\n * when the pass has none.\r\n * @param {string} [options.techniqueName] Carbon's DEFAULT_TECHNIQUE.\r\n * @param {Function} [options.ResolvePerFrame] Supplies the packed bytes for a\r\n * per-frame constant slot, which the scene owns.\r\n * @param {Function} [options.ResolveSampler] Supplies a device sampler for a\r\n * declared sampler binding.\r\n * @param {Function} [options.ResolveStorageBuffer] Supplies a storage buffer\r\n * binding, such as a bone palette.\r\n * @param {Function} [options.ResolveTexture] Supplies a device texture for a\r\n * named effect resource. Absent means this resolver draws only effects that\r\n * bind none, and says so rather than binding nothing.\r\n */\r\n constructor(webgpu, options = {})\r\n {\r\n super();\r\n\r\n if (!webgpu) fail(\"a WebGPU device is required\");\r\n const createPackage = options.CreatePackage\r\n ?? (typeof options.read === \"function\"\r\n ? bytes => CjsWebgpuPackage.fromBytes(bytes, { read: options.read })\r\n : null);\r\n\r\n if (typeof createPackage !== \"function\")\r\n {\r\n fail(\"options.CreatePackage or options.read is required to build a package\");\r\n }\r\n if (!Array.isArray(options.targets) || !options.targets.length)\r\n {\r\n fail(\"options.targets must name the pass's colour attachment formats\");\r\n }\r\n\r\n this._webgpu = webgpu;\r\n this._createPackage = createPackage;\r\n this._targets = options.targets;\r\n this._depthFormat = options.depthFormat === undefined ? \"depth24plus\" : options.depthFormat;\r\n this._techniqueName = options.techniqueName ?? \"Main\";\r\n this._resolvePerFrame = options.ResolvePerFrame ?? null;\r\n this._resolveTexture = options.ResolveTexture ?? null;\r\n this._resolveSampler = options.ResolveSampler ?? null;\r\n this._resolveStorageBuffer = options.ResolveStorageBuffer ?? null;\r\n\r\n // Defaulted rather than required: the register map is fixed, so a caller\r\n // with no renderer to hand gets the same answers. A composed one arrives\r\n // when the library owns the renderer.\r\n this._renderer = options.renderer ?? new Tr2Renderer();\r\n }\r\n\r\n /**\r\n * The reflected pass this batch draws, for a pass index.\r\n *\r\n * @param {object} material Trinity material.\r\n * @param {number} passIndex Pass within the technique.\r\n * @returns {object|null} Reflected pass.\r\n */\r\n _PassOf(material, passIndex)\r\n {\r\n const shader = material.GetShaderStateInterface?.();\r\n const techniqueIndex = shader?.GetTechniqueIndex?.(this._techniqueName) ?? -1;\r\n\r\n if (techniqueIndex < 0) return null;\r\n\r\n return shader.GetEffect?.()?.techniques?.[techniqueIndex]?.passes?.[passIndex] ?? null;\r\n }\r\n\r\n /**\r\n * The package for this material's effect, read once from the container bytes\r\n * the resource already holds.\r\n *\r\n * @param {object} material Trinity material.\r\n * @returns {object} Package.\r\n */\r\n _PackageFor(material)\r\n {\r\n const resource = material.GetEffectRes?.();\r\n\r\n if (!resource) fail(\"material has no effect resource to read a package from\");\r\n\r\n const cached = this._packages.get(resource);\r\n\r\n if (cached) return cached;\r\n\r\n const bytes = resource.GetContainerBytes?.();\r\n\r\n if (!bytes) fail(\"effect resource is not holding container bytes to read\");\r\n\r\n const built = this._createPackage(bytes);\r\n\r\n this._packages.set(resource, built);\r\n\r\n return built;\r\n }\r\n\r\n /**\r\n * Realizes a batch's geometry once and keeps it.\r\n *\r\n * Keyed on the geometry resource, mesh, LOD and the shader inputs it was\r\n * bound against, because the same bytes drawn by two shaders need two\r\n * layouts. Realizing per batch would repack every mesh every frame.\r\n *\r\n * @param {object} source Batch geometry source.\r\n * @param {object} pass Reflected pass supplying the vertex inputs.\r\n * @returns {Promise<object>} Device geometry.\r\n */\r\n async _GeometryFor(source, pass)\r\n {\r\n // Under `signature`, not on the stage input itself: the reflection groups a\r\n // stage's declared inputs with the rest of its signature. Reading the wrong\r\n // level yields an empty list, a binding plan that matches nothing, and a\r\n // geometry with no attributes - found against real containers, where every\r\n // effect reported no inputs at all.\r\n const inputs = pass?.stageInputs?.[0]?.signature?.pipelineInputs ?? [];\r\n const geometry = source?.geometry;\r\n\r\n if (!geometry) fail(\"batch geometry source carries no geometry resource\");\r\n\r\n const meshIndex = source.meshIndex ?? 0;\r\n const key = `${geometry.GetPath?.() ?? geometry.id ?? \"geometry\"}|${meshIndex}|`\r\n + inputs.map(input => `${input.usage}:${input.usageIndex}:${input.registerIndex}`).join(\",\");\r\n\r\n const cached = this._geometry.get(key);\r\n\r\n if (cached) return cached;\r\n\r\n const mesh = geometry.GetPayload?.()?.meshes?.[meshIndex] ?? null;\r\n\r\n if (!mesh) fail(`geometry has no mesh ${meshIndex} to realize`);\r\n\r\n const elements = CarbonVertexElements(geometry.GetMeshVertexElements?.(meshIndex));\r\n const plan = resolveBindingPlan(elements, inputs);\r\n const request = WebgpuGeometryOptions(mesh, plan.entries, {\r\n label: `${geometry.GetPath?.() ?? \"geometry\"}#${meshIndex}`\r\n });\r\n\r\n const realized = await this._webgpu.CreateGeometry(request);\r\n\r\n this._geometry.set(key, realized);\r\n\r\n return realized;\r\n }\r\n\r\n /** @inheritdoc */\r\n async ResolveMaterial(material, batch, context)\r\n {\r\n const passIndex = context?.passIndex ?? 0;\r\n const pass = this._PassOf(material, passIndex);\r\n\r\n if (!pass) fail(`material declares no pass ${passIndex} of technique ${this._techniqueName}`);\r\n\r\n const setup = Tr2EffectStateManager.resolveRenderStates(batch.renderingMode, pass.renderStates);\r\n\r\n if (!setup) fail(\"pass resolves to no render state\");\r\n\r\n const projected = setup.GetWebgpuRecipe({ depthFormat: this._depthFormat });\r\n\r\n // The geometry decides the vertex layout, and CreateDraw requires the\r\n // pipeline's layout to equal the geometry's exactly, so it is realized here\r\n // rather than left to ResolveGeometry - which reuses the same cache entry.\r\n const geometry = await this._GeometryFor(batch.geometrySource, pass);\r\n\r\n return {\r\n pipeline: this._PackageFor(material).GetPipeline(this._techniqueName, passIndex),\r\n recipe: {\r\n ...projected,\r\n vertex: { buffers: geometry.vertexBufferLayouts },\r\n fragment: { targets: this._targets.map(target => ({ ...target, blend: projected.blend ?? undefined })) }\r\n }\r\n };\r\n }\r\n\r\n /** @inheritdoc */\r\n async ResolveGeometry(source, batch, context)\r\n {\r\n const pass = this._PassOf(batch.material, context?.passIndex ?? 0);\r\n const geometry = await this._GeometryFor(source, pass);\r\n\r\n // The draw arguments are omitted deliberately: Tr2MeshBase already resolved\r\n // them onto the batch from the LOD's areas, and the dispatcher reads them\r\n // there. Supplying them again would be a second derivation of the same\r\n // range, and the two could disagree.\r\n return { geometry, indexed: geometry.indexed };\r\n }\r\n\r\n /** @inheritdoc */\r\n async ResolveBindings(batch, objectData, context)\r\n {\r\n const passIndex = context?.passIndex ?? 0;\r\n const material = batch.material;\r\n const pipeline = this._PackageFor(material).GetPipeline(this._techniqueName, passIndex);\r\n\r\n // BIND WHAT THE PIPELINE DECLARES. Inventing keys and hoping they match is\r\n // how this first failed against a real container: the device wanted\r\n // \"uniform-buffer:0:0@fragment\" and was handed \"cb0\". The binding record\r\n // carries its own identity, so there is nothing to guess.\r\n const uniformData = new Map();\r\n const resources = new Map();\r\n\r\n for (const group of pipeline?.bindGroups ?? [])\r\n {\r\n for (const binding of group.bindings ?? [])\r\n {\r\n const identity = binding.scopeIdentity\r\n ?? `${binding.resourceKind}:${binding.registerSpace}:${binding.registerIndex}`;\r\n\r\n if (binding.bindingKind === \"constantBuffer\" || binding.resourceKind === \"uniform-buffer\")\r\n {\r\n const value = await this._ConstantsFor(binding, material, objectData, passIndex);\r\n\r\n if (value) uniformData.set(identity, value);\r\n\r\n continue;\r\n }\r\n\r\n // A BINDING IS NOT ALWAYS A TEXTURE. A quad pass declares storage\r\n // buffers and samplers alongside its textures, and routing all three\r\n // to a texture source would hand a sampler request to something that\r\n // resolves texture paths.\r\n const source = this._SourceFor(binding);\r\n\r\n if (!source)\r\n {\r\n fail(\r\n `pass binds ${binding.name ?? identity} and no source was supplied for a `\r\n + `${binding.resourceKind}. An effect with resources cannot be drawn without `\r\n + \"one, and binding nothing would draw the wrong thing rather than fail.\"\r\n );\r\n }\r\n\r\n resources.set(identity, await source(binding.name, material, binding));\r\n }\r\n }\r\n\r\n return { uniformData, resources };\r\n }\r\n\r\n /**\r\n * The caller-supplied source for one declared binding, by kind.\r\n *\r\n * Kinds are kept apart because they are answered by different things: a\r\n * texture comes from a resource path, a sampler from authored state, a\r\n * storage buffer from whatever produced its contents. Carbon keeps the same\r\n * separation - SetSrv, SetSampler and the buffer overload are distinct calls\r\n * on the resource-set description (Tr2ResourceSetAL.h:57-64).\r\n *\r\n * KIND ALONE DOES NOT SEPARATE A TEXTURE FROM A BUFFER. A structured buffer\r\n * such as a bone palette is declared through an SRV, so it arrives as a\r\n * \"sampled-resource\" exactly like a texture does. The binding's LAYOUT is\r\n * what tells them apart, and the package already computed it - it is the\r\n * same descriptor the bind-group layout is created from, so reading it here\r\n * cannot disagree with what the pipeline was built to accept.\r\n *\r\n * @param {object} binding Declared binding record.\r\n * @returns {Function|null} Source for this kind, or null when none was given.\r\n */\r\n _SourceFor(binding)\r\n {\r\n const layout = binding.layout;\r\n\r\n if (layout?.sampler) return this._resolveSampler;\r\n if (layout?.texture) return this._resolveTexture;\r\n\r\n return this._resolveStorageBuffer;\r\n }\r\n\r\n /**\r\n * The bytes for one declared constant buffer.\r\n *\r\n * Which buffer it is comes from its register, using Carbon's slot map\r\n * (Tr2RenderContextEnum.h:406, Tr2Renderer.cpp:38-43): b0 is the effect's own\r\n * parameters, b3 and b4 are the per-object blocks. Per-frame b1 and b2 belong\r\n * to the scene and are bound by whoever owns the frame, not per batch.\r\n *\r\n * @param {object} binding Declared binding record.\r\n * @param {object} material Trinity material.\r\n * @param {object} objectData Per-object data for this batch.\r\n * @param {number} passIndex Pass within the technique.\r\n * @returns {Promise<ArrayBufferView|null>} Bytes, or null when nothing supplies it.\r\n */\r\n async _ConstantsFor(binding, material, objectData, passIndex)\r\n {\r\n const shader = material.GetShaderStateInterface?.();\r\n const pass = this._PassOf(material, passIndex);\r\n\r\n if (binding.registerIndex === EFFECT_CONSTANTS)\r\n {\r\n // b0, the effect's own constants. A pass with no pixel stage has none to\r\n // pack - a depth-only pass is the ordinary case - and that is an absence\r\n // rather than a failure.\r\n if (!pass?.stageInputs?.[1]?.exists) return null;\r\n\r\n const layout = MaterialLayoutFromShader(shader, {\r\n technique: this._techniqueName,\r\n pass: passIndex\r\n });\r\n\r\n return layout?.size ? PackMaterialConstants(layout, material.GetValues?.() ?? {}) : null;\r\n }\r\n\r\n // ASK THE RENDERER WHICH REGISTER IS WHICH. It owns the numbers\r\n // (Tr2Renderer.cpp:38-43) and Carbon compares against them exactly like\r\n // this. b1 and b2 are PER FRAME, not per object, and letting anything past\r\n // b0 fall through to the per-object path filled the two frame slots with\r\n // object bytes - a wrong picture rather than a failure.\r\n const renderer = this._renderer;\r\n const register = binding.registerIndex;\r\n\r\n if (register === renderer.GetPerFrameVSStartRegister() || register === renderer.GetPerFramePSStartRegister())\r\n {\r\n if (!this._resolvePerFrame)\r\n {\r\n fail(\r\n `pass binds b${binding.registerIndex}, which is per-frame data owned by the`\r\n + \" scene, and no ResolvePerFrame was supplied. The scene holds it;\"\r\n + \" the resolver cannot invent it.\"\r\n );\r\n }\r\n\r\n return this._resolvePerFrame(binding.registerIndex, binding);\r\n }\r\n\r\n // Everything else Carbon assigns - b5 ray-traced vertex data, b6 the GUI's\r\n // per-object block - and b8, which is ours for emulated addressing. None has\r\n // a source here, and filling one with per-object bytes would draw a wrong\r\n // picture rather than fail.\r\n if (register !== renderer.GetPerObjectVSStartRegister() && register !== renderer.GetPerObjectPSStartRegister())\r\n {\r\n fail(\r\n `pass binds b${register}, and nothing here fills it. Sourced registers are `\r\n + `b${EFFECT_CONSTANTS} effect, b${renderer.GetPerFrameVSStartRegister()} and `\r\n + `b${renderer.GetPerFramePSStartRegister()} per frame, and `\r\n + `b${renderer.GetPerObjectVSStartRegister()} and `\r\n + `b${renderer.GetPerObjectPSStartRegister()} per object.`\r\n );\r\n }\r\n\r\n // b3 and b4, gated on the technique's stage mask the way Carbon gates\r\n // SetPerObjectDataToDevice.\r\n const techniqueIndex = shader?.GetTechniqueIndex?.(this._techniqueName) ?? -1;\r\n const mask = techniqueIndex < 0 ? 0 : (shader.GetShaderTypeMask?.(techniqueIndex) ?? 0);\r\n const records = Tr2PerObjectData.getConstantRecords(objectData, mask);\r\n\r\n if (!records.length) return null;\r\n\r\n // WHICH RECORD, NOT THE FIRST ONE. b3 is the per-object VERTEX block and b4\r\n // the pixel one. A renderable's GetPerObjectData returns a { vs, ps } pair,\r\n // so getConstantRecords yields two records, and taking [0] handed b4 the\r\n // vertex record's bytes - a wrong picture rather than a failure.\r\n //\r\n // A \"vs\" payload declares the whole non-pixel family, because those stages\r\n // share the per-object vertex register (Tr2PerObjectData.cpp:49-54).\r\n const wanted = register === renderer.GetPerObjectVSStartRegister()\r\n ? Tr2PerObjectData.VertexFamilyMask\r\n : Tr2PerObjectData.StageBits.ps;\r\n\r\n const record = records.find(candidate => (candidate.stageMask & wanted) !== 0);\r\n\r\n if (!record) return null;\r\n\r\n // READ THE BYTES; DO NOT ASK THE UPLOADER FOR THEM. CollectPerObjectUploads\r\n // is the upload path and deliberately skips a payload that is not dirty,\r\n // which is right for \"what changed since the last write\" and wrong for\r\n // \"what is bound on this draw\". Going through it meant a payload that had\r\n // settled bound nothing at all.\r\n return record.data;\r\n }\r\n\r\n /** Releases every geometry this resolver realized. */\r\n Destroy()\r\n {\r\n for (const geometry of this._geometry.values()) geometry.Destroy?.();\r\n\r\n this._geometry.clear();\r\n }\r\n}\r\n"],"names":["fail","message","error","Error","code","CjsWebgpuTrinityBatchResolver","CjsTrinityBatchResolver","_webgpu","_createPackage","_techniqueName","_targets","_depthFormat","_resolvePerFrame","_resolveTexture","_resolveSampler","_resolveStorageBuffer","_renderer","_packages","WeakMap","_geometry","Map","constructor","webgpu","options","createPackage","CreatePackage","read","bytes","CjsWebgpuPackage","fromBytes","Array","isArray","targets","length","depthFormat","undefined","techniqueName","ResolvePerFrame","ResolveTexture","ResolveSampler","ResolveStorageBuffer","renderer","Tr2Renderer","_PassOf","material","passIndex","shader","GetShaderStateInterface","techniqueIndex","GetTechniqueIndex","GetEffect","techniques","passes","_PackageFor","resource","GetEffectRes","cached","get","GetContainerBytes","built","set","_GeometryFor","source","pass","inputs","stageInputs","signature","pipelineInputs","geometry","meshIndex","key","GetPath","id","map","input","usage","usageIndex","registerIndex","join","mesh","GetPayload","meshes","elements","CarbonVertexElements","GetMeshVertexElements","plan","resolveBindingPlan","request","WebgpuGeometryOptions","entries","label","realized","CreateGeometry","ResolveMaterial","batch","context","setup","Tr2EffectStateManager","resolveRenderStates","renderingMode","renderStates","projected","GetWebgpuRecipe","geometrySource","pipeline","GetPipeline","recipe","vertex","buffers","vertexBufferLayouts","fragment","target","blend","ResolveGeometry","indexed","ResolveBindings","objectData","uniformData","resources","group","bindGroups","binding","bindings","identity","scopeIdentity","resourceKind","registerSpace","bindingKind","value","_ConstantsFor","_SourceFor","name","layout","sampler","texture","EFFECT_CONSTANTS","exists","MaterialLayoutFromShader","technique","size","PackMaterialConstants","GetValues","register","GetPerFrameVSStartRegister","GetPerFramePSStartRegister","GetPerObjectVSStartRegister","GetPerObjectPSStartRegister","mask","GetShaderTypeMask","records","Tr2PerObjectData","getConstantRecords","wanted","VertexFamilyMask","StageBits","ps","record","find","candidate","stageMask","data","Destroy","values","clear"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AE;AACxB,EAAA;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trinityPassEncoder.js","sources":["../../../../../src/trinityal/webgpu/core/trinityPassEncoder.js"],"sourcesContent":["import { CjsWebgpuTrinityBatchDispatcher } from \"./trinityBatchDispatcher.js\";\n\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuTrinityPassEncoder: ${message}`);\n error.code = \"CJS_WEBGPU_TRINITY_PASS_INVALID\";\n throw error;\n}\n\nfunction normalizeSelection(selection, passIndex, selectionIndex)\n{\n if (!selection || typeof selection !== \"object\" || Array.isArray(selection))\n {\n fail(`pass ${passIndex} selection ${selectionIndex} must be an object`);\n }\n if (!selection.preparedBatchMap || typeof selection.preparedBatchMap !== \"object\"\n || Array.isArray(selection.preparedBatchMap))\n {\n fail(`pass ${passIndex} selection ${selectionIndex} requires preparedBatchMap`);\n }\n if (!Number.isInteger(selection.batchType) || selection.batchType < 0)\n {\n fail(`pass ${passIndex} selection ${selectionIndex} batchType must be a non-negative integer`);\n }\n return {\n preparedBatchMap: selection.preparedBatchMap,\n batchType: selection.batchType\n };\n}\n\nfunction normalizePass(entry, index)\n{\n if (!entry || typeof entry !== \"object\" || Array.isArray(entry))\n {\n fail(`pass ${index} must be an object`);\n }\n if (!entry.descriptor || typeof entry.descriptor !== \"object\" || Array.isArray(entry.descriptor))\n {\n fail(`pass ${index} requires a render-pass descriptor`);\n }\n if (!Array.isArray(entry.selections))\n {\n fail(`pass ${index} selections must be an array`);\n }\n if (entry.configure !== undefined && typeof entry.configure !== \"function\")\n {\n fail(`pass ${index} configure must be a function when provided`);\n }\n return {\n descriptor: entry.descriptor,\n configure: entry.configure ?? null,\n selections: entry.selections.map(\n (selection, selectionIndex) => normalizeSelection(selection, index, selectionIndex)\n )\n };\n}\n\n/**\n * Internal encoder for caller-owned WebGPU render-pass plans over prepared\n * Trinity batch maps.\n *\n * Attachment lifetime, descriptors, pass order, batch-type order, technique\n * selection, command-buffer completion, and submission all remain external.\n */\nexport class CjsWebgpuTrinityPassEncoder\n{\n _dispatcher;\n\n /**\n * Creates an encoder over a CjsWebgpuTrinityBatchDispatcher-compatible\n * boundary.\n */\n constructor(dispatcher)\n {\n if (!(dispatcher instanceof CjsWebgpuTrinityBatchDispatcher))\n {\n fail(\"dispatcher must be a CjsWebgpuTrinityBatchDispatcher\");\n }\n this._dispatcher = dispatcher;\n }\n\n /**\n * Encodes caller-ordered pass descriptors and batch-map selections into an\n * existing GPUCommandEncoder, ending every begun pass even when work fails.\n * Returns the number of encoded selections.\n */\n Encode(commandEncoder, passes)\n {\n if (!commandEncoder || typeof commandEncoder.beginRenderPass !== \"function\")\n {\n fail(\"a GPUCommandEncoder-compatible boundary is required\");\n }\n if (!Array.isArray(passes)) fail(\"passes must be an array\");\n const plan = passes.map(normalizePass);\n let encodedSelections = 0;\n\n for (let passIndex = 0; passIndex < plan.length; passIndex += 1)\n {\n const entry = plan[passIndex];\n const pass = commandEncoder.beginRenderPass(entry.descriptor);\n if (!pass || typeof pass.end !== \"function\")\n {\n fail(`pass ${passIndex} did not return a render-pass encoder`);\n }\n\n let error = null;\n try\n {\n if (entry.configure)\n {\n const result = entry.configure(pass, passIndex);\n if (result && typeof result.then === \"function\")\n {\n fail(`pass ${passIndex} configure must be synchronous`);\n }\n }\n for (const selection of entry.selections)\n {\n this._dispatcher.EncodeBatchType(\n pass,\n selection.preparedBatchMap,\n selection.batchType\n );\n encodedSelections += 1;\n }\n }\n catch (caught)\n {\n error = caught;\n }\n try\n {\n pass.end();\n }\n catch (caught)\n {\n if (!error) error = caught;\n }\n if (error) throw error;\n }\n return encodedSelections;\n }\n}\n"],"names":["fail","message","error","Error","code","normalizeSelection","selection","passIndex","selectionIndex","Array","isArray","preparedBatchMap","Number","isInteger","batchType","normalizePass","entry","index","descriptor","selections","configure","undefined","map","CjsWebgpuTrinityPassEncoder","_dispatcher","constructor","dispatcher","CjsWebgpuTrinityBatchDispatcher","Encode","commandEncoder","passes","beginRenderPass","plan","encodedSelections","length","pass","end","result","then","EncodeBatchType","caught"],"mappings":";;AAGA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,6BAAA,EAAgCF,OAAO,EAAE,CAAC;EAClEC,KAAK,CAACE,IAAI,GAAG,iCAAiC;AAC9C,EAAA,MAAMF,KAAK;AACb;AAEA,SAASG,kBAAkBA,CAACC,SAAS,EAAEC,SAAS,EAAEC,cAAc,EAChE;AACE,EAAA,IAAI,CAACF,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAIG,KAAK,CAACC,OAAO,CAACJ,SAAS,CAAC,EAC3E;AACEN,IAAAA,IAAI,CAAC,CAAA,KAAA,EAAQO,SAAS,CAAA,WAAA,EAAcC,cAAc,oBAAoB,CAAC;AACzE,EAAA;EACA,IAAI,CAACF,SAAS,CAACK,gBAAgB,IAAI,OAAOL,SAAS,CAACK,gBAAgB,KAAK,QAAQ,IAC5EF,KAAK,CAACC,OAAO,CAACJ,SAAS,CAACK,gBAAgB,CAAC,EAC9C;AACEX,IAAAA,IAAI,CAAC,CAAA,KAAA,EAAQO,SAAS,CAAA,WAAA,EAAcC,cAAc,4BAA4B,CAAC;AACjF,EAAA;AACA,EAAA,IAAI,CAACI,MAAM,CAACC,SAAS,CAACP,SAAS,CAACQ,SAAS,CAAC,IAAIR,SAAS,CAACQ,SAAS,GAAG,CAAC,EACrE;AACEd,IAAAA,IAAI,CAAC,CAAA,KAAA,EAAQO,SAAS,CAAA,WAAA,EAAcC,cAAc,2CAA2C,CAAC;AAChG,EAAA;EACA,OAAO;IACLG,gBAAgB,EAAEL,SAAS,CAACK,gBAAgB;IAC5CG,SAAS,EAAER,SAAS,CAACQ;GACtB;AACH;AAEA,SAASC,aAAaA,CAACC,KAAK,EAAEC,KAAK,EACnC;AACE,EAAA,IAAI,CAACD,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIP,KAAK,CAACC,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;AACE,UAAA,IAAI,CAACK,WAAW,CAACe,eAAe,CAC9BJ,IAAI,EACJ7B,SAAS,CAACK,gBAAgB,EAC1BL,SAAS,CAACQ,SACZ,CAAC;AACDmB,UAAAA,iBAAiB,IAAI,CAAC;AACxB,QAAA;MACF,CAAC,CACD,OAAOO,MAAM,EACb;AACEtC,QAAAA,KAAK,GAAGsC,MAAM;AAChB,MAAA;MACA,IACA;QACEL,IAAI,CAACC,GAAG,EAAE;MACZ,CAAC,CACD,OAAOI,MAAM,EACb;AACE,QAAA,IAAI,CAACtC,KAAK,EAAEA,KAAK,GAAGsC,MAAM;AAC5B,MAAA;MACA,IAAItC,KAAK,EAAE,MAAMA,KAAK;AACxB,IAAA;AACA,IAAA,OAAO+B,iBAAiB;AAC1B,EAAA;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workQueue.js","sources":["../../../../../src/trinityal/webgpu/core/workQueue.js"],"sourcesContent":["// Source: trinity/trinityal/metal/MetalWorkQueue.h\n// Source: trinity/trinityal/metal/MetalWorkQueue.mm\n//\n// MODELLED ON `MetalWorkQueue`, NOT A REPLICA OF IT - which is what the\n// `modelledOn` declaration below says, and why the parity check does not hold\n// this class to that class's surface. Metal's work queue declares 113 methods\n// to this file's 27, because it is the whole command recorder; comparing them\n// would report 101 absences as debt when the surface simply lives elsewhere\n// here.\n//\n// What this file took, and where the rest of Metal's work queue went:\n//\n// ENCODER LIFETIME -> here. BeginFrame/EndFrame, SetCurrentEncoder,\n// GetRenderEncoder/ReleaseEncoder, the pass\n// hint and its attachments, the pending\n// bindings a draw needs.\n// Blend, depth, stencil, cull, -> the PIPELINE. WebGPU has no per-state\n// fill, sample state setter; `Tr2RenderStateSetup.GetWebgpuRecipe`\n// projects the authored setup and\n// `CjsWebgpuPsoDescription` resolves it once.\n// SetTextures/SetSamplers/ -> `CjsWebgpuResourceSetAL` and the bind\n// SetBuffers/SetConstants groups the render context assembles.\n// Draw*/Dispatch* -> `CjsWebgpuRenderContextAL`'s draw verbs.\n// Blit, mipmaps, MSAA resolve, -> not ported, each recorded where it refuses.\n// visibility queries, parallel\n// encoding, the drawable blit\n//\n// The encoder the backend is currently writing into, and when it has to change.\n//\n// THIS IS A PORT, NOT A DESIGN. Carbon's command-encoder backend splits into a\n// render context that answers the abstraction layer's verbs and a WORK QUEUE\n// that owns the command buffer and the encoder lifetime - `Tr2RenderContextAL`\n// holds `m_workQueue` (`Tr2RenderContextMetal.h:299`). WebGPU has the same\n// shape as Metal: one command encoder per frame, render passes with fixed\n// attachments, and compute and copies that may not happen inside one. So this\n// carries Carbon's name and Carbon's responsibilities rather than a new noun.\n//\n// It replaces `framePlan.js`, which looks AHEAD over a recorded intent stream.\n// That look-ahead exists only because the planner is not the thing issuing the\n// calls - it reads them afterwards. A work queue is called verb by verb, in\n// order, so every decision is about the call in hand. Metal's\n// `SetCurrentEncoder` (`MetalWorkQueue.mm:840-900`) is lazy for that reason and\n// has no look-ahead anywhere.\n//\n// NOT PORTED, deliberately: the blit and acceleration-structure encoders, the\n// parallel render encoder, and the drawable blit. WebGPU takes copies on the\n// command encoder directly rather than through a blit encoder, it has no\n// parallel encoder, and ray tracing is absent from this backend as it is from\n// Carbon's stub. `MTLENCODERTYPE_BLIT` therefore has no counterpart here and\n// transfers are recorded against the command encoder itself.\n\nimport { CjsSchema } from \"#schema\";\nimport { Tr2LoadAction, Tr2StoreAction } from \"#consts/render-context\";\n\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuWorkQueue: ${message}`);\n error.code = \"CJS_WEBGPU_WORK_QUEUE_INVALID\";\n throw error;\n}\n\n\n/** Carbon's `MetalEncoderType`, less the encoders WebGPU does not have. */\nexport const EncoderType = Object.freeze({\n NONE: \"none\",\n RENDER: \"render\",\n COMPUTE: \"compute\"\n});\n\n\n/**\n * Owns the encoder lifetime for one frame, as Carbon's `MetalWorkQueue` does.\n *\n * DEVICE-FREE, for the reason Carbon's stub backend is: the rules are the part\n * worth testing, and they need no GPU. A caller applies the transitions this\n * reports to a real command encoder.\n */\nexport class CjsWebgpuWorkQueue\n{\n /** m_currentEncoderType */\n _currentEncoderType = EncoderType.NONE;\n\n /** m_pendingRenderPassHint / m_hasPendingRenderPassHint */\n _pendingRenderPassHint = null;\n\n /** Transitions since the last drain, in order. */\n _events = [];\n\n /** Render passes begun this frame. */\n _passCount = 0;\n\n /** Whether BeginFrame has run without a matching EndFrame. */\n _inFrame = false;\n\n /** m_currentRenderPassDescriptor.colorAttachments */\n _colorAttachments = [];\n\n /** m_currentRenderPassDescriptor.depthAttachment */\n _depthAttachment = null;\n\n /**\n * The encoder currently open.\n *\n * @returns {string} An `EncoderType`.\n */\n GetCurrentEncoderType()\n {\n return this._currentEncoderType;\n }\n\n /** Render passes begun this frame. @returns {number} */\n GetPassCount()\n {\n return this._passCount;\n }\n\n /** Whether a hint is waiting to be folded in. @returns {boolean} */\n HasPendingRenderPassHint()\n {\n return this._pendingRenderPassHint !== null;\n }\n\n /**\n * Opens the frame's command buffer. Carbon's `BeginFrame`.\n *\n * Returns its transitions like every other verb here, so a caller drains one\n * list per call and never carries events into the next one.\n *\n * @returns {object[]} The transitions this required.\n */\n BeginFrame()\n {\n if (this._inFrame) fail(\"BeginFrame without EndFrame\");\n\n this._inFrame = true;\n this._passCount = 0;\n // Nothing named last frame is wanted this frame until a verb names it.\n this._pending = { pipeline: null, vertexBuffers: [], indexBuffer: null, bindGroups: [] };\n this._events.push({ type: \"begin-frame\" });\n\n return this._Drain();\n }\n\n /**\n * Closes any encoder and commits. Carbon's `EndFrame` plus\n * `CommitCommandBuffer`.\n *\n * @returns {object[]} The transitions this required, in order.\n */\n EndFrame()\n {\n if (!this._inFrame) fail(\"EndFrame without BeginFrame\");\n\n if (this._pendingRenderPassHint) this._GetRenderEncoder();\n\n this._ReleaseEncoder();\n this._inFrame = false;\n this._events.push({ type: \"commit\" });\n\n return this._Drain();\n }\n\n /**\n * Declares what the next render pass does with its attachments.\n *\n * A SECOND HINT WHILE ONE IS PENDING OPENS AND IMMEDIATELY RELEASES A RENDER\n * ENCODER (`MetalWorkQueue.mm:3282-3291`). The first hint described a pass\n * that must still happen - its load and store actions are the point even when\n * nothing drew into it - so discarding it would lose a clear.\n *\n * @param {object[]} colors `Tr2ColorAttachment`s, in slot order.\n * @param {object} [depth] A `Tr2DepthAttachment`.\n */\n RenderPassHint(colors, depth = null)\n {\n if (!Array.isArray(colors)) fail(\"RenderPassHint takes an array of colour attachments\");\n\n if (this._pendingRenderPassHint)\n {\n this._GetRenderEncoder();\n this._ReleaseEncoder();\n }\n\n this._pendingRenderPassHint = { colors, depth };\n }\n\n /**\n * Ends the declared pass, so following work opens a new one.\n *\n * Carbon flushes rather than discards, for the reason above\n * (`MetalWorkQueue.mm:3293-3300`).\n *\n * @returns {object[]} The transitions this required.\n */\n EndRenderPassHint()\n {\n if (this._pendingRenderPassHint) this._GetRenderEncoder();\n\n this._ReleaseEncoder();\n\n return this._Drain();\n }\n\n /** Carbon's `EndCurrentRenderPass`. @returns {object[]} The transitions. */\n EndCurrentRenderPass()\n {\n if (this._currentEncoderType === EncoderType.RENDER) this._ReleaseEncoder();\n\n return this._Drain();\n }\n\n /**\n * Makes an encoder of the given type current, as `SetCurrentEncoder` does.\n *\n * @param {string} encoderType An `EncoderType` other than NONE.\n * @returns {object[]} The transitions this required, in order.\n */\n SetCurrentEncoder(encoderType)\n {\n if (!this._inFrame) fail(\"SetCurrentEncoder outside a frame\");\n if (encoderType === EncoderType.NONE) fail(\"SetCurrentEncoder needs a real encoder type\");\n\n // Carbon flushes a pending hint before any NON-render encoder, because the\n // declared pass must happen before the work that follows it\n // (`MetalWorkQueue.mm:851-855`).\n if (encoderType !== EncoderType.RENDER && this._pendingRenderPassHint)\n {\n this._GetRenderEncoder();\n this._ReleaseEncoder();\n }\n\n if (this._currentEncoderType === encoderType)\n {\n // A pending hint describes the NEXT pass, so an open render encoder is\n // still the wrong one to keep drawing into.\n if (encoderType !== EncoderType.RENDER || !this._pendingRenderPassHint) return this._Drain();\n }\n\n if (encoderType === EncoderType.RENDER)\n {\n this._GetRenderEncoder();\n\n return this._Drain();\n }\n\n this._ReleaseEncoder();\n this._currentEncoderType = encoderType;\n this._events.push({ type: \"open\", encoderType });\n\n return this._Drain();\n }\n\n /**\n * Attaches a colour target at one slot.\n *\n * THREE BEHAVIOURS, ALL CARBON'S (`MetalWorkQueue.mm:2000-2030`), and none of\n * them guessable:\n *\n * 1. **Attaching the texture already there is a no-op.** A redundant target\n * set is common - a step that re-binds what it inherited - and cutting a\n * pass for it would double the pass count for nothing.\n * 2. **A real change flushes outstanding work**, because the attachments of\n * an open pass are fixed and the next work needs a new encoder. Carbon's\n * comment says exactly this.\n * 3. **A newly attached texture defaults to LOAD and STORE**, not clear. The\n * caller has not said the previous contents are worthless, so discarding\n * them would lose whatever is already there.\n *\n * @param {object|null} texture The target, or null to detach.\n * @param {number} [index] The slot.\n * @param {number} [slice] The array slice or cube face.\n * @returns {object[]} The transitions this required.\n */\n SetRenderAttachments(texture, index = 0, slice = 0)\n {\n if (!Number.isInteger(index) || index < 0) fail(\"a render attachment needs a slot index\");\n\n const current = this._colorAttachments[index] ?? null;\n\n if (current?.texture === (texture ?? null)) return this._Drain();\n\n this._ReleaseEncoder();\n\n this._colorAttachments[index] = texture\n ? { texture, slice, loadOp: \"load\", storeOp: \"store\" }\n : null;\n\n return this._Drain();\n }\n\n /**\n * Attaches the depth-stencil target, with the same three behaviours.\n *\n * @param {object|null} texture The depth target, or null to detach.\n * @returns {object[]} The transitions this required.\n */\n SetDepthAttachment(texture)\n {\n if (this._depthAttachment?.texture === (texture ?? null)) return this._Drain();\n\n this._ReleaseEncoder();\n\n this._depthAttachment = texture ? { texture, loadOp: \"load\", storeOp: \"store\" } : null;\n\n return this._Drain();\n }\n\n /**\n * What is currently attached, for a caller building a pass descriptor.\n *\n * @returns {object} `{ colors, depth }`.\n */\n GetAttachments()\n {\n return {\n colors: this._colorAttachments.map(attachment => (attachment ? { ...attachment } : null)),\n depth: this._depthAttachment ? { ...this._depthAttachment } : null\n };\n }\n\n /**\n * Records an indexed draw, opening a render encoder if none is current.\n *\n * THE DRAW OPENS THE ENCODER, which is why this lives here rather than the\n * caller reaching for `SetCurrentEncoder` first. Carbon's\n * `MetalWorkQueue::DrawIndexedPrimitives` (`mm:2922-2945`) begins with\n * `GetRenderEncoder()` for exactly this reason: the abstraction layer's job\n * is to validate arguments and convert primitive counts, and the work\n * queue's job is to have somewhere to put the result.\n *\n * @param {number} indexCount Indices this draw reads.\n * @param {number} instanceCount Instances to draw.\n * @param {number} startIndex First index.\n * @param {number} baseVertex Value added to every index.\n * @param {number} startInstance First instance id.\n * @returns {object[]} The transitions this required, in order.\n */\n DrawIndexedPrimitives(indexCount, instanceCount, startIndex, baseVertex, startInstance)\n {\n this._RequireRenderEncoder();\n this._events.push({\n type: \"draw\",\n indexed: true,\n indexCount,\n instanceCount,\n startIndex,\n baseVertex,\n startInstance\n });\n\n if (this._renderPass)\n {\n this._EmitRenderEncoderState(true);\n this._renderPass.drawIndexed(indexCount, instanceCount, startIndex, baseVertex, startInstance);\n }\n\n return this._Drain();\n }\n\n // THE BINDINGS A DRAW NEEDS, HELD UNTIL THE DRAW. Metal's setters write\n // shadow state and a dirty bit (`MetalWorkQueue.mm:2570-2598`) and the\n // encoder is touched only from `EmitRenderEncoderState` inside the draw\n // (`:1750-1890`). These three do the same, and the live half below compares\n // against what the CURRENT encoder has already been told, which resets when\n // an encoder opens - a new pass starts with nothing bound.\n\n /** What the next draw must have bound. */\n _pending = { pipeline: null, vertexBuffers: [], indexBuffer: null, bindGroups: [] };\n\n /** What the open encoder has been told, reset per encoder. */\n _encoderState = { pipeline: null, vertexBuffers: [], indexBuffer: null, bindGroups: [] };\n\n /**\n * Names the bind group for one group index.\n *\n * @param {number} index The group index.\n * @param {object} bindGroup A `GPUBindGroup`.\n */\n SetBindGroup(index, bindGroup, dynamicOffsets = null)\n {\n this._pending.bindGroups[index] = { bindGroup, dynamicOffsets: dynamicOffsets?.length ? dynamicOffsets.slice() : null };\n }\n\n /**\n * Names the pipeline the next draw runs.\n *\n * @param {object} pipeline A `GPURenderPipeline`.\n */\n SetRenderPipeline(pipeline)\n {\n this._pending.pipeline = pipeline;\n }\n\n /**\n * Names a vertex buffer for one slot.\n *\n * @param {number} slot The vertex buffer slot.\n * @param {object} buffer A `GPUBuffer`.\n * @param {number} [offset] Byte offset into it.\n */\n SetVertexBuffer(slot, buffer, offset = 0)\n {\n this._pending.vertexBuffers[slot] = { buffer, offset };\n }\n\n /**\n * Names the index buffer.\n *\n * @param {object} buffer A `GPUBuffer`.\n * @param {string} format `\"uint16\"` or `\"uint32\"`.\n * @param {number} [offset] Byte offset into it.\n */\n SetIndexBuffer(buffer, format, offset = 0)\n {\n this._pending.indexBuffer = { buffer, format, offset };\n }\n\n /** Metal's `EmitRenderEncoderState`: bind what differs from the encoder's. */\n _EmitRenderEncoderState(indexed)\n {\n const pass = this._renderPass;\n const live = this._encoderState;\n const want = this._pending;\n\n if (want.pipeline && live.pipeline !== want.pipeline)\n {\n pass.setPipeline(want.pipeline);\n live.pipeline = want.pipeline;\n }\n\n want.bindGroups.forEach((entry, index) =>\n {\n if (!entry) return;\n\n const bound = live.bindGroups[index];\n\n // Metal re-sets only the OFFSET when the page is unchanged\n // (`setVertexBufferOffset:`); WebGPU has no such call, so a changed\n // offset re-sets the group with its offsets.\n if (bound && bound.bindGroup === entry.bindGroup && sameOffsets(bound.dynamicOffsets, entry.dynamicOffsets)) return;\n\n if (entry.dynamicOffsets) pass.setBindGroup(index, entry.bindGroup, entry.dynamicOffsets);\n else pass.setBindGroup(index, entry.bindGroup);\n\n live.bindGroups[index] = entry;\n });\n\n want.vertexBuffers.forEach((entry, slot) =>\n {\n if (!entry) return;\n\n const bound = live.vertexBuffers[slot];\n\n if (bound && bound.buffer === entry.buffer && bound.offset === entry.offset) return;\n\n pass.setVertexBuffer(slot, entry.buffer, entry.offset);\n live.vertexBuffers[slot] = entry;\n });\n\n if (!indexed || !want.indexBuffer) return;\n\n const bound = live.indexBuffer;\n const entry = want.indexBuffer;\n\n if (bound && bound.buffer === entry.buffer && bound.format === entry.format && bound.offset === entry.offset) return;\n\n pass.setIndexBuffer(entry.buffer, entry.format, entry.offset);\n live.indexBuffer = entry;\n }\n\n /**\n * Records a non-indexed draw, opening a render encoder if none is current.\n *\n * @param {number} vertexCount Vertices this draw reads.\n * @param {number} instanceCount Instances to draw.\n * @param {number} startVertex First vertex.\n * @param {number} startInstance First instance id.\n * @returns {object[]} The transitions this required, in order.\n */\n DrawPrimitives(vertexCount, instanceCount, startVertex, startInstance)\n {\n this._RequireRenderEncoder();\n this._events.push({\n type: \"draw\",\n indexed: false,\n vertexCount,\n instanceCount,\n startVertex,\n startInstance\n });\n\n if (this._renderPass)\n {\n this._EmitRenderEncoderState(false);\n this._renderPass.draw(vertexCount, instanceCount, startVertex, startInstance);\n }\n\n return this._Drain();\n }\n\n // THE DEVICE IS OPTIONAL AND THAT IS THE WHOLE DESIGN. Everything above is\n // the RULES - when an encoder opens, what a hint folds into it, when it has\n // to close - and those need no GPU, which is why they are testable and why\n // Carbon ships a stub backend at all. What follows lets a real command\n // encoder ride along with the rules rather than reimplement them.\n //\n // Without one this queue reports transitions and draws nothing, exactly as\n // before. With one, opening an encoder also calls `beginRenderPass` and\n // closing it calls `end`, so a caller can hand the live pass to the batch\n // dispatcher. That is what stops the queue being a second recording layer.\n\n /** The live command encoder, when a frame is being encoded for real. */\n _commandEncoder = null;\n\n /** Turns folded attachments into a `GPURenderPassDescriptor`. */\n _describePass = null;\n\n /** The open `GPURenderPassEncoder`, or null. */\n _renderPass = null;\n\n /**\n * Attaches a real command encoder for this frame.\n *\n * @param {object|null} commandEncoder A `GPUCommandEncoder`, or null to detach.\n * @param {Function} [describePass] Maps folded attachments to a pass\n * descriptor. IT IS CALLED WITH NULL WHEN NO HINT WAS DECLARED, which is\n * not the same as DONT_CARE - Carbon applies load and store actions only\n * when a hint is pending, and leaves the backend's own defaults alone\n * otherwise. A describePass that assumes an object will crash on the\n * first unhinted pass, which is most of them.\n * @returns {CjsWebgpuWorkQueue} This queue.\n */\n SetCommandEncoder(commandEncoder, describePass = null)\n {\n if (commandEncoder && typeof commandEncoder.beginRenderPass !== \"function\")\n {\n fail(\"a command encoder must be a GPUCommandEncoder\");\n }\n\n if (commandEncoder && typeof describePass !== \"function\")\n {\n fail(\"a command encoder needs a describePass that returns a render-pass descriptor\");\n }\n\n this._commandEncoder = commandEncoder ?? null;\n this._describePass = commandEncoder ? describePass : null;\n\n return this;\n }\n\n /**\n * The open render pass, if one is open and a device is attached.\n *\n * @returns {object|null} A `GPURenderPassEncoder`, or null.\n */\n GetRenderPass()\n {\n return this._renderPass;\n }\n\n /**\n * Opens a render pass if one is not already open, and returns it.\n *\n * This is the verb a draw path calls: Carbon's Metal backend asks for an\n * encoder at the moment it needs one and never before, so a frame that draws\n * nothing opens nothing.\n *\n * @returns {object|null} A `GPURenderPassEncoder`, or null with no device.\n */\n /**\n * Carbon's `GetRenderEncoder` (`MetalWorkQueue.mm:2922`): opens a render\n * encoder if none is current, BEFORE the draw verb asks whether it can draw.\n * Metal opens first and then tests `EmitRenderEncoderState()`, so a draw that\n * is then refused has still opened its pass - which is why a marker pushed\n * after a refused draw lands on a pass encoder.\n *\n * @returns {object[]} The transitions this required, in order.\n */\n GetRenderEncoder()\n {\n this._RequireRenderEncoder();\n\n return this._Drain();\n }\n\n /**\n * The open `GPURenderPassEncoder` for a caller that encodes on it directly.\n *\n * @returns {object|null} The pass, after forgetting what this queue had bound.\n */\n RequireRenderPass()\n {\n this._RequireRenderEncoder();\n\n // A caller that encodes on the pass directly binds what it likes, so what\n // this queue believes the encoder holds is no longer true.\n this._encoderState = { pipeline: null, vertexBuffers: [], indexBuffer: null, bindGroups: [] };\n\n return this._renderPass;\n }\n\n /** Carbon's `GetRenderEncoder`: the current one, or a new one. */\n _RequireRenderEncoder()\n {\n if (!this._inFrame) fail(\"a draw outside a frame\");\n\n if (this._currentEncoderType === EncoderType.RENDER && !this._pendingRenderPassHint) return;\n\n this._GetRenderEncoder();\n }\n\n /** Opens a render encoder, folding any pending hint into its descriptor. */\n _GetRenderEncoder()\n {\n this._ReleaseEncoder();\n\n const hint = this._pendingRenderPassHint;\n const attachments = ApplyRenderPassHint(hint);\n\n this._pendingRenderPassHint = null;\n this._passCount += 1;\n this._currentEncoderType = EncoderType.RENDER;\n this._events.push({ type: \"open\", encoderType: EncoderType.RENDER, attachments });\n\n if (this._commandEncoder)\n {\n this._renderPass = this._commandEncoder.beginRenderPass(this._describePass(attachments));\n this._encoderState = { pipeline: null, vertexBuffers: [], indexBuffer: null, bindGroups: [] };\n }\n }\n\n /** Carbon's `ReleaseEncoder( true )`. */\n _ReleaseEncoder()\n {\n if (this._currentEncoderType === EncoderType.NONE) return;\n\n // The pass ends BEFORE the close event, so a caller draining events after\n // a close can rely on the pass already being finished rather than racing it.\n if (this._renderPass)\n {\n this._renderPass.end();\n this._renderPass = null;\n }\n\n this._events.push({ type: \"close\", encoderType: this._currentEncoderType });\n this._currentEncoderType = EncoderType.NONE;\n }\n\n /** Takes the recorded events, leaving the queue's list empty. */\n _Drain()\n {\n const events = this._events;\n\n this._events = [];\n\n return events;\n }\n}\n\n\n/** Whether two dynamic-offset lists bind the same regions. */\nfunction sameOffsets(first, second)\n{\n if (first === second) return true;\n if (!first || !second || first.length !== second.length) return false;\n\n for (let index = 0; index < first.length; index += 1)\n {\n if (first[index] !== second[index]) return false;\n }\n\n return true;\n}\n\n\n/**\n * Turns a declared hint into load and store operations, as Carbon's\n * `ApplyRenderPassHint` writes them into its pass descriptor\n * (`MetalWorkQueue.mm:773-809`).\n *\n * NO HINT IS NOT DONT_CARE. Carbon only applies actions when a hint is pending\n * and otherwise leaves the descriptor as it was, so an absent hint returns null\n * and the caller keeps its own defaults rather than being told to discard.\n *\n * @param {object} [hint] A pending hint.\n * @returns {object|null} `{ colors, depth }` with `load`/`store` per attachment.\n */\nexport function ApplyRenderPassHint(hint)\n{\n if (!hint) return null;\n\n return {\n colors: hint.colors.map(Describe),\n depth: hint.depth ? Describe(hint.depth) : null\n };\n}\n\nfunction Describe(attachment)\n{\n return {\n loadOp: LoadOp(attachment.load),\n storeOp: attachment.store === Tr2StoreAction.STORE ? \"store\" : \"discard\",\n clearValue: attachment.clearColor ?? attachment.clearValue ?? 0\n };\n}\n\nfunction LoadOp(action)\n{\n if (action === Tr2LoadAction.CLEAR) return \"clear\";\n if (action === Tr2LoadAction.LOAD) return \"load\";\n\n // DONT_CARE has no WebGPU spelling - the API has no \"contents are undefined\"\n // load. `clear` is the honest mapping: `load` would promise to preserve\n // contents the caller has said it does not need, which costs a fetch on\n // exactly the tile-based hardware the hint exists for.\n return \"clear\";\n}\n\n\n// DECLARED AS A CALL, NOT A DECORATOR. The abstraction layer is imported\n// straight from source by its tests - `#trinityal/...` resolves to `src/` - and\n// raw Node cannot parse decorator syntax, so a decorator here breaks every test\n// that reaches this file without a build first. `CjsSchema.define` is the same\n// metadata through the door the schema already provides for exactly this, and\n// it keeps the layer free of the decorator chain it has never carried.\nCjsSchema.define(CjsWebgpuWorkQueue, { className: \"CjsWebgpuWorkQueue\", modelledOn: \"MetalWorkQueue\" });\n"],"names":["fail","message","error","Error","code","EncoderType","Object","freeze","NONE","RENDER","COMPUTE","CjsWebgpuWorkQueue","_currentEncoderType","_pendingRenderPassHint","_events","_passCount","_inFrame","_colorAttachments","_depthAttachment","GetCurrentEncoderType","GetPassCount","HasPendingRenderPassHint","BeginFrame","_pending","pipeline","vertexBuffers","indexBuffer","bindGroups","push","type","_Drain","EndFrame","_GetRenderEncoder","_ReleaseEncoder","RenderPassHint","colors","depth","Array","isArray","EndRenderPassHint","EndCurrentRenderPass","SetCurrentEncoder","encoderType","SetRenderAttachments","texture","index","slice","Number","isInteger","current","loadOp","storeOp","SetDepthAttachment","GetAttachments","map","attachment","DrawIndexedPrimitives","indexCount","instanceCount","startIndex","baseVertex","startInstance","_RequireRenderEncoder","indexed","_renderPass","_EmitRenderEncoderState","drawIndexed","_encoderState","SetBindGroup","bindGroup","dynamicOffsets","length","SetRenderPipeline","SetVertexBuffer","slot","buffer","offset","SetIndexBuffer","format","pass","live","want","setPipeline","forEach","entry","bound","sameOffsets","setBindGroup","setVertexBuffer","setIndexBuffer","DrawPrimitives","vertexCount","startVertex","draw","_commandEncoder","_describePass","SetCommandEncoder","commandEncoder","describePass","beginRenderPass","GetRenderPass","GetRenderEncoder","RequireRenderPass","hint","attachments","ApplyRenderPassHint","end","events","first","second","Describe","LoadOp","load","store","Tr2StoreAction","STORE","clearValue","clearColor","action","Tr2LoadAction","CLEAR","LOAD","CjsSchema","define","className","modelledOn"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,oBAAA,EAAuBF,OAAO,EAAE,CAAC;EACzDC,KAAK,CAACE,IAAI,GAAG,+BAA+B;AAC5C,EAAA,MAAMF,KAAK;AACb;;AAGA;MACaG,WAAW,GAAGC,MAAM,CAACC,MAAM,CAAC;AACvCC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,OAAO,EAAE;AACX,CAAC;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB,CAC/B;AACE;EACAC,mBAAmB,GAAGP,WAAW,CAACG,IAAI;;AAEtC;AACAK,EAAAA,sBAAsB,GAAG,IAAI;;AAE7B;AACAC,EAAAA,OAAO,GAAG,EAAE;;AAEZ;AACAC,EAAAA,UA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