@carbonenginejs/runtime 0.1.0-alpha.0 → 0.1.0-alpha.1
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/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 +52 -4
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.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 +104 -260
- 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 +82 -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,3 +1,4 @@
|
|
|
1
|
+
import { CjsSchema } from '#schema';
|
|
1
2
|
import { ALResult, Tr2ALMemoryType } from '#trinityal';
|
|
2
3
|
import { HasFlag, Tr2CpuUsage, Tr2GpuUsage } from '#consts/render-context';
|
|
3
4
|
import { RenderContextALOf } from '../renderContextAL.js';
|
|
@@ -71,12 +72,12 @@ function gpuBufferUsage(gpuUsage, usage) {
|
|
|
71
72
|
return mask;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
/**
|
|
75
|
-
* A `Tr2BufferAL` backed by a real `GPUBuffer`.
|
|
76
|
-
*
|
|
77
|
-
* It deliberately does NOT extend `Tr2BaseDeviceResourceAL`: that base lives in
|
|
78
|
-
* Trinity and registers into a Trinity-side resource list, and the engine does
|
|
79
|
-
* not import Trinity classes for identity. It implements the same surface.
|
|
75
|
+
/**
|
|
76
|
+
* A `Tr2BufferAL` backed by a real `GPUBuffer`.
|
|
77
|
+
*
|
|
78
|
+
* It deliberately does NOT extend `Tr2BaseDeviceResourceAL`: that base lives in
|
|
79
|
+
* Trinity and registers into a Trinity-side resource list, and the engine does
|
|
80
|
+
* not import Trinity classes for identity. It implements the same surface.
|
|
80
81
|
*/
|
|
81
82
|
class CjsWebgpuBufferAL {
|
|
82
83
|
/** m_desc */
|
|
@@ -94,13 +95,13 @@ class CjsWebgpuBufferAL {
|
|
|
94
95
|
/** Whether a map is open, so a double map is caught rather than silently nested. */
|
|
95
96
|
_mapped = false;
|
|
96
97
|
|
|
97
|
-
/**
|
|
98
|
-
* Creates the buffer against a device.
|
|
99
|
-
*
|
|
100
|
-
* @param {Tr2BufferDescriptionAL} desc The description.
|
|
101
|
-
* @param {ArrayBufferView|null} initialData Initial contents, if any.
|
|
102
|
-
* @param {object} renderContext The WebGPU render context AL.
|
|
103
|
-
* @returns {number} An `ALResult` value.
|
|
98
|
+
/**
|
|
99
|
+
* Creates the buffer against a device.
|
|
100
|
+
*
|
|
101
|
+
* @param {Tr2BufferDescriptionAL} desc The description.
|
|
102
|
+
* @param {ArrayBufferView|null} initialData Initial contents, if any.
|
|
103
|
+
* @param {object} renderContext The WebGPU render context AL.
|
|
104
|
+
* @returns {number} An `ALResult` value.
|
|
104
105
|
*/
|
|
105
106
|
Create(desc, initialData, renderContext) {
|
|
106
107
|
this.Destroy();
|
|
@@ -162,14 +163,14 @@ class CjsWebgpuBufferAL {
|
|
|
162
163
|
return this._handle ? this._webgpu.GetDeviceBuffer(this._handle) : null;
|
|
163
164
|
}
|
|
164
165
|
|
|
165
|
-
/**
|
|
166
|
-
* Opens the buffer for writing, returning the shadow to write into.
|
|
167
|
-
*
|
|
168
|
-
* Carbon returns `{ result, data }` from its stub and a raw pointer from the
|
|
169
|
-
* backends; the stub's shape is the one Trinity callers already read.
|
|
170
|
-
*
|
|
171
|
-
* @param {object} _renderContext Unused; the device came from Create.
|
|
172
|
-
* @returns {{result: number, data: Uint8Array|null}} The shadow.
|
|
166
|
+
/**
|
|
167
|
+
* Opens the buffer for writing, returning the shadow to write into.
|
|
168
|
+
*
|
|
169
|
+
* Carbon returns `{ result, data }` from its stub and a raw pointer from the
|
|
170
|
+
* backends; the stub's shape is the one Trinity callers already read.
|
|
171
|
+
*
|
|
172
|
+
* @param {object} _renderContext Unused; the device came from Create.
|
|
173
|
+
* @returns {{result: number, data: Uint8Array|null}} The shadow.
|
|
173
174
|
*/
|
|
174
175
|
MapForWriting(_renderContext) {
|
|
175
176
|
if (!this.IsValid()) return {
|
|
@@ -194,13 +195,13 @@ class CjsWebgpuBufferAL {
|
|
|
194
195
|
};
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
/**
|
|
198
|
-
* Closes the map and uploads the whole buffer.
|
|
199
|
-
*
|
|
200
|
-
* Uploading everything rather than a dirty range matches all three real
|
|
201
|
-
* backends: DX11 `UpdateSubresource` on the whole buffer (cpp:400), DX12
|
|
202
|
-
* `CopyBufferRegion` of `m_size` (Tr2ResourceHelper.cpp:234), Metal a blit of
|
|
203
|
-
* `m_mtlBuffer.length` (mm:259).
|
|
198
|
+
/**
|
|
199
|
+
* Closes the map and uploads the whole buffer.
|
|
200
|
+
*
|
|
201
|
+
* Uploading everything rather than a dirty range matches all three real
|
|
202
|
+
* backends: DX11 `UpdateSubresource` on the whole buffer (cpp:400), DX12
|
|
203
|
+
* `CopyBufferRegion` of `m_size` (Tr2ResourceHelper.cpp:234), Metal a blit of
|
|
204
|
+
* `m_mtlBuffer.length` (mm:259).
|
|
204
205
|
*/
|
|
205
206
|
UnmapForWriting() {
|
|
206
207
|
if (!this._mapped) return;
|
|
@@ -208,21 +209,21 @@ class CjsWebgpuBufferAL {
|
|
|
208
209
|
this._webgpu.WriteDeviceBuffer(this._handle, this._shadow);
|
|
209
210
|
}
|
|
210
211
|
|
|
211
|
-
/**
|
|
212
|
-
* Writes a range without a map.
|
|
213
|
-
*
|
|
214
|
-
* Carbon's stub refuses this for `WRITE_OFTEN` (`Tr2BufferALStub.cpp:138-141`)
|
|
215
|
-
* and DX12 refuses it for a DYNAMIC buffer (`Tr2ResourceHelper.cpp:253-256`),
|
|
216
|
-
* both because such a buffer's storage moves under a partial write. Ours does
|
|
217
|
-
* not move, but the refusal is kept: a caller that reaches here with a
|
|
218
|
-
* WRITE_OFTEN buffer has confused the two update paths, and every portable
|
|
219
|
-
* caller uses map/unmap for those.
|
|
220
|
-
*
|
|
221
|
-
* @param {number} offset Byte offset of the range.
|
|
222
|
-
* @param {number} size Bytes in the range.
|
|
223
|
-
* @param {ArrayBufferView} data The bytes.
|
|
224
|
-
* @param {object} _renderContext Unused; the device came from Create.
|
|
225
|
-
* @returns {number} An `ALResult` value.
|
|
212
|
+
/**
|
|
213
|
+
* Writes a range without a map.
|
|
214
|
+
*
|
|
215
|
+
* Carbon's stub refuses this for `WRITE_OFTEN` (`Tr2BufferALStub.cpp:138-141`)
|
|
216
|
+
* and DX12 refuses it for a DYNAMIC buffer (`Tr2ResourceHelper.cpp:253-256`),
|
|
217
|
+
* both because such a buffer's storage moves under a partial write. Ours does
|
|
218
|
+
* not move, but the refusal is kept: a caller that reaches here with a
|
|
219
|
+
* WRITE_OFTEN buffer has confused the two update paths, and every portable
|
|
220
|
+
* caller uses map/unmap for those.
|
|
221
|
+
*
|
|
222
|
+
* @param {number} offset Byte offset of the range.
|
|
223
|
+
* @param {number} size Bytes in the range.
|
|
224
|
+
* @param {ArrayBufferView} data The bytes.
|
|
225
|
+
* @param {object} _renderContext Unused; the device came from Create.
|
|
226
|
+
* @returns {number} An `ALResult` value.
|
|
226
227
|
*/
|
|
227
228
|
UpdateBuffer(offset, size, data, _renderContext) {
|
|
228
229
|
if (!this.IsValid()) return ALResult.E_INVALIDCALL;
|
|
@@ -271,42 +272,42 @@ class CjsWebgpuBufferAL {
|
|
|
271
272
|
/** @see MapForReading */
|
|
272
273
|
UnmapForReading() {}
|
|
273
274
|
|
|
274
|
-
/**
|
|
275
|
-
* The buffer's size in bytes, under Carbon's name for the question.
|
|
276
|
-
*
|
|
277
|
-
* `GetSizeInBytes` above is this backend's own spelling and predates the
|
|
278
|
-
* parity check. Both stay: the stub answers to `GetSize`
|
|
279
|
-
* (`stub/Tr2BufferALStub.js`), so a caller written against one backend must
|
|
280
|
-
* not fail against the other.
|
|
281
|
-
*
|
|
282
|
-
* @returns {number} Size in bytes.
|
|
275
|
+
/**
|
|
276
|
+
* The buffer's size in bytes, under Carbon's name for the question.
|
|
277
|
+
*
|
|
278
|
+
* `GetSizeInBytes` above is this backend's own spelling and predates the
|
|
279
|
+
* parity check. Both stay: the stub answers to `GetSize`
|
|
280
|
+
* (`stub/Tr2BufferALStub.js`), so a caller written against one backend must
|
|
281
|
+
* not fail against the other.
|
|
282
|
+
*
|
|
283
|
+
* @returns {number} Size in bytes.
|
|
283
284
|
*/
|
|
284
285
|
GetSize() {
|
|
285
286
|
return this.GetSizeInBytes();
|
|
286
287
|
}
|
|
287
288
|
|
|
288
|
-
/**
|
|
289
|
-
* Which memory class this buffer occupies.
|
|
290
|
-
*
|
|
291
|
-
* MANAGED, as the stub buffer reports: WebGPU gives no placement control and
|
|
292
|
-
* no residency signal, so the honest answer is the device-heap default rather
|
|
293
|
-
* than a claim about video memory.
|
|
294
|
-
*
|
|
295
|
-
* @returns {number} A `Tr2ALMemoryType` value.
|
|
289
|
+
/**
|
|
290
|
+
* Which memory class this buffer occupies.
|
|
291
|
+
*
|
|
292
|
+
* MANAGED, as the stub buffer reports: WebGPU gives no placement control and
|
|
293
|
+
* no residency signal, so the honest answer is the device-heap default rather
|
|
294
|
+
* than a claim about video memory.
|
|
295
|
+
*
|
|
296
|
+
* @returns {number} A `Tr2ALMemoryType` value.
|
|
296
297
|
*/
|
|
297
298
|
GetMemoryClass() {
|
|
298
299
|
return Tr2ALMemoryType.AL_MEMORY_MANAGED;
|
|
299
300
|
}
|
|
300
301
|
|
|
301
|
-
/**
|
|
302
|
-
* Fills in a device-resource description.
|
|
303
|
-
*
|
|
304
|
-
* Carbon's backends report size and memory class into the struct the resource
|
|
305
|
-
* sweep walks; the base class's own version is empty
|
|
306
|
-
* (`Tr2DeviceResourceAL.js`), and so is the stub's.
|
|
307
|
-
*
|
|
308
|
-
* @param {object} description The description to fill.
|
|
309
|
-
* @returns {object} The description, filled.
|
|
302
|
+
/**
|
|
303
|
+
* Fills in a device-resource description.
|
|
304
|
+
*
|
|
305
|
+
* Carbon's backends report size and memory class into the struct the resource
|
|
306
|
+
* sweep walks; the base class's own version is empty
|
|
307
|
+
* (`Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js`), and so is the stub's.
|
|
308
|
+
*
|
|
309
|
+
* @param {object} description The description to fill.
|
|
310
|
+
* @returns {object} The description, filled.
|
|
310
311
|
*/
|
|
311
312
|
Describe(description) {
|
|
312
313
|
if (!description) return description;
|
|
@@ -315,14 +316,14 @@ class CjsWebgpuBufferAL {
|
|
|
315
316
|
return description;
|
|
316
317
|
}
|
|
317
318
|
|
|
318
|
-
/**
|
|
319
|
-
* Names the buffer for a debugger.
|
|
320
|
-
*
|
|
321
|
-
* `GPUObjectBase.label` is writable after creation, so unlike the stub this
|
|
322
|
-
* one keeps the name where the browser's own error messages will quote it.
|
|
323
|
-
*
|
|
324
|
-
* @param {string} name The name to attach.
|
|
325
|
-
* @returns {number} An `ALResult` value.
|
|
319
|
+
/**
|
|
320
|
+
* Names the buffer for a debugger.
|
|
321
|
+
*
|
|
322
|
+
* `GPUObjectBase.label` is writable after creation, so unlike the stub this
|
|
323
|
+
* one keeps the name where the browser's own error messages will quote it.
|
|
324
|
+
*
|
|
325
|
+
* @param {string} name The name to attach.
|
|
326
|
+
* @returns {number} An `ALResult` value.
|
|
326
327
|
*/
|
|
327
328
|
SetName(name) {
|
|
328
329
|
const buffer = this.GetDeviceBuffer();
|
|
@@ -330,29 +331,43 @@ class CjsWebgpuBufferAL {
|
|
|
330
331
|
return ALResult.S_OK;
|
|
331
332
|
}
|
|
332
333
|
|
|
333
|
-
/**
|
|
334
|
-
* The buffer's index in a shader-resource descriptor heap.
|
|
335
|
-
*
|
|
336
|
-
* WebGPU HAS NO DESCRIPTOR HEAP - a resource is reached through a bind group,
|
|
337
|
-
* not by index into a global table - so this reports Carbon's "not in a heap"
|
|
338
|
-
* sentinel, as the stub does. It is not a gap to be filled later; there is
|
|
339
|
-
* nothing for it to number.
|
|
340
|
-
*
|
|
341
|
-
* @returns {number} `NO_HEAP_INDEX`.
|
|
334
|
+
/**
|
|
335
|
+
* The buffer's index in a shader-resource descriptor heap.
|
|
336
|
+
*
|
|
337
|
+
* WebGPU HAS NO DESCRIPTOR HEAP - a resource is reached through a bind group,
|
|
338
|
+
* not by index into a global table - so this reports Carbon's "not in a heap"
|
|
339
|
+
* sentinel, as the stub does. It is not a gap to be filled later; there is
|
|
340
|
+
* nothing for it to number.
|
|
341
|
+
*
|
|
342
|
+
* @returns {number} `NO_HEAP_INDEX`.
|
|
342
343
|
*/
|
|
343
344
|
GetSrvIndexInHeap() {
|
|
344
345
|
return NO_HEAP_INDEX;
|
|
345
346
|
}
|
|
346
347
|
|
|
347
|
-
/**
|
|
348
|
-
* The buffer's index in an unordered-access descriptor heap.
|
|
349
|
-
*
|
|
350
|
-
* @returns {number} `NO_HEAP_INDEX`; see `GetSrvIndexInHeap`.
|
|
348
|
+
/**
|
|
349
|
+
* The buffer's index in an unordered-access descriptor heap.
|
|
350
|
+
*
|
|
351
|
+
* @returns {number} `NO_HEAP_INDEX`; see `GetSrvIndexInHeap`.
|
|
351
352
|
*/
|
|
352
353
|
GetUavIndexInHeap() {
|
|
353
354
|
return NO_HEAP_INDEX;
|
|
354
355
|
}
|
|
355
356
|
}
|
|
356
357
|
|
|
358
|
+
// DECLARED AS A CALL, NOT A DECORATOR, for the reason recorded in
|
|
359
|
+
// Tr2BitmapDimensions.js: the layer is imported straight from source by its
|
|
360
|
+
// tests and raw Node cannot parse decorator syntax.
|
|
361
|
+
//
|
|
362
|
+
// The donor is NAMED rather than left to be derived from this class's name.
|
|
363
|
+
// Carbon calls every backend's class the same thing and carries the backend in
|
|
364
|
+
// the FILE name, because only one backend compiles at a time; we ship them
|
|
365
|
+
// together, so the backend moves onto the class name. That divergence is the
|
|
366
|
+
// author's to declare, never a checker's to guess.
|
|
367
|
+
CjsSchema.define(CjsWebgpuBufferAL, {
|
|
368
|
+
className: "CjsWebgpuBufferAL",
|
|
369
|
+
carbon: "Tr2BufferAL"
|
|
370
|
+
});
|
|
371
|
+
|
|
357
372
|
export { CjsWebgpuBufferAL };
|
|
358
373
|
//# sourceMappingURL=CjsWebgpuBufferAL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsWebgpuBufferAL.js","sources":["../../../../src/trinityal/webgpu/CjsWebgpuBufferAL.js"],"sourcesContent":["// Source: trinity/trinityal/include/Tr2BufferAL.h\n// trinity/trinityal/dx11/Tr2BufferALDx11.cpp\n// trinity/trinityal/metal/Tr2BufferALMetal.mm\n//\n// A device-backed `Tr2BufferAL` for WebGPU. The first one: until now the only\n// buffer implementation was `Tr2BufferALStub`, a `Uint8Array` that reaches no\n// device, so a Trinity class that fills a buffer every frame - `Tr2Blitter`'s\n// screen quad, `Tr2RingBuffer`'s upload arena - could be written and would\n// silently draw nothing.\n//\n// WHICH BACKEND THIS IMITATES, AND WHY IT MATTERS.\n//\n// Carbon has two families of MapForWriting. DX11 with WRITE_OFTEN and Metal\n// with NON_SYNCRONIZED_WRITE hand back a pointer into GPU-visible memory and\n// let the driver (or an engine-side pool) RENAME the underlying allocation on\n// unmap, so a second map in the same frame gets fresh storage and previously\n// recorded draws keep the bytes they were given. DX11 plain WRITE, DX12\n// STATIC and Metal plain WRITE instead hand back a CPU scratch and upload the\n// whole buffer on unmap.\n//\n// This is the second family, because it is the one WebGPU can express.\n// `queue.writeBuffer` is already ordered on the queue, so the upload lands\n// before any subsequently submitted draw reads it - which gives the guarantee\n// the renaming backends buy with renaming, without needing to rename.\n//\n// The shadow is RETAINED, not reallocated per map - which is DX11's behaviour\n// specifically, not the family's. DX11 allocates `m_writeLockMemory` once and\n// only if empty (`Tr2BufferALDx11.cpp:357-363`), so it survives across maps.\n// DX12 STATIC calls CreateScratch on every map (`Tr2ResourceHelper.cpp:192`)\n// and Metal plain WRITE makes a fresh MTLBuffer (`Tr2BufferALMetal.mm:233-237`)\n// - both hand back UNINITIALISED scratch, which is only safe because on those\n// backends plain-WRITE UpdateBuffer never goes through map/unmap at all.\n// Retaining is what makes a partial update correct here, since our shadow is\n// the authoritative copy between maps.\n//\n// CORRECTED 2026-09-08: this note previously cited dx11:419-429 and\n// metal:293-302 as showing bytes outside a memcpy range surviving. Those lines\n// are the WRITE_OFTEN arm, not the plain-WRITE arm this class imitates, and\n// under WRITE_DISCARD DX11 does not preserve them either. The plain-WRITE arms\n// are dx11:431-433 and metal:302-306. The decision was right; the citation\n// pointed at a branch that did not demonstrate it.\n//\n// NOT IMPLEMENTED: MapForReading. Reading a buffer back needs MAP_READ, a\n// separate staging buffer and an await, and nothing asks for it yet. It\n// refuses by name rather than returning empty bytes.\n//\n// THREE OF CARBON'S BUFFER METHODS ARE NOT HERE, AND SHOULD NOT BE.\n// `GetGpuResource` (DX) and `GetMetalBuffer` (Metal) are the SAME accessor\n// under each backend's own name for its native object; ours is\n// `GetDeviceBuffer`, which is that name for WebGPU. `CreateStagingBuffer` is\n// declared only by DX11, and PRIVATE there (`Tr2BufferALDx11.h:43`) - it is an\n// implementation detail of that backend's upload path, not part of the\n// contract, and neither dx12, metal nor the stub has it.\nimport { ALResult, Tr2ALMemoryType } from \"#trinityal\";\nimport { Tr2CpuUsage, Tr2GpuUsage, HasFlag } from \"#consts/render-context\";\nimport { RenderContextALOf } from \"../renderContextAL.js\";\n\n\n/** Carbon's \"no descriptor heap index\", as the stub buffer spells it. */\nconst NO_HEAP_INDEX = 0xffffffff;\n\n\n/** Carbon's usage flags mapped onto `GPUBufferUsage`. */\nfunction gpuBufferUsage(gpuUsage, usage)\n{\n let mask = 0;\n\n if (HasFlag(gpuUsage, Tr2GpuUsage.VERTEX_BUFFER)) mask |= usage.VERTEX;\n if (HasFlag(gpuUsage, Tr2GpuUsage.INDEX_BUFFER)) mask |= usage.INDEX;\n if (HasFlag(gpuUsage, Tr2GpuUsage.SHADER_RESOURCE)) mask |= usage.STORAGE;\n if (HasFlag(gpuUsage, Tr2GpuUsage.UNORDERED_ACCESS)) mask |= usage.STORAGE;\n if (HasFlag(gpuUsage, Tr2GpuUsage.DRAW_INDIRECT_ARGS)) mask |= usage.INDIRECT;\n if (HasFlag(gpuUsage, Tr2GpuUsage.COPY_DESTINATION)) mask |= usage.COPY_DST;\n\n return mask;\n}\n\n\n/**\n * A `Tr2BufferAL` backed by a real `GPUBuffer`.\n *\n * It deliberately does NOT extend `Tr2BaseDeviceResourceAL`: that base lives in\n * Trinity and registers into a Trinity-side resource list, and the engine does\n * not import Trinity classes for identity. It implements the same surface.\n */\nexport class CjsWebgpuBufferAL\n{\n /** m_desc */\n _desc = null;\n\n /** The device that owns the buffer, for writes and destruction. */\n _webgpu = null;\n\n /** The opaque `CreateDeviceBuffer` handle. */\n _handle = null;\n\n /** The retained CPU shadow; see the head comment on why it is retained. */\n _shadow = null;\n\n /** Whether a map is open, so a double map is caught rather than silently nested. */\n _mapped = false;\n\n /**\n * Creates the buffer against a device.\n *\n * @param {Tr2BufferDescriptionAL} desc The description.\n * @param {ArrayBufferView|null} initialData Initial contents, if any.\n * @param {object} renderContext The WebGPU render context AL.\n * @returns {number} An `ALResult` value.\n */\n Create(desc, initialData, renderContext)\n {\n this.Destroy();\n\n if (!desc || desc.count === 0) return ALResult.E_INVALIDARG;\n\n // Carbon's immutability rule (dx11:48-52, dx12:45, metal:47-52): a buffer\n // the CPU can never write must arrive with its contents, or nothing can\n // ever put bytes in it.\n const writable = HasFlag(desc.cpuUsage, Tr2CpuUsage.WRITE)\n || HasFlag(desc.gpuUsage, Tr2GpuUsage.UNORDERED_ACCESS);\n\n if (!writable && !initialData) return ALResult.E_INVALIDARG;\n\n // DX12 refuses this pair outright (Tr2BufferALDx12.cpp:51-54) and we have\n // no read path at all, so refusing is both faithful and honest.\n if (HasFlag(desc.cpuUsage, Tr2CpuUsage.READ)) return ALResult.E_INVALIDARG;\n\n // Trinity hands its own context, as Carbon's upcast lets it (`Tr2RingBuffer`,\n // `Tr2GpuResourcePool`); the AL behind it is what creates.\n const al = RenderContextALOf(renderContext);\n\n if (!al || !al.IsValid()) return ALResult.E_INVALIDCALL;\n\n const webgpu = al.GetWebgpu();\n if (!webgpu) return ALResult.E_INVALIDCALL;\n\n const size = desc.GetSizeInBytes();\n if (size === 0) return ALResult.E_INVALIDARG;\n\n const mask = gpuBufferUsage(desc.gpuUsage, webgpu.GetBufferUsage());\n if (mask === 0) return ALResult.E_INVALIDARG;\n\n this._handle = webgpu.CreateDeviceBuffer({ label: desc.label ?? \"Tr2BufferAL\", size, usage: mask });\n this._webgpu = webgpu;\n this._desc = desc;\n this._shadow = new Uint8Array(this._handle.size);\n\n if (initialData)\n {\n const bytes = new Uint8Array(initialData.buffer, initialData.byteOffset, initialData.byteLength);\n this._shadow.set(bytes.subarray(0, Math.min(bytes.length, this._shadow.length)));\n webgpu.WriteDeviceBuffer(this._handle, this._shadow);\n }\n\n return ALResult.S_OK;\n }\n\n /** Whether the buffer holds anything. */\n IsValid()\n {\n return this._handle !== null;\n }\n\n /** The description this buffer was created from, or null. */\n GetDesc()\n {\n return this._desc;\n }\n\n /** The buffer's size in bytes, as the description gives it. */\n GetSizeInBytes()\n {\n return this._desc ? this._desc.GetSizeInBytes() : 0;\n }\n\n /** The `GPUBuffer`, for binding it to a draw. */\n GetDeviceBuffer()\n {\n return this._handle ? this._webgpu.GetDeviceBuffer(this._handle) : null;\n }\n\n /**\n * Opens the buffer for writing, returning the shadow to write into.\n *\n * Carbon returns `{ result, data }` from its stub and a raw pointer from the\n * backends; the stub's shape is the one Trinity callers already read.\n *\n * @param {object} _renderContext Unused; the device came from Create.\n * @returns {{result: number, data: Uint8Array|null}} The shadow.\n */\n MapForWriting(_renderContext)\n {\n if (!this.IsValid()) return { result: ALResult.E_INVALIDCALL, data: null };\n if (!HasFlag(this._desc.cpuUsage, Tr2CpuUsage.WRITE)) return { result: ALResult.E_INVALIDCALL, data: null };\n\n // Every backend permits a second map; none permits a NESTED one, and a\n // nested map here would upload twice and hide which write won.\n if (this._mapped) return { result: ALResult.E_INVALIDCALL, data: null };\n\n this._mapped = true;\n\n return { result: ALResult.S_OK, data: this._shadow };\n }\n\n /**\n * Closes the map and uploads the whole buffer.\n *\n * Uploading everything rather than a dirty range matches all three real\n * backends: DX11 `UpdateSubresource` on the whole buffer (cpp:400), DX12\n * `CopyBufferRegion` of `m_size` (Tr2ResourceHelper.cpp:234), Metal a blit of\n * `m_mtlBuffer.length` (mm:259).\n */\n UnmapForWriting()\n {\n if (!this._mapped) return;\n\n this._mapped = false;\n this._webgpu.WriteDeviceBuffer(this._handle, this._shadow);\n }\n\n /**\n * Writes a range without a map.\n *\n * Carbon's stub refuses this for `WRITE_OFTEN` (`Tr2BufferALStub.cpp:138-141`)\n * and DX12 refuses it for a DYNAMIC buffer (`Tr2ResourceHelper.cpp:253-256`),\n * both because such a buffer's storage moves under a partial write. Ours does\n * not move, but the refusal is kept: a caller that reaches here with a\n * WRITE_OFTEN buffer has confused the two update paths, and every portable\n * caller uses map/unmap for those.\n *\n * @param {number} offset Byte offset of the range.\n * @param {number} size Bytes in the range.\n * @param {ArrayBufferView} data The bytes.\n * @param {object} _renderContext Unused; the device came from Create.\n * @returns {number} An `ALResult` value.\n */\n UpdateBuffer(offset, size, data, _renderContext)\n {\n if (!this.IsValid()) return ALResult.E_INVALIDCALL;\n if (!HasFlag(this._desc.cpuUsage, Tr2CpuUsage.WRITE)) return ALResult.E_INVALIDCALL;\n if (HasFlag(this._desc.cpuUsage, Tr2CpuUsage.WRITE_OFTEN)) return ALResult.E_INVALIDCALL;\n if (!data) return ALResult.E_INVALIDARG;\n if (offset < 0 || size < 0 || offset + size > this._shadow.length) return ALResult.E_INVALIDARG;\n\n const bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n\n this._shadow.set(bytes.subarray(0, size), offset);\n\n // Upload the RANGE, as every Carbon backend does for plain WRITE - DX11 a\n // D3D11_BOX (`Tr2BufferALDx11.cpp:431-433`), Metal a size-byte staging copy\n // (`Tr2BufferALMetal.mm:302-306`), DX12 a CopyBufferRegion of size at offset\n // (`Tr2ResourceHelper.cpp:258-266`). This used to write the whole shadow,\n // which was correct but paid the full buffer on every partial update.\n //\n // Widened outward to four-byte bounds because `queue.writeBuffer` requires\n // that alignment and D3D11_BOX does not. Widening is safe here and only\n // here: the shadow is RETAINED and authoritative, so the extra bytes on\n // each side are the same ones already on the device. The buffer size is\n // aligned at creation, so the widened end never runs past it.\n const start = offset & ~3;\n const end = Math.min((offset + size + 3) & ~3, this._shadow.length);\n\n this._webgpu.WriteDeviceBuffer(this._handle, this._shadow.subarray(start, end), start);\n\n return ALResult.S_OK;\n }\n\n /** Releases the GPU buffer and the shadow. */\n Destroy()\n {\n if (this._handle) this._handle.Destroy();\n\n this._handle = null;\n this._webgpu = null;\n this._desc = null;\n this._shadow = null;\n this._mapped = false;\n }\n\n /** REFUSED: reading back needs MAP_READ, a staging buffer and an await. */\n MapForReading()\n {\n return { result: ALResult.E_INVALIDCALL, data: null };\n }\n\n /** @see MapForReading */\n UnmapForReading()\n {\n }\n\n /**\n * The buffer's size in bytes, under Carbon's name for the question.\n *\n * `GetSizeInBytes` above is this backend's own spelling and predates the\n * parity check. Both stay: the stub answers to `GetSize`\n * (`stub/Tr2BufferALStub.js`), so a caller written against one backend must\n * not fail against the other.\n *\n * @returns {number} Size in bytes.\n */\n GetSize()\n {\n return this.GetSizeInBytes();\n }\n\n /**\n * Which memory class this buffer occupies.\n *\n * MANAGED, as the stub buffer reports: WebGPU gives no placement control and\n * no residency signal, so the honest answer is the device-heap default rather\n * than a claim about video memory.\n *\n * @returns {number} A `Tr2ALMemoryType` value.\n */\n GetMemoryClass()\n {\n return Tr2ALMemoryType.AL_MEMORY_MANAGED;\n }\n\n /**\n * Fills in a device-resource description.\n *\n * Carbon's backends report size and memory class into the struct the resource\n * sweep walks; the base class's own version is empty\n * (`Tr2DeviceResourceAL.js`), and so is the stub's.\n *\n * @param {object} description The description to fill.\n * @returns {object} The description, filled.\n */\n Describe(description)\n {\n if (!description) return description;\n\n description.sizeInBytes = this.GetSize();\n description.memoryClass = this.GetMemoryClass();\n\n return description;\n }\n\n /**\n * Names the buffer for a debugger.\n *\n * `GPUObjectBase.label` is writable after creation, so unlike the stub this\n * one keeps the name where the browser's own error messages will quote it.\n *\n * @param {string} name The name to attach.\n * @returns {number} An `ALResult` value.\n */\n SetName(name)\n {\n const buffer = this.GetDeviceBuffer();\n\n if (buffer) buffer.label = String(name);\n\n return ALResult.S_OK;\n }\n\n /**\n * The buffer's index in a shader-resource descriptor heap.\n *\n * WebGPU HAS NO DESCRIPTOR HEAP - a resource is reached through a bind group,\n * not by index into a global table - so this reports Carbon's \"not in a heap\"\n * sentinel, as the stub does. It is not a gap to be filled later; there is\n * nothing for it to number.\n *\n * @returns {number} `NO_HEAP_INDEX`.\n */\n GetSrvIndexInHeap()\n {\n return NO_HEAP_INDEX;\n }\n\n /**\n * The buffer's index in an unordered-access descriptor heap.\n *\n * @returns {number} `NO_HEAP_INDEX`; see `GetSrvIndexInHeap`.\n */\n GetUavIndexInHeap()\n {\n return NO_HEAP_INDEX;\n }\n}\n"],"names":["NO_HEAP_INDEX","gpuBufferUsage","gpuUsage","usage","mask","HasFlag","Tr2GpuUsage","VERTEX_BUFFER","VERTEX","INDEX_BUFFER","INDEX","SHADER_RESOURCE","STORAGE","UNORDERED_ACCESS","DRAW_INDIRECT_ARGS","INDIRECT","COPY_DESTINATION","COPY_DST","CjsWebgpuBufferAL","_desc","_webgpu","_handle","_shadow","_mapped","Create","desc","initialData","renderContext","Destroy","count","ALResult","E_INVALIDARG","writable","cpuUsage","Tr2CpuUsage","WRITE","READ","al","RenderContextALOf","IsValid","E_INVALIDCALL","webgpu","GetWebgpu","size","GetSizeInBytes","GetBufferUsage","CreateDeviceBuffer","label","Uint8Array","bytes","buffer","byteOffset","byteLength","set","subarray","Math","min","length","WriteDeviceBuffer","S_OK","GetDesc","GetDeviceBuffer","MapForWriting","_renderContext","result","data","UnmapForWriting","UpdateBuffer","offset","WRITE_OFTEN","start","end","MapForReading","UnmapForReading","GetSize","GetMemoryClass","Tr2ALMemoryType","AL_MEMORY_MANAGED","Describe","description","sizeInBytes","memoryClass","SetName","name","String","GetSrvIndexInHeap","GetUavIndexInHeap"],"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;AACA;AACA;AACA;;AAMA;AACA,MAAMA,aAAa,GAAG,UAAU;;AAGhC;AACA,SAASC,cAAcA,CAACC,QAAQ,EAAEC,KAAK,EACvC;EACE,IAAIC,IAAI,GAAG,CAAC;AAEZ,EAAA,IAAIC,OAAO,CAACH,QAAQ,EAAEI,WAAW,CAACC,aAAa,CAAC,EAAEH,IAAI,IAAID,KAAK,CAACK,MAAM;AACtE,EAAA,IAAIH,OAAO,CAACH,QAAQ,EAAEI,WAAW,CAACG,YAAY,CAAC,EAAEL,IAAI,IAAID,KAAK,CAACO,KAAK;AACpE,EAAA,IAAIL,OAAO,CAACH,QAAQ,EAAEI,WAAW,CAACK,eAAe,CAAC,EAAEP,IAAI,IAAID,KAAK,CAACS,OAAO;AACzE,EAAA,IAAIP,OAAO,CAACH,QAAQ,EAAEI,WAAW,CAACO,gBAAgB,CAAC,EAAET,IAAI,IAAID,KAAK,CAACS,OAAO;AAC1E,EAAA,IAAIP,OAAO,CAACH,QAAQ,EAAEI,WAAW,CAACQ,kBAAkB,CAAC,EAAEV,IAAI,IAAID,KAAK,CAACY,QAAQ;AAC7E,EAAA,IAAIV,OAAO,CAACH,QAAQ,EAAEI,WAAW,CAACU,gBAAgB,CAAC,EAAEZ,IAAI,IAAID,KAAK,CAACc,QAAQ;AAE3E,EAAA,OAAOb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AE/C,IAAA,OAAOI,WAAW;AACpB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,OAAOA,CAACC,IAAI,EACZ;AACE,IAAA,MAAMjC,MAAM,GAAG,IAAI,CAACW,eAAe,EAAE;IAErC,IAAIX,MAAM,EAAEA,MAAM,CAACH,KAAK,GAAGqC,MAAM,CAACD,IAAI,CAAC;IAEvC,OAAOrD,QAAQ,CAAC6B,IAAI;AACtB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACE0B,EAAAA,iBAAiBA,GACjB;AACE,IAAA,OAAOrF,aAAa;AACtB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACEsF,EAAAA,iBAAiBA,GACjB;AACE,IAAA,OAAOtF,aAAa;AACtB,EAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsWebgpuBufferAL.js","sources":["../../../../src/trinityal/webgpu/CjsWebgpuBufferAL.js"],"sourcesContent":["// Source: trinity/trinityal/include/Tr2BufferAL.h\r\n// trinity/trinityal/dx11/Tr2BufferALDx11.cpp\r\n// trinity/trinityal/metal/Tr2BufferALMetal.mm\r\n//\r\n// A device-backed `Tr2BufferAL` for WebGPU. The first one: until now the only\r\n// buffer implementation was `Tr2BufferALStub`, a `Uint8Array` that reaches no\r\n// device, so a Trinity class that fills a buffer every frame - `Tr2Blitter`'s\r\n// screen quad, `Tr2RingBuffer`'s upload arena - could be written and would\r\n// silently draw nothing.\r\n//\r\n// WHICH BACKEND THIS IMITATES, AND WHY IT MATTERS.\r\n//\r\n// Carbon has two families of MapForWriting. DX11 with WRITE_OFTEN and Metal\r\n// with NON_SYNCRONIZED_WRITE hand back a pointer into GPU-visible memory and\r\n// let the driver (or an engine-side pool) RENAME the underlying allocation on\r\n// unmap, so a second map in the same frame gets fresh storage and previously\r\n// recorded draws keep the bytes they were given. DX11 plain WRITE, DX12\r\n// STATIC and Metal plain WRITE instead hand back a CPU scratch and upload the\r\n// whole buffer on unmap.\r\n//\r\n// This is the second family, because it is the one WebGPU can express.\r\n// `queue.writeBuffer` is already ordered on the queue, so the upload lands\r\n// before any subsequently submitted draw reads it - which gives the guarantee\r\n// the renaming backends buy with renaming, without needing to rename.\r\n//\r\n// The shadow is RETAINED, not reallocated per map - which is DX11's behaviour\r\n// specifically, not the family's. DX11 allocates `m_writeLockMemory` once and\r\n// only if empty (`Tr2BufferALDx11.cpp:357-363`), so it survives across maps.\r\n// DX12 STATIC calls CreateScratch on every map (`Tr2ResourceHelper.cpp:192`)\r\n// and Metal plain WRITE makes a fresh MTLBuffer (`Tr2BufferALMetal.mm:233-237`)\r\n// - both hand back UNINITIALISED scratch, which is only safe because on those\r\n// backends plain-WRITE UpdateBuffer never goes through map/unmap at all.\r\n// Retaining is what makes a partial update correct here, since our shadow is\r\n// the authoritative copy between maps.\r\n//\r\n// CORRECTED 2026-09-08: this note previously cited dx11:419-429 and\r\n// metal:293-302 as showing bytes outside a memcpy range surviving. Those lines\r\n// are the WRITE_OFTEN arm, not the plain-WRITE arm this class imitates, and\r\n// under WRITE_DISCARD DX11 does not preserve them either. The plain-WRITE arms\r\n// are dx11:431-433 and metal:302-306. The decision was right; the citation\r\n// pointed at a branch that did not demonstrate it.\r\n//\r\n// NOT IMPLEMENTED: MapForReading. Reading a buffer back needs MAP_READ, a\r\n// separate staging buffer and an await, and nothing asks for it yet. It\r\n// refuses by name rather than returning empty bytes.\r\n//\r\n// THREE OF CARBON'S BUFFER METHODS ARE NOT HERE, AND SHOULD NOT BE.\r\n// `GetGpuResource` (DX) and `GetMetalBuffer` (Metal) are the SAME accessor\r\n// under each backend's own name for its native object; ours is\r\n// `GetDeviceBuffer`, which is that name for WebGPU. `CreateStagingBuffer` is\r\n// declared only by DX11, and PRIVATE there (`Tr2BufferALDx11.h:43`) - it is an\r\n// implementation detail of that backend's upload path, not part of the\r\n// contract, and neither dx12, metal nor the stub has it.\r\nimport { CjsSchema } from \"#schema\";\r\nimport { ALResult, Tr2ALMemoryType } from \"#trinityal\";\r\nimport { Tr2CpuUsage, Tr2GpuUsage, HasFlag } from \"#consts/render-context\";\r\nimport { RenderContextALOf } from \"../renderContextAL.js\";\r\n\r\n\r\n/** Carbon's \"no descriptor heap index\", as the stub buffer spells it. */\r\nconst NO_HEAP_INDEX = 0xffffffff;\r\n\r\n\r\n/** Carbon's usage flags mapped onto `GPUBufferUsage`. */\r\nfunction gpuBufferUsage(gpuUsage, usage)\r\n{\r\n let mask = 0;\r\n\r\n if (HasFlag(gpuUsage, Tr2GpuUsage.VERTEX_BUFFER)) mask |= usage.VERTEX;\r\n if (HasFlag(gpuUsage, Tr2GpuUsage.INDEX_BUFFER)) mask |= usage.INDEX;\r\n if (HasFlag(gpuUsage, Tr2GpuUsage.SHADER_RESOURCE)) mask |= usage.STORAGE;\r\n if (HasFlag(gpuUsage, Tr2GpuUsage.UNORDERED_ACCESS)) mask |= usage.STORAGE;\r\n if (HasFlag(gpuUsage, Tr2GpuUsage.DRAW_INDIRECT_ARGS)) mask |= usage.INDIRECT;\r\n if (HasFlag(gpuUsage, Tr2GpuUsage.COPY_DESTINATION)) mask |= usage.COPY_DST;\r\n\r\n return mask;\r\n}\r\n\r\n\r\n/**\r\n * A `Tr2BufferAL` backed by a real `GPUBuffer`.\r\n *\r\n * It deliberately does NOT extend `Tr2BaseDeviceResourceAL`: that base lives in\r\n * Trinity and registers into a Trinity-side resource list, and the engine does\r\n * not import Trinity classes for identity. It implements the same surface.\r\n */\r\nexport class CjsWebgpuBufferAL\r\n{\r\n /** m_desc */\r\n _desc = null;\r\n\r\n /** The device that owns the buffer, for writes and destruction. */\r\n _webgpu = null;\r\n\r\n /** The opaque `CreateDeviceBuffer` handle. */\r\n _handle = null;\r\n\r\n /** The retained CPU shadow; see the head comment on why it is retained. */\r\n _shadow = null;\r\n\r\n /** Whether a map is open, so a double map is caught rather than silently nested. */\r\n _mapped = false;\r\n\r\n /**\r\n * Creates the buffer against a device.\r\n *\r\n * @param {Tr2BufferDescriptionAL} desc The description.\r\n * @param {ArrayBufferView|null} initialData Initial contents, if any.\r\n * @param {object} renderContext The WebGPU render context AL.\r\n * @returns {number} An `ALResult` value.\r\n */\r\n Create(desc, initialData, renderContext)\r\n {\r\n this.Destroy();\r\n\r\n if (!desc || desc.count === 0) return ALResult.E_INVALIDARG;\r\n\r\n // Carbon's immutability rule (dx11:48-52, dx12:45, metal:47-52): a buffer\r\n // the CPU can never write must arrive with its contents, or nothing can\r\n // ever put bytes in it.\r\n const writable = HasFlag(desc.cpuUsage, Tr2CpuUsage.WRITE)\r\n || HasFlag(desc.gpuUsage, Tr2GpuUsage.UNORDERED_ACCESS);\r\n\r\n if (!writable && !initialData) return ALResult.E_INVALIDARG;\r\n\r\n // DX12 refuses this pair outright (Tr2BufferALDx12.cpp:51-54) and we have\r\n // no read path at all, so refusing is both faithful and honest.\r\n if (HasFlag(desc.cpuUsage, Tr2CpuUsage.READ)) return ALResult.E_INVALIDARG;\r\n\r\n // Trinity hands its own context, as Carbon's upcast lets it (`Tr2RingBuffer`,\r\n // `Tr2GpuResourcePool`); the AL behind it is what creates.\r\n const al = RenderContextALOf(renderContext);\r\n\r\n if (!al || !al.IsValid()) return ALResult.E_INVALIDCALL;\r\n\r\n const webgpu = al.GetWebgpu();\r\n if (!webgpu) return ALResult.E_INVALIDCALL;\r\n\r\n const size = desc.GetSizeInBytes();\r\n if (size === 0) return ALResult.E_INVALIDARG;\r\n\r\n const mask = gpuBufferUsage(desc.gpuUsage, webgpu.GetBufferUsage());\r\n if (mask === 0) return ALResult.E_INVALIDARG;\r\n\r\n this._handle = webgpu.CreateDeviceBuffer({ label: desc.label ?? \"Tr2BufferAL\", size, usage: mask });\r\n this._webgpu = webgpu;\r\n this._desc = desc;\r\n this._shadow = new Uint8Array(this._handle.size);\r\n\r\n if (initialData)\r\n {\r\n const bytes = new Uint8Array(initialData.buffer, initialData.byteOffset, initialData.byteLength);\r\n this._shadow.set(bytes.subarray(0, Math.min(bytes.length, this._shadow.length)));\r\n webgpu.WriteDeviceBuffer(this._handle, this._shadow);\r\n }\r\n\r\n return ALResult.S_OK;\r\n }\r\n\r\n /** Whether the buffer holds anything. */\r\n IsValid()\r\n {\r\n return this._handle !== null;\r\n }\r\n\r\n /** The description this buffer was created from, or null. */\r\n GetDesc()\r\n {\r\n return this._desc;\r\n }\r\n\r\n /** The buffer's size in bytes, as the description gives it. */\r\n GetSizeInBytes()\r\n {\r\n return this._desc ? this._desc.GetSizeInBytes() : 0;\r\n }\r\n\r\n /** The `GPUBuffer`, for binding it to a draw. */\r\n GetDeviceBuffer()\r\n {\r\n return this._handle ? this._webgpu.GetDeviceBuffer(this._handle) : null;\r\n }\r\n\r\n /**\r\n * Opens the buffer for writing, returning the shadow to write into.\r\n *\r\n * Carbon returns `{ result, data }` from its stub and a raw pointer from the\r\n * backends; the stub's shape is the one Trinity callers already read.\r\n *\r\n * @param {object} _renderContext Unused; the device came from Create.\r\n * @returns {{result: number, data: Uint8Array|null}} The shadow.\r\n */\r\n MapForWriting(_renderContext)\r\n {\r\n if (!this.IsValid()) return { result: ALResult.E_INVALIDCALL, data: null };\r\n if (!HasFlag(this._desc.cpuUsage, Tr2CpuUsage.WRITE)) return { result: ALResult.E_INVALIDCALL, data: null };\r\n\r\n // Every backend permits a second map; none permits a NESTED one, and a\r\n // nested map here would upload twice and hide which write won.\r\n if (this._mapped) return { result: ALResult.E_INVALIDCALL, data: null };\r\n\r\n this._mapped = true;\r\n\r\n return { result: ALResult.S_OK, data: this._shadow };\r\n }\r\n\r\n /**\r\n * Closes the map and uploads the whole buffer.\r\n *\r\n * Uploading everything rather than a dirty range matches all three real\r\n * backends: DX11 `UpdateSubresource` on the whole buffer (cpp:400), DX12\r\n * `CopyBufferRegion` of `m_size` (Tr2ResourceHelper.cpp:234), Metal a blit of\r\n * `m_mtlBuffer.length` (mm:259).\r\n */\r\n UnmapForWriting()\r\n {\r\n if (!this._mapped) return;\r\n\r\n this._mapped = false;\r\n this._webgpu.WriteDeviceBuffer(this._handle, this._shadow);\r\n }\r\n\r\n /**\r\n * Writes a range without a map.\r\n *\r\n * Carbon's stub refuses this for `WRITE_OFTEN` (`Tr2BufferALStub.cpp:138-141`)\r\n * and DX12 refuses it for a DYNAMIC buffer (`Tr2ResourceHelper.cpp:253-256`),\r\n * both because such a buffer's storage moves under a partial write. Ours does\r\n * not move, but the refusal is kept: a caller that reaches here with a\r\n * WRITE_OFTEN buffer has confused the two update paths, and every portable\r\n * caller uses map/unmap for those.\r\n *\r\n * @param {number} offset Byte offset of the range.\r\n * @param {number} size Bytes in the range.\r\n * @param {ArrayBufferView} data The bytes.\r\n * @param {object} _renderContext Unused; the device came from Create.\r\n * @returns {number} An `ALResult` value.\r\n */\r\n UpdateBuffer(offset, size, data, _renderContext)\r\n {\r\n if (!this.IsValid()) return ALResult.E_INVALIDCALL;\r\n if (!HasFlag(this._desc.cpuUsage, Tr2CpuUsage.WRITE)) return ALResult.E_INVALIDCALL;\r\n if (HasFlag(this._desc.cpuUsage, Tr2CpuUsage.WRITE_OFTEN)) return ALResult.E_INVALIDCALL;\r\n if (!data) return ALResult.E_INVALIDARG;\r\n if (offset < 0 || size < 0 || offset + size > this._shadow.length) return ALResult.E_INVALIDARG;\r\n\r\n const bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\r\n\r\n this._shadow.set(bytes.subarray(0, size), offset);\r\n\r\n // Upload the RANGE, as every Carbon backend does for plain WRITE - DX11 a\r\n // D3D11_BOX (`Tr2BufferALDx11.cpp:431-433`), Metal a size-byte staging copy\r\n // (`Tr2BufferALMetal.mm:302-306`), DX12 a CopyBufferRegion of size at offset\r\n // (`Tr2ResourceHelper.cpp:258-266`). This used to write the whole shadow,\r\n // which was correct but paid the full buffer on every partial update.\r\n //\r\n // Widened outward to four-byte bounds because `queue.writeBuffer` requires\r\n // that alignment and D3D11_BOX does not. Widening is safe here and only\r\n // here: the shadow is RETAINED and authoritative, so the extra bytes on\r\n // each side are the same ones already on the device. The buffer size is\r\n // aligned at creation, so the widened end never runs past it.\r\n const start = offset & ~3;\r\n const end = Math.min((offset + size + 3) & ~3, this._shadow.length);\r\n\r\n this._webgpu.WriteDeviceBuffer(this._handle, this._shadow.subarray(start, end), start);\r\n\r\n return ALResult.S_OK;\r\n }\r\n\r\n /** Releases the GPU buffer and the shadow. */\r\n Destroy()\r\n {\r\n if (this._handle) this._handle.Destroy();\r\n\r\n this._handle = null;\r\n this._webgpu = null;\r\n this._desc = null;\r\n this._shadow = null;\r\n this._mapped = false;\r\n }\r\n\r\n /** REFUSED: reading back needs MAP_READ, a staging buffer and an await. */\r\n MapForReading()\r\n {\r\n return { result: ALResult.E_INVALIDCALL, data: null };\r\n }\r\n\r\n /** @see MapForReading */\r\n UnmapForReading()\r\n {\r\n }\r\n\r\n /**\r\n * The buffer's size in bytes, under Carbon's name for the question.\r\n *\r\n * `GetSizeInBytes` above is this backend's own spelling and predates the\r\n * parity check. Both stay: the stub answers to `GetSize`\r\n * (`stub/Tr2BufferALStub.js`), so a caller written against one backend must\r\n * not fail against the other.\r\n *\r\n * @returns {number} Size in bytes.\r\n */\r\n GetSize()\r\n {\r\n return this.GetSizeInBytes();\r\n }\r\n\r\n /**\r\n * Which memory class this buffer occupies.\r\n *\r\n * MANAGED, as the stub buffer reports: WebGPU gives no placement control and\r\n * no residency signal, so the honest answer is the device-heap default rather\r\n * than a claim about video memory.\r\n *\r\n * @returns {number} A `Tr2ALMemoryType` value.\r\n */\r\n GetMemoryClass()\r\n {\r\n return Tr2ALMemoryType.AL_MEMORY_MANAGED;\r\n }\r\n\r\n /**\r\n * Fills in a device-resource description.\r\n *\r\n * Carbon's backends report size and memory class into the struct the resource\r\n * sweep walks; the base class's own version is empty\r\n * (`Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js`), and so is the stub's.\r\n *\r\n * @param {object} description The description to fill.\r\n * @returns {object} The description, filled.\r\n */\r\n Describe(description)\r\n {\r\n if (!description) return description;\r\n\r\n description.sizeInBytes = this.GetSize();\r\n description.memoryClass = this.GetMemoryClass();\r\n\r\n return description;\r\n }\r\n\r\n /**\r\n * Names the buffer for a debugger.\r\n *\r\n * `GPUObjectBase.label` is writable after creation, so unlike the stub this\r\n * one keeps the name where the browser's own error messages will quote it.\r\n *\r\n * @param {string} name The name to attach.\r\n * @returns {number} An `ALResult` value.\r\n */\r\n SetName(name)\r\n {\r\n const buffer = this.GetDeviceBuffer();\r\n\r\n if (buffer) buffer.label = String(name);\r\n\r\n return ALResult.S_OK;\r\n }\r\n\r\n /**\r\n * The buffer's index in a shader-resource descriptor heap.\r\n *\r\n * WebGPU HAS NO DESCRIPTOR HEAP - a resource is reached through a bind group,\r\n * not by index into a global table - so this reports Carbon's \"not in a heap\"\r\n * sentinel, as the stub does. It is not a gap to be filled later; there is\r\n * nothing for it to number.\r\n *\r\n * @returns {number} `NO_HEAP_INDEX`.\r\n */\r\n GetSrvIndexInHeap()\r\n {\r\n return NO_HEAP_INDEX;\r\n }\r\n\r\n /**\r\n * The buffer's index in an unordered-access descriptor heap.\r\n *\r\n * @returns {number} `NO_HEAP_INDEX`; see `GetSrvIndexInHeap`.\r\n */\r\n GetUavIndexInHeap()\r\n {\r\n return NO_HEAP_INDEX;\r\n }\r\n}\r\n\r\n// DECLARED AS A CALL, NOT A DECORATOR, for the reason recorded in\r\n// Tr2BitmapDimensions.js: the layer is imported straight from source by its\r\n// tests and raw Node cannot parse decorator syntax.\r\n//\r\n// The donor is NAMED rather than left to be derived from this class's name.\r\n// Carbon calls every backend's class the same thing and carries the backend in\r\n// the FILE name, because only one backend compiles at a time; we ship them\r\n// together, so the backend moves onto the class name. That divergence is the\r\n// author's to declare, never a checker's to guess.\r\nCjsSchema.define(CjsWebgpuBufferAL, { className: \"CjsWebgpuBufferAL\", carbon: \"Tr2BufferAL\" });\r\n"],"names":["NO_HEAP_INDEX","gpuBufferUsage","gpuUsage","usage","mask","HasFlag","Tr2GpuUsage","VERTEX_BUFFER","VERTEX","INDEX_BUFFER","INDEX","SHADER_RESOURCE","STORAGE","UNORDERED_ACCESS","DRAW_INDIRECT_ARGS","INDIRECT","COPY_DESTINATION","COPY_DST","CjsWebgpuBufferAL","_desc","_webgpu","_handle","_shadow","_mapped","Create","desc","initialData","renderContext","Destroy","count","ALResult","E_INVALIDARG","writable","cpuUsage","Tr2CpuUsage","WRITE","READ","al","RenderContextALOf","IsValid","E_INVALIDCALL","webgpu","GetWebgpu","size","GetSizeInBytes","GetBufferUsage","CreateDeviceBuffer","label","Uint8Array","bytes","buffer","byteOffset","byteLength","set","subarray","Math","min","length","WriteDeviceBuffer","S_OK","GetDesc","GetDeviceBuffer","MapForWriting","_renderContext","result","data","UnmapForWriting","UpdateBuffer","offset","WRITE_OFTEN","start","end","MapForReading","UnmapForReading","GetSize","GetMemoryClass","Tr2ALMemoryType","AL_MEMORY_MANAGED","Describe","description","sizeInBytes","memoryClass","SetName","name","String","GetSrvIndexInHeap","GetUavIndexInHeap","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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA,MAAMA,aAAa,GAAG,UAAU;;AAGhC;AACA,SAASC,cAAcA,CAACC,QAAQ,EAAEC,KAAK,EACvC;EACE,IAAIC,IAAI,GAAG,CAAC;AAEZ,EAAA,IAAIC,OAAO,CAACH,QAAQ,EAAEI,WAAW,CAACC,aAAa,CAAC,EAAEH,IAAI,IAAID,KAAK,CAACK,MAAM;AACtE,EAAA,IAAIH,OAAO,CAACH,QAAQ,EAAEI,WAAW,CAACG,YAAY,CAAC,EAAEL,IAAI,IAAID,KAAK,CAACO,KAAK;AACpE,EAAA,IAAIL,O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OA,GACP;AACE,IAAA,OAAO,IAAI,CAAC9B,cAAc,EAAE;AAC9B,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACE+B,EAAAA,cAAcA,GACd;IACE,OAAOC,eAAe,CAACC,iBAAiB;AAC1C,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,QAAQA,CAACC,WAAW,EACpB;AACE,IAAA,IAAI,CAACA,WAAW,EAAE,OAAOA,WAAW;AAEpCA,IAAAA,WAAW,CAACC,WAAW,GAAG,IAAI,CAACN,OAAO,EAAE;AACxCK,IAAAA,WAAW,CAACE,WAAW,GAAG,IAAI,CAACN,cAAc,EAAE;AAE/C,IAAA,OAAOI,WAAW;AACpB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,OAAOA,CAACC,IAAI,EACZ;AACE,IAAA,MAAMjC,MAAM,GAAG,IAAI,CAACW,eAAe,EAAE;IAErC,IAAIX,MAAM,EAAEA,MAAM,CAACH,KAAK,GAAGqC,MAAM,CAACD,IAAI,CAAC;IAEvC,OAAOrD,QAAQ,CAAC6B,IAAI;AACtB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACE0B,EAAAA,iBAAiBA,GACjB;AACE,IAAA,OAAOrF,aAAa;AACtB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACEsF,EAAAA,iBAAiBA,GACjB;AACE,IAAA,OAAOtF,aAAa;AACtB,EAAA;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAuF,SAAS,CAACC,MAAM,CAACtE,iBAAiB,EAAE;AAAEuE,EAAAA,SAAS,EAAE,mBAAmB;AAAEC,EAAAA,MAAM,EAAE;AAAc,CAAC,CAAC;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CjsSchema } from '#schema';
|
|
2
|
+
|
|
1
3
|
// Source: trinity/trinityal/metal/Tr2CapsALMetal.h
|
|
2
4
|
// Source: trinity/trinityal/stub/Tr2CapsALStub.h
|
|
3
5
|
//
|
|
@@ -11,6 +13,7 @@
|
|
|
11
13
|
// `SupportsFloat16`, which is an optional feature and is therefore asked of the
|
|
12
14
|
// device when there is one.
|
|
13
15
|
|
|
16
|
+
|
|
14
17
|
/**
|
|
15
18
|
* The platform capability constants, WebGPU's answers.
|
|
16
19
|
*
|
|
@@ -142,5 +145,19 @@ class CjsWebgpuCapsAL {
|
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
147
|
|
|
148
|
+
// DECLARED AS A CALL, NOT A DECORATOR, for the reason recorded in
|
|
149
|
+
// Tr2BitmapDimensions.js: the layer is imported straight from source by its
|
|
150
|
+
// tests and raw Node cannot parse decorator syntax.
|
|
151
|
+
//
|
|
152
|
+
// The donor is NAMED rather than left to be derived from this class's name.
|
|
153
|
+
// Carbon calls every backend's class the same thing and carries the backend in
|
|
154
|
+
// the FILE name, because only one backend compiles at a time; we ship them
|
|
155
|
+
// together, so the backend moves onto the class name. That divergence is the
|
|
156
|
+
// author's to declare, never a checker's to guess.
|
|
157
|
+
CjsSchema.define(CjsWebgpuCapsAL, {
|
|
158
|
+
className: "CjsWebgpuCapsAL",
|
|
159
|
+
carbon: "Tr2CapsAL"
|
|
160
|
+
});
|
|
161
|
+
|
|
145
162
|
export { CjsWebgpuCapsAL, CjsWebgpuPlatformCaps };
|
|
146
163
|
//# sourceMappingURL=CjsWebgpuCapsAL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsWebgpuCapsAL.js","sources":["../../../../src/trinityal/webgpu/CjsWebgpuCapsAL.js"],"sourcesContent":["// Source: trinity/trinityal/metal/Tr2CapsALMetal.h\n// Source: trinity/trinityal/stub/Tr2CapsALStub.h\n//\n// What the WebGPU backend says it can do.\n//\n// Carbon's caps object is six questions a caller BRANCHES on, so answering them\n// wrongly sends Trinity down a path this device never takes - which is why the\n// stub answers \"yes\" to four of its ten platform constants rather than denying\n// everything. These are WebGPU's answers, each one decided against the spec's\n// baseline guarantees rather than against a particular adapter, EXCEPT\n// `SupportsFloat16`, which is an optional feature and is therefore asked of the\n// device when there is one.\n\n/**\n * The platform capability constants, WebGPU's answers.\n *\n * The stub's equivalent is `Tr2StubPlatformCaps`, and this table said yes to\n * three things the stub says no to. Two of them were wrong, and the reason is\n * worth keeping because it is easy to make again:\n *\n * **A CAP DESCRIBES THIS BACKEND, NOT THE API IT IS BUILT ON.** \"Storage\n * buffers are core WebGPU\" is true and answers a different question than\n * \"can this backend honour a caller that takes the unordered-access branch\".\n * A caller reads a cap to decide, and a cap is the LAST place that can say no -\n * after it, the caller is committed and the refusals it meets have no branch to\n * take. Both corrected entries are commented where they sit.\n *\n * What still differs from the stub, and holds: buffer shader resources, and the\n * platform not being declared low-performance, because a caller uses that to\n * pick reduced paths and a GPU is doing this work.\n */\nexport const CjsWebgpuPlatformCaps = Object.freeze({\n SUPPORTS_BUFFER_SHADER_RESOURCES: true,\n\n SUPPORTS_BUFFER_COUNTERS: false,\n\n // FALSE, AND IT SAID TRUE FOR A DAY. The argument was \"storage buffers and\n // storage textures are core WebGPU\" - true of the API, and the wrong question.\n // A cap describes WHAT THIS BACKEND CAN DO, and today `ClearUav` refuses,\n // nothing dispatches compute, and `CjsWebgpuDevice` fails any binding\n // visibility that is not vertex or fragment. Carbon's own stub denies this one\n // (`stub/Tr2CapsALStub.h:10`) while claiming compute, and a caller taking the\n // UAV branch would meet three refusals in a row - with the cap being the last\n // place that could have said no.\n SUPPORTS_UNORDERED_ACCESS: false,\n\n // Carbon's stub claims compute too. The dispatch verbs refuse here exactly as\n // they do there, so this promises no more than the stub does.\n SUPPORTS_COMPUTE: true,\n\n SUPPORTS_TEXTURE_ARRAYS: true,\n\n // Real: the render target creates the multisample attachment and sets a\n // resolve target (`core/renderTarget.js:388-407`, `:303`).\n SUPPORTS_MSAA_SAMPLE: true,\n\n // FALSE for the same reason as unordered access. Carbon's callers DELETE\n // their explicit clears under this cap (`Tr2ReflectionProbe.cpp:128-138`,\n // `EveSpaceScene.cpp:2312`), and this backend honours only the first colour\n // slot's load action and the depth load action: every store action is dropped,\n // colour slots 1-7 are ignored, and the pass descriptor is always built from\n // the canvas rather than from what `SetRenderTarget` bound. A caller that\n // trusted this and dropped its clear would get no clear on anything else.\n SUPPORTS_RENDER_PASS_HINTS: false,\n\n IS_LOW_PERFORMANCE: false,\n\n /** WebGPU's guaranteed `maxUniformBufferBindingSize`, 64 KiB. */\n MAX_CONSTANT_BUFFER_SIZE: 64 * 1024,\n\n SUPPORTS_RAY_TRACING: false\n});\n\n\n/**\n * The capabilities the WebGPU backend reports.\n */\nexport class CjsWebgpuCapsAL\n{\n _webgpu = null;\n\n /**\n * @param {object} [webgpu] The `CjsWebgpuDevice`, when one is composed.\n */\n constructor(webgpu = null)\n {\n this._webgpu = webgpu ?? null;\n }\n\n /**\n * Whether half-precision floats are available in a shader.\n *\n * `shader-f16` is an OPTIONAL WebGPU feature, so this is the one answer that\n * cannot be decided from the spec. Without a device the answer is false: a\n * caller that emits f16 on a promise, against a device that turns out to lack\n * the feature, gets a shader that fails to compile rather than a slow one.\n *\n * @returns {boolean} Whether the device has `shader-f16`.\n */\n SupportsFloat16()\n {\n if (!this._webgpu) return false;\n\n return this._webgpu.GetDevice().features.has(\"shader-f16\");\n }\n\n /**\n * Whether a shader can read a buffer resource.\n *\n * @returns {boolean} True; storage buffers are core WebGPU.\n */\n SupportsGpuBuffer()\n {\n return true;\n }\n\n /**\n * Whether the backend can create a swap chain of its own.\n *\n * FALSE, and not because it is unimplemented. The browser owns presentation:\n * a WebGPU surface is a canvas the page already has, configured with\n * `GPUCanvasContext.configure`, and the frame is shown when the turn ends.\n * There is no chain for Trinity to create, resize or flip.\n *\n * @returns {boolean} False.\n */\n SupportsStandaloneSwapChain()\n {\n return false;\n }\n\n /**\n * Whether a vertex shader can sample a texture.\n *\n * @returns {boolean} True; WebGPU binds textures to any stage.\n */\n SupportsVertexShaderTextures()\n {\n return true;\n }\n\n /**\n * Whether the display refresh rate varies.\n *\n * @returns {boolean} False; the page presents through\n * `requestAnimationFrame` and is not told what the display is doing.\n */\n SupportsVariableRefreshRate()\n {\n return false;\n }\n\n /**\n * Whether hardware ray tracing is available.\n *\n * @returns {boolean} False; WebGPU has no ray-tracing pipeline.\n */\n SupportsRaytracing()\n {\n return false;\n }\n\n}\n"],"names":["CjsWebgpuPlatformCaps","Object","freeze","SUPPORTS_BUFFER_SHADER_RESOURCES","SUPPORTS_BUFFER_COUNTERS","SUPPORTS_UNORDERED_ACCESS","SUPPORTS_COMPUTE","SUPPORTS_TEXTURE_ARRAYS","SUPPORTS_MSAA_SAMPLE","SUPPORTS_RENDER_PASS_HINTS","IS_LOW_PERFORMANCE","MAX_CONSTANT_BUFFER_SIZE","SUPPORTS_RAY_TRACING","CjsWebgpuCapsAL","_webgpu","constructor","webgpu","SupportsFloat16","GetDevice","features","has","SupportsGpuBuffer","SupportsStandaloneSwapChain","SupportsVertexShaderTextures","SupportsVariableRefreshRate","SupportsRaytracing"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"file":"CjsWebgpuCapsAL.js","sources":["../../../../src/trinityal/webgpu/CjsWebgpuCapsAL.js"],"sourcesContent":["// Source: trinity/trinityal/metal/Tr2CapsALMetal.h\n// Source: trinity/trinityal/stub/Tr2CapsALStub.h\n//\n// What the WebGPU backend says it can do.\n//\n// Carbon's caps object is six questions a caller BRANCHES on, so answering them\n// wrongly sends Trinity down a path this device never takes - which is why the\n// stub answers \"yes\" to four of its ten platform constants rather than denying\n// everything. These are WebGPU's answers, each one decided against the spec's\n// baseline guarantees rather than against a particular adapter, EXCEPT\n// `SupportsFloat16`, which is an optional feature and is therefore asked of the\n// device when there is one.\n\nimport { CjsSchema } from \"#schema\";\n\n/**\n * The platform capability constants, WebGPU's answers.\n *\n * The stub's equivalent is `Tr2StubPlatformCaps`, and this table said yes to\n * three things the stub says no to. Two of them were wrong, and the reason is\n * worth keeping because it is easy to make again:\n *\n * **A CAP DESCRIBES THIS BACKEND, NOT THE API IT IS BUILT ON.** \"Storage\n * buffers are core WebGPU\" is true and answers a different question than\n * \"can this backend honour a caller that takes the unordered-access branch\".\n * A caller reads a cap to decide, and a cap is the LAST place that can say no -\n * after it, the caller is committed and the refusals it meets have no branch to\n * take. Both corrected entries are commented where they sit.\n *\n * What still differs from the stub, and holds: buffer shader resources, and the\n * platform not being declared low-performance, because a caller uses that to\n * pick reduced paths and a GPU is doing this work.\n */\nexport const CjsWebgpuPlatformCaps = Object.freeze({\n SUPPORTS_BUFFER_SHADER_RESOURCES: true,\n\n SUPPORTS_BUFFER_COUNTERS: false,\n\n // FALSE, AND IT SAID TRUE FOR A DAY. The argument was \"storage buffers and\n // storage textures are core WebGPU\" - true of the API, and the wrong question.\n // A cap describes WHAT THIS BACKEND CAN DO, and today `ClearUav` refuses,\n // nothing dispatches compute, and `CjsWebgpuDevice` fails any binding\n // visibility that is not vertex or fragment. Carbon's own stub denies this one\n // (`stub/Tr2CapsALStub.h:10`) while claiming compute, and a caller taking the\n // UAV branch would meet three refusals in a row - with the cap being the last\n // place that could have said no.\n SUPPORTS_UNORDERED_ACCESS: false,\n\n // Carbon's stub claims compute too. The dispatch verbs refuse here exactly as\n // they do there, so this promises no more than the stub does.\n SUPPORTS_COMPUTE: true,\n\n SUPPORTS_TEXTURE_ARRAYS: true,\n\n // Real: the render target creates the multisample attachment and sets a\n // resolve target (`core/renderTarget.js:388-407`, `:303`).\n SUPPORTS_MSAA_SAMPLE: true,\n\n // FALSE for the same reason as unordered access. Carbon's callers DELETE\n // their explicit clears under this cap (`Tr2ReflectionProbe.cpp:128-138`,\n // `EveSpaceScene.cpp:2312`), and this backend honours only the first colour\n // slot's load action and the depth load action: every store action is dropped,\n // colour slots 1-7 are ignored, and the pass descriptor is always built from\n // the canvas rather than from what `SetRenderTarget` bound. A caller that\n // trusted this and dropped its clear would get no clear on anything else.\n SUPPORTS_RENDER_PASS_HINTS: false,\n\n IS_LOW_PERFORMANCE: false,\n\n /** WebGPU's guaranteed `maxUniformBufferBindingSize`, 64 KiB. */\n MAX_CONSTANT_BUFFER_SIZE: 64 * 1024,\n\n SUPPORTS_RAY_TRACING: false\n});\n\n\n/**\n * The capabilities the WebGPU backend reports.\n */\nexport class CjsWebgpuCapsAL\n{\n _webgpu = null;\n\n /**\n * @param {object} [webgpu] The `CjsWebgpuDevice`, when one is composed.\n */\n constructor(webgpu = null)\n {\n this._webgpu = webgpu ?? null;\n }\n\n /**\n * Whether half-precision floats are available in a shader.\n *\n * `shader-f16` is an OPTIONAL WebGPU feature, so this is the one answer that\n * cannot be decided from the spec. Without a device the answer is false: a\n * caller that emits f16 on a promise, against a device that turns out to lack\n * the feature, gets a shader that fails to compile rather than a slow one.\n *\n * @returns {boolean} Whether the device has `shader-f16`.\n */\n SupportsFloat16()\n {\n if (!this._webgpu) return false;\n\n return this._webgpu.GetDevice().features.has(\"shader-f16\");\n }\n\n /**\n * Whether a shader can read a buffer resource.\n *\n * @returns {boolean} True; storage buffers are core WebGPU.\n */\n SupportsGpuBuffer()\n {\n return true;\n }\n\n /**\n * Whether the backend can create a swap chain of its own.\n *\n * FALSE, and not because it is unimplemented. The browser owns presentation:\n * a WebGPU surface is a canvas the page already has, configured with\n * `GPUCanvasContext.configure`, and the frame is shown when the turn ends.\n * There is no chain for Trinity to create, resize or flip.\n *\n * @returns {boolean} False.\n */\n SupportsStandaloneSwapChain()\n {\n return false;\n }\n\n /**\n * Whether a vertex shader can sample a texture.\n *\n * @returns {boolean} True; WebGPU binds textures to any stage.\n */\n SupportsVertexShaderTextures()\n {\n return true;\n }\n\n /**\n * Whether the display refresh rate varies.\n *\n * @returns {boolean} False; the page presents through\n * `requestAnimationFrame` and is not told what the display is doing.\n */\n SupportsVariableRefreshRate()\n {\n return false;\n }\n\n /**\n * Whether hardware ray tracing is available.\n *\n * @returns {boolean} False; WebGPU has no ray-tracing pipeline.\n */\n SupportsRaytracing()\n {\n return false;\n }\n\n}\n\n// DECLARED AS A CALL, NOT A DECORATOR, for the reason recorded in\n// Tr2BitmapDimensions.js: the layer is imported straight from source by its\n// tests and raw Node cannot parse decorator syntax.\n//\n// The donor is NAMED rather than left to be derived from this class's name.\n// Carbon calls every backend's class the same thing and carries the backend in\n// the FILE name, because only one backend compiles at a time; we ship them\n// together, so the backend moves onto the class name. That divergence is the\n// author's to declare, never a checker's to guess.\nCjsSchema.define(CjsWebgpuCapsAL, { className: \"CjsWebgpuCapsAL\", carbon: \"Tr2CapsAL\" });\n"],"names":["CjsWebgpuPlatformCaps","Object","freeze","SUPPORTS_BUFFER_SHADER_RESOURCES","SUPPORTS_BUFFER_COUNTERS","SUPPORTS_UNORDERED_ACCESS","SUPPORTS_COMPUTE","SUPPORTS_TEXTURE_ARRAYS","SUPPORTS_MSAA_SAMPLE","SUPPORTS_RENDER_PASS_HINTS","IS_LOW_PERFORMANCE","MAX_CONSTANT_BUFFER_SIZE","SUPPORTS_RAY_TRACING","CjsWebgpuCapsAL","_webgpu","constructor","webgpu","SupportsFloat16","GetDevice","features","has","SupportsGpuBuffer","SupportsStandaloneSwapChain","SupportsVertexShaderTextures","SupportsVariableRefreshRate","SupportsRaytracing","CjsSchema","define","className","carbon"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACaA,qBAAqB,GAAGC,MAAM,CAACC,MAAM,CAAC;AACjDC,EAAAA,gCAAgC,EAAE,IAAI;AAEtCC,EAAAA,wBAAwB,EAAE,KAAK;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAC,EAAAA,yBAAyB,EAAE,KAAK;AAEhC;AACA;AACAC,EAAAA,gBAAgB,EAAE,IAAI;AAEtBC,EAAAA,uB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AACA;AACA;AACAC,SAAS,CAACC,MAAM,CAACd,eAAe,EAAE;AAAEe,EAAAA,SAAS,EAAE,iBAAiB;AAAEC,EAAAA,MAAM,EAAE;AAAY,CAAC,CAAC;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CjsSchema } from '#schema';
|
|
1
2
|
import { Tr2ConstantUsageAL, ALResult, Tr2ALMemoryType } from '#trinityal';
|
|
2
3
|
import { RenderContextALOf } from '../renderContextAL.js';
|
|
3
4
|
|
|
@@ -188,5 +189,19 @@ class CjsWebgpuConstantBufferAL {
|
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
191
|
|
|
192
|
+
// DECLARED AS A CALL, NOT A DECORATOR, for the reason recorded in
|
|
193
|
+
// Tr2BitmapDimensions.js: the layer is imported straight from source by its
|
|
194
|
+
// tests and raw Node cannot parse decorator syntax.
|
|
195
|
+
//
|
|
196
|
+
// The donor is NAMED rather than left to be derived from this class's name.
|
|
197
|
+
// Carbon calls every backend's class the same thing and carries the backend in
|
|
198
|
+
// the FILE name, because only one backend compiles at a time; we ship them
|
|
199
|
+
// together, so the backend moves onto the class name. That divergence is the
|
|
200
|
+
// author's to declare, never a checker's to guess.
|
|
201
|
+
CjsSchema.define(CjsWebgpuConstantBufferAL, {
|
|
202
|
+
className: "CjsWebgpuConstantBufferAL",
|
|
203
|
+
carbon: "Tr2ConstantBufferAL"
|
|
204
|
+
});
|
|
205
|
+
|
|
191
206
|
export { CjsWebgpuConstantBufferAL };
|
|
192
207
|
//# sourceMappingURL=CjsWebgpuConstantBufferAL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsWebgpuConstantBufferAL.js","sources":["../../../../src/trinityal/webgpu/CjsWebgpuConstantBufferAL.js"],"sourcesContent":["// Source: trinity/trinityal/include/Tr2ConstantBufferAL.h\n// trinity/trinityal/metal/Tr2ConstantBufferALMetal.mm\n// trinity/trinityal/dx12/Tr2ConstantBufferALDx12.cpp\n//\n// A `Tr2ConstantBufferAL` for WebGPU - the type behind b0 and the per-object\n// blocks, which until 2026-09-10 only ever landed in `Tr2ConstantBufferALStub`'s\n// shadow copy and reached no device.\n//\n// IT OWNS NO DEVICE BUFFER, AND NEITHER DOES METAL'S. Metal's constant buffer\n// is a CPU allocation and a token (`Tr2ConstantBufferALMetal.mm:42`, `:60-69`):\n// `Lock` hands back the allocation and invalidates the token, `Unlock` is a\n// no-op, and `SetConstants` copies the bytes into the context's per-frame\n// constant ARENA and binds `(page, offset)` (`MetalWorkQueue.mm:2396-2440`).\n// A buffer locked three times and drawn three times therefore lands in three\n// regions, and each draw reads its own. The first version of this class owned\n// one `GPUBuffer` and `writeBuffer`'d into it, which is correct for a single\n// draw and wrong for a frame: every draw read the LAST write.\n//\n// FIELDS ARE PUBLIC AND CARBON-NAMED, for the reason recorded on\n// `CjsWebgpuShaderAL`: Carbon's impl class carries public state.\nimport { ALResult, Tr2ALMemoryType, Tr2ConstantUsageAL } from \"#trinityal\";\nimport { RenderContextALOf } from \"../renderContextAL.js\";\n\n\n/**\n * The shadow's size granularity. Every uniform layout this backend reads has a\n * `minBindingSize` that is a multiple of 16 (`array<vec4<f32>, N>`), and\n * Carbon's stub rounds its mirror the same way.\n */\nconst ALIGNMENT = 16;\n\nlet nextConstantBufferId = 1;\n\n\n/**\n * A `Tr2ConstantBufferAL` whose contents live in a CPU shadow copy, suballocated\n * into the frame's constant arena when they are bound.\n */\nexport class CjsWebgpuConstantBufferAL\n{\n /** m_shadowCopy */\n m_shadowCopy = new Uint8Array(0);\n\n /** m_size, the REQUESTED size; the shadow is aligned up. */\n m_size = 0;\n\n /** m_usage */\n m_usage = Tr2ConstantUsageAL.REUSABLE;\n\n /**\n * m_token: the arena region the shadow was last uploaded to, and for which\n * frame. `frame` is -1 after a Lock (Carbon's `Invalidate`), so the next bind\n * uploads again - to a NEW region.\n *\n * PUBLIC BECAUSE THE CONTEXT WRITES IT, as Carbon's does: the upload lives on\n * the render context (`Tr2RenderContextAL::UploadConstants`) and reaches\n * straight into the buffer's impl - `buffer.m_buffer->m_token`\n * (`Tr2RenderContextMetal.mm:688-697`).\n */\n m_token = { frame: -1, page: 0, offset: 0, size: 0 };\n\n /** A process-unique identity, for caches and diagnostics. Zero until Create. */\n m_id = 0;\n\n /**\n * Creates the buffer.\n *\n * @param {number} size Bytes requested.\n * @param {number} usage A `Tr2ConstantUsageAL`.\n * @param {ArrayBufferView|null} initialData Initial contents, if any.\n * @param {object} renderContext The render context, Trinity's or the AL.\n * @returns {number} An `ALResult` value.\n */\n Create(size, usage, initialData, renderContext)\n {\n this.Destroy();\n\n const al = RenderContextALOf(renderContext);\n\n if (!al || !al.IsValid()) return ALResult.E_INVALIDARG;\n if (!Number.isInteger(size) || size <= 0) return ALResult.E_INVALIDARG;\n if (usage === Tr2ConstantUsageAL.IMMUTABLE && !initialData) return ALResult.E_INVALIDARG;\n\n this.m_shadowCopy = new Uint8Array(Math.ceil(size / ALIGNMENT) * ALIGNMENT);\n this.m_size = size;\n this.m_usage = usage;\n this.m_id = nextConstantBufferId;\n nextConstantBufferId += 1;\n\n if (initialData)\n {\n const bytes = new Uint8Array(initialData.buffer, initialData.byteOffset, initialData.byteLength);\n\n this.m_shadowCopy.set(bytes.subarray(0, Math.min(bytes.length, this.m_shadowCopy.length)));\n }\n\n return ALResult.S_OK;\n }\n\n /**\n * Hands back the shadow to write into, and invalidates the token.\n *\n * @param {object} [_renderContext] Unused.\n * @returns {{result: number, data: Uint8Array|null}} The shadow.\n */\n Lock(_renderContext)\n {\n if (!this.IsValid()) return { result: ALResult.E_FAIL, data: null };\n\n this.m_token.frame = -1;\n\n return { result: ALResult.S_OK, data: this.m_shadowCopy };\n }\n\n /**\n * Carbon's is a no-op on Metal and a token bump on DX12; the upload waits\n * for the bind.\n *\n * @returns {number} `S_OK`.\n */\n Unlock(_renderContext)\n {\n return ALResult.S_OK;\n }\n\n /**\n * Binds this buffer at one stage and register.\n *\n * Metal's context delegates to the buffer for this\n * (`Tr2RenderContextMetal.mm:664-677` → `Tr2ConstantBufferALMetal.mm:79-89`);\n * the upload itself happens when the draw emits its bindings.\n *\n * @param {number} shaderType A `ShaderType`.\n * @param {number} constantIndex The constant-buffer register.\n * @param {object} renderContext The render context to bind on.\n * @returns {number} An `ALResult` value.\n */\n SetConstants(shaderType, constantIndex, renderContext)\n {\n if (!this.IsValid()) return ALResult.E_INVALIDCALL;\n\n const al = RenderContextALOf(renderContext);\n\n return al && al.SetConstants(this, shaderType, constantIndex) ? ALResult.S_OK : ALResult.E_INVALIDARG;\n }\n\n /** Whether the buffer has a shadow copy, which `Create` gives it. */\n IsValid()\n {\n return this.m_shadowCopy.length !== 0;\n }\n\n /** The requested size, as Carbon's `GetSize` reports it. */\n GetSize()\n {\n return this.m_size;\n }\n\n /** Releases the shadow copy and its arena token, leaving the buffer invalid. */\n Destroy()\n {\n this.m_shadowCopy = new Uint8Array(0);\n this.m_size = 0;\n this.m_token = { frame: -1, page: 0, offset: 0, size: 0 };\n this.m_id = 0;\n }\n\n /** Where the buffer lives, which is managed memory, not the device. */\n GetMemoryClass()\n {\n return Tr2ALMemoryType.AL_MEMORY_MANAGED;\n }\n\n /**\n * Fills in a device-resource description.\n *\n * @param {object} description The description to fill.\n * @returns {object} The description, filled.\n */\n Describe(description)\n {\n if (!description) return description;\n\n description.memoryClass = this.GetMemoryClass();\n description.size = this.m_shadowCopy.length;\n\n return description;\n }\n\n /**\n * Nothing device-side carries a label; the arena pages are shared.\n *\n * @returns {number} `S_OK`.\n */\n SetName(_name)\n {\n return ALResult.S_OK;\n }\n}\n"],"names":["ALIGNMENT","nextConstantBufferId","CjsWebgpuConstantBufferAL","m_shadowCopy","Uint8Array","m_size","m_usage","Tr2ConstantUsageAL","REUSABLE","m_token","frame","page","offset","size","m_id","Create","usage","initialData","renderContext","Destroy","al","RenderContextALOf","IsValid","ALResult","E_INVALIDARG","Number","isInteger","IMMUTABLE","Math","ceil","bytes","buffer","byteOffset","byteLength","set","subarray","min","length","S_OK","Lock","_renderContext","result","E_FAIL","data","Unlock","SetConstants","shaderType","constantIndex","E_INVALIDCALL","GetSize","GetMemoryClass","Tr2ALMemoryType","AL_MEMORY_MANAGED","Describe","description","memoryClass","SetName","_name"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA,MAAMA,SAAS,GAAG,EAAE;AAEpB,IAAIC,oBAAoB,GAAG,CAAC;;AAG5B;AACA;AACA;AACA;AACO,MAAMC,yBAAyB,CACtC;AACE;AACAC,EAAAA,YAAY,GAAG,IAAIC,UAAU,CAAC,CAAC,CAAC;;AAEhC;AACAC,EAAAA,MAAM,GAAG,CAAC;;AAEV;EACAC,OAAO,GAAGC,kBAAkB,CAACC,QAAQ;;AAErC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,OAAO,GAAG;IAAEC,KAAK,EAAE,EAAE;AAAEC,IAAAA,IAAI,EAAE,CAAC;AAAEC,IAAAA,MAAM,EAAE,CAAC;AAAEC,IAAAA,IAAI,EAAE;GAAG;;AAEpD;AACAC,EAAAA,IAAI,GAAG,CAAC;;AAER;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,MAAMA,CAACF,IAAI,EAAEG,KAAK,EAAEC,WAAW,EAAEC,aAAa,EAC9C;IACE,IAAI,CAACC,OAAO,EAAE;AAEd,IAAA,MAAMC,EAAE,GAAGC,iBAAiB,CAACH,aAAa,CAAC;AAE3C,IAAA,IAAI,CAACE,EAAE,IAAI,CAACA,EAAE,CAACE,OAAO,EAAE,EAAE,OAAOC,QAAQ,CAACC,YAAY;AACtD,IAAA,IAAI,CAACC,MAAM,CAACC,SAAS,CAACb,IAAI,CAAC,IAAIA,IAAI,IAAI,CAAC,EAAE,OAAOU,QAAQ,CAACC,YAAY;AACtE,IAAA,IAAIR,KAAK,KAAKT,k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,CAACV,YAAY,CAACkC,MAAM;AAE3C,IAAA,OAAOiB,WAAW;AACpB,EAAA;;AAEA;AACF;AACA;AACA;AACA;EACEE,OAAOA,CAACC,KAAK,EACb;IACE,OAAOlC,QAAQ,CAACe,IAAI;AACtB,EAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsWebgpuConstantBufferAL.js","sources":["../../../../src/trinityal/webgpu/CjsWebgpuConstantBufferAL.js"],"sourcesContent":["// Source: trinity/trinityal/include/Tr2ConstantBufferAL.h\n// trinity/trinityal/metal/Tr2ConstantBufferALMetal.mm\n// trinity/trinityal/dx12/Tr2ConstantBufferALDx12.cpp\n//\n// A `Tr2ConstantBufferAL` for WebGPU - the type behind b0 and the per-object\n// blocks, which until 2026-09-10 only ever landed in `Tr2ConstantBufferALStub`'s\n// shadow copy and reached no device.\n//\n// IT OWNS NO DEVICE BUFFER, AND NEITHER DOES METAL'S. Metal's constant buffer\n// is a CPU allocation and a token (`Tr2ConstantBufferALMetal.mm:42`, `:60-69`):\n// `Lock` hands back the allocation and invalidates the token, `Unlock` is a\n// no-op, and `SetConstants` copies the bytes into the context's per-frame\n// constant ARENA and binds `(page, offset)` (`MetalWorkQueue.mm:2396-2440`).\n// A buffer locked three times and drawn three times therefore lands in three\n// regions, and each draw reads its own. The first version of this class owned\n// one `GPUBuffer` and `writeBuffer`'d into it, which is correct for a single\n// draw and wrong for a frame: every draw read the LAST write.\n//\n// FIELDS ARE PUBLIC AND CARBON-NAMED, for the reason recorded on\n// `CjsWebgpuShaderAL`: Carbon's impl class carries public state.\nimport { CjsSchema } from \"#schema\";\nimport { ALResult, Tr2ALMemoryType, Tr2ConstantUsageAL } from \"#trinityal\";\nimport { RenderContextALOf } from \"../renderContextAL.js\";\n\n\n/**\n * The shadow's size granularity. Every uniform layout this backend reads has a\n * `minBindingSize` that is a multiple of 16 (`array<vec4<f32>, N>`), and\n * Carbon's stub rounds its mirror the same way.\n */\nconst ALIGNMENT = 16;\n\nlet nextConstantBufferId = 1;\n\n\n/**\n * A `Tr2ConstantBufferAL` whose contents live in a CPU shadow copy, suballocated\n * into the frame's constant arena when they are bound.\n */\nexport class CjsWebgpuConstantBufferAL\n{\n /** m_shadowCopy */\n m_shadowCopy = new Uint8Array(0);\n\n /** m_size, the REQUESTED size; the shadow is aligned up. */\n m_size = 0;\n\n /** m_usage */\n m_usage = Tr2ConstantUsageAL.REUSABLE;\n\n /**\n * m_token: the arena region the shadow was last uploaded to, and for which\n * frame. `frame` is -1 after a Lock (Carbon's `Invalidate`), so the next bind\n * uploads again - to a NEW region.\n *\n * PUBLIC BECAUSE THE CONTEXT WRITES IT, as Carbon's does: the upload lives on\n * the render context (`Tr2RenderContextAL::UploadConstants`) and reaches\n * straight into the buffer's impl - `buffer.m_buffer->m_token`\n * (`Tr2RenderContextMetal.mm:688-697`).\n */\n m_token = { frame: -1, page: 0, offset: 0, size: 0 };\n\n /** A process-unique identity, for caches and diagnostics. Zero until Create. */\n m_id = 0;\n\n /**\n * Creates the buffer.\n *\n * @param {number} size Bytes requested.\n * @param {number} usage A `Tr2ConstantUsageAL`.\n * @param {ArrayBufferView|null} initialData Initial contents, if any.\n * @param {object} renderContext The render context, Trinity's or the AL.\n * @returns {number} An `ALResult` value.\n */\n Create(size, usage, initialData, renderContext)\n {\n this.Destroy();\n\n const al = RenderContextALOf(renderContext);\n\n if (!al || !al.IsValid()) return ALResult.E_INVALIDARG;\n if (!Number.isInteger(size) || size <= 0) return ALResult.E_INVALIDARG;\n if (usage === Tr2ConstantUsageAL.IMMUTABLE && !initialData) return ALResult.E_INVALIDARG;\n\n this.m_shadowCopy = new Uint8Array(Math.ceil(size / ALIGNMENT) * ALIGNMENT);\n this.m_size = size;\n this.m_usage = usage;\n this.m_id = nextConstantBufferId;\n nextConstantBufferId += 1;\n\n if (initialData)\n {\n const bytes = new Uint8Array(initialData.buffer, initialData.byteOffset, initialData.byteLength);\n\n this.m_shadowCopy.set(bytes.subarray(0, Math.min(bytes.length, this.m_shadowCopy.length)));\n }\n\n return ALResult.S_OK;\n }\n\n /**\n * Hands back the shadow to write into, and invalidates the token.\n *\n * @param {object} [_renderContext] Unused.\n * @returns {{result: number, data: Uint8Array|null}} The shadow.\n */\n Lock(_renderContext)\n {\n if (!this.IsValid()) return { result: ALResult.E_FAIL, data: null };\n\n this.m_token.frame = -1;\n\n return { result: ALResult.S_OK, data: this.m_shadowCopy };\n }\n\n /**\n * Carbon's is a no-op on Metal and a token bump on DX12; the upload waits\n * for the bind.\n *\n * @returns {number} `S_OK`.\n */\n Unlock(_renderContext)\n {\n return ALResult.S_OK;\n }\n\n /**\n * Binds this buffer at one stage and register.\n *\n * Metal's context delegates to the buffer for this\n * (`Tr2RenderContextMetal.mm:664-677` → `Tr2ConstantBufferALMetal.mm:79-89`);\n * the upload itself happens when the draw emits its bindings.\n *\n * @param {number} shaderType A `ShaderType`.\n * @param {number} constantIndex The constant-buffer register.\n * @param {object} renderContext The render context to bind on.\n * @returns {number} An `ALResult` value.\n */\n SetConstants(shaderType, constantIndex, renderContext)\n {\n if (!this.IsValid()) return ALResult.E_INVALIDCALL;\n\n const al = RenderContextALOf(renderContext);\n\n return al && al.SetConstants(this, shaderType, constantIndex) ? ALResult.S_OK : ALResult.E_INVALIDARG;\n }\n\n /** Whether the buffer has a shadow copy, which `Create` gives it. */\n IsValid()\n {\n return this.m_shadowCopy.length !== 0;\n }\n\n /** The requested size, as Carbon's `GetSize` reports it. */\n GetSize()\n {\n return this.m_size;\n }\n\n /** Releases the shadow copy and its arena token, leaving the buffer invalid. */\n Destroy()\n {\n this.m_shadowCopy = new Uint8Array(0);\n this.m_size = 0;\n this.m_token = { frame: -1, page: 0, offset: 0, size: 0 };\n this.m_id = 0;\n }\n\n /** Where the buffer lives, which is managed memory, not the device. */\n GetMemoryClass()\n {\n return Tr2ALMemoryType.AL_MEMORY_MANAGED;\n }\n\n /**\n * Fills in a device-resource description.\n *\n * @param {object} description The description to fill.\n * @returns {object} The description, filled.\n */\n Describe(description)\n {\n if (!description) return description;\n\n description.memoryClass = this.GetMemoryClass();\n description.size = this.m_shadowCopy.length;\n\n return description;\n }\n\n /**\n * Nothing device-side carries a label; the arena pages are shared.\n *\n * @returns {number} `S_OK`.\n */\n SetName(_name)\n {\n return ALResult.S_OK;\n }\n}\n\n// DECLARED AS A CALL, NOT A DECORATOR, for the reason recorded in\n// Tr2BitmapDimensions.js: the layer is imported straight from source by its\n// tests and raw Node cannot parse decorator syntax.\n//\n// The donor is NAMED rather than left to be derived from this class's name.\n// Carbon calls every backend's class the same thing and carries the backend in\n// the FILE name, because only one backend compiles at a time; we ship them\n// together, so the backend moves onto the class name. That divergence is the\n// author's to declare, never a checker's to guess.\nCjsSchema.define(CjsWebgpuConstantBufferAL, { className: \"CjsWebgpuConstantBufferAL\", carbon: \"Tr2ConstantBufferAL\" });\n"],"names":["ALIGNMENT","nextConstantBufferId","CjsWebgpuConstantBufferAL","m_shadowCopy","Uint8Array","m_size","m_usage","Tr2ConstantUsageAL","REUSABLE","m_token","frame","page","offset","size","m_id","Create","usage","initialData","renderContext","Destroy","al","RenderContextALOf","IsValid","ALResult","E_INVALIDARG","Number","isInteger","IMMUTABLE","Math","ceil","bytes","buffer","byteOffset","byteLength","set","subarray","min","length","S_OK","Lock","_renderContext","result","E_FAIL","data","Unlock","SetConstants","shaderType","constantIndex","E_INVALIDCALL","GetSize","GetMemoryClass","Tr2ALMemoryType","AL_MEMORY_MANAGED","Describe","description","memoryClass","SetName","_name","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;;AAMA;AACA;AACA;AACA;AACA;AACA,MAAMA,SAAS,GAAG,EAAE;AAEpB,IAAIC,oBAAoB,GAAG,CAAC;;AAG5B;AACA;AACA;AACA;AACO,MAAMC,yBAAyB,CACtC;AACE;AACAC,EAAAA,YAAY,GAAG,IAAIC,UAAU,CAAC,CA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uPipelineCache, CanonicalKey, RenderPipelineKey } from './core/
|
|
2
|
+
import { CjsWebgpuPipelineCache, CanonicalKey, RenderPipelineKey } from './core/CjsWebgpuPipelineCache.js';
|
|
3
3
|
import { AssertFormatFeature, PlanTextureUpload } from './core/textureLayout.js';
|
|
4
|
-
import { CjsWebgpuEncodeState } from './core/
|
|
4
|
+
import { CjsWebgpuEncodeState } from './core/CjsWebgpuEncodeState.js';
|
|
5
5
|
|
|
6
6
|
const PREPARED_PIPELINES = new WeakMap();
|
|
7
7
|
const LIVE_PIPELINES = new WeakMap();
|