@carbonenginejs/runtime 0.1.0-alpha.0 → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -125
- package/dist/audio/index.js +8 -1
- package/dist/audio/index.js.map +1 -1
- package/dist/audio/trinity/audio/AudActionLog/AudActionLogCB.js +84 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionLogCB.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecord.js +14 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecord.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordExecuteActionOnPlayingID.js +26 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordExecuteActionOnPlayingID.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordPostEvent.js +27 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordPostEvent.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetRTPC.js +27 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetRTPC.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetState.js +25 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetState.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetSwitch.js +26 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetSwitch.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/IAudActionLog.js +58 -0
- package/dist/audio/trinity/audio/AudActionLog/IAudActionLog.js.map +1 -0
- package/dist/audio/trinity/audio/AudManager.js +1 -1
- package/dist/audio/trinity/audio/AudManager.js.map +1 -1
- package/dist/audio/trinity/audio/{AudObstructionOcclusion.js → AudObstructionOcclusion/AudObstructionOcclusion.js} +8 -52
- package/dist/audio/trinity/audio/AudObstructionOcclusion/AudObstructionOcclusion.js.map +1 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/EmitterState.js +17 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/EmitterState.js.map +1 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/FadingValue.js +46 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/FadingValue.js.map +1 -0
- package/dist/audio/trinity/index.js +8 -1
- package/dist/audio/trinity/index.js.map +1 -1
- package/dist/character/CjsCharacterAppearanceConstruction.js +5 -0
- package/dist/character/CjsCharacterAppearanceConstruction.js.map +1 -1
- package/dist/character/CjsCharacterAppearanceManager.js +14 -0
- package/dist/character/CjsCharacterAppearanceManager.js.map +1 -1
- package/dist/character/CjsCharacterFoundationConstruction.js +5 -0
- package/dist/character/CjsCharacterFoundationConstruction.js.map +1 -1
- package/dist/character/CjsCharacterTexturePolicy.js +5 -0
- package/dist/character/CjsCharacterTexturePolicy.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesAppearanceAL.js +17 -0
- package/dist/character/gles/CjsCharacterGlesAppearanceAL.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesAtlasRenderer.js +2 -0
- package/dist/character/gles/CjsCharacterGlesAtlasRenderer.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesFoundationTranslator.js +5 -0
- package/dist/character/gles/CjsCharacterGlesFoundationTranslator.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesLegacyConstructionTranslator.js +5 -0
- package/dist/character/gles/CjsCharacterGlesLegacyConstructionTranslator.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesMorphDeformation.js +2 -0
- package/dist/character/gles/CjsCharacterGlesMorphDeformation.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesPaletteCompatibility.js +5 -0
- package/dist/character/gles/CjsCharacterGlesPaletteCompatibility.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesTriangleCoverage.js +5 -0
- package/dist/character/gles/CjsCharacterGlesTriangleCoverage.js.map +1 -1
- package/dist/character/webgl2/CjsCharacterWebgl2EffectRouter.js +9 -0
- package/dist/character/webgl2/CjsCharacterWebgl2EffectRouter.js.map +1 -1
- package/dist/global/blue/CjsScriptCallback.js +142 -0
- package/dist/global/blue/CjsScriptCallback.js.map +1 -0
- package/dist/global/blue/index.js +2 -0
- package/dist/global/blue/index.js.map +1 -0
- package/dist/global/consts/renderContext/formats.js +51 -1
- package/dist/global/consts/renderContext/formats.js.map +1 -1
- package/dist/global/consts/renderContext/index.js +2 -2
- package/dist/global/consts/renderContext/renderStates.js +16 -1
- package/dist/global/consts/renderContext/renderStates.js.map +1 -1
- package/dist/global/contracts/index.js +0 -1
- package/dist/global/contracts/index.js.map +1 -1
- package/dist/global/index.js +4 -3
- package/dist/global/index.js.map +1 -1
- package/dist/global/math/index.js +2 -0
- package/dist/global/math/index.js.map +1 -1
- package/dist/global/math/mesh.js +70 -16
- package/dist/global/math/mesh.js.map +1 -1
- package/dist/global/math/noise.js +47 -68
- package/dist/global/math/noise.js.map +1 -1
- package/dist/global/math/pool.js +18 -3
- package/dist/global/math/pool.js.map +1 -1
- package/dist/global/math/random.js +52 -0
- package/dist/global/math/random.js.map +1 -0
- package/dist/global/math/tri3.js +18 -4
- package/dist/global/math/tri3.js.map +1 -1
- package/dist/global/schema/CjsSchema.js +20 -2
- package/dist/global/schema/CjsSchema.js.map +1 -1
- package/dist/global/schema/hydration.js +14 -0
- package/dist/global/schema/hydration.js.map +1 -1
- package/dist/global/utils/bytes.js +22 -4
- package/dist/global/utils/bytes.js.map +1 -1
- package/dist/global/utils/checksum.js +80 -0
- package/dist/global/utils/checksum.js.map +1 -0
- package/dist/global/utils/errors/CjsCancellationError.js +36 -0
- package/dist/global/utils/errors/CjsCancellationError.js.map +1 -0
- package/dist/global/utils/errors/CjsError.js +21 -52
- package/dist/global/utils/errors/CjsError.js.map +1 -1
- package/dist/global/utils/errors/abort.js +1 -1
- package/dist/global/utils/errors/abort.js.map +1 -1
- package/dist/global/utils/errors/index.js +2 -1
- package/dist/global/utils/errors/index.js.map +1 -1
- package/dist/global/utils/index.js +4 -2
- package/dist/global/utils/index.js.map +1 -1
- package/dist/index.js +95 -35
- package/dist/index.js.map +1 -1
- package/dist/input/Tr2MainWindow.js +7 -9
- package/dist/input/Tr2MainWindow.js.map +1 -1
- package/dist/resource/CjsResMan.js +33 -39
- package/dist/resource/CjsResMan.js.map +1 -1
- package/dist/resource/CjsResource.js +19 -5
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/audio/AudioGeometryResData.js +22 -27
- package/dist/resource/audio/AudioGeometryResData.js.map +1 -1
- package/dist/resource/audio/CjsAudioRes.js +4 -5
- package/dist/resource/audio/CjsAudioRes.js.map +1 -1
- package/dist/resource/format/CjsBitReader.js +263 -0
- package/dist/resource/format/CjsBitReader.js.map +1 -0
- package/dist/resource/format/CjsByteReader.js +130 -125
- package/dist/resource/format/CjsByteReader.js.map +1 -1
- package/dist/resource/format/CjsFormat.js +11 -4
- package/dist/resource/format/CjsFormat.js.map +1 -1
- package/dist/resource/format/CjsFormatError.js +37 -1
- package/dist/resource/format/CjsFormatError.js.map +1 -1
- package/dist/resource/format/CjsResourceProbe.js +41 -37
- package/dist/resource/format/CjsResourceProbe.js.map +1 -1
- package/dist/resource/format/carbonRecordGuard.js +33 -0
- package/dist/resource/format/carbonRecordGuard.js.map +1 -0
- package/dist/resource/format/imageSignatures.js +202 -0
- package/dist/resource/format/imageSignatures.js.map +1 -0
- package/dist/resource/format/index.js +2 -1
- package/dist/resource/format/index.js.map +1 -1
- package/dist/resource/format/jsonPolicies.js +180 -0
- package/dist/resource/format/jsonPolicies.js.map +1 -0
- package/dist/resource/formats/black/core/helpers.js +18 -29
- package/dist/resource/formats/black/core/helpers.js.map +1 -1
- package/dist/resource/formats/bnk/CjsBnkFormat.js +4 -3
- package/dist/resource/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/resource/formats/bnk/core/WwiseCursor.js +218 -0
- package/dist/resource/formats/bnk/core/WwiseCursor.js.map +1 -0
- package/dist/resource/formats/bnk/core/busNodes.js +2 -1
- package/dist/resource/formats/bnk/core/busNodes.js.map +1 -1
- package/dist/resource/formats/bnk/core/effectNodes.js +2 -1
- package/dist/resource/formats/bnk/core/effectNodes.js.map +1 -1
- package/dist/resource/formats/bnk/core/eventAction.js +15 -93
- package/dist/resource/formats/bnk/core/eventAction.js.map +1 -1
- package/dist/resource/formats/bnk/core/globalSettings.js +19 -94
- package/dist/resource/formats/bnk/core/globalSettings.js.map +1 -1
- package/dist/resource/formats/bnk/core/helpers.js +2 -48
- package/dist/resource/formats/bnk/core/helpers.js.map +1 -1
- package/dist/resource/formats/bnk/core/musicNodes.js +42 -134
- package/dist/resource/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/resource/formats/bnk/core/nodeBase.js +20 -111
- package/dist/resource/formats/bnk/core/nodeBase.js.map +1 -1
- package/dist/resource/formats/bnk/core/sfxNodes.js +2 -1
- package/dist/resource/formats/bnk/core/sfxNodes.js.map +1 -1
- package/dist/resource/formats/cmf/CjsCmfFormat.js +242 -228
- package/dist/resource/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/resource/formats/cmf/core/binary.js +54 -60
- package/dist/resource/formats/cmf/core/binary.js.map +1 -1
- package/dist/resource/formats/dds/CjsDdsFormat.js +5 -3
- package/dist/resource/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/resource/formats/dds/core/bc6h.js +16 -18
- package/dist/resource/formats/dds/core/bc6h.js.map +1 -1
- package/dist/resource/formats/dds/core/bc7.js +28 -24
- package/dist/resource/formats/dds/core/bc7.js.map +1 -1
- package/dist/resource/formats/dds/core/helpers.js +7 -133
- package/dist/resource/formats/dds/core/helpers.js.map +1 -1
- package/dist/resource/formats/dxbc/CjsDxbcFormat.js +3 -2
- package/dist/resource/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/resource/formats/dxbc/core/helpers.js +4 -32
- package/dist/resource/formats/dxbc/core/helpers.js.map +1 -1
- package/dist/resource/formats/fbx/CjsFbxFormat.js +11 -0
- package/dist/resource/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/resource/formats/fbx/core/helpers.js +18 -12
- package/dist/resource/formats/fbx/core/helpers.js.map +1 -1
- package/dist/resource/formats/flac/CjsFlacFormat.js +4 -9
- package/dist/resource/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/resource/formats/flac/core/helpers.js +1 -62
- package/dist/resource/formats/flac/core/helpers.js.map +1 -1
- package/dist/resource/formats/gif/CjsGifFormat.js +4 -9
- package/dist/resource/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/resource/formats/gif/core/helpers.js +1 -63
- package/dist/resource/formats/gif/core/helpers.js.map +1 -1
- package/dist/resource/formats/gltf/CjsGltfFormat.js +4 -3
- package/dist/resource/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/resource/formats/gltf/core/helpers.js +3 -19
- package/dist/resource/formats/gltf/core/helpers.js.map +1 -1
- package/dist/resource/formats/gr2/CjsGr2Format.js +105 -92
- package/dist/resource/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/resource/formats/gr2/core/container.js +1 -10
- package/dist/resource/formats/gr2/core/container.js.map +1 -1
- package/dist/resource/formats/gr2/core/helpers.js +24 -35
- package/dist/resource/formats/gr2/core/helpers.js.map +1 -1
- package/dist/resource/formats/gr2/core/shared.js +193 -189
- package/dist/resource/formats/gr2/core/shared.js.map +1 -1
- package/dist/resource/formats/hlsl/CjsHlslFormat.js +4 -3
- package/dist/resource/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/resource/formats/hlsl/core/helpers.js +1 -30
- package/dist/resource/formats/hlsl/core/helpers.js.map +1 -1
- package/dist/resource/formats/jpeg/CjsJpegFormat.js +5 -3
- package/dist/resource/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/resource/formats/jpeg/core/helpers.js +7 -134
- package/dist/resource/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/resource/formats/mp3/CjsMp3Format.js +4 -9
- package/dist/resource/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/resource/formats/mp3/core/helpers.js +1 -64
- package/dist/resource/formats/mp3/core/helpers.js.map +1 -1
- package/dist/resource/formats/mp4/CjsMp4Format.js +4 -9
- package/dist/resource/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/resource/formats/mp4/core/helpers.js +1 -73
- package/dist/resource/formats/mp4/core/helpers.js.map +1 -1
- package/dist/resource/formats/obj/CjsObjFormat.js +4 -3
- package/dist/resource/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/resource/formats/obj/core/helpers.js +93 -115
- package/dist/resource/formats/obj/core/helpers.js.map +1 -1
- package/dist/resource/formats/ogg/CjsOggFormat.js +4 -3
- package/dist/resource/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/resource/formats/ogg/core/helpers.js +1 -15
- package/dist/resource/formats/ogg/core/helpers.js.map +1 -1
- package/dist/resource/formats/ogg/core/vorbis.js +138 -144
- package/dist/resource/formats/ogg/core/vorbis.js.map +1 -1
- package/dist/resource/formats/pickle/CjsPickleFormat.js +83 -114
- package/dist/resource/formats/pickle/CjsPickleFormat.js.map +1 -1
- package/dist/resource/formats/png/CjsPngFormat.js +5 -3
- package/dist/resource/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/resource/formats/png/core/helpers.js +13 -152
- package/dist/resource/formats/png/core/helpers.js.map +1 -1
- package/dist/resource/formats/png/core/writer.js +3 -27
- package/dist/resource/formats/png/core/writer.js.map +1 -1
- package/dist/resource/formats/red/core/helpers.js +19 -29
- package/dist/resource/formats/red/core/helpers.js.map +1 -1
- package/dist/resource/formats/stl/CjsStlFormat.js +158 -147
- package/dist/resource/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/resource/formats/stl/core/helpers.js +44 -66
- package/dist/resource/formats/stl/core/helpers.js.map +1 -1
- package/dist/resource/formats/tga/CjsTgaFormat.js +5 -3
- package/dist/resource/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/resource/formats/tga/core/helpers.js +7 -153
- package/dist/resource/formats/tga/core/helpers.js.map +1 -1
- package/dist/resource/formats/vta/CjsVtaFormat.js +4 -3
- package/dist/resource/formats/vta/CjsVtaFormat.js.map +1 -1
- package/dist/resource/formats/vta/core/helpers.js +1 -17
- package/dist/resource/formats/vta/core/helpers.js.map +1 -1
- package/dist/resource/formats/wav/CjsWavFormat.js +4 -3
- package/dist/resource/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/resource/formats/wav/core/helpers.js +1 -15
- package/dist/resource/formats/wav/core/helpers.js.map +1 -1
- package/dist/resource/formats/webgl/CjsWebglFormat.js +4 -3
- package/dist/resource/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +69 -9
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +12 -3
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
- package/dist/resource/formats/webgl/core/helpers.js +39 -68
- package/dist/resource/formats/webgl/core/helpers.js.map +1 -1
- package/dist/resource/formats/webgpu/CjsWebgpuFormat.js +4 -3
- package/dist/resource/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/resource/formats/webgpu/core/helpers.js +4 -30
- package/dist/resource/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/resource/formats/webm/CjsWebmFormat.js +4 -9
- package/dist/resource/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/resource/formats/webm/core/helpers.js +1 -73
- package/dist/resource/formats/webm/core/helpers.js.map +1 -1
- package/dist/resource/formats/webp/CjsWebpFormat.js +4 -9
- package/dist/resource/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/resource/formats/webp/core/helpers.js +1 -62
- package/dist/resource/formats/webp/core/helpers.js.map +1 -1
- package/dist/resource/formats/wem/CjsWemFormat.js +4 -3
- package/dist/resource/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/resource/formats/wem/core/bitStream.js +83 -106
- package/dist/resource/formats/wem/core/bitStream.js.map +1 -1
- package/dist/resource/formats/wem/core/codebookLibrary.js +52 -52
- package/dist/resource/formats/wem/core/codebookLibrary.js.map +1 -1
- package/dist/resource/formats/wem/core/helpers.js +1 -15
- package/dist/resource/formats/wem/core/helpers.js.map +1 -1
- package/dist/resource/formats/wem/core/wemToOgg.js +67 -67
- package/dist/resource/formats/wem/core/wemToOgg.js.map +1 -1
- package/dist/resource/geometry/MeshDecalData.js +23 -25
- package/dist/resource/geometry/MeshDecalData.js.map +1 -1
- package/dist/resource/geometry/MeshDecalLodData.js +14 -23
- package/dist/resource/geometry/MeshDecalLodData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryRes.js +299 -284
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResAreaData.js +30 -31
- package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResJointData.js +16 -24
- package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResLodData.js +50 -41
- package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResMeshData.js +32 -32
- package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResSkeletonData.js +14 -23
- package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -1
- package/dist/resource/geometry/TriJointBinding.js +16 -24
- package/dist/resource/geometry/TriJointBinding.js.map +1 -1
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js +22 -27
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -1
- package/dist/resource/geometry/TriRtGeometryConstants.js +50 -41
- package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -1
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js +12 -22
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js +30 -31
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -1
- package/dist/resource/index.js +1 -1
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +16 -17
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +26 -28
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +24 -25
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +21 -22
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +25 -26
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +69 -72
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +17 -18
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +42 -43
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2RenderStateSetup.js +26 -5
- package/dist/resource/shader/reflection/Tr2RenderStateSetup.js.map +1 -1
- package/dist/resource/shader/reflection/carbonRecordFields.js +87 -90
- package/dist/resource/shader/reflection/carbonRecordFields.js.map +1 -1
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +32 -34
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +1 -6
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
- package/dist/resource/texture/Tr2TextureLodManager.js +35 -27
- package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -1
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js +16 -24
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePackChannel.js +16 -24
- package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipeline.js +24 -20
- package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineParams.js +14 -23
- package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +18 -25
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +11 -16
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +14 -23
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +12 -22
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js +38 -26
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -1
- package/dist/resource/worker/CjsResManMainThreadLoader.js +2 -5
- package/dist/resource/worker/CjsResManMainThreadLoader.js.map +1 -1
- package/dist/resource/worker/CjsResManWorkerLoader.js +6 -7
- package/dist/resource/worker/CjsResManWorkerLoader.js.map +1 -1
- package/dist/resource/worker/protocol.js +18 -1
- package/dist/resource/worker/protocol.js.map +1 -1
- package/dist/sof/EveSOF.js +2 -222
- package/dist/sof/EveSOF.js.map +1 -1
- package/dist/sof/SofDocumentBuilder.js +205 -0
- package/dist/sof/SofDocumentBuilder.js.map +1 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeNotFound.js +16 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeNotFound.js.map +1 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeUnknown.js +16 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeUnknown.js.map +1 -0
- package/dist/sof/faction/EveSOFDataFactionColorSet.js +3 -27
- package/dist/sof/faction/EveSOFDataFactionColorSet.js.map +1 -1
- package/dist/sof/faction/index.js +3 -1
- package/dist/sof/faction/index.js.map +1 -1
- package/dist/sof/generic/ErrSOFAreaShaderNotFound.js +18 -0
- package/dist/sof/generic/ErrSOFAreaShaderNotFound.js.map +1 -0
- package/dist/sof/generic/ErrSOFDecalShaderNotFound.js +18 -0
- package/dist/sof/generic/ErrSOFDecalShaderNotFound.js.map +1 -0
- package/dist/sof/generic/ErrSOFMaterialPrefixNotFound.js +21 -0
- package/dist/sof/generic/ErrSOFMaterialPrefixNotFound.js.map +1 -0
- package/dist/sof/generic/ErrSOFPatternMaterialPrefixNotFound.js +21 -0
- package/dist/sof/generic/ErrSOFPatternMaterialPrefixNotFound.js.map +1 -0
- package/dist/sof/generic/EveSOFDataGeneric.js +5 -69
- package/dist/sof/generic/EveSOFDataGeneric.js.map +1 -1
- package/dist/sof/generic/index.js +5 -1
- package/dist/sof/generic/index.js.map +1 -1
- package/dist/sof/index.js +23 -7
- package/dist/sof/index.js.map +1 -1
- package/dist/sof/pattern/ErrSOFProjectionNotFound.js +20 -0
- package/dist/sof/pattern/ErrSOFProjectionNotFound.js.map +1 -0
- package/dist/sof/pattern/EveSOFDataPattern.js +2 -17
- package/dist/sof/pattern/EveSOFDataPattern.js.map +1 -1
- package/dist/sof/pattern/index.js +2 -1
- package/dist/sof/pattern/index.js.map +1 -1
- package/dist/sof/shared/ErrSOFAreaTypeNotFound.js +16 -0
- package/dist/sof/shared/ErrSOFAreaTypeNotFound.js.map +1 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeNotFound.js +16 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeNotFound.js.map +1 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeUnknown.js +16 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeUnknown.js.map +1 -0
- package/dist/sof/shared/EveSOFDataArea.js +2 -13
- package/dist/sof/shared/EveSOFDataArea.js.map +1 -1
- package/dist/sof/shared/EveSOFDataLogoSet.js +3 -27
- package/dist/sof/shared/EveSOFDataLogoSet.js.map +1 -1
- package/dist/sof/shared/EveSOFDataParameter.js +2 -146
- package/dist/sof/shared/EveSOFDataParameter.js.map +1 -1
- package/dist/sof/shared/EveSOFDataParameterBool.js +40 -0
- package/dist/sof/shared/EveSOFDataParameterBool.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterColor.js +36 -0
- package/dist/sof/shared/EveSOFDataParameterColor.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterFloat.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterFloat.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterInt.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterInt.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterVector2.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterVector2.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterVector3.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterVector3.js.map +1 -0
- package/dist/sof/shared/{EveSOFDataSpotlightAttachment.js → EveSOFDataSpotLightAttachment.js} +1 -1
- package/dist/sof/shared/{EveSOFDataSpotlightAttachment.js.map → EveSOFDataSpotLightAttachment.js.map} +1 -1
- package/dist/sof/shared/index.js +13 -4
- package/dist/sof/shared/index.js.map +1 -1
- package/dist/sof/sofDocumentValues.js +33 -0
- package/dist/sof/sofDocumentValues.js.map +1 -0
- package/dist/trinity/controllers/ITr2Controller/ITr2ActionController.js +168 -0
- package/dist/trinity/controllers/ITr2Controller/ITr2ActionController.js.map +1 -0
- package/dist/trinity/controllers/{ITr2Controller.js → ITr2Controller/ITr2Controller.js} +2 -134
- package/dist/trinity/controllers/ITr2Controller/ITr2Controller.js.map +1 -0
- package/dist/trinity/controllers/Tr2Controller.js +2 -1
- package/dist/trinity/controllers/Tr2Controller.js.map +1 -1
- package/dist/trinity/controllers/Tr2ControllerReference.js +2 -1
- package/dist/trinity/controllers/Tr2ControllerReference.js.map +1 -1
- package/dist/trinity/controllers/action/ITr2ControllerAction.js +2 -1
- package/dist/trinity/controllers/action/ITr2ControllerAction.js.map +1 -1
- package/dist/trinity/controllers/action/Tr2ActionSpawnParticles.js +10 -9
- package/dist/trinity/controllers/action/Tr2ActionSpawnParticles.js.map +1 -1
- package/dist/trinity/controllers/expression/CjsControllerExpressionCompileError.js +26 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionCompileError.js.map +1 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionEvaluateError.js +24 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionEvaluateError.js.map +1 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionParser.js +387 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionParser.js.map +1 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionProgram.js +4 -1011
- package/dist/trinity/controllers/expression/CjsControllerExpressionProgram.js.map +1 -1
- package/dist/trinity/controllers/expression/expressionRuntime.js +605 -0
- package/dist/trinity/controllers/expression/expressionRuntime.js.map +1 -0
- package/dist/trinity/controllers/index.js +5 -2
- package/dist/trinity/controllers/index.js.map +1 -1
- package/dist/trinity/controllers/state/ITr2StateMachineStateFinalizer.js +2 -1
- package/dist/trinity/controllers/state/ITr2StateMachineStateFinalizer.js.map +1 -1
- package/dist/trinity/controllers/timeline/Tr2TimelineController.js +2 -1
- package/dist/trinity/controllers/timeline/Tr2TimelineController.js.map +1 -1
- package/dist/trinity/core/ITr2Updateable.js +2 -1
- package/dist/trinity/core/ITr2Updateable.js.map +1 -1
- package/dist/trinity/core/Tr2Blitter.js +6 -3
- package/dist/trinity/core/Tr2Blitter.js.map +1 -1
- package/dist/trinity/core/Tr2Denoiser.js +256 -0
- package/dist/trinity/core/Tr2Denoiser.js.map +1 -0
- package/dist/trinity/core/Tr2GpuResourcePool/GpuResourceHandle.js +115 -0
- package/dist/trinity/core/Tr2GpuResourcePool/GpuResourceHandle.js.map +1 -0
- package/dist/trinity/core/Tr2GpuResourcePool/TextureSize2D.js +79 -0
- package/dist/trinity/core/Tr2GpuResourcePool/TextureSize2D.js.map +1 -0
- package/dist/trinity/core/{Tr2GpuResourcePool.js → Tr2GpuResourcePool/Tr2GpuResourcePool.js} +63 -151
- package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js.map +1 -0
- package/dist/trinity/core/{Tr2QuadRenderer.js → Tr2QuadRenderer/Tr2QuadRenderer.js} +8 -30
- package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRenderer.js.map +1 -0
- package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRendererEffectRecord.js +38 -0
- package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRendererEffectRecord.js.map +1 -0
- package/dist/trinity/core/Tr2RenderUtils.js +20 -3
- package/dist/trinity/core/Tr2RenderUtils.js.map +1 -1
- package/dist/trinity/core/Tr2Renderer.js +146 -1
- package/dist/trinity/core/Tr2Renderer.js.map +1 -1
- package/dist/trinity/core/Tr2ShadowMap.js +135 -14
- package/dist/trinity/core/Tr2ShadowMap.js.map +1 -1
- package/dist/trinity/core/{Tr2TextureArray.js → Tr2TextureArray/Tr2TextureArray.js} +3 -58
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js.map +1 -0
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArrayElement.js +61 -0
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArrayElement.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/DefaultKeyGenerator.js +26 -0
- package/dist/trinity/core/batch/TriRenderBatch/DefaultKeyGenerator.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/EffectKeyGenerator.js +29 -0
- package/dist/trinity/core/batch/TriRenderBatch/EffectKeyGenerator.js.map +1 -0
- package/dist/trinity/core/batch/{ITriRenderBatchAccumulator.js → TriRenderBatch/ITriRenderBatchAccumulator.js} +30 -30
- package/dist/trinity/core/batch/TriRenderBatch/ITriRenderBatchAccumulator.js.map +1 -0
- package/dist/trinity/core/batch/{Tr2RenderBatch.js → TriRenderBatch/Tr2RenderBatch.js} +81 -154
- package/dist/trinity/core/batch/TriRenderBatch/Tr2RenderBatch.js.map +1 -0
- package/dist/trinity/core/batch/{TriRenderBatchAccumulator.js → TriRenderBatch/TriRenderBatchAccumulator.js} +7 -38
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAccumulator.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlock.js +61 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlock.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlocksWithSharedMaterial.js +40 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlocksWithSharedMaterial.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatchMap.js +6 -1
- package/dist/trinity/core/batch/TriRenderBatchMap.js.map +1 -1
- package/dist/trinity/core/context/Tr2RenderContext.js +75 -57
- package/dist/trinity/core/context/Tr2RenderContext.js.map +1 -1
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityEvent.js +67 -0
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityEvent.js.map +1 -0
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityResults.js +50 -0
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityResults.js.map +1 -0
- package/dist/trinity/core/device/Tr2DepthStencil.js +186 -13
- package/dist/trinity/core/device/Tr2DepthStencil.js.map +1 -1
- package/dist/trinity/core/device/{Tr2RingBuffer.js → Tr2RingBuffer/Tr2RingBuffer.js} +27 -79
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js.map +1 -0
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBufferOffsets.js +114 -0
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBufferOffsets.js.map +1 -0
- package/dist/trinity/core/device/{Tr2SuballocatedBuffer.js → Tr2SuballocatedBuffer/Tr2SuballocatedBuffer.js} +5 -59
- package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBuffer.js.map +1 -0
- package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBufferAllocation.js +80 -0
- package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBufferAllocation.js.map +1 -0
- package/dist/trinity/core/index.js +42 -15
- package/dist/trinity/core/index.js.map +1 -1
- package/dist/trinity/core/lighting/Tr2LightManager.js +6 -1
- package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
- package/dist/trinity/core/mesh/{ITr2ImpostorSource.js → ITr2ImpostorSource/ITr2ImpostorSource.js} +6 -28
- package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSource.js.map +1 -0
- package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSourceImpostorHash.js +32 -0
- package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSourceImpostorHash.js.map +1 -0
- package/dist/trinity/core/mesh/{ITr2InstanceData.js → ITr2InstanceData/ITr2InstanceData.js} +5 -29
- package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceData.js.map +1 -0
- package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceDataInstanceData.js +33 -0
- package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceDataInstanceData.js.map +1 -0
- package/dist/trinity/core/mesh/Tr2DirectInstanceData.js +2 -1
- package/dist/trinity/core/mesh/Tr2DirectInstanceData.js.map +1 -1
- package/dist/trinity/core/mesh/Tr2MeshBase.js +7 -1
- package/dist/trinity/core/mesh/Tr2MeshBase.js.map +1 -1
- package/dist/trinity/core/mesh/Tr2RuntimeInstanceData.js +2 -1
- package/dist/trinity/core/mesh/Tr2RuntimeInstanceData.js.map +1 -1
- package/dist/trinity/core/mesh/TriGeometryResAllocations.js +6 -2
- package/dist/trinity/core/mesh/TriGeometryResAllocations.js.map +1 -1
- package/dist/trinity/core/rawData/CjsConstantLayout.js +196 -0
- package/dist/trinity/core/rawData/CjsConstantLayout.js.map +1 -0
- package/dist/trinity/core/rawData/CjsPerFrameLayouts.js +8 -3
- package/dist/trinity/core/rawData/CjsPerFrameLayouts.js.map +1 -1
- package/dist/trinity/core/rawData/CjsPerObjectLayouts.js +40 -732
- package/dist/trinity/core/rawData/CjsPerObjectLayouts.js.map +1 -1
- package/dist/trinity/core/rawData/layouts/CjsEveBasicLayout.js +34 -0
- package/dist/trinity/core/rawData/layouts/CjsEveBasicLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveBoosterSetLayout.js +69 -0
- package/dist/trinity/core/rawData/layouts/CjsEveBoosterSetLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBoosterSetLayout.js +59 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBoosterSetLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBulletStormLayout.js +37 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBulletStormLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildSpherePinLayout.js +44 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildSpherePinLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveLensflareLayout.js +31 -0
- package/dist/trinity/core/rawData/layouts/CjsEveLensflareLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveMissileWarheadLayout.js +29 -0
- package/dist/trinity/core/rawData/layouts/CjsEveMissileWarheadLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEvePerObjectLayout.js +39 -0
- package/dist/trinity/core/rawData/layouts/CjsEvePerObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSceneStaticParticlesLayout.js +30 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSceneStaticParticlesLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectDecalLayout.js +78 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectDecalLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectLayout.js +169 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpacePerObjectLayout.js +107 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpacePerObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpherePinLayout.js +44 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpherePinLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveStretch2Layout.js +34 -0
- package/dist/trinity/core/rawData/layouts/CjsEveStretch2Layout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveTurretSetLayout.js +82 -0
- package/dist/trinity/core/rawData/layouts/CjsEveTurretSetLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsTr2PerObjectLayout.js +42 -0
- package/dist/trinity/core/rawData/layouts/CjsTr2PerObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveBasicPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveBasicPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveBoosterSetPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveBoosterSetPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBoosterSetPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBoosterSetPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBulletStormPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBulletStormPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildSpherePinPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildSpherePinPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveDecalPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveDecalPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveLensflarePerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveLensflarePerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveMissileWarheadPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveMissileWarheadPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveSceneStaticParticlesPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveSceneStaticParticlesPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveSpherePinPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveSpherePinPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveTurretSetPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveTurretSetPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/StretchPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/StretchPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/{Tr2PerObjectData.js → perObjectData/Tr2PerObjectData.js} +110 -62
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataPSBuffer.js +104 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataPSBuffer.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataStandard.js +87 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataStandard.js.map +1 -0
- package/dist/trinity/core/variable/TriVariable.js +83 -83
- package/dist/trinity/core/variable/TriVariable.js.map +1 -1
- package/dist/trinity/core/vertex/{Tr2VertexDefinition.js → Tr2VertexDefinition/Tr2VertexDefinition.js} +4 -20
- package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinition.js.map +1 -0
- package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinitionItem.js +29 -0
- package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinitionItem.js.map +1 -0
- package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js +116 -36
- package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js.map +1 -1
- package/dist/trinity/curves/curve/Tr2CurveRandomAxisRotation.js +50 -92
- package/dist/trinity/curves/curve/Tr2CurveRandomAxisRotation.js.map +1 -1
- package/dist/trinity/eve/EveModularObjectModifier.js +9 -5
- package/dist/trinity/eve/EveModularObjectModifier.js.map +1 -1
- package/dist/trinity/eve/IEveInheritPropertiesOwner.js +2 -1
- package/dist/trinity/eve/IEveInheritPropertiesOwner.js.map +1 -1
- package/dist/trinity/eve/IEveSpaceObject2.js +2 -1
- package/dist/trinity/eve/IEveSpaceObject2.js.map +1 -1
- package/dist/trinity/eve/IEveTransform.js +2 -1
- package/dist/trinity/eve/IEveTransform.js.map +1 -1
- package/dist/trinity/eve/attachment/banner/EveBannerSet.js +2 -2
- package/dist/trinity/eve/attachment/banner/EveBannerSet.js.map +1 -1
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2.js +109 -133
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2.js.map +1 -1
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Item.js +40 -0
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Item.js.map +1 -0
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Renderable.js +1 -1
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Renderable.js.map +1 -1
- package/dist/trinity/eve/attachment/decal/DecalMeshCache.js +2 -14
- package/dist/trinity/eve/attachment/decal/DecalMeshCache.js.map +1 -1
- package/dist/trinity/eve/attachment/decal/DecalMeshCacheMeshBuffers.js +18 -0
- package/dist/trinity/eve/attachment/decal/DecalMeshCacheMeshBuffers.js.map +1 -0
- package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js +1 -1
- package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js.map +1 -1
- package/dist/trinity/eve/attachment/haze/EveHazeSet.js +1 -1
- package/dist/trinity/eve/attachment/haze/EveHazeSet.js.map +1 -1
- package/dist/trinity/eve/attachment/plane/EvePlaneSet.js +1 -1
- package/dist/trinity/eve/attachment/plane/EvePlaneSet.js.map +1 -1
- package/dist/trinity/eve/attachment/spotlight/EveSpotlightSet.js +2 -2
- package/dist/trinity/eve/attachment/spotlight/EveSpotlightSet.js.map +1 -1
- package/dist/trinity/eve/attachment/sprite/EveSpriteLineSet.js +1 -1
- package/dist/trinity/eve/attachment/sprite/EveSpriteLineSet.js.map +1 -1
- package/dist/trinity/eve/attachment/sprite/EveSpriteSet.js +4 -2
- package/dist/trinity/eve/attachment/sprite/EveSpriteSet.js.map +1 -1
- package/dist/trinity/eve/attachment/turrets/EveTurretSet.js +143 -139
- package/dist/trinity/eve/attachment/turrets/EveTurretSet.js.map +1 -1
- package/dist/trinity/eve/camera/EveCamera.js +1 -1
- package/dist/trinity/eve/camera/EveCamera.js.map +1 -1
- package/dist/trinity/eve/child/EveChildBoosterSet.js +12 -1
- package/dist/trinity/eve/child/EveChildBoosterSet.js.map +1 -1
- package/dist/trinity/eve/child/EveChildCloud2.js +178 -151
- package/dist/trinity/eve/child/EveChildCloud2.js.map +1 -1
- package/dist/trinity/eve/child/EveChildContainer.js +141 -141
- package/dist/trinity/eve/child/EveChildContainer.js.map +1 -1
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js +87 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js.map +1 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshArea.js +46 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshArea.js.map +1 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshInstance.js +35 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshInstance.js.map +1 -0
- package/dist/trinity/eve/child/{EveChildInstancedMeshes.js → EveChildInstancedMeshes/EveChildInstancedMeshes.js} +42 -163
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js.map +1 -0
- package/dist/trinity/eve/child/EveChildMesh.js +218 -218
- package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
- package/dist/trinity/eve/child/EveChildPartData/EveChildPartData.js +53 -0
- package/dist/trinity/eve/child/EveChildPartData/EveChildPartData.js.map +1 -0
- package/dist/trinity/eve/child/{EveChildPartData.js → EveChildPartData/EveChildPartDataPartData.js} +9 -45
- package/dist/trinity/eve/child/EveChildPartData/EveChildPartDataPartData.js.map +1 -0
- package/dist/trinity/eve/child/EveChildParticleSystem.js +30 -29
- package/dist/trinity/eve/child/EveChildParticleSystem.js.map +1 -1
- package/dist/trinity/eve/child/EveChildTransform.js +5 -0
- package/dist/trinity/eve/child/EveChildTransform.js.map +1 -1
- package/dist/trinity/eve/child/EveChildTurret.js +7 -0
- package/dist/trinity/eve/child/EveChildTurret.js.map +1 -1
- package/dist/trinity/eve/index.js +10 -4
- package/dist/trinity/eve/index.js.map +1 -1
- package/dist/trinity/eve/lights/Tr2Light.js +5 -0
- package/dist/trinity/eve/lights/Tr2Light.js.map +1 -1
- package/dist/trinity/eve/overlays/overlayBatches.js +6 -1
- package/dist/trinity/eve/overlays/overlayBatches.js.map +1 -1
- package/dist/trinity/eve/particles/static/EveSceneStaticParticles.js +4 -4
- package/dist/trinity/eve/particles/static/EveSceneStaticParticles.js.map +1 -1
- package/dist/trinity/eve/renderable/stretch/EveStretch2.js +76 -71
- package/dist/trinity/eve/renderable/stretch/EveStretch2.js.map +1 -1
- package/dist/trinity/eve/renderable/stretch/EveStretch3.js +1 -1
- package/dist/trinity/eve/renderable/stretch/EveStretch3.js.map +1 -1
- package/dist/trinity/eve/spaceObject/EveShip2.js +3 -3
- package/dist/trinity/eve/spaceObject/EveShip2.js.map +1 -1
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +408 -407
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
- package/dist/trinity/eve/ui/EveTacticalOverlay.js +1 -1
- package/dist/trinity/eve/ui/EveTacticalOverlay.js.map +1 -1
- package/dist/trinity/eve/ui/lines/EveCurveLineSet.js +9 -9
- package/dist/trinity/eve/ui/lines/EveCurveLineSet.js.map +1 -1
- package/dist/trinity/eve/ui/lines/EveLineSet.js +27 -25
- package/dist/trinity/eve/ui/lines/EveLineSet.js.map +1 -1
- package/dist/trinity/eve/ui/tacticalOverlay/EveTacticalTrails.js +3 -2
- package/dist/trinity/eve/ui/tacticalOverlay/EveTacticalTrails.js.map +1 -1
- package/dist/trinity/generated/index.js +0 -1
- package/dist/trinity/generated/index.js.map +1 -1
- package/dist/trinity/generated/trinityCore/index.js +0 -1
- package/dist/trinity/generated/trinityCore/index.js.map +1 -1
- package/dist/trinity/index.js +59 -23
- package/dist/trinity/index.js.map +1 -1
- package/dist/trinity/particle/{ITr2GenericEmitter.js → ITr2GenericEmitter/ITr2GenericEmitter.js} +4 -32
- package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitter.js.map +1 -0
- package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitterUpdateArguments.js +36 -0
- package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitterUpdateArguments.js.map +1 -0
- package/dist/trinity/particle/Tr2ParticleSystem.js +4 -2
- package/dist/trinity/particle/Tr2ParticleSystem.js.map +1 -1
- package/dist/trinity/particle/element/Tr2ParticleElementData.js +15 -4
- package/dist/trinity/particle/element/Tr2ParticleElementData.js.map +1 -1
- package/dist/trinity/particle/emitter/Tr2DynamicEmitter.js +21 -20
- package/dist/trinity/particle/emitter/Tr2DynamicEmitter.js.map +1 -1
- package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js +23 -22
- package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js.map +1 -1
- package/dist/trinity/particle/emitter/Tr2StaticEmitter.js +14 -13
- package/dist/trinity/particle/emitter/Tr2StaticEmitter.js.map +1 -1
- package/dist/trinity/particle/index.js +2 -1
- package/dist/trinity/particle/index.js.map +1 -1
- package/dist/trinity/renderJob/step/TriStepPushRenderTarget.js +7 -1
- package/dist/trinity/renderJob/step/TriStepPushRenderTarget.js.map +1 -1
- package/dist/trinity/shader/Tr2Effect.js +131 -58
- package/dist/trinity/shader/Tr2Effect.js.map +1 -1
- package/dist/trinity/shader/Tr2EffectStateManager.js +17 -5
- package/dist/trinity/shader/Tr2EffectStateManager.js.map +1 -1
- package/dist/trinity/shader/Tr2Material.js +21 -4
- package/dist/trinity/shader/Tr2Material.js.map +1 -1
- package/dist/trinity/shader/material/Tr2EffectPassParameters.js +4 -1
- package/dist/trinity/shader/material/Tr2EffectPassParameters.js.map +1 -1
- package/dist/trinity/shader/parameter/Tr2GeometryBufferParameter.js +2 -2
- package/dist/trinity/shader/parameter/Tr2GeometryBufferParameter.js.map +1 -1
- package/dist/trinityal/Tr2BufferAL/Tr2BufferDescriptionAL.js +79 -0
- package/dist/trinityal/Tr2BufferAL/Tr2BufferDescriptionAL.js.map +1 -0
- package/dist/trinityal/{Tr2DeviceResourceAL.js → Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js} +77 -79
- package/dist/trinityal/Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js.map +1 -0
- package/dist/trinityal/Tr2DeviceResourceAL/Tr2DeviceResourceAL.js +24 -0
- package/dist/trinityal/Tr2DeviceResourceAL/Tr2DeviceResourceAL.js.map +1 -0
- package/dist/trinityal/Tr2DrawUPHelper.js +2 -1
- package/dist/trinityal/Tr2DrawUPHelper.js.map +1 -1
- package/dist/trinityal/Tr2HalHelperStructures/Tr2MsaaDesc.js +45 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2MsaaDesc.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SamplerDescription.js +154 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SamplerDescription.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SubresourceData.js +48 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SubresourceData.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureCoordBox.js +75 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureCoordBox.js.map +1 -0
- package/dist/trinityal/{Tr2HalHelperStructures.js → Tr2HalHelperStructures/Tr2TextureSubresource.js} +11 -115
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2Viewport.js +51 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2Viewport.js.map +1 -0
- package/dist/trinityal/{Tr2RenderPassAL.js → Tr2RenderPassAL/Tr2ColorAttachment.js} +5 -28
- package/dist/trinityal/Tr2RenderPassAL/Tr2ColorAttachment.js.map +1 -0
- package/dist/trinityal/Tr2RenderPassAL/Tr2DepthAttachment.js +38 -0
- package/dist/trinityal/Tr2RenderPassAL/Tr2DepthAttachment.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2RegisterMapAL.js +80 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2RegisterMapAL.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetAL.js +76 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetAL.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetALStub.js +96 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetALStub.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetDescriptionAL.js +196 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetDescriptionAL.js.map +1 -0
- package/dist/trinityal/index.js +22 -9
- package/dist/trinityal/index.js.map +1 -1
- package/dist/trinityal/stub/Tr2BufferALStub.js +86 -141
- package/dist/trinityal/stub/Tr2BufferALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2CapsALStub.js +17 -0
- package/dist/trinityal/stub/Tr2CapsALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2ConstantBufferALStub.js +57 -41
- package/dist/trinityal/stub/Tr2ConstantBufferALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2FenceALStub.js +18 -2
- package/dist/trinityal/stub/Tr2FenceALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2GpuTimerALStub.js +97 -0
- package/dist/trinityal/stub/Tr2GpuTimerALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2OcclusionQueryALStub.js +124 -0
- package/dist/trinityal/stub/Tr2OcclusionQueryALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2PipelineStatsQueryALStub/Tr2PipelineStatsQueryALStub.js +146 -0
- package/dist/trinityal/stub/Tr2PipelineStatsQueryALStub/Tr2PipelineStatsQueryALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2BindlessResourcesAL.js +28 -0
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2BindlessResourcesAL.js.map +1 -0
- package/dist/trinityal/stub/{Tr2RenderContextALStub.js → Tr2RenderContextALStub/Tr2RenderContextALStub.js} +70 -75
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2SamplerStateALStub.js +47 -31
- package/dist/trinityal/stub/Tr2SamplerStateALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2ShaderALStub.js +61 -45
- package/dist/trinityal/stub/Tr2ShaderALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2ShaderProgramALStub.js +51 -33
- package/dist/trinityal/stub/Tr2ShaderProgramALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2SwapChainALStub.js +61 -45
- package/dist/trinityal/stub/Tr2SwapChainALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2TextureALStub.js +188 -171
- package/dist/trinityal/stub/Tr2TextureALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2VertexLayoutALStub.js +43 -27
- package/dist/trinityal/stub/Tr2VertexLayoutALStub.js.map +1 -1
- package/dist/trinityal/stub/{Tr2VideoAdapterInfoALStub.js → Tr2VideoAdapterInfoStub.js} +16 -1
- package/dist/trinityal/stub/Tr2VideoAdapterInfoStub.js.map +1 -0
- package/dist/trinityal/stub/index.js +8 -4
- package/dist/trinityal/stub/index.js.map +1 -1
- package/dist/trinityal/vertexLayoutMatch.js +2 -2
- package/dist/trinityal/vertexLayoutMatch.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuBufferAL.js +105 -90
- package/dist/trinityal/webgpu/CjsWebgpuBufferAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuCapsAL.js +17 -0
- package/dist/trinityal/webgpu/CjsWebgpuCapsAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuConstantBufferAL.js +15 -0
- package/dist/trinityal/webgpu/CjsWebgpuConstantBufferAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuDevice.js +2 -2
- package/dist/trinityal/webgpu/CjsWebgpuDevice.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +900 -938
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js +56 -60
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuSamplerStateAL.js +16 -1
- package/dist/trinityal/webgpu/CjsWebgpuSamplerStateAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js +100 -379
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js +330 -0
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js.map +1 -0
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +15 -0
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
- package/dist/trinityal/webgpu/core/{constantArena.js → CjsWebgpuConstantArena.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuConstantArena.js.map +1 -0
- package/dist/trinityal/webgpu/core/{batchGroups.js → CjsWebgpuEncodeState.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuEncodeState.js.map +1 -0
- package/dist/trinityal/webgpu/core/{perFrameSource.js → CjsWebgpuPerFrameSource.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuPerFrameSource.js.map +1 -0
- package/dist/trinityal/webgpu/core/{pipelineCache.js → CjsWebgpuPipelineCache.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuPipelineCache.js.map +1 -0
- package/dist/trinityal/webgpu/core/{psoDescription.js → CjsWebgpuPsoDescription.js} +2 -2
- package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js.map +1 -0
- package/dist/trinityal/webgpu/core/{renderTarget.js → CjsWebgpuRenderTarget.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuRenderTarget.js.map +1 -0
- package/dist/trinityal/webgpu/core/{samplerSource.js → CjsWebgpuSamplerSource.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuSamplerSource.js.map +1 -0
- package/dist/trinityal/webgpu/core/{textureSource.js → CjsWebgpuTextureSource.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuTextureSource.js.map +1 -0
- package/dist/trinityal/webgpu/core/{trinityBatchDispatcher.js → CjsWebgpuTrinityBatchDispatcher.js} +4 -4
- package/dist/trinityal/webgpu/core/CjsWebgpuTrinityBatchDispatcher.js.map +1 -0
- package/dist/trinityal/webgpu/core/{trinityBatchResolver.js → CjsWebgpuTrinityBatchResolver.js} +81 -81
- package/dist/trinityal/webgpu/core/CjsWebgpuTrinityBatchResolver.js.map +1 -0
- package/dist/trinityal/webgpu/core/{trinityPassEncoder.js → CjsWebgpuTrinityPassEncoder.js} +2 -2
- package/dist/trinityal/webgpu/core/CjsWebgpuTrinityPassEncoder.js.map +1 -0
- package/dist/trinityal/webgpu/core/{workQueue.js → CjsWebgpuWorkQueue.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js.map +1 -0
- package/dist/trinityal/webgpu/internal.js +12 -11
- package/dist/trinityal/webgpu/internal.js.map +1 -1
- package/docs/audio/reference/classes/trinity.md +44 -34
- package/docs/character/architecture.md +276 -0
- package/docs/character/reference/character-appearance-plans.md +30 -66
- package/docs/character/reference/prepared-libraries.md +14 -30
- package/docs/global/reference/api.md +2 -1
- package/docs/global/reference/classes/README.md +53 -71
- package/docs/global/reference/classes/dropped.md +16 -0
- package/docs/resource/README.md +19 -15
- package/docs/resource/architecture.md +9 -2
- package/docs/resource/concepts/format-capabilities.md +124 -80
- package/docs/resource/concepts/shared-format-helpers.md +94 -0
- package/docs/resource/formats/README.md +230 -224
- package/docs/resource/formats/bitknit2.md +221 -0
- package/docs/resource/formats/carbon-effect-container.md +184 -269
- package/docs/resource/formats/gr2.md +6 -1
- package/docs/resource/formats/schemabound.md +28 -48
- package/docs/resource/formats/static.md +70 -97
- package/docs/resource/formats/webgl/carbon-constant-layouts.md +8 -8
- package/docs/resource/formats/webgl/decl-io.md +165 -256
- package/docs/resource/formats/webgl/memory-structured.md +64 -142
- package/docs/resource/formats/webgl/texture-sample.md +109 -138
- package/docs/resource/formats/webgpu/formats/carbon-webgpu.md +38 -69
- package/docs/resource/formats/webgpu/guides/effect-packaging.md +54 -116
- package/docs/resource/formats/webgpu/reference/api.md +64 -67
- package/docs/resource/formats/webgpu/reference/wgsl-compatibility.md +158 -345
- package/docs/resource/reference/classes/core.md +256 -236
- package/docs/resource/reference/classes/formats.md +1668 -1672
- package/docs/resource/reference/workers.md +4 -2
- package/docs/sof/reference/classes/core.md +1 -1
- package/docs/sof/reference/classes/faction.md +2 -2
- package/docs/sof/reference/classes/generic.md +4 -4
- package/docs/sof/reference/classes/pattern.md +1 -1
- package/docs/sof/reference/classes/shared.md +10 -10
- package/docs/trinity/architecture.md +55 -44
- package/docs/trinity/concepts/generated-class-lifecycle.md +10 -15
- package/docs/trinity/reference/classes/curves-and-utilities.md +496 -506
- package/docs/trinity/reference/classes/dropped.md +0 -189
- package/docs/trinity/reference/classes/eve-runtime.md +8 -8
- package/docs/trinity/reference/classes/generated.md +0 -10
- package/docs/trinity/reference/classes/particle.md +2 -2
- package/docs/trinity/reference/classes/trinity-core.md +1554 -1256
- package/docs/trinity/reference/implementation-status.md +50 -75
- package/docs/trinity/reference/main-semantic-extraction.md +13 -17
- package/docs/trinityal/reference/classes/README.md +77 -27
- package/docs/trinityal/reference/classes/dropped.md +92 -0
- package/docs/trinityal/webgpu/README.md +3 -1
- package/docs/trinityal/webgpu/architecture.md +121 -228
- package/docs/trinityal/webgpu/reference/api.md +5 -5
- package/docs/trinityal/webgpu/reference/classes/README.md +13 -13
- package/format-notices/gr2/NOTICE +18 -12
- package/format-notices/gr2/THIRD-PARTY-NOTICES.md +5 -5
- package/package.json +4 -1
- package/dist/audio/trinity/audio/AudActionLog.js +0 -173
- package/dist/audio/trinity/audio/AudActionLog.js.map +0 -1
- package/dist/audio/trinity/audio/AudObstructionOcclusion.js.map +0 -1
- package/dist/global/contracts/CjsScriptCallback.js +0 -94
- package/dist/global/contracts/CjsScriptCallback.js.map +0 -1
- package/dist/trinity/controllers/ITr2Controller.js.map +0 -1
- package/dist/trinity/core/Tr2GpuResourcePool.js.map +0 -1
- package/dist/trinity/core/Tr2QuadRenderer.js.map +0 -1
- package/dist/trinity/core/Tr2TextureArray.js.map +0 -1
- package/dist/trinity/core/batch/ITriRenderBatchAccumulator.js.map +0 -1
- package/dist/trinity/core/batch/Tr2RenderBatch.js.map +0 -1
- package/dist/trinity/core/batch/TriRenderBatchAccumulator.js.map +0 -1
- package/dist/trinity/core/context/CjsShadowMapExecutor.js +0 -43
- package/dist/trinity/core/context/CjsShadowMapExecutor.js.map +0 -1
- package/dist/trinity/core/context/CjsVolumetricsExecutor.js +0 -64
- package/dist/trinity/core/context/CjsVolumetricsExecutor.js.map +0 -1
- package/dist/trinity/core/context/Tr2VisibilityResults.js +0 -109
- package/dist/trinity/core/context/Tr2VisibilityResults.js.map +0 -1
- package/dist/trinity/core/device/Tr2RingBuffer.js.map +0 -1
- package/dist/trinity/core/device/Tr2SuballocatedBuffer.js.map +0 -1
- package/dist/trinity/core/mesh/ITr2ImpostorSource.js.map +0 -1
- package/dist/trinity/core/mesh/ITr2InstanceData.js.map +0 -1
- package/dist/trinity/core/rawData/Tr2PerObjectData.js.map +0 -1
- package/dist/trinity/core/rawData/constantLayout.js +0 -175
- package/dist/trinity/core/rawData/constantLayout.js.map +0 -1
- package/dist/trinity/core/vertex/Tr2VertexDefinition.js.map +0 -1
- package/dist/trinity/eve/child/EveChildInstancedMeshes.js.map +0 -1
- package/dist/trinity/eve/child/EveChildPartData.js.map +0 -1
- package/dist/trinity/generated/trinityCore/Tr2Denoiser.js +0 -47
- package/dist/trinity/generated/trinityCore/Tr2Denoiser.js.map +0 -1
- package/dist/trinity/particle/ITr2GenericEmitter.js.map +0 -1
- package/dist/trinityal/Tr2DeviceResourceAL.js.map +0 -1
- package/dist/trinityal/Tr2HalHelperStructures.js.map +0 -1
- package/dist/trinityal/Tr2RenderPassAL.js.map +0 -1
- package/dist/trinityal/Tr2ResourceSetAL.js +0 -419
- package/dist/trinityal/Tr2ResourceSetAL.js.map +0 -1
- package/dist/trinityal/Tr2SamplerDescription.js +0 -72
- package/dist/trinityal/Tr2SamplerDescription.js.map +0 -1
- package/dist/trinityal/stub/Tr2QueryALStub.js +0 -326
- package/dist/trinityal/stub/Tr2QueryALStub.js.map +0 -1
- package/dist/trinityal/stub/Tr2RenderContextALStub.js.map +0 -1
- package/dist/trinityal/stub/Tr2VideoAdapterInfoALStub.js.map +0 -1
- package/dist/trinityal/webgpu/core/batchGroups.js.map +0 -1
- package/dist/trinityal/webgpu/core/constantArena.js.map +0 -1
- package/dist/trinityal/webgpu/core/perFrameSource.js.map +0 -1
- package/dist/trinityal/webgpu/core/pipelineCache.js.map +0 -1
- package/dist/trinityal/webgpu/core/psoDescription.js.map +0 -1
- package/dist/trinityal/webgpu/core/renderTarget.js.map +0 -1
- package/dist/trinityal/webgpu/core/samplerSource.js.map +0 -1
- package/dist/trinityal/webgpu/core/textureSource.js.map +0 -1
- package/dist/trinityal/webgpu/core/trinityBatchDispatcher.js.map +0 -1
- package/dist/trinityal/webgpu/core/trinityBatchResolver.js.map +0 -1
- package/dist/trinityal/webgpu/core/trinityPassEncoder.js.map +0 -1
- package/dist/trinityal/webgpu/core/workQueue.js.map +0 -1
|
@@ -1,93 +1,25 @@
|
|
|
1
|
+
import { applyDecs2311 as _applyDecs2311 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { impl, CjsSchema } from '#schema';
|
|
3
|
+
import { Tr2ResourceSetAL } from '../Tr2ResourceSetAL/Tr2ResourceSetAL.js';
|
|
1
4
|
import { Topology, PixelFormat, Tr2LoadAction, Tr2StoreAction, ShaderType, UpscalingResult, UpscalingSetting, UpscalingTechnique } from '#consts/render-context';
|
|
2
5
|
import { Tr2DrawUPHelper, Failed, Tr2VertexLayoutALStub, Tr2ConstantUsageAL, ALResult, Tr2ColorAttachment, Tr2DepthAttachment, resolveBindingPlan } from '#trinityal';
|
|
3
|
-
import { CjsWebgpuWorkQueue } from './core/
|
|
6
|
+
import { CjsWebgpuWorkQueue } from './core/CjsWebgpuWorkQueue.js';
|
|
4
7
|
import { CjsWebgpuBufferAL } from './CjsWebgpuBufferAL.js';
|
|
5
8
|
import { CjsWebgpuConstantBufferAL } from './CjsWebgpuConstantBufferAL.js';
|
|
6
9
|
import { CjsWebgpuSamplerStateAL } from './CjsWebgpuSamplerStateAL.js';
|
|
7
10
|
import { CjsWebgpuResourceSetAL } from './CjsWebgpuResourceSetAL.js';
|
|
8
11
|
import { CjsWebgpuTextureAL } from './CjsWebgpuTextureAL.js';
|
|
9
|
-
import { CjsWebgpuConstantArena } from './core/
|
|
10
|
-
import { CanonicalKey } from './core/
|
|
12
|
+
import { CjsWebgpuConstantArena } from './core/CjsWebgpuConstantArena.js';
|
|
13
|
+
import { CanonicalKey } from './core/CjsWebgpuPipelineCache.js';
|
|
11
14
|
import { TOPOLOGIES } from './core/topology.js';
|
|
12
|
-
import { SamplerDescriptionKey } from '../Tr2SamplerDescription.js';
|
|
15
|
+
import { SamplerDescriptionKey } from '../Tr2HalHelperStructures/Tr2SamplerDescription.js';
|
|
13
16
|
import { CjsWebgpuCapsAL } from './CjsWebgpuCapsAL.js';
|
|
14
|
-
import { CjsWebgpuPsoDescription } from './core/
|
|
15
|
-
import { CjsWebgpuShaderAL,
|
|
17
|
+
import { CjsWebgpuPsoDescription } from './core/CjsWebgpuPsoDescription.js';
|
|
18
|
+
import { CjsWebgpuShaderAL, WEBGPU_ENTRY_POINT } from './CjsWebgpuShaderAL.js';
|
|
19
|
+
import { CjsWebgpuShaderProgramAL } from './CjsWebgpuShaderProgramAL.js';
|
|
16
20
|
import { WebgpuVertexBufferLayout } from './core/vertexFormat.js';
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
// Source: trinity/trinityal/metal/Tr2RenderContextMetal.mm
|
|
20
|
-
// Source: trinity/trinityal/stub/Tr2RenderContextStub.h
|
|
21
|
-
//
|
|
22
|
-
// The WebGPU backend behind Carbon's abstraction layer.
|
|
23
|
-
//
|
|
24
|
-
// WHAT THIS REPLACED. `Tr2RenderContext` used to RECORD what Trinity asked for
|
|
25
|
-
// into an intent list, which `framePlan.js` partitioned and `frameExecutor.js`
|
|
26
|
-
// encoded. That mechanism had no Carbon counterpart - Carbon gives the same job
|
|
27
|
-
// to the abstraction layer, and a backend is simply called - and it is now
|
|
28
|
-
// deleted, along with all three of those files (runtime `1e881dec`).
|
|
29
|
-
//
|
|
30
|
-
// THE DIVISION OF LABOUR IS CARBON'S. `Tr2RenderContextAL` (metal) holds the
|
|
31
|
-
// bound state and validates; `MetalWorkQueue` owns the command buffer and the
|
|
32
|
-
// encoder lifetime. `DrawIndexedInstanced` there checks its index buffer,
|
|
33
|
-
// converts a primitive count to a vertex count, then calls the work queue,
|
|
34
|
-
// whose draw opens a render encoder if none is current
|
|
35
|
-
// (`Tr2RenderContextMetal.mm:414-436`, `MetalWorkQueue.mm:2922-2945`). This
|
|
36
|
-
// keeps that split, so `CjsWebgpuWorkQueue` is the only thing that knows when a
|
|
37
|
-
// pass begins.
|
|
38
|
-
//
|
|
39
|
-
// DEVICE-FREE, AS CARBON'S STUB IS. Every verb here is argument validation,
|
|
40
|
-
// state, and delegation - none of it needs a GPU, and Carbon ships a whole
|
|
41
|
-
// backend (`TrinityAL_stub`) on that basis. The device arrives when the work
|
|
42
|
-
// queue's recorded transitions are applied to a real command encoder.
|
|
43
|
-
//
|
|
44
|
-
// SCOPE. The verbs `Tr2RenderContext` forwards to a backend: the geometry and
|
|
45
|
-
// draw path Carbon's `SubmitGeometry` touches (`Tr2RenderContext.cpp:83-103`),
|
|
46
|
-
// the render-target and depth-stencil families with their per-slot stacks, the
|
|
47
|
-
// viewport, clear, compute and present. That is what installing this backend
|
|
48
|
-
// requires, because the context prefers the AL per verb and a missing one is a
|
|
49
|
-
// crash rather than a fallback.
|
|
50
|
-
//
|
|
51
|
-
// NOT HERE YET: texture creation, copies and mip generation. Absent rather than
|
|
52
|
-
// faked. Buffer creation IS here (`CreateBuffer`), because a Trinity class that
|
|
53
|
-
// fills a buffer per frame cannot pick its own backend.
|
|
54
|
-
//
|
|
55
|
-
// WHAT CARBON'S METAL BACKEND HAS THAT THIS DOES NOT, AND WHY.
|
|
56
|
-
//
|
|
57
|
-
// The parity check compares this file against the donors it cites, which
|
|
58
|
-
// includes all of metal - so Metal-only members are reported against a backend
|
|
59
|
-
// that has no reason to carry them. These are decisions, not a queue:
|
|
60
|
-
//
|
|
61
|
-
// - `BeginParallelEncoding`/`EndParallelEncoding`/`ForkContext` spread batch
|
|
62
|
-
// encoding across threads. There is one thread here, and `Tr2RenderContext`
|
|
63
|
-
// already records the same omission for the same reason.
|
|
64
|
-
// - `BufferRewritten` notifies the context that a buffer allocation was RENAMED
|
|
65
|
-
// under it. WebGPU cannot rename: `queue.writeBuffer` is ordered on the queue,
|
|
66
|
-
// which gives the guarantee renaming buys without renaming, and
|
|
67
|
-
// `CjsWebgpuBufferAL`'s head comment argues that at length.
|
|
68
|
-
// - `CheckDrawResources` does not validate, which the first version of this
|
|
69
|
-
// note claimed. Carbon BINDS dummy resources into unfilled slots and installs
|
|
70
|
-
// the vertex descriptor, on every draw (`Tr2RenderContextMetal.mm:524-541`).
|
|
71
|
-
// WebGPU has the same requirement and will reject a draw with an unfilled
|
|
72
|
-
// binding, so the browser is not doing this for us - it is the thing that
|
|
73
|
-
// rejects us. WE DO IT, under Metal's other name: `EmitRenderEncoderState`
|
|
74
|
-
// resolves the pipeline, fills unbound slots with dummies and binds the
|
|
75
|
-
// layout, inside every draw verb. A NAME divergence, not an absence. (Until
|
|
76
|
-
// 2026-09-10 this note said the divergence held "because the dispatcher fills
|
|
77
|
-
// bindings before the draw reaches here"; there is no dispatcher.)
|
|
78
|
-
// - `ReleaseLater` defers destruction until the GPU has finished reading. A
|
|
79
|
-
// `GPUBuffer` stays alive as long as a submitted command references it, so
|
|
80
|
-
// the deferral has nothing to defer.
|
|
81
|
-
// - `UseConstantBuffer` is Metal-only and makes a constant buffer resident on
|
|
82
|
-
// the COMPUTE encoder (`:1658-1673`); its only callers build the ray-tracing
|
|
83
|
-
// shader table. No compute dispatches here and there is no ray tracing, so
|
|
84
|
-
// there is nothing to make resident. (This note used to lump it with
|
|
85
|
-
// `UploadConstants` and claim "there is no arena", which stopped being true
|
|
86
|
-
// the day the arena landed. `UploadConstants` IS ported, above.)
|
|
87
|
-
// - `GetMetalContext` and `GetMetalWorkQueue` are Metal's native escape
|
|
88
|
-
// hatches. Ours are `GetWebgpu` and `GetWorkQueue` - Carbon names these per
|
|
89
|
-
// backend too, so a WebGPU spelling is the faithful thing, not a divergence.
|
|
90
|
-
|
|
22
|
+
let _initProto;
|
|
91
23
|
|
|
92
24
|
/** WebGPU's index format for a Carbon index stride, or null for one it lacks. */
|
|
93
25
|
const INDEX_FORMAT = Object.freeze({
|
|
@@ -98,11 +30,11 @@ const INDEX_FORMAT = Object.freeze({
|
|
|
98
30
|
/** Bind groups kept before the cache is dropped and rebuilt. */
|
|
99
31
|
const MAX_CACHED_BIND_GROUPS = 1024;
|
|
100
32
|
|
|
101
|
-
/**
|
|
102
|
-
* The `GPUBuffer` behind a bound stream, or null.
|
|
103
|
-
*
|
|
104
|
-
* A stream is whatever Trinity bound: a `Tr2BufferAL` answers; a geometry
|
|
105
|
-
* descriptor - what a mesh batch carries today - does not, and the draw refuses.
|
|
33
|
+
/**
|
|
34
|
+
* The `GPUBuffer` behind a bound stream, or null.
|
|
35
|
+
*
|
|
36
|
+
* A stream is whatever Trinity bound: a `Tr2BufferAL` answers; a geometry
|
|
37
|
+
* descriptor - what a mesh batch carries today - does not, and the draw refuses.
|
|
106
38
|
*/
|
|
107
39
|
function DeviceBufferOf(bound) {
|
|
108
40
|
return bound && typeof bound.GetDeviceBuffer === "function" ? bound.GetDeviceBuffer() : null;
|
|
@@ -113,12 +45,12 @@ function fail(message) {
|
|
|
113
45
|
throw error;
|
|
114
46
|
}
|
|
115
47
|
|
|
116
|
-
/**
|
|
117
|
-
* How many vertices a primitive count describes, per topology.
|
|
118
|
-
*
|
|
119
|
-
* CARBON'S DRAW VERBS TAKE PRIMITIVES AND ITS BACKENDS DRAW VERTICES, so every
|
|
120
|
-
* one of them converts (`Tr2RenderContextMetal.mm:424`, `ComputeVertexCount`).
|
|
121
|
-
* The conversion depends on the bound topology, which is why the AL holds it.
|
|
48
|
+
/**
|
|
49
|
+
* How many vertices a primitive count describes, per topology.
|
|
50
|
+
*
|
|
51
|
+
* CARBON'S DRAW VERBS TAKE PRIMITIVES AND ITS BACKENDS DRAW VERTICES, so every
|
|
52
|
+
* one of them converts (`Tr2RenderContextMetal.mm:424`, `ComputeVertexCount`).
|
|
53
|
+
* The conversion depends on the bound topology, which is why the AL holds it.
|
|
122
54
|
*/
|
|
123
55
|
const VERTICES_PER_PRIMITIVE = Object.freeze({
|
|
124
56
|
[Topology.TOP_TRIANGLES]: count => count * 3,
|
|
@@ -132,12 +64,12 @@ const VERTICES_PER_PRIMITIVE = Object.freeze({
|
|
|
132
64
|
/** Carbon's `MAX_RENDER_TARGET`; the bound-target array is fixed width. */
|
|
133
65
|
const MAX_RENDER_TARGET = 8;
|
|
134
66
|
|
|
135
|
-
/**
|
|
136
|
-
* The Carbon pixel format behind each format a canvas can be configured with.
|
|
137
|
-
*
|
|
138
|
-
* SHORT ON PURPOSE. `GPUCanvasContext.configure` accepts only `bgra8unorm`,
|
|
139
|
-
* `rgba8unorm` and their sRGB view formats, so this is the whole domain rather
|
|
140
|
-
* than a partial table someone should extend later.
|
|
67
|
+
/**
|
|
68
|
+
* The Carbon pixel format behind each format a canvas can be configured with.
|
|
69
|
+
*
|
|
70
|
+
* SHORT ON PURPOSE. `GPUCanvasContext.configure` accepts only `bgra8unorm`,
|
|
71
|
+
* `rgba8unorm` and their sRGB view formats, so this is the whole domain rather
|
|
72
|
+
* than a partial table someone should extend later.
|
|
141
73
|
*/
|
|
142
74
|
const CANVAS_PIXEL_FORMAT = Object.freeze({
|
|
143
75
|
"bgra8unorm": PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM,
|
|
@@ -146,29 +78,32 @@ const CANVAS_PIXEL_FORMAT = Object.freeze({
|
|
|
146
78
|
"rgba8unorm-srgb": PixelFormat.PIXEL_FORMAT_R8G8B8A8_UNORM_SRGB
|
|
147
79
|
});
|
|
148
80
|
|
|
149
|
-
/**
|
|
150
|
-
* The primary render context, Carbon's process-wide one.
|
|
151
|
-
*
|
|
152
|
-
* A MODULE-LEVEL BINDING, matching the stub, because Carbon's is a static on
|
|
153
|
-
* the class and a JavaScript static field would be per-subclass. There is one
|
|
154
|
-
* primary context per process in Carbon and there is one here.
|
|
81
|
+
/**
|
|
82
|
+
* The primary render context, Carbon's process-wide one.
|
|
83
|
+
*
|
|
84
|
+
* A MODULE-LEVEL BINDING, matching the stub, because Carbon's is a static on
|
|
85
|
+
* the class and a JavaScript static field would be per-subclass. There is one
|
|
86
|
+
* primary context per process in Carbon and there is one here.
|
|
155
87
|
*/
|
|
156
88
|
let primaryRenderContext = null;
|
|
157
89
|
|
|
158
|
-
/**
|
|
159
|
-
* How many constant-buffer registers a stage has.
|
|
160
|
-
*
|
|
161
|
-
* Carbon's Metal backend fixes this at 20 (`METAL_CONST_BUFFER_COUNT`,
|
|
162
|
-
* `MetalWorkQueue.h:39`) and rejects anything past it. Kept at Carbon's number
|
|
163
|
-
* rather than a WebGPU limit: this bounds the REGISTER INDEX an effect declares,
|
|
164
|
-
* which the shader compiler already fixed, not the bind-group slot count.
|
|
90
|
+
/**
|
|
91
|
+
* How many constant-buffer registers a stage has.
|
|
92
|
+
*
|
|
93
|
+
* Carbon's Metal backend fixes this at 20 (`METAL_CONST_BUFFER_COUNT`,
|
|
94
|
+
* `MetalWorkQueue.h:39`) and rejects anything past it. Kept at Carbon's number
|
|
95
|
+
* rather than a WebGPU limit: this bounds the REGISTER INDEX an effect declares,
|
|
96
|
+
* which the shader compiler already fixed, not the bind-group slot count.
|
|
165
97
|
*/
|
|
166
98
|
const CONSTANT_BUFFER_REGISTERS = 20;
|
|
167
99
|
|
|
168
100
|
/** WebGPU behind the abstraction layer, holding a work queue as Metal does. */
|
|
169
101
|
class CjsWebgpuRenderContextAL {
|
|
102
|
+
static {
|
|
103
|
+
[_initProto] = _applyDecs2311(this, [], [[[impl, impl.custom, void 0, impl.reason("JavaScript chooses the AL implementation through this context factory instead of a compile-time platform include. The private allocation branch preserves the native Create result.")], 18, "CreateResourceSet"], [[impl, impl.adapted, void 0, impl.reason("A copied public wrapper retains the shared ownership record while this context binds the WebGPU implementation.")], 18, "SetResourceSet"]]).e;
|
|
104
|
+
}
|
|
170
105
|
/** m_workQueue */
|
|
171
|
-
_workQueue = new CjsWebgpuWorkQueue();
|
|
106
|
+
_workQueue = (_initProto(this), new CjsWebgpuWorkQueue());
|
|
172
107
|
|
|
173
108
|
/** m_isValid */
|
|
174
109
|
_isValid = false;
|
|
@@ -204,23 +139,23 @@ class CjsWebgpuRenderContextAL {
|
|
|
204
139
|
/** m_dirtyPso */
|
|
205
140
|
_pipelineDirty = true;
|
|
206
141
|
|
|
207
|
-
/**
|
|
208
|
-
* m_drawUPHelper, DX12's name for it; DX11 calls the same thing m_drawUP.
|
|
209
|
-
*
|
|
210
|
-
* Owned rather than shared, as every backend owns its own: the ring's slots
|
|
211
|
-
* are only safe because one context advances one cursor.
|
|
142
|
+
/**
|
|
143
|
+
* m_drawUPHelper, DX12's name for it; DX11 calls the same thing m_drawUP.
|
|
144
|
+
*
|
|
145
|
+
* Owned rather than shared, as every backend owns its own: the ring's slots
|
|
146
|
+
* are only safe because one context advances one cursor.
|
|
212
147
|
*/
|
|
213
148
|
_drawUP = new Tr2DrawUPHelper();
|
|
214
149
|
|
|
215
|
-
/**
|
|
216
|
-
* m_psoDescription. Carbon's setters accumulate into one of these and mark it
|
|
217
|
-
* dirty; every draw entry then calls `SetAllState`, which resolves a pipeline
|
|
218
|
-
* from a cache keyed on the description's hash and binds it
|
|
219
|
-
* (`Tr2RenderContextDx12.cpp:763-806`, `:810-880`).
|
|
220
|
-
*
|
|
221
|
-
* The class was written for this and wired to nothing until 2026-09-09. It is
|
|
222
|
-
* filled here so the description is always current; RESOLVING it is the next
|
|
223
|
-
* step, and needs the bound program to carry its effect package.
|
|
150
|
+
/**
|
|
151
|
+
* m_psoDescription. Carbon's setters accumulate into one of these and mark it
|
|
152
|
+
* dirty; every draw entry then calls `SetAllState`, which resolves a pipeline
|
|
153
|
+
* from a cache keyed on the description's hash and binds it
|
|
154
|
+
* (`Tr2RenderContextDx12.cpp:763-806`, `:810-880`).
|
|
155
|
+
*
|
|
156
|
+
* The class was written for this and wired to nothing until 2026-09-09. It is
|
|
157
|
+
* filled here so the description is always current; RESOLVING it is the next
|
|
158
|
+
* step, and needs the bound program to carry its effect package.
|
|
224
159
|
*/
|
|
225
160
|
_psoDescription = new CjsWebgpuPsoDescription();
|
|
226
161
|
|
|
@@ -260,10 +195,10 @@ class CjsWebgpuRenderContextAL {
|
|
|
260
195
|
/** The acquired swap-chain frame, valid only within one scene. */
|
|
261
196
|
_frame = null;
|
|
262
197
|
|
|
263
|
-
/**
|
|
264
|
-
* @param {object} [composition] The device half; omit for the stub backend.
|
|
265
|
-
* @param {object} [composition.webgpu] A `CjsWebgpuDevice`.
|
|
266
|
-
* @param {object} [composition.renderTarget] A `CjsWebgpuRenderTarget`.
|
|
198
|
+
/**
|
|
199
|
+
* @param {object} [composition] The device half; omit for the stub backend.
|
|
200
|
+
* @param {object} [composition.webgpu] A `CjsWebgpuDevice`.
|
|
201
|
+
* @param {object} [composition.renderTarget] A `CjsWebgpuRenderTarget`.
|
|
267
202
|
*/
|
|
268
203
|
constructor({
|
|
269
204
|
webgpu = null,
|
|
@@ -287,29 +222,29 @@ class CjsWebgpuRenderContextAL {
|
|
|
287
222
|
return this._webgpu !== null;
|
|
288
223
|
}
|
|
289
224
|
|
|
290
|
-
/**
|
|
291
|
-
* The device this context draws through.
|
|
292
|
-
*
|
|
293
|
-
* Carbon's buffer and texture AL types take a `Tr2PrimaryRenderContextAL&` in
|
|
294
|
-
* `Create` and reach the device through it (`Tr2BufferAL.h:47`), so the
|
|
295
|
-
* context being the way to the device is Carbon's shape, not a shortcut.
|
|
296
|
-
*
|
|
297
|
-
* @returns {object|null} The `CjsWebgpuDevice`, or null before composition.
|
|
225
|
+
/**
|
|
226
|
+
* The device this context draws through.
|
|
227
|
+
*
|
|
228
|
+
* Carbon's buffer and texture AL types take a `Tr2PrimaryRenderContextAL&` in
|
|
229
|
+
* `Create` and reach the device through it (`Tr2BufferAL.h:47`), so the
|
|
230
|
+
* context being the way to the device is Carbon's shape, not a shortcut.
|
|
231
|
+
*
|
|
232
|
+
* @returns {object|null} The `CjsWebgpuDevice`, or null before composition.
|
|
298
233
|
*/
|
|
299
234
|
GetWebgpu() {
|
|
300
235
|
return this._webgpu;
|
|
301
236
|
}
|
|
302
237
|
|
|
303
|
-
/**
|
|
304
|
-
* Creates a device-backed buffer, this backend's kind of `Tr2BufferAL`.
|
|
305
|
-
*
|
|
306
|
-
* The stub context answers the same call with a `Tr2BufferALStub`, which is
|
|
307
|
-
* how a Trinity class gets the right buffer for the running backend without
|
|
308
|
-
* importing either - see the note on the stub's `CreateBuffer`.
|
|
309
|
-
*
|
|
310
|
-
* @param {object} description A `Tr2BufferDescriptionAL`.
|
|
311
|
-
* @param {ArrayBufferView|null} [initialData] Initial contents, if any.
|
|
312
|
-
* @returns {object|null} The created buffer, or null when Create refused.
|
|
238
|
+
/**
|
|
239
|
+
* Creates a device-backed buffer, this backend's kind of `Tr2BufferAL`.
|
|
240
|
+
*
|
|
241
|
+
* The stub context answers the same call with a `Tr2BufferALStub`, which is
|
|
242
|
+
* how a Trinity class gets the right buffer for the running backend without
|
|
243
|
+
* importing either - see the note on the stub's `CreateBuffer`.
|
|
244
|
+
*
|
|
245
|
+
* @param {object} description A `Tr2BufferDescriptionAL`.
|
|
246
|
+
* @param {ArrayBufferView|null} [initialData] Initial contents, if any.
|
|
247
|
+
* @returns {object|null} The created buffer, or null when Create refused.
|
|
313
248
|
*/
|
|
314
249
|
CreateBuffer(description, initialData = null) {
|
|
315
250
|
const buffer = new CjsWebgpuBufferAL();
|
|
@@ -317,18 +252,18 @@ class CjsWebgpuRenderContextAL {
|
|
|
317
252
|
return buffer;
|
|
318
253
|
}
|
|
319
254
|
|
|
320
|
-
/**
|
|
321
|
-
* Creates a vertex layout, this backend's kind of `Tr2VertexLayoutAL`.
|
|
322
|
-
*
|
|
323
|
-
* IT HOLDS THE DEFINITION AND NOTHING DEVICE-SIDE, and that is not a stub
|
|
324
|
-
* standing in for real work. WebGPU has no input-layout object: the vertex
|
|
325
|
-
* buffer layouts are part of the render pipeline descriptor and are fixed at
|
|
326
|
-
* pipeline creation, so a layout here can only be the definition a pipeline
|
|
327
|
-
* will later be built from. That is why `Tr2VertexLayoutALStub` is the right
|
|
328
|
-
* shape for this backend too rather than a placeholder for a WebGPU one.
|
|
329
|
-
*
|
|
330
|
-
* @param {object[]|object} definition The vertex element list or definition.
|
|
331
|
-
* @returns {object|null} The created layout, or null when Create refused.
|
|
255
|
+
/**
|
|
256
|
+
* Creates a vertex layout, this backend's kind of `Tr2VertexLayoutAL`.
|
|
257
|
+
*
|
|
258
|
+
* IT HOLDS THE DEFINITION AND NOTHING DEVICE-SIDE, and that is not a stub
|
|
259
|
+
* standing in for real work. WebGPU has no input-layout object: the vertex
|
|
260
|
+
* buffer layouts are part of the render pipeline descriptor and are fixed at
|
|
261
|
+
* pipeline creation, so a layout here can only be the definition a pipeline
|
|
262
|
+
* will later be built from. That is why `Tr2VertexLayoutALStub` is the right
|
|
263
|
+
* shape for this backend too rather than a placeholder for a WebGPU one.
|
|
264
|
+
*
|
|
265
|
+
* @param {object[]|object} definition The vertex element list or definition.
|
|
266
|
+
* @returns {object|null} The created layout, or null when Create refused.
|
|
332
267
|
*/
|
|
333
268
|
CreateVertexLayout(definition) {
|
|
334
269
|
const layout = new Tr2VertexLayoutALStub();
|
|
@@ -336,16 +271,16 @@ class CjsWebgpuRenderContextAL {
|
|
|
336
271
|
return layout;
|
|
337
272
|
}
|
|
338
273
|
|
|
339
|
-
/**
|
|
340
|
-
* Creates a constant buffer, this backend's kind of `Tr2ConstantBufferAL`.
|
|
341
|
-
*
|
|
342
|
-
* See the stub's note: with no size this returns an empty buffer for a
|
|
343
|
-
* Trinity caller to `Create` later, as Carbon default-constructs its member.
|
|
344
|
-
*
|
|
345
|
-
* @param {number} [size] Bytes; zero returns an empty, invalid buffer.
|
|
346
|
-
* @param {number} [usage] A `Tr2ConstantUsageAL`.
|
|
347
|
-
* @param {ArrayBufferView|null} [initialData] Initial contents, if any.
|
|
348
|
-
* @returns {object|null} The buffer, or null when a sized Create refused.
|
|
274
|
+
/**
|
|
275
|
+
* Creates a constant buffer, this backend's kind of `Tr2ConstantBufferAL`.
|
|
276
|
+
*
|
|
277
|
+
* See the stub's note: with no size this returns an empty buffer for a
|
|
278
|
+
* Trinity caller to `Create` later, as Carbon default-constructs its member.
|
|
279
|
+
*
|
|
280
|
+
* @param {number} [size] Bytes; zero returns an empty, invalid buffer.
|
|
281
|
+
* @param {number} [usage] A `Tr2ConstantUsageAL`.
|
|
282
|
+
* @param {ArrayBufferView|null} [initialData] Initial contents, if any.
|
|
283
|
+
* @returns {object|null} The buffer, or null when a sized Create refused.
|
|
349
284
|
*/
|
|
350
285
|
CreateConstantBuffer(size = 0, usage = Tr2ConstantUsageAL.REUSABLE, initialData = null) {
|
|
351
286
|
const buffer = new CjsWebgpuConstantBufferAL();
|
|
@@ -353,23 +288,23 @@ class CjsWebgpuRenderContextAL {
|
|
|
353
288
|
return buffer;
|
|
354
289
|
}
|
|
355
290
|
|
|
356
|
-
/**
|
|
357
|
-
* Carbon's `Tr2SamplerStateALFactory` (`Tr2SamplerStateAL.h:41-43`), keyed on
|
|
358
|
-
* the description: equal descriptions are one state.
|
|
291
|
+
/**
|
|
292
|
+
* Carbon's `Tr2SamplerStateALFactory` (`Tr2SamplerStateAL.h:41-43`), keyed on
|
|
293
|
+
* the description: equal descriptions are one state.
|
|
359
294
|
*/
|
|
360
295
|
_samplerStates = new Map();
|
|
361
296
|
|
|
362
|
-
/**
|
|
363
|
-
* The sampler state for a description, this backend's kind of
|
|
364
|
-
* `Tr2SamplerStateAL`, created once per distinct description.
|
|
365
|
-
*
|
|
366
|
-
* Carbon's `Tr2SamplerStateAL::Create` IS this lookup
|
|
367
|
-
* (`Tr2SamplerStateAL.cpp:25-28`): the primary context owns the factory and
|
|
368
|
-
* hands back the shared object, which is why a resource set can compare
|
|
369
|
-
* sampler states by identity.
|
|
370
|
-
*
|
|
371
|
-
* @param {object} description A `Tr2SamplerDescription`, either spelling.
|
|
372
|
-
* @returns {object|null} The shared state, or null when Create refused.
|
|
297
|
+
/**
|
|
298
|
+
* The sampler state for a description, this backend's kind of
|
|
299
|
+
* `Tr2SamplerStateAL`, created once per distinct description.
|
|
300
|
+
*
|
|
301
|
+
* Carbon's `Tr2SamplerStateAL::Create` IS this lookup
|
|
302
|
+
* (`Tr2SamplerStateAL.cpp:25-28`): the primary context owns the factory and
|
|
303
|
+
* hands back the shared object, which is why a resource set can compare
|
|
304
|
+
* sampler states by identity.
|
|
305
|
+
*
|
|
306
|
+
* @param {object} description A `Tr2SamplerDescription`, either spelling.
|
|
307
|
+
* @returns {object|null} The shared state, or null when Create refused.
|
|
373
308
|
*/
|
|
374
309
|
CreateSamplerState(description) {
|
|
375
310
|
const key = SamplerDescriptionKey(description);
|
|
@@ -382,20 +317,20 @@ class CjsWebgpuRenderContextAL {
|
|
|
382
317
|
return state;
|
|
383
318
|
}
|
|
384
319
|
|
|
385
|
-
/**
|
|
386
|
-
* Compiles one shader stage into a `GPUShaderModule`.
|
|
387
|
-
*
|
|
388
|
-
* THE FIRST CONSTRUCTION OF THESE CLASSES. `CjsWebgpuShaderAL` and
|
|
389
|
-
* `CjsWebgpuShaderProgramAL` were written for the immediate-draw route and
|
|
390
|
-
* nothing built one, because the state manager had no way to ask a backend
|
|
391
|
-
* for a shader. This is that way.
|
|
392
|
-
*
|
|
393
|
-
* @param {number} stageType A Carbon `ShaderType`.
|
|
394
|
-
* @param {ArrayBufferView|string} bytecode WGSL source, as this backend's
|
|
395
|
-
* bytecode; see the head comment on `CjsWebgpuShaderAL`.
|
|
396
|
-
* @param {object|null} signature The reflected signature.
|
|
397
|
-
* @param {string} [shaderPath] A debug label.
|
|
398
|
-
* @returns {object|null} The created shader, or null when Create refused.
|
|
320
|
+
/**
|
|
321
|
+
* Compiles one shader stage into a `GPUShaderModule`.
|
|
322
|
+
*
|
|
323
|
+
* THE FIRST CONSTRUCTION OF THESE CLASSES. `CjsWebgpuShaderAL` and
|
|
324
|
+
* `CjsWebgpuShaderProgramAL` were written for the immediate-draw route and
|
|
325
|
+
* nothing built one, because the state manager had no way to ask a backend
|
|
326
|
+
* for a shader. This is that way.
|
|
327
|
+
*
|
|
328
|
+
* @param {number} stageType A Carbon `ShaderType`.
|
|
329
|
+
* @param {ArrayBufferView|string} bytecode WGSL source, as this backend's
|
|
330
|
+
* bytecode; see the head comment on `CjsWebgpuShaderAL`.
|
|
331
|
+
* @param {object|null} signature The reflected signature.
|
|
332
|
+
* @param {string} [shaderPath] A debug label.
|
|
333
|
+
* @returns {object|null} The created shader, or null when Create refused.
|
|
399
334
|
*/
|
|
400
335
|
CreateShader(stageType, bytecode, signature, shaderPath = "") {
|
|
401
336
|
const shader = new CjsWebgpuShaderAL();
|
|
@@ -403,11 +338,11 @@ class CjsWebgpuRenderContextAL {
|
|
|
403
338
|
return shader;
|
|
404
339
|
}
|
|
405
340
|
|
|
406
|
-
/**
|
|
407
|
-
* Links compiled stages into a program.
|
|
408
|
-
*
|
|
409
|
-
* @param {object[]} shaders The stages to link.
|
|
410
|
-
* @returns {object|null} The created program, or null when Create refused.
|
|
341
|
+
/**
|
|
342
|
+
* Links compiled stages into a program.
|
|
343
|
+
*
|
|
344
|
+
* @param {object[]} shaders The stages to link.
|
|
345
|
+
* @returns {object|null} The created program, or null when Create refused.
|
|
411
346
|
*/
|
|
412
347
|
CreateShaderProgram(shaders) {
|
|
413
348
|
const program = new CjsWebgpuShaderProgramAL();
|
|
@@ -415,25 +350,25 @@ class CjsWebgpuRenderContextAL {
|
|
|
415
350
|
return program;
|
|
416
351
|
}
|
|
417
352
|
|
|
418
|
-
/**
|
|
419
|
-
* How many batches this backend has encoded since it was created.
|
|
420
|
-
*
|
|
421
|
-
* A HARNESS NEEDS THIS AND A FRAME DOES NOT, which is why it counts batches
|
|
422
|
-
* rather than reporting them: "did anything draw" is the question a test asks
|
|
423
|
-
* when the alternative is trusting an empty canvas. Carbon answers it with
|
|
424
|
-
* `CCP_STATS_INC( batchCount )` for the same reason.
|
|
425
|
-
*
|
|
426
|
-
* @returns {number} Batches encoded.
|
|
353
|
+
/**
|
|
354
|
+
* How many batches this backend has encoded since it was created.
|
|
355
|
+
*
|
|
356
|
+
* A HARNESS NEEDS THIS AND A FRAME DOES NOT, which is why it counts batches
|
|
357
|
+
* rather than reporting them: "did anything draw" is the question a test asks
|
|
358
|
+
* when the alternative is trusting an empty canvas. Carbon answers it with
|
|
359
|
+
* `CCP_STATS_INC( batchCount )` for the same reason.
|
|
360
|
+
*
|
|
361
|
+
* @returns {number} Batches encoded.
|
|
427
362
|
*/
|
|
428
363
|
GetDrawnBatchCount() {
|
|
429
364
|
return this._drawnBatchCount;
|
|
430
365
|
}
|
|
431
366
|
_drawnBatchCount = 0;
|
|
432
367
|
|
|
433
|
-
/**
|
|
434
|
-
* The work queue this backend records through.
|
|
435
|
-
*
|
|
436
|
-
* @returns {CjsWebgpuWorkQueue} The queue.
|
|
368
|
+
/**
|
|
369
|
+
* The work queue this backend records through.
|
|
370
|
+
*
|
|
371
|
+
* @returns {CjsWebgpuWorkQueue} The queue.
|
|
437
372
|
*/
|
|
438
373
|
GetWorkQueue() {
|
|
439
374
|
return this._workQueue;
|
|
@@ -442,56 +377,56 @@ class CjsWebgpuRenderContextAL {
|
|
|
442
377
|
/** m_caps, built once against whatever device this backend was composed with. */
|
|
443
378
|
_caps = null;
|
|
444
379
|
|
|
445
|
-
/**
|
|
446
|
-
* What this backend can do.
|
|
447
|
-
*
|
|
448
|
-
* Carbon returns a reference to a member (`Tr2RenderContextMetal.mm:855-858`),
|
|
449
|
-
* so the object is stable across calls; built lazily here because the device
|
|
450
|
-
* is a constructor argument and the caps read its limits.
|
|
451
|
-
*
|
|
452
|
-
* @returns {CjsWebgpuCapsAL} The capabilities.
|
|
380
|
+
/**
|
|
381
|
+
* What this backend can do.
|
|
382
|
+
*
|
|
383
|
+
* Carbon returns a reference to a member (`Tr2RenderContextMetal.mm:855-858`),
|
|
384
|
+
* so the object is stable across calls; built lazily here because the device
|
|
385
|
+
* is a constructor argument and the caps read its limits.
|
|
386
|
+
*
|
|
387
|
+
* @returns {CjsWebgpuCapsAL} The capabilities.
|
|
453
388
|
*/
|
|
454
389
|
GetCaps() {
|
|
455
390
|
this._caps ??= new CjsWebgpuCapsAL(this._webgpu);
|
|
456
391
|
return this._caps;
|
|
457
392
|
}
|
|
458
393
|
|
|
459
|
-
/**
|
|
460
|
-
* m_frameNumber. Carbon's Metal backend keeps this on the context behind it
|
|
461
|
-
* (`Tr2RenderContextMetal.mm:1686-1694`); there is no such object here, so it
|
|
462
|
-
* lives on the backend, exactly as the stub keeps it.
|
|
394
|
+
/**
|
|
395
|
+
* m_frameNumber. Carbon's Metal backend keeps this on the context behind it
|
|
396
|
+
* (`Tr2RenderContextMetal.mm:1686-1694`); there is no such object here, so it
|
|
397
|
+
* lives on the backend, exactly as the stub keeps it.
|
|
463
398
|
*/
|
|
464
399
|
_frameNumber = 0;
|
|
465
400
|
|
|
466
|
-
/**
|
|
467
|
-
* The frame being recorded now.
|
|
468
|
-
*
|
|
469
|
-
* @returns {number} One past the last frame submitted.
|
|
401
|
+
/**
|
|
402
|
+
* The frame being recorded now.
|
|
403
|
+
*
|
|
404
|
+
* @returns {number} One past the last frame submitted.
|
|
470
405
|
*/
|
|
471
406
|
GetRecordingFrameNumber() {
|
|
472
407
|
return this._frameNumber + 1;
|
|
473
408
|
}
|
|
474
409
|
|
|
475
|
-
/**
|
|
476
|
-
* The last frame handed to the device.
|
|
477
|
-
*
|
|
478
|
-
* SUBMISSION, NOT COMPLETION. `GPUQueue.submit` returns without waiting, and
|
|
479
|
-
* the only handle on actual completion is `onSubmittedWorkDone`, a promise -
|
|
480
|
-
* so a truthful "rendered" count would lag by an unbounded amount and could
|
|
481
|
-
* not be read synchronously. This counts submitted frames, and a ring buffer
|
|
482
|
-
* fencing against it is therefore protected by submission order rather than
|
|
483
|
-
* by GPU completion.
|
|
484
|
-
*
|
|
485
|
-
* @returns {number} Frames submitted.
|
|
410
|
+
/**
|
|
411
|
+
* The last frame handed to the device.
|
|
412
|
+
*
|
|
413
|
+
* SUBMISSION, NOT COMPLETION. `GPUQueue.submit` returns without waiting, and
|
|
414
|
+
* the only handle on actual completion is `onSubmittedWorkDone`, a promise -
|
|
415
|
+
* so a truthful "rendered" count would lag by an unbounded amount and could
|
|
416
|
+
* not be read synchronously. This counts submitted frames, and a ring buffer
|
|
417
|
+
* fencing against it is therefore protected by submission order rather than
|
|
418
|
+
* by GPU completion.
|
|
419
|
+
*
|
|
420
|
+
* @returns {number} Frames submitted.
|
|
486
421
|
*/
|
|
487
422
|
GetRenderedFrameNumber() {
|
|
488
423
|
return this._frameNumber;
|
|
489
424
|
}
|
|
490
425
|
|
|
491
|
-
/**
|
|
492
|
-
* Everything the work queue has reported since the last drain.
|
|
493
|
-
*
|
|
494
|
-
* @returns {object[]} Transitions and draws, in order.
|
|
426
|
+
/**
|
|
427
|
+
* Everything the work queue has reported since the last drain.
|
|
428
|
+
*
|
|
429
|
+
* @returns {object[]} Transitions and draws, in order.
|
|
495
430
|
*/
|
|
496
431
|
DrainTransitions() {
|
|
497
432
|
const transitions = this._transitions;
|
|
@@ -499,10 +434,10 @@ class CjsWebgpuRenderContextAL {
|
|
|
499
434
|
return transitions;
|
|
500
435
|
}
|
|
501
436
|
|
|
502
|
-
/**
|
|
503
|
-
* Creates the device. Carbon gates every resource create on this.
|
|
504
|
-
*
|
|
505
|
-
* @returns {boolean} True.
|
|
437
|
+
/**
|
|
438
|
+
* Creates the device. Carbon gates every resource create on this.
|
|
439
|
+
*
|
|
440
|
+
* @returns {boolean} True.
|
|
506
441
|
*/
|
|
507
442
|
CreateDevice() {
|
|
508
443
|
this._isValid = true;
|
|
@@ -514,10 +449,10 @@ class CjsWebgpuRenderContextAL {
|
|
|
514
449
|
return this._isValid;
|
|
515
450
|
}
|
|
516
451
|
|
|
517
|
-
/**
|
|
518
|
-
* Opens the frame's command buffer.
|
|
519
|
-
*
|
|
520
|
-
* @returns {boolean} True.
|
|
452
|
+
/**
|
|
453
|
+
* Opens the frame's command buffer.
|
|
454
|
+
*
|
|
455
|
+
* @returns {boolean} True.
|
|
521
456
|
*/
|
|
522
457
|
BeginScene() {
|
|
523
458
|
if (!this._isValid) fail("BeginScene before CreateDevice");
|
|
@@ -547,12 +482,12 @@ class CjsWebgpuRenderContextAL {
|
|
|
547
482
|
return true;
|
|
548
483
|
}
|
|
549
484
|
|
|
550
|
-
/**
|
|
551
|
-
* The render-pass descriptor for a set of folded attachments.
|
|
552
|
-
*
|
|
553
|
-
* `attachments` IS NULL FOR AN UNHINTED PASS, which is most of them: Carbon
|
|
554
|
-
* applies load and store actions only when a hint is pending and otherwise
|
|
555
|
-
* leaves the backend's own defaults alone. Ours are the render target's.
|
|
485
|
+
/**
|
|
486
|
+
* The render-pass descriptor for a set of folded attachments.
|
|
487
|
+
*
|
|
488
|
+
* `attachments` IS NULL FOR AN UNHINTED PASS, which is most of them: Carbon
|
|
489
|
+
* applies load and store actions only when a hint is pending and otherwise
|
|
490
|
+
* leaves the backend's own defaults alone. Ours are the render target's.
|
|
556
491
|
*/
|
|
557
492
|
_Descriptor(attachments) {
|
|
558
493
|
// First pass of the scene acquires; later passes share the one view.
|
|
@@ -565,17 +500,17 @@ class CjsWebgpuRenderContextAL {
|
|
|
565
500
|
});
|
|
566
501
|
}
|
|
567
502
|
|
|
568
|
-
/**
|
|
569
|
-
* Closes the frame's last pass and submits the command buffer.
|
|
570
|
-
*
|
|
571
|
-
* SYNCHRONOUS, AS CARBON'S IS. The first version awaited the dispatcher's
|
|
572
|
-
* preparation here, because the backend had been handed batches it still had
|
|
573
|
-
* to turn into pipelines. It is handed verbs now, every draw resolved inside
|
|
574
|
-
* the verb that issued it, and there is nothing left to wait for: `finish()`
|
|
575
|
-
* and `queue.submit()` are synchronous calls. A caller that awaits this
|
|
576
|
-
* still may; awaiting a non-promise costs nothing.
|
|
577
|
-
*
|
|
578
|
-
* @returns {boolean} Whether the scene ended cleanly.
|
|
503
|
+
/**
|
|
504
|
+
* Closes the frame's last pass and submits the command buffer.
|
|
505
|
+
*
|
|
506
|
+
* SYNCHRONOUS, AS CARBON'S IS. The first version awaited the dispatcher's
|
|
507
|
+
* preparation here, because the backend had been handed batches it still had
|
|
508
|
+
* to turn into pipelines. It is handed verbs now, every draw resolved inside
|
|
509
|
+
* the verb that issued it, and there is nothing left to wait for: `finish()`
|
|
510
|
+
* and `queue.submit()` are synchronous calls. A caller that awaits this
|
|
511
|
+
* still may; awaiting a non-promise costs nothing.
|
|
512
|
+
*
|
|
513
|
+
* @returns {boolean} Whether the scene ended cleanly.
|
|
579
514
|
*/
|
|
580
515
|
EndScene() {
|
|
581
516
|
this._Record(this._workQueue.EndFrame());
|
|
@@ -610,14 +545,14 @@ class CjsWebgpuRenderContextAL {
|
|
|
610
545
|
return true;
|
|
611
546
|
}
|
|
612
547
|
|
|
613
|
-
/**
|
|
614
|
-
* Declares what the next render pass does with its attachments.
|
|
615
|
-
*
|
|
616
|
-
* Carbon's two overloads differ only in how many colour attachments they
|
|
617
|
-
* carry, so they collapse into one variadic list. The depth attachment is
|
|
618
|
-
* always last.
|
|
619
|
-
*
|
|
620
|
-
* @param {...object} attachments `Tr2ColorAttachment`s then a `Tr2DepthAttachment`.
|
|
548
|
+
/**
|
|
549
|
+
* Declares what the next render pass does with its attachments.
|
|
550
|
+
*
|
|
551
|
+
* Carbon's two overloads differ only in how many colour attachments they
|
|
552
|
+
* carry, so they collapse into one variadic list. The depth attachment is
|
|
553
|
+
* always last.
|
|
554
|
+
*
|
|
555
|
+
* @param {...object} attachments `Tr2ColorAttachment`s then a `Tr2DepthAttachment`.
|
|
621
556
|
*/
|
|
622
557
|
RenderPassHint(...attachments) {
|
|
623
558
|
const depth = attachments.length ? attachments[attachments.length - 1] : null;
|
|
@@ -630,18 +565,18 @@ class CjsWebgpuRenderContextAL {
|
|
|
630
565
|
this._Record(this._workQueue.EndRenderPassHint());
|
|
631
566
|
}
|
|
632
567
|
|
|
633
|
-
/**
|
|
634
|
-
* Binds a colour target at one slot.
|
|
635
|
-
*
|
|
636
|
-
* RESETS THE VIEWPORT TO THE NEW TARGET, which Carbon does here in the
|
|
637
|
-
* backend (`Tr2RenderContextMetal.mm:762-766`) whenever slot zero changes.
|
|
638
|
-
* Leaving it alone is the defect where a 2048 shadow pass leaves the viewport
|
|
639
|
-
* at 2048 for the rest of the frame.
|
|
640
|
-
*
|
|
641
|
-
* @param {number} slot The slot.
|
|
642
|
-
* @param {object|null} renderTarget A `Tr2TextureAL`, or null to detach.
|
|
643
|
-
* @param {number} [slice] The array slice or cube face.
|
|
644
|
-
* @returns {boolean} True.
|
|
568
|
+
/**
|
|
569
|
+
* Binds a colour target at one slot.
|
|
570
|
+
*
|
|
571
|
+
* RESETS THE VIEWPORT TO THE NEW TARGET, which Carbon does here in the
|
|
572
|
+
* backend (`Tr2RenderContextMetal.mm:762-766`) whenever slot zero changes.
|
|
573
|
+
* Leaving it alone is the defect where a 2048 shadow pass leaves the viewport
|
|
574
|
+
* at 2048 for the rest of the frame.
|
|
575
|
+
*
|
|
576
|
+
* @param {number} slot The slot.
|
|
577
|
+
* @param {object|null} renderTarget A `Tr2TextureAL`, or null to detach.
|
|
578
|
+
* @param {number} [slice] The array slice or cube face.
|
|
579
|
+
* @returns {boolean} True.
|
|
645
580
|
*/
|
|
646
581
|
SetRenderTarget(slot, renderTarget, slice = 0) {
|
|
647
582
|
if (slot >= MAX_RENDER_TARGET) return false;
|
|
@@ -663,25 +598,25 @@ class CjsWebgpuRenderContextAL {
|
|
|
663
598
|
return true;
|
|
664
599
|
}
|
|
665
600
|
|
|
666
|
-
/**
|
|
667
|
-
* The target bound at one slot.
|
|
668
|
-
*
|
|
669
|
-
* @param {number} [slot] The slot.
|
|
670
|
-
* @returns {object|null} The target.
|
|
601
|
+
/**
|
|
602
|
+
* The target bound at one slot.
|
|
603
|
+
*
|
|
604
|
+
* @param {number} [slot] The slot.
|
|
605
|
+
* @returns {object|null} The target.
|
|
671
606
|
*/
|
|
672
607
|
GetRenderTarget(slot = 0) {
|
|
673
608
|
return this._boundRenderTargets[slot] ?? null;
|
|
674
609
|
}
|
|
675
610
|
|
|
676
|
-
/**
|
|
677
|
-
* Saves the target bound at one slot.
|
|
678
|
-
*
|
|
679
|
-
* ONE STACK PER SLOT, as Carbon has (`m_stackRT[MAX_RENDER_TARGET]`). A single
|
|
680
|
-
* shared stack pops the most recent push whatever its slot, so pushing slot 0
|
|
681
|
-
* then slot 1 and popping slot 0 restores the wrong surface.
|
|
682
|
-
*
|
|
683
|
-
* @param {number} [slot] The slot.
|
|
684
|
-
* @returns {boolean} True.
|
|
611
|
+
/**
|
|
612
|
+
* Saves the target bound at one slot.
|
|
613
|
+
*
|
|
614
|
+
* ONE STACK PER SLOT, as Carbon has (`m_stackRT[MAX_RENDER_TARGET]`). A single
|
|
615
|
+
* shared stack pops the most recent push whatever its slot, so pushing slot 0
|
|
616
|
+
* then slot 1 and popping slot 0 restores the wrong surface.
|
|
617
|
+
*
|
|
618
|
+
* @param {number} [slot] The slot.
|
|
619
|
+
* @returns {boolean} True.
|
|
685
620
|
*/
|
|
686
621
|
PushRenderTarget(slot = 0) {
|
|
687
622
|
if (slot >= MAX_RENDER_TARGET) return false;
|
|
@@ -689,11 +624,11 @@ class CjsWebgpuRenderContextAL {
|
|
|
689
624
|
return true;
|
|
690
625
|
}
|
|
691
626
|
|
|
692
|
-
/**
|
|
693
|
-
* Restores the target saved for one slot.
|
|
694
|
-
*
|
|
695
|
-
* @param {number} [slot] The slot.
|
|
696
|
-
* @returns {boolean} Whether anything was saved.
|
|
627
|
+
/**
|
|
628
|
+
* Restores the target saved for one slot.
|
|
629
|
+
*
|
|
630
|
+
* @param {number} [slot] The slot.
|
|
631
|
+
* @returns {boolean} Whether anything was saved.
|
|
697
632
|
*/
|
|
698
633
|
PopRenderTarget(slot = 0) {
|
|
699
634
|
const stack = this._renderTargetStacks[slot];
|
|
@@ -702,21 +637,21 @@ class CjsWebgpuRenderContextAL {
|
|
|
702
637
|
return true;
|
|
703
638
|
}
|
|
704
639
|
|
|
705
|
-
/**
|
|
706
|
-
* Depth of one slot's stack.
|
|
707
|
-
*
|
|
708
|
-
* @param {number} [slot] The slot.
|
|
709
|
-
* @returns {number} The depth.
|
|
640
|
+
/**
|
|
641
|
+
* Depth of one slot's stack.
|
|
642
|
+
*
|
|
643
|
+
* @param {number} [slot] The slot.
|
|
644
|
+
* @returns {number} The depth.
|
|
710
645
|
*/
|
|
711
646
|
GetStackSizeRT(slot = 0) {
|
|
712
647
|
return this._renderTargetStacks[slot]?.length ?? 0;
|
|
713
648
|
}
|
|
714
649
|
|
|
715
|
-
/**
|
|
716
|
-
* Binds the depth-stencil target.
|
|
717
|
-
*
|
|
718
|
-
* @param {object|null} depthStencil A `Tr2TextureAL`, or null to detach.
|
|
719
|
-
* @returns {boolean} True.
|
|
650
|
+
/**
|
|
651
|
+
* Binds the depth-stencil target.
|
|
652
|
+
*
|
|
653
|
+
* @param {object|null} depthStencil A `Tr2TextureAL`, or null to detach.
|
|
654
|
+
* @returns {boolean} True.
|
|
720
655
|
*/
|
|
721
656
|
SetDepthStencil(depthStencil) {
|
|
722
657
|
this._Record(this._workQueue.SetDepthAttachment(depthStencil ?? null));
|
|
@@ -748,11 +683,11 @@ class CjsWebgpuRenderContextAL {
|
|
|
748
683
|
return this._depthStencilStack.length;
|
|
749
684
|
}
|
|
750
685
|
|
|
751
|
-
/**
|
|
752
|
-
* The size of the target at one slot.
|
|
753
|
-
*
|
|
754
|
-
* @param {number} [slot] The slot.
|
|
755
|
-
* @returns {object} `{ result, width, height }`.
|
|
686
|
+
/**
|
|
687
|
+
* The size of the target at one slot.
|
|
688
|
+
*
|
|
689
|
+
* @param {number} [slot] The slot.
|
|
690
|
+
* @returns {object} `{ result, width, height }`.
|
|
756
691
|
*/
|
|
757
692
|
GetRenderTargetSize(slot = 0) {
|
|
758
693
|
const target = this._boundRenderTargets[slot];
|
|
@@ -768,21 +703,21 @@ class CjsWebgpuRenderContextAL {
|
|
|
768
703
|
};
|
|
769
704
|
}
|
|
770
705
|
|
|
771
|
-
/**
|
|
772
|
-
* Whether a target can be drawn to.
|
|
773
|
-
*
|
|
774
|
-
* @param {object} renderTarget The target.
|
|
775
|
-
* @returns {boolean} Whether it is usable.
|
|
706
|
+
/**
|
|
707
|
+
* Whether a target can be drawn to.
|
|
708
|
+
*
|
|
709
|
+
* @param {object} renderTarget The target.
|
|
710
|
+
* @returns {boolean} Whether it is usable.
|
|
776
711
|
*/
|
|
777
712
|
IsRenderTargetValid(renderTarget) {
|
|
778
713
|
return this._isValid && !!renderTarget;
|
|
779
714
|
}
|
|
780
715
|
|
|
781
|
-
/**
|
|
782
|
-
* Sets the viewport following draws use.
|
|
783
|
-
*
|
|
784
|
-
* @param {object} viewport `{ x, y, width, height }`.
|
|
785
|
-
* @returns {boolean} True.
|
|
716
|
+
/**
|
|
717
|
+
* Sets the viewport following draws use.
|
|
718
|
+
*
|
|
719
|
+
* @param {object} viewport `{ x, y, width, height }`.
|
|
720
|
+
* @returns {boolean} True.
|
|
786
721
|
*/
|
|
787
722
|
SetViewport(viewport) {
|
|
788
723
|
this._viewport = viewport ? {
|
|
@@ -798,16 +733,16 @@ class CjsWebgpuRenderContextAL {
|
|
|
798
733
|
} : null;
|
|
799
734
|
}
|
|
800
735
|
|
|
801
|
-
/**
|
|
802
|
-
* Clears the bound attachments.
|
|
803
|
-
*
|
|
804
|
-
* A CLEAR IS A LOAD OPERATION, not a command. WebGPU has no mid-pass clear,
|
|
805
|
-
* so this ends the current pass and declares the next one's load actions -
|
|
806
|
-
* which is the same thing `RenderPassHint` does, arrived at from the other
|
|
807
|
-
* direction. Carbon's Metal backend folds a clear the same way.
|
|
808
|
-
*
|
|
809
|
-
* @param {object} [options] `{ color, depth, stencil }` values.
|
|
810
|
-
* @returns {boolean} True.
|
|
736
|
+
/**
|
|
737
|
+
* Clears the bound attachments.
|
|
738
|
+
*
|
|
739
|
+
* A CLEAR IS A LOAD OPERATION, not a command. WebGPU has no mid-pass clear,
|
|
740
|
+
* so this ends the current pass and declares the next one's load actions -
|
|
741
|
+
* which is the same thing `RenderPassHint` does, arrived at from the other
|
|
742
|
+
* direction. Carbon's Metal backend folds a clear the same way.
|
|
743
|
+
*
|
|
744
|
+
* @param {object} [options] `{ color, depth, stencil }` values.
|
|
745
|
+
* @returns {boolean} True.
|
|
811
746
|
*/
|
|
812
747
|
Clear(options = {}) {
|
|
813
748
|
const attachments = this._workQueue.GetAttachments();
|
|
@@ -817,90 +752,90 @@ class CjsWebgpuRenderContextAL {
|
|
|
817
752
|
return true;
|
|
818
753
|
}
|
|
819
754
|
|
|
820
|
-
/**
|
|
821
|
-
* Runs a compute dispatch, which may not happen inside a render pass.
|
|
822
|
-
*
|
|
823
|
-
* REFUSES, BECAUSE NOTHING DISPATCHES. This reported success and encoded no
|
|
824
|
-
* command: it set the encoder type and returned true, and there is no
|
|
825
|
-
* `dispatchWorkgroups` anywhere in this backend. A caller running a cull or
|
|
826
|
-
* simulate pass was told it had happened, then read a buffer the GPU never
|
|
827
|
-
* touched - with no validation error, because no command existed to be
|
|
828
|
-
* rejected. That is the failure `ClearUav` below refuses to allow, one method
|
|
829
|
-
* over, and it was allowed here for a day.
|
|
830
|
-
*
|
|
831
|
-
* Carbon's stub refuses too (`stub/Tr2RenderContextStub.h:171-174`, `E_FAIL`).
|
|
832
|
-
*
|
|
833
|
-
* @param {number} [_x] Workgroups.
|
|
834
|
-
* @param {number} [_y] Workgroups.
|
|
835
|
-
* @param {number} [_z] Workgroups.
|
|
836
|
-
* @returns {boolean} False; nothing is dispatched.
|
|
755
|
+
/**
|
|
756
|
+
* Runs a compute dispatch, which may not happen inside a render pass.
|
|
757
|
+
*
|
|
758
|
+
* REFUSES, BECAUSE NOTHING DISPATCHES. This reported success and encoded no
|
|
759
|
+
* command: it set the encoder type and returned true, and there is no
|
|
760
|
+
* `dispatchWorkgroups` anywhere in this backend. A caller running a cull or
|
|
761
|
+
* simulate pass was told it had happened, then read a buffer the GPU never
|
|
762
|
+
* touched - with no validation error, because no command existed to be
|
|
763
|
+
* rejected. That is the failure `ClearUav` below refuses to allow, one method
|
|
764
|
+
* over, and it was allowed here for a day.
|
|
765
|
+
*
|
|
766
|
+
* Carbon's stub refuses too (`stub/Tr2RenderContextStub.h:171-174`, `E_FAIL`).
|
|
767
|
+
*
|
|
768
|
+
* @param {number} [_x] Workgroups.
|
|
769
|
+
* @param {number} [_y] Workgroups.
|
|
770
|
+
* @param {number} [_z] Workgroups.
|
|
771
|
+
* @returns {boolean} False; nothing is dispatched.
|
|
837
772
|
*/
|
|
838
773
|
RunComputeShader(_x = 1, _y = 1, _z = 1) {
|
|
839
774
|
return false;
|
|
840
775
|
}
|
|
841
776
|
|
|
842
|
-
/**
|
|
843
|
-
* Runs a compute dispatch whose group counts are read from a buffer.
|
|
844
|
-
*
|
|
845
|
-
* REFUSES; see `RunComputeShader`. This validated the buffer and then set the
|
|
846
|
-
* compute encoder type, which is not a dispatch - the same false success, with
|
|
847
|
-
* an argument check in front of it that made it look like more.
|
|
848
|
-
*
|
|
849
|
-
* Carbon's stub refuses too (`stub/Tr2RenderContextStub.h:175-178`).
|
|
850
|
-
*
|
|
851
|
-
* @param {object} _effect The compute effect to run.
|
|
852
|
-
* @param {object} _indirectionBuffer A buffer holding the group counts.
|
|
853
|
-
* @param {number} [_offsetForArgs] Byte offset to them.
|
|
854
|
-
* @returns {boolean} False; nothing is dispatched.
|
|
777
|
+
/**
|
|
778
|
+
* Runs a compute dispatch whose group counts are read from a buffer.
|
|
779
|
+
*
|
|
780
|
+
* REFUSES; see `RunComputeShader`. This validated the buffer and then set the
|
|
781
|
+
* compute encoder type, which is not a dispatch - the same false success, with
|
|
782
|
+
* an argument check in front of it that made it look like more.
|
|
783
|
+
*
|
|
784
|
+
* Carbon's stub refuses too (`stub/Tr2RenderContextStub.h:175-178`).
|
|
785
|
+
*
|
|
786
|
+
* @param {object} _effect The compute effect to run.
|
|
787
|
+
* @param {object} _indirectionBuffer A buffer holding the group counts.
|
|
788
|
+
* @param {number} [_offsetForArgs] Byte offset to them.
|
|
789
|
+
* @returns {boolean} False; nothing is dispatched.
|
|
855
790
|
*/
|
|
856
791
|
RunComputeShaderIndirect(_effect, _indirectionBuffer, _offsetForArgs = 0) {
|
|
857
792
|
return false;
|
|
858
793
|
}
|
|
859
794
|
|
|
860
|
-
/**
|
|
861
|
-
* Clears an unordered-access resource.
|
|
862
|
-
*
|
|
863
|
-
* REFUSES RATHER THAN PRETENDS. Carbon's Metal backend clears through
|
|
864
|
-
* `MetalWorkQueue::ClearBuffer`/`ClearTexture`
|
|
865
|
-
* (`Tr2RenderContextMetal.mm:237-280`); this work queue has neither, and
|
|
866
|
-
* WebGPU's own equivalents - `clearBuffer` on the command encoder, a
|
|
867
|
-
* clear-load render pass for a texture - are not wired to it. Reporting
|
|
868
|
-
* success would leave a caller reading stale contents it believes are zero,
|
|
869
|
-
* which is exactly the failure a compute pass cannot detect. Carbon's stub
|
|
870
|
-
* refuses the same way (`Tr2RenderContextALStub.ClearUav`).
|
|
871
|
-
*
|
|
872
|
-
* @param {object} _resource The buffer or texture to clear.
|
|
873
|
-
* @param {number[]} _value The clear value, four components.
|
|
874
|
-
* @param {boolean} [_clearWithFloat] Whether the value is float or integer.
|
|
875
|
-
* @returns {boolean} False; the clear is not encoded.
|
|
795
|
+
/**
|
|
796
|
+
* Clears an unordered-access resource.
|
|
797
|
+
*
|
|
798
|
+
* REFUSES RATHER THAN PRETENDS. Carbon's Metal backend clears through
|
|
799
|
+
* `MetalWorkQueue::ClearBuffer`/`ClearTexture`
|
|
800
|
+
* (`Tr2RenderContextMetal.mm:237-280`); this work queue has neither, and
|
|
801
|
+
* WebGPU's own equivalents - `clearBuffer` on the command encoder, a
|
|
802
|
+
* clear-load render pass for a texture - are not wired to it. Reporting
|
|
803
|
+
* success would leave a caller reading stale contents it believes are zero,
|
|
804
|
+
* which is exactly the failure a compute pass cannot detect. Carbon's stub
|
|
805
|
+
* refuses the same way (`Tr2RenderContextALStub.ClearUav`).
|
|
806
|
+
*
|
|
807
|
+
* @param {object} _resource The buffer or texture to clear.
|
|
808
|
+
* @param {number[]} _value The clear value, four components.
|
|
809
|
+
* @param {boolean} [_clearWithFloat] Whether the value is float or integer.
|
|
810
|
+
* @returns {boolean} False; the clear is not encoded.
|
|
876
811
|
*/
|
|
877
812
|
ClearUav(_resource, _value, _clearWithFloat = false) {
|
|
878
813
|
return false;
|
|
879
814
|
}
|
|
880
815
|
|
|
881
|
-
/**
|
|
882
|
-
* Presents the frame.
|
|
883
|
-
*
|
|
884
|
-
* The browser presents a configured canvas after the submission that drew
|
|
885
|
-
* into its current texture, so there is nothing to do beyond ending the
|
|
886
|
-
* frame's work.
|
|
887
|
-
*
|
|
888
|
-
* AWAITS, because `EndScene` on this backend does. Returning its promise
|
|
889
|
-
* unawaited would hand a caller expecting a boolean something truthy that is
|
|
890
|
-
* not a result - the frame would still be encoding when presentation was
|
|
891
|
-
* reported complete.
|
|
892
|
-
*
|
|
893
|
-
* @returns {Promise<boolean>} True once the frame is submitted.
|
|
816
|
+
/**
|
|
817
|
+
* Presents the frame.
|
|
818
|
+
*
|
|
819
|
+
* The browser presents a configured canvas after the submission that drew
|
|
820
|
+
* into its current texture, so there is nothing to do beyond ending the
|
|
821
|
+
* frame's work.
|
|
822
|
+
*
|
|
823
|
+
* AWAITS, because `EndScene` on this backend does. Returning its promise
|
|
824
|
+
* unawaited would hand a caller expecting a boolean something truthy that is
|
|
825
|
+
* not a result - the frame would still be encoding when presentation was
|
|
826
|
+
* reported complete.
|
|
827
|
+
*
|
|
828
|
+
* @returns {Promise<boolean>} True once the frame is submitted.
|
|
894
829
|
*/
|
|
895
830
|
async Present() {
|
|
896
831
|
return this.EndScene();
|
|
897
832
|
}
|
|
898
833
|
|
|
899
|
-
/**
|
|
900
|
-
* Sets the primitive topology following draws use.
|
|
901
|
-
*
|
|
902
|
-
* @param {number} topology A `Topology` value.
|
|
903
|
-
* @returns {boolean} Whether the AL knows it.
|
|
834
|
+
/**
|
|
835
|
+
* Sets the primitive topology following draws use.
|
|
836
|
+
*
|
|
837
|
+
* @param {number} topology A `Topology` value.
|
|
838
|
+
* @returns {boolean} Whether the AL knows it.
|
|
904
839
|
*/
|
|
905
840
|
SetTopology(topology) {
|
|
906
841
|
if (topology >= Topology.TOP_MAX_TOPOLOGY || !VERTICES_PER_PRIMITIVE[topology]) return false;
|
|
@@ -910,11 +845,11 @@ class CjsWebgpuRenderContextAL {
|
|
|
910
845
|
return true;
|
|
911
846
|
}
|
|
912
847
|
|
|
913
|
-
/**
|
|
914
|
-
* Binds the vertex declaration.
|
|
915
|
-
*
|
|
916
|
-
* @param {object} layout A `Tr2VertexLayoutAL`.
|
|
917
|
-
* @returns {boolean} True.
|
|
848
|
+
/**
|
|
849
|
+
* Binds the vertex declaration.
|
|
850
|
+
*
|
|
851
|
+
* @param {object} layout A `Tr2VertexLayoutAL`.
|
|
852
|
+
* @returns {boolean} True.
|
|
918
853
|
*/
|
|
919
854
|
SetVertexLayout(layout) {
|
|
920
855
|
if (this._vertexLayout === layout) return true;
|
|
@@ -930,14 +865,14 @@ class CjsWebgpuRenderContextAL {
|
|
|
930
865
|
return true;
|
|
931
866
|
}
|
|
932
867
|
|
|
933
|
-
/**
|
|
934
|
-
* Binds one vertex stream.
|
|
935
|
-
*
|
|
936
|
-
* @param {number} stream The slot.
|
|
937
|
-
* @param {object} buffer A `Tr2BufferAL`.
|
|
938
|
-
* @param {number} offset Byte offset.
|
|
939
|
-
* @param {number} stride Bytes per vertex.
|
|
940
|
-
* @returns {boolean} True.
|
|
868
|
+
/**
|
|
869
|
+
* Binds one vertex stream.
|
|
870
|
+
*
|
|
871
|
+
* @param {number} stream The slot.
|
|
872
|
+
* @param {object} buffer A `Tr2BufferAL`.
|
|
873
|
+
* @param {number} offset Byte offset.
|
|
874
|
+
* @param {number} stride Bytes per vertex.
|
|
875
|
+
* @returns {boolean} True.
|
|
941
876
|
*/
|
|
942
877
|
SetStreamSource(stream, buffer, offset, stride) {
|
|
943
878
|
// The stride is part of the pipeline on WebGPU - `arrayStride` lives in the
|
|
@@ -953,12 +888,12 @@ class CjsWebgpuRenderContextAL {
|
|
|
953
888
|
return true;
|
|
954
889
|
}
|
|
955
890
|
|
|
956
|
-
/**
|
|
957
|
-
* Binds the index buffer.
|
|
958
|
-
*
|
|
959
|
-
* @param {object} buffer A `Tr2BufferAL`.
|
|
960
|
-
* @param {number} [stride] Bytes per index.
|
|
961
|
-
* @returns {boolean} True.
|
|
891
|
+
/**
|
|
892
|
+
* Binds the index buffer.
|
|
893
|
+
*
|
|
894
|
+
* @param {object} buffer A `Tr2BufferAL`.
|
|
895
|
+
* @param {number} [stride] Bytes per index.
|
|
896
|
+
* @returns {boolean} True.
|
|
962
897
|
*/
|
|
963
898
|
SetIndices(buffer, stride = 0) {
|
|
964
899
|
this._indexBuffer = buffer;
|
|
@@ -966,11 +901,11 @@ class CjsWebgpuRenderContextAL {
|
|
|
966
901
|
return true;
|
|
967
902
|
}
|
|
968
903
|
|
|
969
|
-
/**
|
|
970
|
-
* Binds the shader program following draws run.
|
|
971
|
-
*
|
|
972
|
-
* @param {object} shaderProgram A `Tr2ShaderProgramAL`.
|
|
973
|
-
* @returns {boolean} True.
|
|
904
|
+
/**
|
|
905
|
+
* Binds the shader program following draws run.
|
|
906
|
+
*
|
|
907
|
+
* @param {object} shaderProgram A `Tr2ShaderProgramAL`.
|
|
908
|
+
* @returns {boolean} True.
|
|
974
909
|
*/
|
|
975
910
|
SetShaderProgram(shaderProgram) {
|
|
976
911
|
if (this._shaderProgram === shaderProgram) return true;
|
|
@@ -980,24 +915,24 @@ class CjsWebgpuRenderContextAL {
|
|
|
980
915
|
return true;
|
|
981
916
|
}
|
|
982
917
|
|
|
983
|
-
/**
|
|
984
|
-
* Takes the render-state setup a pass authored, with the state manager's
|
|
985
|
-
* overrides applied.
|
|
986
|
-
*
|
|
987
|
-
* Carbon's backends receive a resolved state-PAIR list here and set each pair
|
|
988
|
-
* on the device (`Tr2EffectStateManager.cpp:753`). WebGPU has no per-state
|
|
989
|
-
* setter - state is folded into a pipeline at creation - so the setup is held
|
|
990
|
-
* and projected when a pipeline is resolved, which is also why the projection
|
|
991
|
-
* needs the depth format only this backend knows.
|
|
992
|
-
*
|
|
993
|
-
* THE PROJECTION IS NOT DONE HERE. `Tr2RenderStateSetup.GetWebgpuRecipe`
|
|
994
|
-
* already does it and the batch resolver already uses it; a second translator
|
|
995
|
-
* would be the mistake this whole lane exists to undo. This stores the inputs
|
|
996
|
-
* and marks the pipeline dirty, as Carbon's setters do.
|
|
997
|
-
*
|
|
998
|
-
* @param {object} setup A `Tr2RenderStateSetup`.
|
|
999
|
-
* @param {object} [overrides] The state manager's render-state overrides.
|
|
1000
|
-
* @returns {boolean} Whether a setup was supplied.
|
|
918
|
+
/**
|
|
919
|
+
* Takes the render-state setup a pass authored, with the state manager's
|
|
920
|
+
* overrides applied.
|
|
921
|
+
*
|
|
922
|
+
* Carbon's backends receive a resolved state-PAIR list here and set each pair
|
|
923
|
+
* on the device (`Tr2EffectStateManager.cpp:753`). WebGPU has no per-state
|
|
924
|
+
* setter - state is folded into a pipeline at creation - so the setup is held
|
|
925
|
+
* and projected when a pipeline is resolved, which is also why the projection
|
|
926
|
+
* needs the depth format only this backend knows.
|
|
927
|
+
*
|
|
928
|
+
* THE PROJECTION IS NOT DONE HERE. `Tr2RenderStateSetup.GetWebgpuRecipe`
|
|
929
|
+
* already does it and the batch resolver already uses it; a second translator
|
|
930
|
+
* would be the mistake this whole lane exists to undo. This stores the inputs
|
|
931
|
+
* and marks the pipeline dirty, as Carbon's setters do.
|
|
932
|
+
*
|
|
933
|
+
* @param {object} setup A `Tr2RenderStateSetup`.
|
|
934
|
+
* @param {object} [overrides] The state manager's render-state overrides.
|
|
935
|
+
* @returns {boolean} Whether a setup was supplied.
|
|
1001
936
|
*/
|
|
1002
937
|
SetRenderStates(setup, overrides = null) {
|
|
1003
938
|
if (!setup) return false;
|
|
@@ -1015,33 +950,33 @@ class CjsWebgpuRenderContextAL {
|
|
|
1015
950
|
return true;
|
|
1016
951
|
}
|
|
1017
952
|
|
|
1018
|
-
/**
|
|
1019
|
-
* m_renderStates - single states set by name rather than through a setup.
|
|
1020
|
-
*
|
|
1021
|
-
* A DIFFERENT AXIS FROM `overrides`, which is a flags object the PSO
|
|
1022
|
-
* description reads (`core/psoDescription.js:113-114`). These are Carbon's
|
|
1023
|
-
* raw `RenderState` values, which `TriStepSetRenderState` sets one at a time.
|
|
953
|
+
/**
|
|
954
|
+
* m_renderStates - single states set by name rather than through a setup.
|
|
955
|
+
*
|
|
956
|
+
* A DIFFERENT AXIS FROM `overrides`, which is a flags object the PSO
|
|
957
|
+
* description reads (`core/psoDescription.js:113-114`). These are Carbon's
|
|
958
|
+
* raw `RenderState` values, which `TriStepSetRenderState` sets one at a time.
|
|
1024
959
|
*/
|
|
1025
960
|
_renderStates = new Map();
|
|
1026
961
|
|
|
1027
|
-
/**
|
|
1028
|
-
* Sets one render state.
|
|
1029
|
-
*
|
|
1030
|
-
* Carbon's Metal backend stores the value and applies it when the pipeline is
|
|
1031
|
-
* assembled, and says so in a comment above the method: "we'll remove the
|
|
1032
|
-
* actual setting here and just store the values in some state and we'll do a
|
|
1033
|
-
* wholesale setting of state in some combined function just before we draw"
|
|
1034
|
-
* (`Tr2RenderContextMetal.mm:925-928`). This stores.
|
|
1035
|
-
*
|
|
1036
|
-
* THE PSO RESOLVER DOES NOT READ THESE YET. `GetWebgpuRecipe` projects the
|
|
1037
|
-
* setup and the flags, and nothing consumes the single-state map, so a state
|
|
1038
|
-
* set this way is recorded and not yet honoured. Recorded rather than dropped,
|
|
1039
|
-
* because the resolver is where the projection belongs and adding a second
|
|
1040
|
-
* translator here is the mistake this file already carries a warning about.
|
|
1041
|
-
*
|
|
1042
|
-
* @param {number} state A `RenderState` value.
|
|
1043
|
-
* @param {number} value The value to set.
|
|
1044
|
-
* @returns {boolean} True.
|
|
962
|
+
/**
|
|
963
|
+
* Sets one render state.
|
|
964
|
+
*
|
|
965
|
+
* Carbon's Metal backend stores the value and applies it when the pipeline is
|
|
966
|
+
* assembled, and says so in a comment above the method: "we'll remove the
|
|
967
|
+
* actual setting here and just store the values in some state and we'll do a
|
|
968
|
+
* wholesale setting of state in some combined function just before we draw"
|
|
969
|
+
* (`Tr2RenderContextMetal.mm:925-928`). This stores.
|
|
970
|
+
*
|
|
971
|
+
* THE PSO RESOLVER DOES NOT READ THESE YET. `GetWebgpuRecipe` projects the
|
|
972
|
+
* setup and the flags, and nothing consumes the single-state map, so a state
|
|
973
|
+
* set this way is recorded and not yet honoured. Recorded rather than dropped,
|
|
974
|
+
* because the resolver is where the projection belongs and adding a second
|
|
975
|
+
* translator here is the mistake this file already carries a warning about.
|
|
976
|
+
*
|
|
977
|
+
* @param {number} state A `RenderState` value.
|
|
978
|
+
* @param {number} value The value to set.
|
|
979
|
+
* @returns {boolean} True.
|
|
1045
980
|
*/
|
|
1046
981
|
SetRenderState(state, value) {
|
|
1047
982
|
const key = state >>> 0;
|
|
@@ -1065,14 +1000,14 @@ class CjsWebgpuRenderContextAL {
|
|
|
1065
1000
|
return this._pipelineDirty;
|
|
1066
1001
|
}
|
|
1067
1002
|
|
|
1068
|
-
/**
|
|
1069
|
-
* The pipeline description the setters have accumulated.
|
|
1070
|
-
*
|
|
1071
|
-
* Carbon's `m_psoDescription`, and `GetMissing()` on it answers the question
|
|
1072
|
-
* `GetPipelineState` answers by returning null: what this state does not yet
|
|
1073
|
-
* name. Reading it does not resolve anything.
|
|
1074
|
-
*
|
|
1075
|
-
* @returns {CjsWebgpuPsoDescription} The live description.
|
|
1003
|
+
/**
|
|
1004
|
+
* The pipeline description the setters have accumulated.
|
|
1005
|
+
*
|
|
1006
|
+
* Carbon's `m_psoDescription`, and `GetMissing()` on it answers the question
|
|
1007
|
+
* `GetPipelineState` answers by returning null: what this state does not yet
|
|
1008
|
+
* name. Reading it does not resolve anything.
|
|
1009
|
+
*
|
|
1010
|
+
* @returns {CjsWebgpuPsoDescription} The live description.
|
|
1076
1011
|
*/
|
|
1077
1012
|
GetPsoDescription() {
|
|
1078
1013
|
this._RefreshAttachmentFormats();
|
|
@@ -1082,45 +1017,45 @@ class CjsWebgpuRenderContextAL {
|
|
|
1082
1017
|
/** The pipeline the last resolve produced, or null. */
|
|
1083
1018
|
_pipeline = null;
|
|
1084
1019
|
|
|
1085
|
-
/**
|
|
1086
|
-
* Resolved pipelines by description key.
|
|
1087
|
-
*
|
|
1088
|
-
* Carbon keeps this on the DEVICE (`m_ownerDevice->m_pipelineStates`,
|
|
1089
|
-
* `Tr2PrimaryRenderContextDx12.h:319`; Metal's `GetCachedRenderPipelineState`)
|
|
1090
|
-
* so every context shares one. It lives here until `CjsWebgpuDevice` offers a
|
|
1091
|
-
* synchronous cache - its `CjsWebgpuPipelineCache` resolves asynchronously,
|
|
1092
|
-
* and a draw verb cannot await. Cleared with the device resources.
|
|
1020
|
+
/**
|
|
1021
|
+
* Resolved pipelines by description key.
|
|
1022
|
+
*
|
|
1023
|
+
* Carbon keeps this on the DEVICE (`m_ownerDevice->m_pipelineStates`,
|
|
1024
|
+
* `Tr2PrimaryRenderContextDx12.h:319`; Metal's `GetCachedRenderPipelineState`)
|
|
1025
|
+
* so every context shares one. It lives here until `CjsWebgpuDevice` offers a
|
|
1026
|
+
* synchronous cache - its `CjsWebgpuPipelineCache` resolves asynchronously,
|
|
1027
|
+
* and a draw verb cannot await. Cleared with the device resources.
|
|
1093
1028
|
*/
|
|
1094
1029
|
_pipelines = new Map();
|
|
1095
1030
|
|
|
1096
|
-
/**
|
|
1097
|
-
* Why the last `EmitRenderEncoderState` refused, or null when it did not.
|
|
1098
|
-
*
|
|
1099
|
-
* Carbon asserts at these points; a JS frame must not die at a draw, so the
|
|
1100
|
-
* reason is kept where a harness can read it instead.
|
|
1031
|
+
/**
|
|
1032
|
+
* Why the last `EmitRenderEncoderState` refused, or null when it did not.
|
|
1033
|
+
*
|
|
1034
|
+
* Carbon asserts at these points; a JS frame must not die at a draw, so the
|
|
1035
|
+
* reason is kept where a harness can read it instead.
|
|
1101
1036
|
*/
|
|
1102
1037
|
m_pipelineFailure = null;
|
|
1103
1038
|
|
|
1104
|
-
/**
|
|
1105
|
-
* Resolves and binds the pipeline the bound state describes.
|
|
1106
|
-
*
|
|
1107
|
-
* METAL'S `EmitRenderPipelineState` (`MetalWorkQueue.mm:1595-1747`) AND
|
|
1108
|
-
* DX12'S `SetAllState` (`Tr2RenderContextDx12.cpp:810-878`): called from
|
|
1109
|
-
* inside every draw verb, keyed on the description's hash, creating on a miss
|
|
1110
|
-
* and otherwise reusing, and clearing the dirty flag once resolved
|
|
1111
|
-
* (`:870`). Pipeline creation is SYNCHRONOUS here as it is there -
|
|
1112
|
-
* `createRenderPipeline` returns immediately, and the first-use stall it can
|
|
1113
|
-
* carry is the same one `newRenderPipelineStateWithDescriptor` carries.
|
|
1114
|
-
*
|
|
1115
|
-
* The vertex half of the description is built here rather than by
|
|
1116
|
-
* `SetVertexLayout`, because it depends on three bound things at once: the
|
|
1117
|
-
* declaration, the program whose inputs select from it, and the stream
|
|
1118
|
-
* strides (`Tr2RenderContextMetal.mm:524-541`, `MetalWorkQueue.mm:1842-1863`).
|
|
1119
|
-
*
|
|
1120
|
-
* Uncomposed, there is no device and nothing to resolve; the verbs record as
|
|
1121
|
-
* the stub's do.
|
|
1122
|
-
*
|
|
1123
|
-
* @returns {boolean} Whether a pipeline is bound for the next draw.
|
|
1039
|
+
/**
|
|
1040
|
+
* Resolves and binds the pipeline the bound state describes.
|
|
1041
|
+
*
|
|
1042
|
+
* METAL'S `EmitRenderPipelineState` (`MetalWorkQueue.mm:1595-1747`) AND
|
|
1043
|
+
* DX12'S `SetAllState` (`Tr2RenderContextDx12.cpp:810-878`): called from
|
|
1044
|
+
* inside every draw verb, keyed on the description's hash, creating on a miss
|
|
1045
|
+
* and otherwise reusing, and clearing the dirty flag once resolved
|
|
1046
|
+
* (`:870`). Pipeline creation is SYNCHRONOUS here as it is there -
|
|
1047
|
+
* `createRenderPipeline` returns immediately, and the first-use stall it can
|
|
1048
|
+
* carry is the same one `newRenderPipelineStateWithDescriptor` carries.
|
|
1049
|
+
*
|
|
1050
|
+
* The vertex half of the description is built here rather than by
|
|
1051
|
+
* `SetVertexLayout`, because it depends on three bound things at once: the
|
|
1052
|
+
* declaration, the program whose inputs select from it, and the stream
|
|
1053
|
+
* strides (`Tr2RenderContextMetal.mm:524-541`, `MetalWorkQueue.mm:1842-1863`).
|
|
1054
|
+
*
|
|
1055
|
+
* Uncomposed, there is no device and nothing to resolve; the verbs record as
|
|
1056
|
+
* the stub's do.
|
|
1057
|
+
*
|
|
1058
|
+
* @returns {boolean} Whether a pipeline is bound for the next draw.
|
|
1124
1059
|
*/
|
|
1125
1060
|
EmitRenderPipelineState() {
|
|
1126
1061
|
if (!this._webgpu) return true;
|
|
@@ -1179,23 +1114,23 @@ class CjsWebgpuRenderContextAL {
|
|
|
1179
1114
|
return true;
|
|
1180
1115
|
}
|
|
1181
1116
|
|
|
1182
|
-
/**
|
|
1183
|
-
* Binds everything a draw needs on the encoder: pipeline, then buffers.
|
|
1184
|
-
*
|
|
1185
|
-
* Metal's `EmitRenderEncoderState` (`MetalWorkQueue.mm:1750-1890`), which
|
|
1186
|
-
* the draw verbs call first and skip the draw when it fails. Bindings are
|
|
1187
|
-
* deferred to here rather than set in `SetStreamSource`, as Metal defers
|
|
1188
|
-
* them (`:2570-2598` stores, `:2613-2690` binds).
|
|
1189
|
-
*
|
|
1190
|
-
* WHAT IT CANNOT YET HONOUR, IT REFUSES. A program whose layout declares
|
|
1191
|
-
* bind groups needs a resource set realised into `GPUBindGroup`s, and that
|
|
1192
|
-
* half is not ported; drawing without them is a validation error on the GPU,
|
|
1193
|
-
* so the draw is refused here and says why. A stream whose buffer is not a
|
|
1194
|
-
* device buffer - a mesh batch carries a geometry descriptor today - is
|
|
1195
|
-
* refused the same way.
|
|
1196
|
-
*
|
|
1197
|
-
* @param {boolean} indexed Whether the draw reads the bound index buffer.
|
|
1198
|
-
* @returns {boolean} Whether the encoder is ready to draw.
|
|
1117
|
+
/**
|
|
1118
|
+
* Binds everything a draw needs on the encoder: pipeline, then buffers.
|
|
1119
|
+
*
|
|
1120
|
+
* Metal's `EmitRenderEncoderState` (`MetalWorkQueue.mm:1750-1890`), which
|
|
1121
|
+
* the draw verbs call first and skip the draw when it fails. Bindings are
|
|
1122
|
+
* deferred to here rather than set in `SetStreamSource`, as Metal defers
|
|
1123
|
+
* them (`:2570-2598` stores, `:2613-2690` binds).
|
|
1124
|
+
*
|
|
1125
|
+
* WHAT IT CANNOT YET HONOUR, IT REFUSES. A program whose layout declares
|
|
1126
|
+
* bind groups needs a resource set realised into `GPUBindGroup`s, and that
|
|
1127
|
+
* half is not ported; drawing without them is a validation error on the GPU,
|
|
1128
|
+
* so the draw is refused here and says why. A stream whose buffer is not a
|
|
1129
|
+
* device buffer - a mesh batch carries a geometry descriptor today - is
|
|
1130
|
+
* refused the same way.
|
|
1131
|
+
*
|
|
1132
|
+
* @param {boolean} indexed Whether the draw reads the bound index buffer.
|
|
1133
|
+
* @returns {boolean} Whether the encoder is ready to draw.
|
|
1199
1134
|
*/
|
|
1200
1135
|
EmitRenderEncoderState(indexed) {
|
|
1201
1136
|
if (!this._webgpu) return true;
|
|
@@ -1223,18 +1158,18 @@ class CjsWebgpuRenderContextAL {
|
|
|
1223
1158
|
return true;
|
|
1224
1159
|
}
|
|
1225
1160
|
|
|
1226
|
-
/**
|
|
1227
|
-
* The vertex buffer layouts the bound declaration, program and strides
|
|
1228
|
-
* describe, one per stream slot.
|
|
1229
|
-
*
|
|
1230
|
-
* Metal's `Tr2VertexLayoutAL::SetVertexLayout` (`Tr2VertexLayoutALMetal.mm:205-245`):
|
|
1231
|
-
* match the program's pipeline inputs against the declaration's items, and
|
|
1232
|
-
* stamp each active stream's stride. An input the declaration lacks gets no
|
|
1233
|
-
* attribute - Metal points it at a dummy stream - and a stream no input
|
|
1234
|
-
* reads gets no layout.
|
|
1235
|
-
*
|
|
1236
|
-
* @returns {Array<object|null>|string} The layouts by slot, or what is
|
|
1237
|
-
* missing when they cannot be built.
|
|
1161
|
+
/**
|
|
1162
|
+
* The vertex buffer layouts the bound declaration, program and strides
|
|
1163
|
+
* describe, one per stream slot.
|
|
1164
|
+
*
|
|
1165
|
+
* Metal's `Tr2VertexLayoutAL::SetVertexLayout` (`Tr2VertexLayoutALMetal.mm:205-245`):
|
|
1166
|
+
* match the program's pipeline inputs against the declaration's items, and
|
|
1167
|
+
* stamp each active stream's stride. An input the declaration lacks gets no
|
|
1168
|
+
* attribute - Metal points it at a dummy stream - and a stream no input
|
|
1169
|
+
* reads gets no layout.
|
|
1170
|
+
*
|
|
1171
|
+
* @returns {Array<object|null>|string} The layouts by slot, or what is
|
|
1172
|
+
* missing when they cannot be built.
|
|
1238
1173
|
*/
|
|
1239
1174
|
BuildVertexBufferLayouts() {
|
|
1240
1175
|
const layout = this._vertexLayout;
|
|
@@ -1274,37 +1209,37 @@ class CjsWebgpuRenderContextAL {
|
|
|
1274
1209
|
return layouts;
|
|
1275
1210
|
}
|
|
1276
1211
|
|
|
1277
|
-
/**
|
|
1278
|
-
* Bind groups by `program | group | resource set | constant buffers`.
|
|
1279
|
-
*
|
|
1280
|
-
* DX12's descriptor tables live on the CONTEXT, per back buffer
|
|
1281
|
-
* (`Tr2RenderContextDx12.h:269`), and are committed at `SetAllState`
|
|
1282
|
-
* (`:875`); Metal binds per stage inside `EmitRenderEncoderState`
|
|
1283
|
-
* (`MetalWorkQueue.mm:2613-2690`). A WebGPU bind group is an immutable object
|
|
1284
|
-
* made of both the set's entries and the bound constant buffers, so it is
|
|
1285
|
-
* made here, at the draw, and kept by the identities that produced it.
|
|
1212
|
+
/**
|
|
1213
|
+
* Bind groups by `program | group | resource set | constant buffers`.
|
|
1214
|
+
*
|
|
1215
|
+
* DX12's descriptor tables live on the CONTEXT, per back buffer
|
|
1216
|
+
* (`Tr2RenderContextDx12.h:269`), and are committed at `SetAllState`
|
|
1217
|
+
* (`:875`); Metal binds per stage inside `EmitRenderEncoderState`
|
|
1218
|
+
* (`MetalWorkQueue.mm:2613-2690`). A WebGPU bind group is an immutable object
|
|
1219
|
+
* made of both the set's entries and the bound constant buffers, so it is
|
|
1220
|
+
* made here, at the draw, and kept by the identities that produced it.
|
|
1286
1221
|
*/
|
|
1287
1222
|
_bindGroups = new Map();
|
|
1288
1223
|
|
|
1289
|
-
/**
|
|
1290
|
-
* Builds or reuses one bind group per program group and names them for the
|
|
1291
|
-
* draw.
|
|
1292
|
-
*
|
|
1293
|
-
* The program's uniform slots read the constant buffers `SetConstants` bound
|
|
1294
|
-
* at that stage and register - Carbon's parallel road for CBs - uploading
|
|
1295
|
-
* each buffer's shadow if it changed, which is where Carbon's token is
|
|
1296
|
-
* consumed. Every other slot reads the resource set; with no set bound, or a
|
|
1297
|
-
* set made for another program, the slots take dummies, which is Metal's
|
|
1298
|
-
* `SetDummyResources` (`Tr2RenderContextMetal.mm:527-530`).
|
|
1299
|
-
*
|
|
1300
|
-
* @returns {boolean} Whether every group could be built.
|
|
1224
|
+
/**
|
|
1225
|
+
* Builds or reuses one bind group per program group and names them for the
|
|
1226
|
+
* draw.
|
|
1227
|
+
*
|
|
1228
|
+
* The program's uniform slots read the constant buffers `SetConstants` bound
|
|
1229
|
+
* at that stage and register - Carbon's parallel road for CBs - uploading
|
|
1230
|
+
* each buffer's shadow if it changed, which is where Carbon's token is
|
|
1231
|
+
* consumed. Every other slot reads the resource set; with no set bound, or a
|
|
1232
|
+
* set made for another program, the slots take dummies, which is Metal's
|
|
1233
|
+
* `SetDummyResources` (`Tr2RenderContextMetal.mm:527-530`).
|
|
1234
|
+
*
|
|
1235
|
+
* @returns {boolean} Whether every group could be built.
|
|
1301
1236
|
*/
|
|
1302
1237
|
_EmitBindGroups() {
|
|
1303
1238
|
const program = this._shaderProgram;
|
|
1304
1239
|
const layouts = program.GetBindGroupLayouts();
|
|
1305
1240
|
if (!layouts.length) return true;
|
|
1306
|
-
const set = this._resourceSet;
|
|
1307
|
-
const entries = set &&
|
|
1241
|
+
const set = this._resourceSet?.m_resourceSet.implementation;
|
|
1242
|
+
const entries = set && set.IsValid() && set.GetProgram() === program ? set.GetEntries() : null;
|
|
1308
1243
|
const setId = entries ? set.m_id : 0;
|
|
1309
1244
|
const bindings = program.GetBindings();
|
|
1310
1245
|
const device = this._webgpu.GetDevice();
|
|
@@ -1384,26 +1319,26 @@ class CjsWebgpuRenderContextAL {
|
|
|
1384
1319
|
return this._constantArena;
|
|
1385
1320
|
}
|
|
1386
1321
|
|
|
1387
|
-
/**
|
|
1388
|
-
* Copies constants into this frame's arena and says where they landed.
|
|
1389
|
-
*
|
|
1390
|
-
* CARBON'S TWO OVERLOADS, in one method as JavaScript spells them
|
|
1391
|
-
* (`Tr2RenderContextMetal.mm:679-697`, `Tr2RenderContextDx12.cpp:538-548`):
|
|
1392
|
-
*
|
|
1393
|
-
* - given BYTES, a fresh region every call - Carbon constructs a zeroed
|
|
1394
|
-
* token each time, so nothing is reused;
|
|
1395
|
-
* - given a `Tr2ConstantBufferAL`, the buffer's OWN token, so a buffer bound
|
|
1396
|
-
* twice in a frame without a Lock between keeps one region. Carbon reaches
|
|
1397
|
-
* straight into the impl for it (`buffer.m_buffer->m_token`), which is why
|
|
1398
|
-
* ours is public.
|
|
1399
|
-
*
|
|
1400
|
-
* Carbon returns a `uint64_t` packing Metal's page and offset together; the
|
|
1401
|
-
* region object is that pair unpacked, which is what a bind group needs.
|
|
1402
|
-
*
|
|
1403
|
-
* @param {object|ArrayBufferView} source A constant buffer, or the bytes.
|
|
1404
|
-
* @param {number} [size] Bytes the binding demands at least.
|
|
1405
|
-
* @returns {{page: number, offset: number, size: number}|null} The region,
|
|
1406
|
-
* or null when there is nothing to upload - Carbon's `return 0`.
|
|
1322
|
+
/**
|
|
1323
|
+
* Copies constants into this frame's arena and says where they landed.
|
|
1324
|
+
*
|
|
1325
|
+
* CARBON'S TWO OVERLOADS, in one method as JavaScript spells them
|
|
1326
|
+
* (`Tr2RenderContextMetal.mm:679-697`, `Tr2RenderContextDx12.cpp:538-548`):
|
|
1327
|
+
*
|
|
1328
|
+
* - given BYTES, a fresh region every call - Carbon constructs a zeroed
|
|
1329
|
+
* token each time, so nothing is reused;
|
|
1330
|
+
* - given a `Tr2ConstantBufferAL`, the buffer's OWN token, so a buffer bound
|
|
1331
|
+
* twice in a frame without a Lock between keeps one region. Carbon reaches
|
|
1332
|
+
* straight into the impl for it (`buffer.m_buffer->m_token`), which is why
|
|
1333
|
+
* ours is public.
|
|
1334
|
+
*
|
|
1335
|
+
* Carbon returns a `uint64_t` packing Metal's page and offset together; the
|
|
1336
|
+
* region object is that pair unpacked, which is what a bind group needs.
|
|
1337
|
+
*
|
|
1338
|
+
* @param {object|ArrayBufferView} source A constant buffer, or the bytes.
|
|
1339
|
+
* @param {number} [size] Bytes the binding demands at least.
|
|
1340
|
+
* @returns {{page: number, offset: number, size: number}|null} The region,
|
|
1341
|
+
* or null when there is nothing to upload - Carbon's `return 0`.
|
|
1407
1342
|
*/
|
|
1408
1343
|
UploadConstants(source, size = 0) {
|
|
1409
1344
|
if (!this._webgpu || !source) return null;
|
|
@@ -1427,13 +1362,13 @@ class CjsWebgpuRenderContextAL {
|
|
|
1427
1362
|
return token;
|
|
1428
1363
|
}
|
|
1429
1364
|
|
|
1430
|
-
/**
|
|
1431
|
-
* NOT PORTED, and Metal-only in Carbon. `UseConstantBuffer` makes a constant
|
|
1432
|
-
* buffer resident on the COMPUTE encoder (`useResource:`,
|
|
1433
|
-
* `Tr2RenderContextMetal.mm:1658-1673`) and its only callers build the
|
|
1434
|
-
* ray-tracing shader table (`Tr2RtShaderTableALMetal.mm:61-68`). DX12 has no
|
|
1435
|
-
* such method. This backend dispatches no compute and has no ray tracing, so
|
|
1436
|
-
* there is nothing to make resident.
|
|
1365
|
+
/**
|
|
1366
|
+
* NOT PORTED, and Metal-only in Carbon. `UseConstantBuffer` makes a constant
|
|
1367
|
+
* buffer resident on the COMPUTE encoder (`useResource:`,
|
|
1368
|
+
* `Tr2RenderContextMetal.mm:1658-1673`) and its only callers build the
|
|
1369
|
+
* ray-tracing shader table (`Tr2RtShaderTableALMetal.mm:61-68`). DX12 has no
|
|
1370
|
+
* such method. This backend dispatches no compute and has no ray tracing, so
|
|
1371
|
+
* there is nothing to make resident.
|
|
1437
1372
|
*/
|
|
1438
1373
|
|
|
1439
1374
|
/** The constant buffer `SetConstants` bound for a uniform binding, by any visible stage. */
|
|
@@ -1468,15 +1403,15 @@ class CjsWebgpuRenderContextAL {
|
|
|
1468
1403
|
buffers: new Map()
|
|
1469
1404
|
};
|
|
1470
1405
|
|
|
1471
|
-
/**
|
|
1472
|
-
* A 1x1 texture view of the given dimension, for a slot nothing filled.
|
|
1473
|
-
*
|
|
1474
|
-
* `MetalContext::GetDummyTexture( MTLTextureType )` (`MetalContext.mm:306-320`):
|
|
1475
|
-
* one per texture type, because a sampler of the wrong dimension is a
|
|
1476
|
-
* validation error rather than a black texel.
|
|
1477
|
-
*
|
|
1478
|
-
* @param {string} [viewDimension] A `GPUTextureViewDimension`.
|
|
1479
|
-
* @returns {object} A `GPUTextureView`.
|
|
1406
|
+
/**
|
|
1407
|
+
* A 1x1 texture view of the given dimension, for a slot nothing filled.
|
|
1408
|
+
*
|
|
1409
|
+
* `MetalContext::GetDummyTexture( MTLTextureType )` (`MetalContext.mm:306-320`):
|
|
1410
|
+
* one per texture type, because a sampler of the wrong dimension is a
|
|
1411
|
+
* validation error rather than a black texel.
|
|
1412
|
+
*
|
|
1413
|
+
* @param {string} [viewDimension] A `GPUTextureViewDimension`.
|
|
1414
|
+
* @returns {object} A `GPUTextureView`.
|
|
1480
1415
|
*/
|
|
1481
1416
|
GetDummyTexture(viewDimension = "2d") {
|
|
1482
1417
|
const existing = this._dummies.textures.get(viewDimension);
|
|
@@ -1509,14 +1444,14 @@ class CjsWebgpuRenderContextAL {
|
|
|
1509
1444
|
return this._dummies.sampler;
|
|
1510
1445
|
}
|
|
1511
1446
|
|
|
1512
|
-
/**
|
|
1513
|
-
* A zeroed buffer of at least `size` bytes for a slot nothing filled.
|
|
1514
|
-
*
|
|
1515
|
-
* DX12's null CB / null SRV substitution, one per size and usage.
|
|
1516
|
-
*
|
|
1517
|
-
* @param {number} size Bytes the layout demands.
|
|
1518
|
-
* @param {"UNIFORM"|"STORAGE"} usageName The usage flag's name.
|
|
1519
|
-
* @returns {object} A `GPUBuffer`.
|
|
1447
|
+
/**
|
|
1448
|
+
* A zeroed buffer of at least `size` bytes for a slot nothing filled.
|
|
1449
|
+
*
|
|
1450
|
+
* DX12's null CB / null SRV substitution, one per size and usage.
|
|
1451
|
+
*
|
|
1452
|
+
* @param {number} size Bytes the layout demands.
|
|
1453
|
+
* @param {"UNIFORM"|"STORAGE"} usageName The usage flag's name.
|
|
1454
|
+
* @returns {object} A `GPUBuffer`.
|
|
1520
1455
|
*/
|
|
1521
1456
|
GetNullBuffer(size, usageName) {
|
|
1522
1457
|
const aligned = Math.max(16, Math.ceil(size / 16) * 16);
|
|
@@ -1533,12 +1468,12 @@ class CjsWebgpuRenderContextAL {
|
|
|
1533
1468
|
return buffer;
|
|
1534
1469
|
}
|
|
1535
1470
|
|
|
1536
|
-
/**
|
|
1537
|
-
* Creates a texture, this backend's kind of `Tr2TextureAL`.
|
|
1538
|
-
*
|
|
1539
|
-
* @param {object} desc A `Tr2BitmapDimensions`.
|
|
1540
|
-
* @param {object} options `{ gpuUsage, cpuUsage, msaa, initialData }`.
|
|
1541
|
-
* @returns {object|null} The texture, or null when Create refused.
|
|
1471
|
+
/**
|
|
1472
|
+
* Creates a texture, this backend's kind of `Tr2TextureAL`.
|
|
1473
|
+
*
|
|
1474
|
+
* @param {object} desc A `Tr2BitmapDimensions`.
|
|
1475
|
+
* @param {object} options `{ gpuUsage, cpuUsage, msaa, initialData }`.
|
|
1476
|
+
* @returns {object|null} The texture, or null when Create refused.
|
|
1542
1477
|
*/
|
|
1543
1478
|
CreateTexture(desc, options) {
|
|
1544
1479
|
const texture = new CjsWebgpuTextureAL();
|
|
@@ -1546,15 +1481,26 @@ class CjsWebgpuRenderContextAL {
|
|
|
1546
1481
|
return texture;
|
|
1547
1482
|
}
|
|
1548
1483
|
|
|
1549
|
-
/**
|
|
1550
|
-
* Creates a resource set, this backend's kind of `Tr2ResourceSetAL`.
|
|
1551
|
-
*
|
|
1552
|
-
* @param {object} description A `Tr2ResourceSetDescriptionAL`.
|
|
1553
|
-
* @param {object} program The `CjsWebgpuShaderProgramAL` it binds against.
|
|
1554
|
-
* @returns {object|null} The set, or null when Create refused.
|
|
1555
|
-
*/
|
|
1556
|
-
CreateResourceSet(description, program) {
|
|
1557
|
-
|
|
1484
|
+
/**
|
|
1485
|
+
* Creates a resource set, this backend's kind of `Tr2ResourceSetAL`.
|
|
1486
|
+
*
|
|
1487
|
+
* @param {object} description A `Tr2ResourceSetDescriptionAL`.
|
|
1488
|
+
* @param {object} program The `CjsWebgpuShaderProgramAL` it binds against.
|
|
1489
|
+
* @returns {object|null} The set, or null when Create refused.
|
|
1490
|
+
*/
|
|
1491
|
+
CreateResourceSet(description, program, implementationOnly = false) {
|
|
1492
|
+
// JS platform selection for the public facade; the allocation branch
|
|
1493
|
+
// returns the native status code without collapsing it to null.
|
|
1494
|
+
if (implementationOnly) {
|
|
1495
|
+
const implementation = new CjsWebgpuResourceSetAL();
|
|
1496
|
+
const result = implementation.Create(description, program, this);
|
|
1497
|
+
if (Failed(result)) implementation.Destroy();
|
|
1498
|
+
return {
|
|
1499
|
+
result,
|
|
1500
|
+
implementation
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
const resourceSet = new Tr2ResourceSetAL();
|
|
1558
1504
|
if (Failed(resourceSet.Create(description, program, this))) return null;
|
|
1559
1505
|
return resourceSet;
|
|
1560
1506
|
}
|
|
@@ -1565,11 +1511,11 @@ class CjsWebgpuRenderContextAL {
|
|
|
1565
1511
|
return false;
|
|
1566
1512
|
}
|
|
1567
1513
|
|
|
1568
|
-
/**
|
|
1569
|
-
* Creates the `GPURenderPipeline` a program and recipe describe.
|
|
1570
|
-
*
|
|
1571
|
-
* A program without a pixel stage is a depth-only pipeline, which WebGPU
|
|
1572
|
-
* spells by omitting `fragment` - Carbon's shadow passes are exactly this.
|
|
1514
|
+
/**
|
|
1515
|
+
* Creates the `GPURenderPipeline` a program and recipe describe.
|
|
1516
|
+
*
|
|
1517
|
+
* A program without a pixel stage is a depth-only pipeline, which WebGPU
|
|
1518
|
+
* spells by omitting `fragment` - Carbon's shadow passes are exactly this.
|
|
1573
1519
|
*/
|
|
1574
1520
|
_CreateRenderPipeline(program, recipe) {
|
|
1575
1521
|
const fragmentModule = program.GetModuleFor(ShaderType.PIXEL_SHADER);
|
|
@@ -1599,15 +1545,15 @@ class CjsWebgpuRenderContextAL {
|
|
|
1599
1545
|
return this._webgpu.GetDevice().createRenderPipeline(descriptor);
|
|
1600
1546
|
}
|
|
1601
1547
|
|
|
1602
|
-
/**
|
|
1603
|
-
* Copies the bound attachments' formats onto the description.
|
|
1604
|
-
*
|
|
1605
|
-
* Deferred to the read rather than done in `SetRenderTarget`, because the
|
|
1606
|
-
* canvas format is only known once the target is configured and a target can
|
|
1607
|
-
* be bound before that. Carbon has no equivalent hop: a DX12 render-target
|
|
1608
|
-
* format is written straight into the description by `SetRenderState`
|
|
1609
|
-
* (`Tr2RenderContextDx12.cpp:453`), because a D3D texture knows its format
|
|
1610
|
-
* from creation.
|
|
1548
|
+
/**
|
|
1549
|
+
* Copies the bound attachments' formats onto the description.
|
|
1550
|
+
*
|
|
1551
|
+
* Deferred to the read rather than done in `SetRenderTarget`, because the
|
|
1552
|
+
* canvas format is only known once the target is configured and a target can
|
|
1553
|
+
* be bound before that. Carbon has no equivalent hop: a DX12 render-target
|
|
1554
|
+
* format is written straight into the description by `SetRenderState`
|
|
1555
|
+
* (`Tr2RenderContextDx12.cpp:453`), because a D3D texture knows its format
|
|
1556
|
+
* from creation.
|
|
1611
1557
|
*/
|
|
1612
1558
|
_RefreshAttachmentFormats() {
|
|
1613
1559
|
const primary = this._boundRenderTargets[0];
|
|
@@ -1632,39 +1578,41 @@ class CjsWebgpuRenderContextAL {
|
|
|
1632
1578
|
this._psoDescription.sampleCount = renderTargetBound ? this._renderTarget.GetSampleCount() : 1;
|
|
1633
1579
|
}
|
|
1634
1580
|
|
|
1635
|
-
/**
|
|
1636
|
-
* Binds a prepared set of textures, samplers and buffers.
|
|
1637
|
-
*
|
|
1638
|
-
* @param {object} resourceSet A `Tr2ResourceSetAL`.
|
|
1639
|
-
* @returns {boolean} True.
|
|
1581
|
+
/**
|
|
1582
|
+
* Binds a prepared set of textures, samplers and buffers.
|
|
1583
|
+
*
|
|
1584
|
+
* @param {object} resourceSet A `Tr2ResourceSetAL`.
|
|
1585
|
+
* @returns {boolean} True.
|
|
1640
1586
|
*/
|
|
1641
1587
|
SetResourceSet(resourceSet) {
|
|
1642
|
-
this._resourceSet = resourceSet
|
|
1588
|
+
this._resourceSet = resourceSet ? new Tr2ResourceSetAL({
|
|
1589
|
+
copy: resourceSet
|
|
1590
|
+
}) : null;
|
|
1643
1591
|
return true;
|
|
1644
1592
|
}
|
|
1645
1593
|
|
|
1646
|
-
/**
|
|
1647
|
-
* m_constantBuffers[stage][register], as Metal keeps them.
|
|
1648
|
-
*
|
|
1649
|
-
* A Map keyed by `stage * CONSTANT_BUFFER_REGISTERS + register` rather than a
|
|
1650
|
-
* fixed two-dimensional array, because the register count is a device limit
|
|
1651
|
-
* here and not a compile-time constant.
|
|
1594
|
+
/**
|
|
1595
|
+
* m_constantBuffers[stage][register], as Metal keeps them.
|
|
1596
|
+
*
|
|
1597
|
+
* A Map keyed by `stage * CONSTANT_BUFFER_REGISTERS + register` rather than a
|
|
1598
|
+
* fixed two-dimensional array, because the register count is a device limit
|
|
1599
|
+
* here and not a compile-time constant.
|
|
1652
1600
|
*/
|
|
1653
1601
|
_constantBuffers = new Map();
|
|
1654
1602
|
|
|
1655
|
-
/**
|
|
1656
|
-
* Binds a constant buffer to one shader stage at one register.
|
|
1657
|
-
*
|
|
1658
|
-
* Carbon rejects a register past the backend's constant-buffer count and
|
|
1659
|
-
* otherwise hands the buffer to itself to bind
|
|
1660
|
-
* (`Tr2RenderContextMetal.mm:664-677`). The bound state is what the resolver
|
|
1661
|
-
* reads when it assembles a draw.
|
|
1662
|
-
*
|
|
1663
|
-
* @param {object} buffer A `Tr2ConstantBufferAL`.
|
|
1664
|
-
* @param {number} constantType A `ShaderType`.
|
|
1665
|
-
* @param {number} registerIndex The constant-buffer register.
|
|
1666
|
-
* @param {number} [_maxRegisterCount] Carbon's optional bound.
|
|
1667
|
-
* @returns {boolean} Whether the AL accepted it.
|
|
1603
|
+
/**
|
|
1604
|
+
* Binds a constant buffer to one shader stage at one register.
|
|
1605
|
+
*
|
|
1606
|
+
* Carbon rejects a register past the backend's constant-buffer count and
|
|
1607
|
+
* otherwise hands the buffer to itself to bind
|
|
1608
|
+
* (`Tr2RenderContextMetal.mm:664-677`). The bound state is what the resolver
|
|
1609
|
+
* reads when it assembles a draw.
|
|
1610
|
+
*
|
|
1611
|
+
* @param {object} buffer A `Tr2ConstantBufferAL`.
|
|
1612
|
+
* @param {number} constantType A `ShaderType`.
|
|
1613
|
+
* @param {number} registerIndex The constant-buffer register.
|
|
1614
|
+
* @param {number} [_maxRegisterCount] Carbon's optional bound.
|
|
1615
|
+
* @returns {boolean} Whether the AL accepted it.
|
|
1668
1616
|
*/
|
|
1669
1617
|
SetConstants(buffer, constantType, registerIndex, _maxRegisterCount = 0) {
|
|
1670
1618
|
if (registerIndex < 0 || registerIndex >= CONSTANT_BUFFER_REGISTERS) return false;
|
|
@@ -1673,12 +1621,12 @@ class CjsWebgpuRenderContextAL {
|
|
|
1673
1621
|
return true;
|
|
1674
1622
|
}
|
|
1675
1623
|
|
|
1676
|
-
/**
|
|
1677
|
-
* The constant buffer bound to one stage and register.
|
|
1678
|
-
*
|
|
1679
|
-
* @param {number} constantType A `ShaderType`.
|
|
1680
|
-
* @param {number} registerIndex The constant-buffer register.
|
|
1681
|
-
* @returns {object|null} The buffer, or null when nothing is bound.
|
|
1624
|
+
/**
|
|
1625
|
+
* The constant buffer bound to one stage and register.
|
|
1626
|
+
*
|
|
1627
|
+
* @param {number} constantType A `ShaderType`.
|
|
1628
|
+
* @param {number} registerIndex The constant-buffer register.
|
|
1629
|
+
* @returns {object|null} The buffer, or null when nothing is bound.
|
|
1682
1630
|
*/
|
|
1683
1631
|
GetConstants(constantType, registerIndex) {
|
|
1684
1632
|
return this._constantBuffers.get(constantType * CONSTANT_BUFFER_REGISTERS + registerIndex) ?? null;
|
|
@@ -1693,13 +1641,13 @@ class CjsWebgpuRenderContextAL {
|
|
|
1693
1641
|
// changes". Each one either does what WebGPU can do or reports what the stub
|
|
1694
1642
|
// reports, and says which.
|
|
1695
1643
|
|
|
1696
|
-
/**
|
|
1697
|
-
* Where a debug group was pushed, so its pop reaches the same encoder.
|
|
1698
|
-
*
|
|
1699
|
-
* WEBGPU REQUIRES THE PAIR TO BALANCE WITHIN ONE ENCODER. A group pushed on
|
|
1700
|
-
* the command encoder and popped after a render pass opened would be a
|
|
1701
|
-
* validation error, not a mislabelled capture - so the push records its
|
|
1702
|
-
* target and the pop uses it rather than asking again.
|
|
1644
|
+
/**
|
|
1645
|
+
* Where a debug group was pushed, so its pop reaches the same encoder.
|
|
1646
|
+
*
|
|
1647
|
+
* WEBGPU REQUIRES THE PAIR TO BALANCE WITHIN ONE ENCODER. A group pushed on
|
|
1648
|
+
* the command encoder and popped after a render pass opened would be a
|
|
1649
|
+
* validation error, not a mislabelled capture - so the push records its
|
|
1650
|
+
* target and the pop uses it rather than asking again.
|
|
1703
1651
|
*/
|
|
1704
1652
|
_markerStack = [];
|
|
1705
1653
|
|
|
@@ -1708,23 +1656,23 @@ class CjsWebgpuRenderContextAL {
|
|
|
1708
1656
|
return this._workQueue.GetRenderPass() ?? this._commandEncoder;
|
|
1709
1657
|
}
|
|
1710
1658
|
|
|
1711
|
-
/**
|
|
1712
|
-
* Inserts a one-off marker into the capture.
|
|
1713
|
-
*
|
|
1714
|
-
* Real, unlike the stub's empty body: `insertDebugMarker` is what a WebGPU
|
|
1715
|
-
* capture tool shows, and this is the only reason Carbon's markers exist.
|
|
1716
|
-
*
|
|
1717
|
-
* @param {string} marker The label.
|
|
1659
|
+
/**
|
|
1660
|
+
* Inserts a one-off marker into the capture.
|
|
1661
|
+
*
|
|
1662
|
+
* Real, unlike the stub's empty body: `insertDebugMarker` is what a WebGPU
|
|
1663
|
+
* capture tool shows, and this is the only reason Carbon's markers exist.
|
|
1664
|
+
*
|
|
1665
|
+
* @param {string} marker The label.
|
|
1718
1666
|
*/
|
|
1719
1667
|
AddGpuMarker(marker) {
|
|
1720
1668
|
const target = this._MarkerTarget();
|
|
1721
1669
|
if (target) target.insertDebugMarker(String(marker));
|
|
1722
1670
|
}
|
|
1723
1671
|
|
|
1724
|
-
/**
|
|
1725
|
-
* Opens a named debug group.
|
|
1726
|
-
*
|
|
1727
|
-
* @param {string} marker The label.
|
|
1672
|
+
/**
|
|
1673
|
+
* Opens a named debug group.
|
|
1674
|
+
*
|
|
1675
|
+
* @param {string} marker The label.
|
|
1728
1676
|
*/
|
|
1729
1677
|
PushGpuMarker(marker) {
|
|
1730
1678
|
const target = this._MarkerTarget();
|
|
@@ -1738,19 +1686,19 @@ class CjsWebgpuRenderContextAL {
|
|
|
1738
1686
|
if (target) target.popDebugGroup();
|
|
1739
1687
|
}
|
|
1740
1688
|
|
|
1741
|
-
/**
|
|
1742
|
-
* Marks a point in the frame for a profiler.
|
|
1743
|
-
*
|
|
1744
|
-
* @param {string} frameEvent The event name.
|
|
1689
|
+
/**
|
|
1690
|
+
* Marks a point in the frame for a profiler.
|
|
1691
|
+
*
|
|
1692
|
+
* @param {string} frameEvent The event name.
|
|
1745
1693
|
*/
|
|
1746
1694
|
MarkFrameEvent(frameEvent) {
|
|
1747
1695
|
this.AddGpuMarker(frameEvent);
|
|
1748
1696
|
}
|
|
1749
1697
|
|
|
1750
|
-
/**
|
|
1751
|
-
* Tears the device down, dropping every piece of bound state.
|
|
1752
|
-
*
|
|
1753
|
-
* @returns {boolean} True.
|
|
1698
|
+
/**
|
|
1699
|
+
* Tears the device down, dropping every piece of bound state.
|
|
1700
|
+
*
|
|
1701
|
+
* @returns {boolean} True.
|
|
1754
1702
|
*/
|
|
1755
1703
|
Destroy() {
|
|
1756
1704
|
this._boundRenderTargets.fill(null);
|
|
@@ -1782,16 +1730,16 @@ class CjsWebgpuRenderContextAL {
|
|
|
1782
1730
|
return true;
|
|
1783
1731
|
}
|
|
1784
1732
|
|
|
1785
|
-
/**
|
|
1786
|
-
* Binds the default back buffer at slot zero and clears every other slot.
|
|
1787
|
-
*
|
|
1788
|
-
* Carbon calls this from `BeginScene` (`Tr2RenderContextMetal.mm:860-864`),
|
|
1789
|
-
* which is why a frame there never inherits the previous frame's targets.
|
|
1790
|
-
* This backend did not, so bound targets survived across frames and the first
|
|
1791
|
-
* pass of a frame drew into whatever the last pass of the previous one had
|
|
1792
|
-
* left bound - the same shape as the 2048 shadow-map defect one layer up.
|
|
1793
|
-
*
|
|
1794
|
-
* @returns {boolean} True.
|
|
1733
|
+
/**
|
|
1734
|
+
* Binds the default back buffer at slot zero and clears every other slot.
|
|
1735
|
+
*
|
|
1736
|
+
* Carbon calls this from `BeginScene` (`Tr2RenderContextMetal.mm:860-864`),
|
|
1737
|
+
* which is why a frame there never inherits the previous frame's targets.
|
|
1738
|
+
* This backend did not, so bound targets survived across frames and the first
|
|
1739
|
+
* pass of a frame drew into whatever the last pass of the previous one had
|
|
1740
|
+
* left bound - the same shape as the 2048 shadow-map defect one layer up.
|
|
1741
|
+
*
|
|
1742
|
+
* @returns {boolean} True.
|
|
1795
1743
|
*/
|
|
1796
1744
|
ResetRenderTargets() {
|
|
1797
1745
|
this.SetDepthStencil(null);
|
|
@@ -1800,28 +1748,28 @@ class CjsWebgpuRenderContextAL {
|
|
|
1800
1748
|
return true;
|
|
1801
1749
|
}
|
|
1802
1750
|
|
|
1803
|
-
/**
|
|
1804
|
-
* Marks this context as the process-wide primary one.
|
|
1805
|
-
*
|
|
1806
|
-
* Carbon's Metal version also constructs the device-side context and the
|
|
1807
|
-
* default back buffer (`Tr2RenderContextMetal.mm:114-124`); ours receive both
|
|
1808
|
-
* through the constructor, so what remains is the registration.
|
|
1809
|
-
*
|
|
1810
|
-
* @returns {boolean} True.
|
|
1751
|
+
/**
|
|
1752
|
+
* Marks this context as the process-wide primary one.
|
|
1753
|
+
*
|
|
1754
|
+
* Carbon's Metal version also constructs the device-side context and the
|
|
1755
|
+
* default back buffer (`Tr2RenderContextMetal.mm:114-124`); ours receive both
|
|
1756
|
+
* through the constructor, so what remains is the registration.
|
|
1757
|
+
*
|
|
1758
|
+
* @returns {boolean} True.
|
|
1811
1759
|
*/
|
|
1812
1760
|
SetAsPrimary() {
|
|
1813
1761
|
CjsWebgpuRenderContextAL.SetPrimaryRenderContext(this);
|
|
1814
1762
|
return true;
|
|
1815
1763
|
}
|
|
1816
1764
|
|
|
1817
|
-
/**
|
|
1818
|
-
* The present parameters last applied.
|
|
1819
|
-
*
|
|
1820
|
-
* CARBON'S MISSPELLING IS KEPT (`Tr2RenderContextMetal.h:230`). It is the
|
|
1821
|
-
* name on the abstraction-layer contract, and a backend that spells it
|
|
1822
|
-
* correctly is a backend the contract cannot reach.
|
|
1823
|
-
*
|
|
1824
|
-
* @returns {object|null} The parameters, or null before any were set.
|
|
1765
|
+
/**
|
|
1766
|
+
* The present parameters last applied.
|
|
1767
|
+
*
|
|
1768
|
+
* CARBON'S MISSPELLING IS KEPT (`Tr2RenderContextMetal.h:230`). It is the
|
|
1769
|
+
* name on the abstraction-layer contract, and a backend that spells it
|
|
1770
|
+
* correctly is a backend the contract cannot reach.
|
|
1771
|
+
*
|
|
1772
|
+
* @returns {object|null} The parameters, or null before any were set.
|
|
1825
1773
|
*/
|
|
1826
1774
|
GetPresentParamaters() {
|
|
1827
1775
|
return this._presentParameters;
|
|
@@ -1830,10 +1778,10 @@ class CjsWebgpuRenderContextAL {
|
|
|
1830
1778
|
/** m_presentParameters */
|
|
1831
1779
|
_presentParameters = null;
|
|
1832
1780
|
|
|
1833
|
-
/**
|
|
1834
|
-
* Releases what a device reset would invalidate, keeping the context alive.
|
|
1835
|
-
*
|
|
1836
|
-
* @returns {boolean} True.
|
|
1781
|
+
/**
|
|
1782
|
+
* Releases what a device reset would invalidate, keeping the context alive.
|
|
1783
|
+
*
|
|
1784
|
+
* @returns {boolean} True.
|
|
1837
1785
|
*/
|
|
1838
1786
|
ReleaseDeviceResources() {
|
|
1839
1787
|
this._boundRenderTargets.fill(null);
|
|
@@ -1859,39 +1807,39 @@ class CjsWebgpuRenderContextAL {
|
|
|
1859
1807
|
// second state and report a change it had not made.
|
|
1860
1808
|
}
|
|
1861
1809
|
|
|
1862
|
-
/**
|
|
1863
|
-
* The back buffer this context presents into.
|
|
1864
|
-
*
|
|
1865
|
-
* The render target IS this backend's back buffer: it answers `GetWidth` and
|
|
1866
|
-
* `GetHeight` exactly as a `Tr2TextureAL` does, which is why it can be bound
|
|
1867
|
-
* at slot zero without an adapter.
|
|
1868
|
-
*
|
|
1869
|
-
* @returns {object|null} The render target, or null before composition.
|
|
1810
|
+
/**
|
|
1811
|
+
* The back buffer this context presents into.
|
|
1812
|
+
*
|
|
1813
|
+
* The render target IS this backend's back buffer: it answers `GetWidth` and
|
|
1814
|
+
* `GetHeight` exactly as a `Tr2TextureAL` does, which is why it can be bound
|
|
1815
|
+
* at slot zero without an adapter.
|
|
1816
|
+
*
|
|
1817
|
+
* @returns {object|null} The render target, or null before composition.
|
|
1870
1818
|
*/
|
|
1871
1819
|
GetDefaultBackBuffer() {
|
|
1872
1820
|
return this._renderTarget;
|
|
1873
1821
|
}
|
|
1874
1822
|
|
|
1875
|
-
/**
|
|
1876
|
-
* The back buffer's pixel format, as a Carbon `PixelFormat`.
|
|
1877
|
-
*
|
|
1878
|
-
* @returns {number} The format, or `PIXEL_FORMAT_UNKNOWN` before composition
|
|
1879
|
-
* or for a canvas format outside the four the spec allows.
|
|
1823
|
+
/**
|
|
1824
|
+
* The back buffer's pixel format, as a Carbon `PixelFormat`.
|
|
1825
|
+
*
|
|
1826
|
+
* @returns {number} The format, or `PIXEL_FORMAT_UNKNOWN` before composition
|
|
1827
|
+
* or for a canvas format outside the four the spec allows.
|
|
1880
1828
|
*/
|
|
1881
1829
|
GetBackBufferFormat() {
|
|
1882
1830
|
if (!this._renderTarget) return PixelFormat.PIXEL_FORMAT_UNKNOWN;
|
|
1883
1831
|
return CANVAS_PIXEL_FORMAT[this._renderTarget.GetFormat()] ?? PixelFormat.PIXEL_FORMAT_UNKNOWN;
|
|
1884
1832
|
}
|
|
1885
1833
|
|
|
1886
|
-
/**
|
|
1887
|
-
* Applies present parameters by resizing the presentation surface.
|
|
1888
|
-
*
|
|
1889
|
-
* The stub CREATES a back buffer at the requested size; here the canvas
|
|
1890
|
-
* already exists and is reconfigured instead, which is the same act against a
|
|
1891
|
-
* surface the page owns rather than one the backend allocates.
|
|
1892
|
-
*
|
|
1893
|
-
* @param {object} presentParameters Carbon's `Tr2PresentParametersAL`.
|
|
1894
|
-
* @returns {number} An `ALResult` value.
|
|
1834
|
+
/**
|
|
1835
|
+
* Applies present parameters by resizing the presentation surface.
|
|
1836
|
+
*
|
|
1837
|
+
* The stub CREATES a back buffer at the requested size; here the canvas
|
|
1838
|
+
* already exists and is reconfigured instead, which is the same act against a
|
|
1839
|
+
* surface the page owns rather than one the backend allocates.
|
|
1840
|
+
*
|
|
1841
|
+
* @param {object} presentParameters Carbon's `Tr2PresentParametersAL`.
|
|
1842
|
+
* @returns {number} An `ALResult` value.
|
|
1895
1843
|
*/
|
|
1896
1844
|
SetPresentParameters(presentParameters) {
|
|
1897
1845
|
if (!presentParameters || !presentParameters.mode) return ALResult.E_INVALIDARG;
|
|
@@ -1908,22 +1856,22 @@ class CjsWebgpuRenderContextAL {
|
|
|
1908
1856
|
return ALResult.S_OK;
|
|
1909
1857
|
}
|
|
1910
1858
|
|
|
1911
|
-
/**
|
|
1912
|
-
* Whether textures can be reached without a binding.
|
|
1913
|
-
*
|
|
1914
|
-
* @returns {boolean} False. WebGPU has no bindless path at all: every
|
|
1915
|
-
* resource is reached through a bind group.
|
|
1859
|
+
/**
|
|
1860
|
+
* Whether textures can be reached without a binding.
|
|
1861
|
+
*
|
|
1862
|
+
* @returns {boolean} False. WebGPU has no bindless path at all: every
|
|
1863
|
+
* resource is reached through a bind group.
|
|
1916
1864
|
*/
|
|
1917
1865
|
SupportsBindlessTextures() {
|
|
1918
1866
|
return false;
|
|
1919
1867
|
}
|
|
1920
1868
|
|
|
1921
|
-
/**
|
|
1922
|
-
* How much video memory the adapter has.
|
|
1923
|
-
*
|
|
1924
|
-
* @returns {number} Zero, as the stub reports. WebGPU deliberately exposes no
|
|
1925
|
-
* memory size - it is a fingerprinting surface - so this is not a gap that
|
|
1926
|
-
* a later browser fills in.
|
|
1869
|
+
/**
|
|
1870
|
+
* How much video memory the adapter has.
|
|
1871
|
+
*
|
|
1872
|
+
* @returns {number} Zero, as the stub reports. WebGPU deliberately exposes no
|
|
1873
|
+
* memory size - it is a fingerprinting surface - so this is not a gap that
|
|
1874
|
+
* a later browser fills in.
|
|
1927
1875
|
*/
|
|
1928
1876
|
GetTotalVideoMemory() {
|
|
1929
1877
|
return 0;
|
|
@@ -1932,41 +1880,41 @@ class CjsWebgpuRenderContextAL {
|
|
|
1932
1880
|
/** m_readOnlyDepth - Metal keeps this and folds it into ZWRITEENABLE. */
|
|
1933
1881
|
_readOnlyDepth = false;
|
|
1934
1882
|
|
|
1935
|
-
/**
|
|
1936
|
-
* Whether depth is bound read-only.
|
|
1937
|
-
*
|
|
1938
|
-
* @returns {boolean} The flag.
|
|
1883
|
+
/**
|
|
1884
|
+
* Whether depth is bound read-only.
|
|
1885
|
+
*
|
|
1886
|
+
* @returns {boolean} The flag.
|
|
1939
1887
|
*/
|
|
1940
1888
|
GetReadOnlyDepth() {
|
|
1941
1889
|
return this._readOnlyDepth;
|
|
1942
1890
|
}
|
|
1943
1891
|
|
|
1944
|
-
/**
|
|
1945
|
-
* Binds depth read-only, so it can be sampled while still testing.
|
|
1946
|
-
*
|
|
1947
|
-
* STORED, NOT YET APPLIED. WebGPU expresses this as `depthReadOnly` on the
|
|
1948
|
-
* render-pass descriptor, which `_Descriptor` builds; wiring it there is a
|
|
1949
|
-
* pass-descriptor change rather than a state one, and the flag has to exist
|
|
1950
|
-
* before it can be read.
|
|
1951
|
-
*
|
|
1952
|
-
* @param {boolean} enable Whether depth is read-only.
|
|
1892
|
+
/**
|
|
1893
|
+
* Binds depth read-only, so it can be sampled while still testing.
|
|
1894
|
+
*
|
|
1895
|
+
* STORED, NOT YET APPLIED. WebGPU expresses this as `depthReadOnly` on the
|
|
1896
|
+
* render-pass descriptor, which `_Descriptor` builds; wiring it there is a
|
|
1897
|
+
* pass-descriptor change rather than a state one, and the flag has to exist
|
|
1898
|
+
* before it can be read.
|
|
1899
|
+
*
|
|
1900
|
+
* @param {boolean} enable Whether depth is read-only.
|
|
1953
1901
|
*/
|
|
1954
1902
|
SetReadOnlyDepth(enable) {
|
|
1955
1903
|
this._readOnlyDepth = !!enable;
|
|
1956
1904
|
}
|
|
1957
1905
|
|
|
1958
|
-
/**
|
|
1959
|
-
* Copies a byte range between two buffers.
|
|
1960
|
-
*
|
|
1961
|
-
* Real when a frame is open: `copyBufferToBuffer` is a command-encoder verb,
|
|
1962
|
-
* so it needs the encoder `BeginScene` created and nothing else.
|
|
1963
|
-
*
|
|
1964
|
-
* @param {object} destination The destination `Tr2BufferAL`.
|
|
1965
|
-
* @param {number} destinationOffset Byte offset into it.
|
|
1966
|
-
* @param {object} source The source `Tr2BufferAL`.
|
|
1967
|
-
* @param {number} sourceOffset Byte offset into it.
|
|
1968
|
-
* @param {number} size Bytes to copy.
|
|
1969
|
-
* @returns {boolean} Whether the copy was encoded.
|
|
1906
|
+
/**
|
|
1907
|
+
* Copies a byte range between two buffers.
|
|
1908
|
+
*
|
|
1909
|
+
* Real when a frame is open: `copyBufferToBuffer` is a command-encoder verb,
|
|
1910
|
+
* so it needs the encoder `BeginScene` created and nothing else.
|
|
1911
|
+
*
|
|
1912
|
+
* @param {object} destination The destination `Tr2BufferAL`.
|
|
1913
|
+
* @param {number} destinationOffset Byte offset into it.
|
|
1914
|
+
* @param {object} source The source `Tr2BufferAL`.
|
|
1915
|
+
* @param {number} sourceOffset Byte offset into it.
|
|
1916
|
+
* @param {number} size Bytes to copy.
|
|
1917
|
+
* @returns {boolean} Whether the copy was encoded.
|
|
1970
1918
|
*/
|
|
1971
1919
|
CopySubBuffer(destination, destinationOffset, source, sourceOffset, size) {
|
|
1972
1920
|
if (!this._commandEncoder) return false;
|
|
@@ -1976,76 +1924,76 @@ class CjsWebgpuRenderContextAL {
|
|
|
1976
1924
|
return true;
|
|
1977
1925
|
}
|
|
1978
1926
|
|
|
1979
|
-
/**
|
|
1980
|
-
* Draws indirectly, reading the draw arguments from a buffer.
|
|
1981
|
-
*
|
|
1982
|
-
* REFUSES, as the stub does. WebGPU has `drawIndirect`, but the work queue
|
|
1983
|
-
* owns every draw and has no indirect verb; adding one here would put a
|
|
1984
|
-
* second draw path beside the queue's, which is the split this backend is
|
|
1985
|
-
* built around.
|
|
1986
|
-
*
|
|
1987
|
-
* @returns {boolean} False.
|
|
1927
|
+
/**
|
|
1928
|
+
* Draws indirectly, reading the draw arguments from a buffer.
|
|
1929
|
+
*
|
|
1930
|
+
* REFUSES, as the stub does. WebGPU has `drawIndirect`, but the work queue
|
|
1931
|
+
* owns every draw and has no indirect verb; adding one here would put a
|
|
1932
|
+
* second draw path beside the queue's, which is the split this backend is
|
|
1933
|
+
* built around.
|
|
1934
|
+
*
|
|
1935
|
+
* @returns {boolean} False.
|
|
1988
1936
|
*/
|
|
1989
1937
|
DrawInstancedIndirect() {
|
|
1990
1938
|
return false;
|
|
1991
1939
|
}
|
|
1992
1940
|
|
|
1993
|
-
/**
|
|
1994
|
-
* Draws indexed indirectly.
|
|
1995
|
-
*
|
|
1996
|
-
* @returns {boolean} False; see `DrawInstancedIndirect`.
|
|
1941
|
+
/**
|
|
1942
|
+
* Draws indexed indirectly.
|
|
1943
|
+
*
|
|
1944
|
+
* @returns {boolean} False; see `DrawInstancedIndirect`.
|
|
1997
1945
|
*/
|
|
1998
1946
|
DrawIndexedInstancedIndirect() {
|
|
1999
1947
|
return false;
|
|
2000
1948
|
}
|
|
2001
1949
|
|
|
2002
|
-
/**
|
|
2003
|
-
* Declares that a batch of resources is about to be used.
|
|
2004
|
-
*
|
|
2005
|
-
* @param {object} _destination Where they are used.
|
|
2006
|
-
* @param {number} _usage How they are used.
|
|
2007
|
-
* @param {object[]} _resources The resources.
|
|
2008
|
-
* @returns {boolean} True. This is a residency and barrier hint for backends
|
|
2009
|
-
* that place their own memory; WebGPU tracks both itself, so honouring it
|
|
2010
|
-
* is nothing rather than unimplemented.
|
|
1950
|
+
/**
|
|
1951
|
+
* Declares that a batch of resources is about to be used.
|
|
1952
|
+
*
|
|
1953
|
+
* @param {object} _destination Where they are used.
|
|
1954
|
+
* @param {number} _usage How they are used.
|
|
1955
|
+
* @param {object[]} _resources The resources.
|
|
1956
|
+
* @returns {boolean} True. This is a residency and barrier hint for backends
|
|
1957
|
+
* that place their own memory; WebGPU tracks both itself, so honouring it
|
|
1958
|
+
* is nothing rather than unimplemented.
|
|
2011
1959
|
*/
|
|
2012
1960
|
UseResources(_destination, _usage, _resources) {
|
|
2013
1961
|
return true;
|
|
2014
1962
|
}
|
|
2015
1963
|
|
|
2016
|
-
/**
|
|
2017
|
-
* Declares a ray-tracing acceleration structure in use.
|
|
2018
|
-
*
|
|
2019
|
-
* @param {object} _tlas The top-level structure.
|
|
2020
|
-
* @returns {boolean} True, as the stub reports.
|
|
1964
|
+
/**
|
|
1965
|
+
* Declares a ray-tracing acceleration structure in use.
|
|
1966
|
+
*
|
|
1967
|
+
* @param {object} _tlas The top-level structure.
|
|
1968
|
+
* @returns {boolean} True, as the stub reports.
|
|
2021
1969
|
*/
|
|
2022
1970
|
UseAccelerationStructure(_tlas) {
|
|
2023
1971
|
return true;
|
|
2024
1972
|
}
|
|
2025
1973
|
|
|
2026
|
-
/**
|
|
2027
|
-
* Dispatches rays.
|
|
2028
|
-
*
|
|
2029
|
-
* @returns {boolean} False; WebGPU has no ray-tracing pipeline.
|
|
1974
|
+
/**
|
|
1975
|
+
* Dispatches rays.
|
|
1976
|
+
*
|
|
1977
|
+
* @returns {boolean} False; WebGPU has no ray-tracing pipeline.
|
|
2030
1978
|
*/
|
|
2031
1979
|
DispatchRays() {
|
|
2032
1980
|
return false;
|
|
2033
1981
|
}
|
|
2034
1982
|
|
|
2035
|
-
/**
|
|
2036
|
-
* Whether the device recorded a GPU state marker after a fault.
|
|
2037
|
-
*
|
|
2038
|
-
* @returns {boolean} False; WebGPU surfaces device loss as a promise and a
|
|
2039
|
-
* reason string, with no marker or breadcrumb to read.
|
|
1983
|
+
/**
|
|
1984
|
+
* Whether the device recorded a GPU state marker after a fault.
|
|
1985
|
+
*
|
|
1986
|
+
* @returns {boolean} False; WebGPU surfaces device loss as a promise and a
|
|
1987
|
+
* reason string, with no marker or breadcrumb to read.
|
|
2040
1988
|
*/
|
|
2041
1989
|
GetGpuStateMarker() {
|
|
2042
1990
|
return false;
|
|
2043
1991
|
}
|
|
2044
1992
|
|
|
2045
|
-
/**
|
|
2046
|
-
* The resource a GPU page fault named.
|
|
2047
|
-
*
|
|
2048
|
-
* @returns {boolean} False; see `GetGpuStateMarker`.
|
|
1993
|
+
/**
|
|
1994
|
+
* The resource a GPU page fault named.
|
|
1995
|
+
*
|
|
1996
|
+
* @returns {boolean} False; see `GetGpuStateMarker`.
|
|
2049
1997
|
*/
|
|
2050
1998
|
GetGpuPageFaultResource() {
|
|
2051
1999
|
return false;
|
|
@@ -2055,30 +2003,30 @@ class CjsWebgpuRenderContextAL {
|
|
|
2055
2003
|
// Carbon's: the family is live only in the DX backends. WebGPU has no
|
|
2056
2004
|
// upscaler to reach, so these are complete rather than pending.
|
|
2057
2005
|
|
|
2058
|
-
/**
|
|
2059
|
-
* Enables upscaling.
|
|
2060
|
-
*
|
|
2061
|
-
* @returns {number} `UpscalingResult.OK` - Carbon's stub succeeds WITHOUT
|
|
2062
|
-
* creating anything, so a caller that then asks for a context gets null.
|
|
2063
|
-
* That pairing is Carbon's and both halves are kept.
|
|
2006
|
+
/**
|
|
2007
|
+
* Enables upscaling.
|
|
2008
|
+
*
|
|
2009
|
+
* @returns {number} `UpscalingResult.OK` - Carbon's stub succeeds WITHOUT
|
|
2010
|
+
* creating anything, so a caller that then asks for a context gets null.
|
|
2011
|
+
* That pairing is Carbon's and both halves are kept.
|
|
2064
2012
|
*/
|
|
2065
2013
|
EnableUpscaling() {
|
|
2066
2014
|
return UpscalingResult.OK;
|
|
2067
2015
|
}
|
|
2068
2016
|
|
|
2069
|
-
/**
|
|
2070
|
-
* An existing upscaling context.
|
|
2071
|
-
*
|
|
2072
|
-
* @returns {null} Null; none is kept.
|
|
2017
|
+
/**
|
|
2018
|
+
* An existing upscaling context.
|
|
2019
|
+
*
|
|
2020
|
+
* @returns {null} Null; none is kept.
|
|
2073
2021
|
*/
|
|
2074
2022
|
GetUpscalingContext() {
|
|
2075
2023
|
return null;
|
|
2076
2024
|
}
|
|
2077
2025
|
|
|
2078
|
-
/**
|
|
2079
|
-
* Creates an upscaling context.
|
|
2080
|
-
*
|
|
2081
|
-
* @returns {null} Null; none is created.
|
|
2026
|
+
/**
|
|
2027
|
+
* Creates an upscaling context.
|
|
2028
|
+
*
|
|
2029
|
+
* @returns {null} Null; none is created.
|
|
2082
2030
|
*/
|
|
2083
2031
|
CreateUpscalingContext() {
|
|
2084
2032
|
return null;
|
|
@@ -2087,10 +2035,10 @@ class CjsWebgpuRenderContextAL {
|
|
|
2087
2035
|
/** Destroys an upscaling context; there are none. */
|
|
2088
2036
|
DeleteUpscalingContext() {}
|
|
2089
2037
|
|
|
2090
|
-
/**
|
|
2091
|
-
* What an upscaling context is doing.
|
|
2092
|
-
*
|
|
2093
|
-
* @returns {object} A default `UpscalingInfo`; two of its values are not zero.
|
|
2038
|
+
/**
|
|
2039
|
+
* What an upscaling context is doing.
|
|
2040
|
+
*
|
|
2041
|
+
* @returns {object} A default `UpscalingInfo`; two of its values are not zero.
|
|
2094
2042
|
*/
|
|
2095
2043
|
GetUpscalingInfo() {
|
|
2096
2044
|
return {
|
|
@@ -2110,19 +2058,19 @@ class CjsWebgpuRenderContextAL {
|
|
|
2110
2058
|
};
|
|
2111
2059
|
}
|
|
2112
2060
|
|
|
2113
|
-
/**
|
|
2114
|
-
* The techniques an adapter supports.
|
|
2115
|
-
*
|
|
2116
|
-
* @returns {Array} Empty.
|
|
2061
|
+
/**
|
|
2062
|
+
* The techniques an adapter supports.
|
|
2063
|
+
*
|
|
2064
|
+
* @returns {Array} Empty.
|
|
2117
2065
|
*/
|
|
2118
2066
|
GetSupportedUpscalingTechniques() {
|
|
2119
2067
|
return [];
|
|
2120
2068
|
}
|
|
2121
2069
|
|
|
2122
|
-
/**
|
|
2123
|
-
* The upscaling currently set up.
|
|
2124
|
-
*
|
|
2125
|
-
* @returns {object} "No upscaling", in the four fields Carbon fills.
|
|
2070
|
+
/**
|
|
2071
|
+
* The upscaling currently set up.
|
|
2072
|
+
*
|
|
2073
|
+
* @returns {object} "No upscaling", in the four fields Carbon fills.
|
|
2126
2074
|
*/
|
|
2127
2075
|
GetUpscalingSetup() {
|
|
2128
2076
|
return {
|
|
@@ -2137,47 +2085,47 @@ class CjsWebgpuRenderContextAL {
|
|
|
2137
2085
|
// reaches it from resource creation; these are the same three accessors the
|
|
2138
2086
|
// stub carries, over the same module-level binding.
|
|
2139
2087
|
|
|
2140
|
-
/**
|
|
2141
|
-
* Records the primary render context.
|
|
2142
|
-
*
|
|
2143
|
-
* @param {object} renderContext The context to make primary.
|
|
2088
|
+
/**
|
|
2089
|
+
* Records the primary render context.
|
|
2090
|
+
*
|
|
2091
|
+
* @param {object} renderContext The context to make primary.
|
|
2144
2092
|
*/
|
|
2145
2093
|
static SetPrimaryRenderContext(renderContext) {
|
|
2146
2094
|
primaryRenderContext = renderContext;
|
|
2147
2095
|
}
|
|
2148
2096
|
|
|
2149
|
-
/**
|
|
2150
|
-
* The primary render context, which must exist.
|
|
2151
|
-
*
|
|
2152
|
-
* @returns {object} The primary context.
|
|
2097
|
+
/**
|
|
2098
|
+
* The primary render context, which must exist.
|
|
2099
|
+
*
|
|
2100
|
+
* @returns {object} The primary context.
|
|
2153
2101
|
*/
|
|
2154
2102
|
static GetPrimaryRenderContext() {
|
|
2155
2103
|
if (primaryRenderContext === null) fail("there is no primary render context");
|
|
2156
2104
|
return primaryRenderContext;
|
|
2157
2105
|
}
|
|
2158
2106
|
|
|
2159
|
-
/**
|
|
2160
|
-
* The primary render context, or null.
|
|
2161
|
-
*
|
|
2162
|
-
* @returns {object|null} The primary context.
|
|
2107
|
+
/**
|
|
2108
|
+
* The primary render context, or null.
|
|
2109
|
+
*
|
|
2110
|
+
* @returns {object|null} The primary context.
|
|
2163
2111
|
*/
|
|
2164
2112
|
static GetPrimaryRenderContextPointer() {
|
|
2165
2113
|
return primaryRenderContext;
|
|
2166
2114
|
}
|
|
2167
2115
|
|
|
2168
|
-
/**
|
|
2169
|
-
* Draws the bound geometry, indexed.
|
|
2170
|
-
*
|
|
2171
|
-
* REFUSES WITHOUT AN INDEX BUFFER, as Metal does - `E_INVALIDARG` at
|
|
2172
|
-
* `Tr2RenderContextMetal.mm:419-422`. An indexed draw with nothing to index
|
|
2173
|
-
* is a caller error a backend can catch without a device.
|
|
2174
|
-
*
|
|
2175
|
-
* @param {number} indexCountPerInstance Indices each instance reads.
|
|
2176
|
-
* @param {number} instanceCount Instances to draw.
|
|
2177
|
-
* @param {number} startIndexLocation First index.
|
|
2178
|
-
* @param {number} baseVertexLocation Value added to every index.
|
|
2179
|
-
* @param {number} startInstanceLocation First instance id.
|
|
2180
|
-
* @returns {boolean} Whether the draw was recorded.
|
|
2116
|
+
/**
|
|
2117
|
+
* Draws the bound geometry, indexed.
|
|
2118
|
+
*
|
|
2119
|
+
* REFUSES WITHOUT AN INDEX BUFFER, as Metal does - `E_INVALIDARG` at
|
|
2120
|
+
* `Tr2RenderContextMetal.mm:419-422`. An indexed draw with nothing to index
|
|
2121
|
+
* is a caller error a backend can catch without a device.
|
|
2122
|
+
*
|
|
2123
|
+
* @param {number} indexCountPerInstance Indices each instance reads.
|
|
2124
|
+
* @param {number} instanceCount Instances to draw.
|
|
2125
|
+
* @param {number} startIndexLocation First index.
|
|
2126
|
+
* @param {number} baseVertexLocation Value added to every index.
|
|
2127
|
+
* @param {number} startInstanceLocation First instance id.
|
|
2128
|
+
* @returns {boolean} Whether the draw was recorded.
|
|
2181
2129
|
*/
|
|
2182
2130
|
DrawIndexedInstanced(indexCountPerInstance, instanceCount, startIndexLocation = 0, baseVertexLocation = 0, startInstanceLocation = 0) {
|
|
2183
2131
|
if (!this._indexBuffer) return false;
|
|
@@ -2194,14 +2142,14 @@ class CjsWebgpuRenderContextAL {
|
|
|
2194
2142
|
return true;
|
|
2195
2143
|
}
|
|
2196
2144
|
|
|
2197
|
-
/**
|
|
2198
|
-
* Draws the bound geometry, non-indexed.
|
|
2199
|
-
*
|
|
2200
|
-
* @param {number} vertexCountPerInstance Vertices each instance reads.
|
|
2201
|
-
* @param {number} instanceCount Instances to draw.
|
|
2202
|
-
* @param {number} startVertexLocation First vertex.
|
|
2203
|
-
* @param {number} startInstanceLocation First instance id.
|
|
2204
|
-
* @returns {boolean} Whether the draw was recorded.
|
|
2145
|
+
/**
|
|
2146
|
+
* Draws the bound geometry, non-indexed.
|
|
2147
|
+
*
|
|
2148
|
+
* @param {number} vertexCountPerInstance Vertices each instance reads.
|
|
2149
|
+
* @param {number} instanceCount Instances to draw.
|
|
2150
|
+
* @param {number} startVertexLocation First vertex.
|
|
2151
|
+
* @param {number} startInstanceLocation First instance id.
|
|
2152
|
+
* @returns {boolean} Whether the draw was recorded.
|
|
2205
2153
|
*/
|
|
2206
2154
|
DrawInstanced(vertexCountPerInstance, instanceCount, startVertexLocation = 0, startInstanceLocation = 0) {
|
|
2207
2155
|
if (!this._shaderProgram) return false;
|
|
@@ -2212,81 +2160,81 @@ class CjsWebgpuRenderContextAL {
|
|
|
2212
2160
|
return true;
|
|
2213
2161
|
}
|
|
2214
2162
|
|
|
2215
|
-
/**
|
|
2216
|
-
* Draws a primitive COUNT, converting it to vertices first.
|
|
2217
|
-
*
|
|
2218
|
-
* @param {number} numVertices Vertices the index range spans.
|
|
2219
|
-
* @param {number} startIndex First index.
|
|
2220
|
-
* @param {number} primitiveCount Primitives to draw.
|
|
2221
|
-
* @param {number} [minimumIndex] Lowest index present.
|
|
2222
|
-
* @returns {boolean} Whether the draw was recorded.
|
|
2163
|
+
/**
|
|
2164
|
+
* Draws a primitive COUNT, converting it to vertices first.
|
|
2165
|
+
*
|
|
2166
|
+
* @param {number} numVertices Vertices the index range spans.
|
|
2167
|
+
* @param {number} startIndex First index.
|
|
2168
|
+
* @param {number} primitiveCount Primitives to draw.
|
|
2169
|
+
* @param {number} [minimumIndex] Lowest index present.
|
|
2170
|
+
* @returns {boolean} Whether the draw was recorded.
|
|
2223
2171
|
*/
|
|
2224
2172
|
DrawIndexedPrimitive(numVertices, startIndex, primitiveCount, minimumIndex = 0) {
|
|
2225
2173
|
return this.DrawIndexedInstanced(this.ComputeVertexCount(primitiveCount), 1, startIndex, minimumIndex, 0);
|
|
2226
2174
|
}
|
|
2227
2175
|
|
|
2228
|
-
/**
|
|
2229
|
-
* Draws a primitive count, non-indexed.
|
|
2230
|
-
*
|
|
2231
|
-
* @param {number} startVertex First vertex.
|
|
2232
|
-
* @param {number} primitiveCount Primitives to draw.
|
|
2233
|
-
* @returns {boolean} Whether the draw was recorded.
|
|
2176
|
+
/**
|
|
2177
|
+
* Draws a primitive count, non-indexed.
|
|
2178
|
+
*
|
|
2179
|
+
* @param {number} startVertex First vertex.
|
|
2180
|
+
* @param {number} primitiveCount Primitives to draw.
|
|
2181
|
+
* @returns {boolean} Whether the draw was recorded.
|
|
2234
2182
|
*/
|
|
2235
2183
|
DrawPrimitive(startVertex, primitiveCount) {
|
|
2236
2184
|
return this.DrawInstanced(this.ComputeVertexCount(primitiveCount), 1, startVertex, 0);
|
|
2237
2185
|
}
|
|
2238
2186
|
|
|
2239
|
-
/**
|
|
2240
|
-
* Draws non-indexed straight from caller memory, with no buffer bound.
|
|
2241
|
-
*
|
|
2242
|
-
* Carbon does not draw this itself either: every backend hands it to
|
|
2243
|
-
* `Tr2DrawUPHelper` (Metal at `Tr2RenderContextMetal.mm:558-571`, DX12 at
|
|
2244
|
-
* `Tr2RenderContextDx12.cpp:1219-1224`), which stages the caller's vertices
|
|
2245
|
-
* into a ring of scratch buffers and issues an ordinary draw. WebGPU cannot
|
|
2246
|
-
* read caller memory either - every vertex must reach a `GPUBuffer` first -
|
|
2247
|
-
* so the helper IS the implementation rather than a detail of it, and the
|
|
2248
|
-
* port is shared rather than written again here.
|
|
2249
|
-
*
|
|
2250
|
-
* @param {number} primitiveCount Primitives to draw.
|
|
2251
|
-
* @param {ArrayBufferView} vertexStreamZeroData The vertices.
|
|
2252
|
-
* @param {number} vertexStreamZeroStride Bytes per vertex.
|
|
2253
|
-
* @returns {boolean} Whether the draw was encoded.
|
|
2187
|
+
/**
|
|
2188
|
+
* Draws non-indexed straight from caller memory, with no buffer bound.
|
|
2189
|
+
*
|
|
2190
|
+
* Carbon does not draw this itself either: every backend hands it to
|
|
2191
|
+
* `Tr2DrawUPHelper` (Metal at `Tr2RenderContextMetal.mm:558-571`, DX12 at
|
|
2192
|
+
* `Tr2RenderContextDx12.cpp:1219-1224`), which stages the caller's vertices
|
|
2193
|
+
* into a ring of scratch buffers and issues an ordinary draw. WebGPU cannot
|
|
2194
|
+
* read caller memory either - every vertex must reach a `GPUBuffer` first -
|
|
2195
|
+
* so the helper IS the implementation rather than a detail of it, and the
|
|
2196
|
+
* port is shared rather than written again here.
|
|
2197
|
+
*
|
|
2198
|
+
* @param {number} primitiveCount Primitives to draw.
|
|
2199
|
+
* @param {ArrayBufferView} vertexStreamZeroData The vertices.
|
|
2200
|
+
* @param {number} vertexStreamZeroStride Bytes per vertex.
|
|
2201
|
+
* @returns {boolean} Whether the draw was encoded.
|
|
2254
2202
|
*/
|
|
2255
2203
|
DrawPrimitiveUP(primitiveCount, vertexStreamZeroData, vertexStreamZeroStride) {
|
|
2256
2204
|
return !Failed(this._drawUP.DrawPrimitiveUP(this._topology, primitiveCount, vertexStreamZeroData, vertexStreamZeroStride, this));
|
|
2257
2205
|
}
|
|
2258
2206
|
|
|
2259
|
-
/**
|
|
2260
|
-
* Draws indexed straight from caller memory.
|
|
2261
|
-
*
|
|
2262
|
-
* The same helper, staging indices as well as vertices. Carbon has an
|
|
2263
|
-
* overload per index width; the width is read off the array here instead.
|
|
2264
|
-
*
|
|
2265
|
-
* @param {number} numVertices Vertices the index data spans.
|
|
2266
|
-
* @param {number} primitiveCount Primitives to draw.
|
|
2267
|
-
* @param {Uint16Array|Uint32Array} indexData The indices.
|
|
2268
|
-
* @param {ArrayBufferView} vertexStreamZeroData The vertices.
|
|
2269
|
-
* @param {number} vertexStreamZeroStride Bytes per vertex.
|
|
2270
|
-
* @returns {boolean} Whether the draw was encoded.
|
|
2207
|
+
/**
|
|
2208
|
+
* Draws indexed straight from caller memory.
|
|
2209
|
+
*
|
|
2210
|
+
* The same helper, staging indices as well as vertices. Carbon has an
|
|
2211
|
+
* overload per index width; the width is read off the array here instead.
|
|
2212
|
+
*
|
|
2213
|
+
* @param {number} numVertices Vertices the index data spans.
|
|
2214
|
+
* @param {number} primitiveCount Primitives to draw.
|
|
2215
|
+
* @param {Uint16Array|Uint32Array} indexData The indices.
|
|
2216
|
+
* @param {ArrayBufferView} vertexStreamZeroData The vertices.
|
|
2217
|
+
* @param {number} vertexStreamZeroStride Bytes per vertex.
|
|
2218
|
+
* @returns {boolean} Whether the draw was encoded.
|
|
2271
2219
|
*/
|
|
2272
2220
|
DrawIndexedPrimitiveUP(numVertices, primitiveCount, indexData, vertexStreamZeroData, vertexStreamZeroStride) {
|
|
2273
2221
|
return !Failed(this._drawUP.DrawIndexedPrimitiveUP(this._topology, numVertices, primitiveCount, indexData, vertexStreamZeroData, vertexStreamZeroStride, this));
|
|
2274
2222
|
}
|
|
2275
2223
|
|
|
2276
|
-
/**
|
|
2277
|
-
* How many vertices a primitive count describes at the bound topology.
|
|
2278
|
-
*
|
|
2279
|
-
* @param {number} primitiveCount Primitives.
|
|
2280
|
-
* @returns {number} Vertices.
|
|
2224
|
+
/**
|
|
2225
|
+
* How many vertices a primitive count describes at the bound topology.
|
|
2226
|
+
*
|
|
2227
|
+
* @param {number} primitiveCount Primitives.
|
|
2228
|
+
* @returns {number} Vertices.
|
|
2281
2229
|
*/
|
|
2282
2230
|
ComputeVertexCount(primitiveCount) {
|
|
2283
2231
|
return VERTICES_PER_PRIMITIVE[this._topology](primitiveCount);
|
|
2284
2232
|
}
|
|
2285
2233
|
|
|
2286
|
-
/**
|
|
2287
|
-
* What a following draw would bind, for a caller that must encode it.
|
|
2288
|
-
*
|
|
2289
|
-
* @returns {object} A copy of the bound state.
|
|
2234
|
+
/**
|
|
2235
|
+
* What a following draw would bind, for a caller that must encode it.
|
|
2236
|
+
*
|
|
2237
|
+
* @returns {object} A copy of the bound state.
|
|
2290
2238
|
*/
|
|
2291
2239
|
GetBoundState() {
|
|
2292
2240
|
return {
|
|
@@ -2302,15 +2250,29 @@ class CjsWebgpuRenderContextAL {
|
|
|
2302
2250
|
};
|
|
2303
2251
|
}
|
|
2304
2252
|
|
|
2305
|
-
/**
|
|
2306
|
-
* Keeps the work queue's reported encoder transitions for the tests to read.
|
|
2307
|
-
*
|
|
2308
|
-
* @param {object[]} [events] The events, if any were reported.
|
|
2253
|
+
/**
|
|
2254
|
+
* Keeps the work queue's reported encoder transitions for the tests to read.
|
|
2255
|
+
*
|
|
2256
|
+
* @param {object[]} [events] The events, if any were reported.
|
|
2309
2257
|
*/
|
|
2310
2258
|
_Record(events) {
|
|
2311
2259
|
if (events?.length) this._transitions.push(...events);
|
|
2312
2260
|
}
|
|
2313
2261
|
}
|
|
2314
2262
|
|
|
2263
|
+
// DECLARED AS A CALL, NOT A DECORATOR, for the reason recorded in
|
|
2264
|
+
// Tr2BitmapDimensions.js: the layer is imported straight from source by its
|
|
2265
|
+
// tests and raw Node cannot parse decorator syntax.
|
|
2266
|
+
//
|
|
2267
|
+
// The donor is NAMED rather than left to be derived from this class's name.
|
|
2268
|
+
// Carbon calls every backend's class the same thing and carries the backend in
|
|
2269
|
+
// the FILE name, because only one backend compiles at a time; we ship them
|
|
2270
|
+
// together, so the backend moves onto the class name. That divergence is the
|
|
2271
|
+
// author's to declare, never a checker's to guess.
|
|
2272
|
+
CjsSchema.define(CjsWebgpuRenderContextAL, {
|
|
2273
|
+
className: "CjsWebgpuRenderContextAL",
|
|
2274
|
+
carbon: "Tr2RenderContextAL"
|
|
2275
|
+
});
|
|
2276
|
+
|
|
2315
2277
|
export { CjsWebgpuRenderContextAL };
|
|
2316
2278
|
//# sourceMappingURL=CjsWebgpuRenderContextAL.js.map
|