@carbonenginejs/runtime-resource 0.9.2 → 0.10.0
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/NOTICE +3 -2
- package/README.md +47 -6
- package/dist/CjsMotherLode.js +88 -88
- package/dist/CjsMotherLode.js.map +1 -1
- package/dist/CjsResMan.js +717 -228
- package/dist/CjsResMan.js.map +1 -1
- package/dist/CjsResManFetchProvider.js +94 -0
- package/dist/CjsResManFetchProvider.js.map +1 -0
- package/dist/{CjsResManQueue.js → CjsResManWorkQueue.js} +112 -25
- package/dist/CjsResManWorkQueue.js.map +1 -0
- package/dist/format/CjsBlueReader.js +89 -0
- package/dist/format/CjsBlueReader.js.map +1 -1
- package/dist/format/CjsFormat.js +42 -16
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsReader.js +4 -0
- package/dist/format/CjsReader.js.map +1 -1
- package/dist/format/CjsResourceProbe.js +2 -0
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/payloadContract.js +20 -0
- package/dist/format/payloadContract.js.map +1 -1
- package/dist/formats/black/CjsBlackFormat.js +15 -1
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/black/core/CjsBlackBinaryReader.js +103 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +61 -0
- package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -1
- package/dist/formats/black/core/CjsBlackReader.js +125 -0
- package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +103 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -1
- package/dist/formats/black/core/helpers.js +17 -0
- package/dist/formats/black/core/helpers.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +8 -0
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +20 -0
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/musicNodes.js +40 -3
- package/dist/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/formats/bnk/core/soundbanksInfo.js +2 -0
- package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
- package/dist/formats/cmf/core/binary.js +71 -0
- package/dist/formats/cmf/core/binary.js.map +1 -1
- package/dist/formats/cmf/core/buffers.js +4 -0
- package/dist/formats/cmf/core/buffers.js.map +1 -1
- package/dist/formats/cmf/core/helpers.js +31 -0
- package/dist/formats/cmf/core/helpers.js.map +1 -1
- package/dist/formats/cmf/core/schema.js +10 -0
- package/dist/formats/cmf/core/schema.js.map +1 -1
- package/dist/formats/cmf/core/shared.js +9 -0
- package/dist/formats/cmf/core/shared.js.map +1 -1
- package/dist/formats/cmf/core/writer.js +54 -0
- package/dist/formats/cmf/core/writer.js.map +1 -1
- package/dist/formats/dds/core/bc6h.js +10 -0
- package/dist/formats/dds/core/bc6h.js.map +1 -1
- package/dist/formats/dds/core/bc7.js +16 -0
- package/dist/formats/dds/core/bc7.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +47 -0
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/fbx/core/helpers.js +21 -0
- package/dist/formats/fbx/core/helpers.js.map +1 -1
- package/dist/formats/flac/CjsFlacFormat.js +49 -0
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +20 -0
- package/dist/formats/flac/core/helpers.js.map +1 -1
- package/dist/formats/gif/CjsGifFormat.js +49 -0
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +20 -0
- package/dist/formats/gif/core/helpers.js.map +1 -1
- package/dist/formats/gltf/core/helpers.js +15 -0
- package/dist/formats/gltf/core/helpers.js.map +1 -1
- package/dist/formats/gltf/core/parser.js +13 -0
- package/dist/formats/gltf/core/parser.js.map +1 -1
- package/dist/formats/gltf/core/targets.js +10 -0
- package/dist/formats/gltf/core/targets.js.map +1 -1
- package/dist/formats/gr2/core/bitknit2.js +2 -0
- package/dist/formats/gr2/core/bitknit2.js.map +1 -1
- package/dist/formats/gr2/core/helpers.js +20 -0
- package/dist/formats/gr2/core/helpers.js.map +1 -1
- package/dist/formats/gr2/core/targets.js +10 -0
- package/dist/formats/gr2/core/targets.js.map +1 -1
- package/dist/formats/jpeg/core/helpers.js +52 -0
- package/dist/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/formats/jpeg/core/jpeg.js +93 -0
- package/dist/formats/jpeg/core/jpeg.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +37 -0
- package/dist/formats/mp3/core/helpers.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +35 -0
- package/dist/formats/mp4/core/helpers.js.map +1 -1
- package/dist/formats/ogg/CjsOggFormat.js +49 -0
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +23 -0
- package/dist/formats/ogg/core/helpers.js.map +1 -1
- package/dist/formats/ogg/core/vorbis.js +13 -0
- package/dist/formats/ogg/core/vorbis.js.map +1 -1
- package/dist/formats/png/core/helpers.js +52 -0
- package/dist/formats/png/core/helpers.js.map +1 -1
- package/dist/formats/red/CjsRedFormat.js +2 -0
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/red/core/CjsRedReader.js +52 -0
- package/dist/formats/red/core/CjsRedReader.js.map +1 -1
- package/dist/formats/red/core/helpers.js +19 -0
- package/dist/formats/red/core/helpers.js.map +1 -1
- package/dist/formats/stl/core/stl.js +8 -0
- package/dist/formats/stl/core/stl.js.map +1 -1
- package/dist/formats/stl/core/targets.js +10 -0
- package/dist/formats/stl/core/targets.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +47 -0
- package/dist/formats/tga/core/helpers.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +37 -0
- package/dist/formats/wav/core/helpers.js.map +1 -1
- package/dist/formats/webm/core/helpers.js +35 -0
- package/dist/formats/webm/core/helpers.js.map +1 -1
- package/dist/formats/webp/CjsWebpFormat.js +49 -0
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +23 -0
- package/dist/formats/webp/core/helpers.js.map +1 -1
- package/dist/formats/wem/CjsWemFormat.js +8 -0
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/bitStream.js +2 -0
- package/dist/formats/wem/core/bitStream.js.map +1 -1
- package/dist/formats/wem/core/helpers.js +20 -0
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/yaml/CjsYamlFormat.js +45 -0
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/formats/yaml/core/CjsYamlReader.js +91 -0
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
- package/dist/formats/yaml/core/helpers.js +10 -0
- package/dist/formats/yaml/core/helpers.js.map +1 -1
- package/dist/index.js +56 -43
- package/dist/index.js.map +1 -1
- package/dist/{CjsResource.js → resource/CjsResource.js} +232 -17
- package/dist/resource/CjsResource.js.map +1 -0
- package/dist/{resources → resource}/Tr2LightProfileRes.js +4 -3
- package/dist/resource/Tr2LightProfileRes.js.map +1 -0
- package/dist/{resources → resource/audio}/AudioGeometryResData.js +1 -1
- package/dist/resource/audio/AudioGeometryResData.js.map +1 -0
- package/dist/resource/audio/CjsAudioBufferRes.js +86 -0
- package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -0
- package/dist/resource/audio/CjsAudioRes.js +213 -0
- package/dist/resource/audio/CjsAudioRes.js.map +1 -0
- package/dist/resource/audio/index.js +4 -0
- package/dist/resource/audio/index.js.map +1 -0
- package/dist/{resources → resource/geometry}/MeshDecalData.js +1 -1
- package/dist/resource/geometry/MeshDecalData.js.map +1 -0
- package/dist/{resources → resource/geometry}/MeshDecalLodData.js +1 -1
- package/dist/resource/geometry/MeshDecalLodData.js.map +1 -0
- package/dist/resource/geometry/TriGeometryRes.js +656 -0
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResAreaData.js +1 -1
- package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResJointData.js +1 -1
- package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResLodData.js +1 -1
- package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResMeshData.js +1 -1
- package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResSkeletonData.js +1 -1
- package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriJointBinding.js +1 -1
- package/dist/resource/geometry/TriJointBinding.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriMorphTargetGeometryConstants.js +1 -1
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriRtGeometryConstants.js +1 -1
- package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/GStateBindingCallbackData.js +1 -1
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/Tr2GrannyIntersectionResult.js +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/Tr2GrannyStateRes.js +6 -5
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/TriGrannyRes.js +6 -5
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/enums.js +1 -9
- package/dist/resource/geometry/granny/enums.js.map +1 -0
- package/dist/resource/geometry/granny/index.js +6 -0
- package/dist/resource/geometry/granny/index.js.map +1 -0
- package/dist/resource/geometry/index.js +17 -0
- package/dist/resource/geometry/index.js.map +1 -0
- package/dist/resource/index.js +52 -0
- package/dist/resource/index.js.map +1 -0
- package/dist/resource/resourceBoundary.js +64 -0
- package/dist/resource/resourceBoundary.js.map +1 -0
- package/dist/resource/shader/Tr2EffectRes.js +420 -0
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2MaterialArea.js +9 -4
- package/dist/resource/shader/Tr2MaterialArea.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2MaterialMesh.js +8 -3
- package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2MaterialRes.js +10 -4
- package/dist/resource/shader/Tr2MaterialRes.js.map +1 -0
- package/dist/resource/shader/Tr2Shader.js +250 -0
- package/dist/resource/shader/Tr2Shader.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2ShaderPermutation.js +13 -7
- package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -0
- package/dist/resource/shader/index.js +17 -0
- package/dist/resource/shader/index.js.map +1 -0
- package/dist/resource/shader/portable.js +33 -0
- package/dist/resource/shader/portable.js.map +1 -0
- package/dist/resource/shader/portableValidation.js +461 -0
- package/dist/resource/shader/portableValidation.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +100 -0
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectDefine.js +34 -0
- package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +113 -0
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +141 -0
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +107 -0
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectResource.js +90 -0
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +235 -0
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +71 -0
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2Pass.js +111 -0
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +80 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -0
- package/dist/{texture → resource/texture}/CjsTextureArrayRes.js +83 -6
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -0
- package/dist/{texture/CjsTextureParameterProxy.js → resource/texture/CjsTextureArrayResParameterProxy.js} +56 -10
- package/dist/resource/texture/CjsTextureArrayResParameterProxy.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2ImageRes.js +6 -4
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TextureLodManager.js +3 -1
- package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TextureLodUpdateRequest.js +1 -1
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePackChannel.js +1 -1
- package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipeline.js +6 -4
- package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineParams.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepCompress.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepGenerateMips.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLimitSize.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLoad.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepPack.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -0
- package/dist/{resources → resource/texture}/TriTextureRes.js +42 -26
- package/dist/resource/texture/TriTextureRes.js.map +1 -0
- package/dist/resource/texture/index.js +15 -0
- package/dist/resource/texture/index.js.map +1 -0
- package/dist/{resources → resource/texture}/texturePipelineBehavior.js +59 -59
- package/dist/resource/texture/texturePipelineBehavior.js.map +1 -0
- package/dist/worker/CjsResManMainThreadLoader.js +87 -0
- package/dist/worker/CjsResManMainThreadLoader.js.map +1 -0
- package/dist/worker/CjsResManWorker.js +217 -0
- package/dist/worker/CjsResManWorker.js.map +1 -0
- package/dist/worker/CjsResManWorkerLoader.js +434 -0
- package/dist/worker/CjsResManWorkerLoader.js.map +1 -0
- package/dist/worker/protocol.js +12 -0
- package/dist/worker/protocol.js.map +1 -0
- package/docs/README.md +16 -3
- package/docs/architecture.md +39 -16
- package/docs/concepts/resource-lifecycle.md +2 -1
- package/docs/formats/README.md +4 -0
- package/docs/reference/classes/README.md +6 -4
- package/docs/reference/classes/audio.md +30 -0
- package/docs/reference/classes/core.md +31 -11
- package/docs/reference/classes/resources.md +151 -41
- package/docs/reference/classes/texture.md +7 -7
- package/docs/reference/motherlode-cache.md +17 -0
- package/docs/reference/queues.md +9 -1
- package/docs/reference/workers.md +135 -0
- package/docs/roadmap.md +27 -1
- package/package.json +8 -1
- package/dist/CjsResManQueue.js.map +0 -1
- package/dist/CjsResource.js.map +0 -1
- package/dist/CjsResourceSource.js +0 -68
- package/dist/CjsResourceSource.js.map +0 -1
- package/dist/resourcePath.js +0 -18
- package/dist/resourcePath.js.map +0 -1
- package/dist/resourceStates.js +0 -9
- package/dist/resourceStates.js.map +0 -1
- package/dist/resources/AudioGeometryResData.js.map +0 -1
- package/dist/resources/GStateBindingCallbackData.js.map +0 -1
- package/dist/resources/MeshDecalData.js.map +0 -1
- package/dist/resources/MeshDecalLodData.js.map +0 -1
- package/dist/resources/Tr2EffectRes.js +0 -71
- package/dist/resources/Tr2EffectRes.js.map +0 -1
- package/dist/resources/Tr2GrannyIntersectionResult.js.map +0 -1
- package/dist/resources/Tr2GrannyStateRes.js.map +0 -1
- package/dist/resources/Tr2ImageRes.js.map +0 -1
- package/dist/resources/Tr2LightProfileRes.js.map +0 -1
- package/dist/resources/Tr2MaterialArea.js.map +0 -1
- package/dist/resources/Tr2MaterialMesh.js.map +0 -1
- package/dist/resources/Tr2MaterialRes.js.map +0 -1
- package/dist/resources/Tr2ShaderPermutation.js.map +0 -1
- package/dist/resources/Tr2TextureLodManager.js.map +0 -1
- package/dist/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
- package/dist/resources/Tr2TexturePackChannel.js.map +0 -1
- package/dist/resources/Tr2TexturePipeline.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineParams.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepGenerateMips.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepPack.js.map +0 -1
- package/dist/resources/TriGeometryRes.js +0 -239
- package/dist/resources/TriGeometryRes.js.map +0 -1
- package/dist/resources/TriGeometryResAreaData.js.map +0 -1
- package/dist/resources/TriGeometryResJointData.js.map +0 -1
- package/dist/resources/TriGeometryResLodData.js.map +0 -1
- package/dist/resources/TriGeometryResMeshData.js.map +0 -1
- package/dist/resources/TriGeometryResSkeletonData.js.map +0 -1
- package/dist/resources/TriGrannyRes.js.map +0 -1
- package/dist/resources/TriJointBinding.js.map +0 -1
- package/dist/resources/TriMorphTargetGeometryConstants.js.map +0 -1
- package/dist/resources/TriRtGeometryConstants.js.map +0 -1
- package/dist/resources/TriTextureRes.js.map +0 -1
- package/dist/resources/enums.js.map +0 -1
- package/dist/resources/resourceBoundary.js +0 -47
- package/dist/resources/resourceBoundary.js.map +0 -1
- package/dist/resources/texturePipelineBehavior.js.map +0 -1
- package/dist/texture/CjsTextureArrayRes.js.map +0 -1
- package/dist/texture/CjsTextureParameterProxy.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceBoundary.js","sources":["../../../src/resource/resourceBoundary.js"],"sourcesContent":["/**\n * Creates a coded error at a public resource API boundary for the resource\n * payload lifecycle.\n */\nexport function resourceBoundaryError(className, methodName, reason) {\n const error = new Error(`${className}.${methodName} is owned by engine adapters in CarbonEngineJS. ${reason || \"\"}`.trim());\n error.code = \"CJS_RESOURCE_ENGINE_BOUNDARY\";\n error.className = className;\n error.methodName = methodName;\n return error;\n}\n\n/**\n * Creates a coded error for an invalid resource payload for the resource payload\n * lifecycle.\n */\nexport function resourcePayloadError(className, reason, field = \"\", cause = null) {\n const location = field ? `${className} payload.${field}` : `${className} payload`;\n const error = new TypeError(`${location} is invalid. ${reason || \"\"}`.trim());\n error.code = \"CJS_RESOURCE_PAYLOAD_INVALID\";\n error.className = className;\n error.field = field;\n if (cause) error.cause = cause;\n return error;\n}\n\n/**\n * Validates that a resource payload is a plain object for the resource payload\n * lifecycle.\n */\nexport function assertResourcePayloadObject(className, payload) {\n if (!payload || typeof payload !== \"object\" || Array.isArray(payload)\n || payload instanceof ArrayBuffer || ArrayBuffer.isView(payload)) {\n throw resourcePayloadError(className, \"Expected a plain payload object.\");\n }\n return payload;\n}\n\n/**\n * Validates that a resource payload field is an array for the resource payload\n * lifecycle.\n */\nexport function assertResourcePayloadArray(className, payload, field) {\n if (!Array.isArray(payload[field])) {\n throw resourcePayloadError(className, \"Expected an array.\", field);\n }\n return payload[field];\n}\n\n/**\n * Validates a resource payload against the supplied field contract for the\n * resource payload lifecycle.\n */\nexport function validateResourcePayload(className, payload, validator) {\n assertResourcePayloadObject(className, payload);\n try {\n return validator(payload);\n } catch (cause) {\n if (cause?.code === \"CJS_RESOURCE_PAYLOAD_INVALID\") throw cause;\n throw resourcePayloadError(className, cause?.message || \"Validation failed.\", \"\", cause);\n }\n}\n"],"names":["resourceBoundaryError","className","methodName","reason","error","Error","trim","code","resourcePayloadError","field","cause","location","TypeError","assertResourcePayloadObject","payload","Array","isArray","ArrayBuffer","isView","assertResourcePayloadArray","validateResourcePayload","validator","message"],"mappings":"AAAA;AACA;AACA;AACA;AACO,SAASA,qBAAqBA,CAACC,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAE;AACnE,EAAA,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,EAAGJ,SAAS,CAAA,CAAA,EAAIC,UAAU,CAAA,gDAAA,EAAmDC,MAAM,IAAI,EAAE,CAAA,CAAE,CAACG,IAAI,EAAE,CAAC;EAC3HF,KAAK,CAACG,IAAI,GAAG,8BAA8B;EAC3CH,KAAK,CAACH,SAAS,GAAGA,SAAS;EAC3BG,KAAK,CAACF,UAAU,GAAGA,UAAU;AAC7B,EAAA,OAAOE,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACO,SAASI,oBAAoBA,CAACP,SAAS,EAAEE,MAAM,EAAEM,KAAK,GAAG,EAAE,EAAEC,KAAK,GAAG,IAAI,EAAE;AAChF,EAAA,MAAMC,QAAQ,GAAGF,KAAK,GAAG,CAAA,EAAGR,SAAS,CAAA,SAAA,EAAYQ,KAAK,CAAA,CAAE,GAAG,CAAA,EAAGR,SAAS,CAAA,QAAA,CAAU;AACjF,EAAA,MAAMG,KAAK,GAAG,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AEH,IAAI,KAAK,8BAA8B,EAAE,MAAMG,KAAK;AAC/D,IAAA,MAAMF,oBAAoB,CAACP,SAAS,EAAES,KAAK,EAAEY,OAAO,IAAI,oBAAoB,EAAE,EAAE,EAAEZ,KAAK,CAAC;AAC1F,EAAA;AACF;;;;"}
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { identity as _identity, applyDecs2311 as _applyDecs2311 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { carbon, impl, type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
|
+
import { CjsResource as _CjsResource } from '../CjsResource.js';
|
|
4
|
+
import { validateResourcePayload } from '../resourceBoundary.js';
|
|
5
|
+
import { Tr2Shader as _Tr2Shader } from './Tr2Shader.js';
|
|
6
|
+
|
|
7
|
+
let _initProto, _initClass;
|
|
8
|
+
const globalEffectOptions = [];
|
|
9
|
+
const SHA256 = /^[0-9a-f]{64}$/u;
|
|
10
|
+
const UINT8_MAX = 0xff;
|
|
11
|
+
const UINT32_MAX = 0xffffffff;
|
|
12
|
+
const MAX_EFFECT_PERMUTATIONS = 0x10000;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Tr2EffectRes resource record.
|
|
16
|
+
*
|
|
17
|
+
* This stores effect/shader payload facts. Engine-gpu decides shader module,
|
|
18
|
+
* pipeline, bind group, and sampler realization.
|
|
19
|
+
*/
|
|
20
|
+
let _Tr2EffectRes;
|
|
21
|
+
new class extends _identity {
|
|
22
|
+
static [class Tr2EffectRes extends _CjsResource {
|
|
23
|
+
static {
|
|
24
|
+
({
|
|
25
|
+
e: [_initProto],
|
|
26
|
+
c: [_Tr2EffectRes, _initClass]
|
|
27
|
+
} = _applyDecs2311(this, [type.define({
|
|
28
|
+
className: "Tr2EffectRes",
|
|
29
|
+
family: "resources"
|
|
30
|
+
})], [[[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Carbon reads the selected body directly from compiled effect bytes and registers renderer handles; CarbonEngineJS hydrates the format package's validated portable reflection without realizing GPU state.")], 18, "GetShader"], [[impl, impl.custom, void 0, impl.reason("Carbon selects compiled bodies through GetShader; CarbonEngineJS exposes exact package-index hydration for deterministic package consumers and tests.")], 18, "GetShaderByIndex"], [[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Carbon exposes a Python tuple through Blue; CarbonEngineJS returns a JSON-friendly plain axis description.")], 18, "GetPermutationDescription"], [[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Backend resources are engine-owned; the resource-side release clears only hydrated device-free shader graphs.")], 18, "ReleaseResources"]], 0, void 0, _CjsResource));
|
|
31
|
+
}
|
|
32
|
+
#shaders = (_initProto(this), new Map());
|
|
33
|
+
|
|
34
|
+
/** Creates a Tr2EffectRes with caller-provided initial state. */
|
|
35
|
+
constructor(values = null) {
|
|
36
|
+
super();
|
|
37
|
+
this.SetValues(values || {}, {
|
|
38
|
+
markDirty: false,
|
|
39
|
+
skipUpdate: true,
|
|
40
|
+
skipEvents: true
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Attach a plain shader/effect payload.
|
|
46
|
+
*
|
|
47
|
+
* @param {object|null} payload
|
|
48
|
+
* @param {object|null} options
|
|
49
|
+
* @returns {Tr2EffectRes}
|
|
50
|
+
*/
|
|
51
|
+
SetPayload(payload = null, options = null) {
|
|
52
|
+
if (payload === null) {
|
|
53
|
+
this.#shaders.clear();
|
|
54
|
+
super.SetPayload(null);
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
validateResourcePayload("Tr2EffectRes", payload, validateEffectPayload);
|
|
58
|
+
this.#shaders.clear();
|
|
59
|
+
super.SetPayload(payload);
|
|
60
|
+
this.SetValues(options || {});
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Select and hydrate one canonical shader from the complete permutation
|
|
66
|
+
* graph exposed by a CEWG/CEWGPU raw package.
|
|
67
|
+
*
|
|
68
|
+
* Global options have Carbon-compatible precedence over caller options.
|
|
69
|
+
* Unknown option values retain the authored default.
|
|
70
|
+
*
|
|
71
|
+
* @param {Array<object>|Map<string,string>} options Local name/value choices.
|
|
72
|
+
* @param {number|null} count Number of local entries to consider.
|
|
73
|
+
* @returns {Tr2Shader|null} Selected device-free shader reflection.
|
|
74
|
+
*/
|
|
75
|
+
GetShader(options = [], count = null) {
|
|
76
|
+
const axes = getPermutationAxes(this.GetPayload());
|
|
77
|
+
if (!axes.length) {
|
|
78
|
+
const portableIndex = _Tr2Shader.isPortableReflection(this.GetPayload()) ? this.GetPayload().permutationIndex : 0;
|
|
79
|
+
return this.GetShaderByIndex(portableIndex);
|
|
80
|
+
}
|
|
81
|
+
const localOptions = normalizeShaderOptions(options);
|
|
82
|
+
const localCount = Number.isSafeInteger(count) ? Math.max(0, Math.min(count, localOptions.length)) : localOptions.length;
|
|
83
|
+
let multiplier = 1;
|
|
84
|
+
let index = 0;
|
|
85
|
+
for (const axis of axes) {
|
|
86
|
+
let selectedIndex = axis.defaultOption;
|
|
87
|
+
const globalOption = globalEffectOptions.find(option => option.name === axis.name);
|
|
88
|
+
if (globalOption) {
|
|
89
|
+
const requestedIndex = axis.options.indexOf(globalOption.value);
|
|
90
|
+
if (requestedIndex >= 0) {
|
|
91
|
+
selectedIndex = requestedIndex;
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
for (let optionIndex = 0; optionIndex < localCount; optionIndex += 1) {
|
|
95
|
+
const localOption = localOptions[optionIndex];
|
|
96
|
+
if (localOption.name !== axis.name) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const requestedIndex = axis.options.indexOf(localOption.value);
|
|
100
|
+
if (requestedIndex >= 0) {
|
|
101
|
+
selectedIndex = requestedIndex;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
index += selectedIndex * multiplier;
|
|
106
|
+
multiplier *= axis.options.length;
|
|
107
|
+
}
|
|
108
|
+
return this.GetShaderByIndex(index);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Hydrate one exact permutation-table index and cache the resulting runtime
|
|
113
|
+
* graph for this payload.
|
|
114
|
+
*
|
|
115
|
+
* @param {number} index Exact permutation index.
|
|
116
|
+
* @returns {Tr2Shader|null} Canonical shader or null when reflection is absent.
|
|
117
|
+
*/
|
|
118
|
+
GetShaderByIndex(index) {
|
|
119
|
+
if (!Number.isSafeInteger(index) || index < 0) {
|
|
120
|
+
throw new TypeError("Tr2EffectRes shader index must be a non-negative safe integer");
|
|
121
|
+
}
|
|
122
|
+
if (this.#shaders.has(index)) {
|
|
123
|
+
return this.#shaders.get(index);
|
|
124
|
+
}
|
|
125
|
+
const payload = this.GetPayload();
|
|
126
|
+
const variantCount = getPermutationVariantCount(payload);
|
|
127
|
+
if (variantCount !== null && index >= variantCount) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const portable = getPortableReflection(payload, index);
|
|
131
|
+
if (!portable) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
if (portable.permutationIndex !== index) {
|
|
135
|
+
throw new Error(`Portable effect reflection index ${portable.permutationIndex} does not match requested index ${index}`);
|
|
136
|
+
}
|
|
137
|
+
const shader = _Tr2Shader.fromPortable(portable);
|
|
138
|
+
this.#shaders.set(index, shader);
|
|
139
|
+
return shader;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Return a small JSON-friendly permutation description.
|
|
144
|
+
*
|
|
145
|
+
* @returns {Array<*>}
|
|
146
|
+
*/
|
|
147
|
+
GetPermutationDescription() {
|
|
148
|
+
const payload = this.GetPayload();
|
|
149
|
+
const axes = getPermutationAxes(payload);
|
|
150
|
+
if (!axes.length && Array.isArray(payload?.permutations)) {
|
|
151
|
+
return payload.permutations.map(permutation => ({
|
|
152
|
+
...permutation
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
return axes.map(axis => ({
|
|
156
|
+
name: axis.name,
|
|
157
|
+
options: [...axis.options],
|
|
158
|
+
defaultOption: axis.defaultOption,
|
|
159
|
+
description: axis.description,
|
|
160
|
+
type: axis.type
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Drop hydrated shader graphs while retaining the validated CPU payload.
|
|
166
|
+
*/
|
|
167
|
+
ReleaseResources() {
|
|
168
|
+
this.#shaders.clear();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Release the payload and every shader graph hydrated from it. */
|
|
172
|
+
ReleasePayload() {
|
|
173
|
+
this.#shaders.clear();
|
|
174
|
+
return super.ReleasePayload();
|
|
175
|
+
}
|
|
176
|
+
}];
|
|
177
|
+
payload = "shader";
|
|
178
|
+
constructor() {
|
|
179
|
+
super(_Tr2EffectRes), _initClass();
|
|
180
|
+
}
|
|
181
|
+
}();
|
|
182
|
+
function ModifyGlobalEffectOptions(changes = []) {
|
|
183
|
+
for (const change of normalizeShaderOptions(changes)) {
|
|
184
|
+
const index = globalEffectOptions.findIndex(option => option.name === change.name);
|
|
185
|
+
if (!change.value) {
|
|
186
|
+
if (index >= 0) {
|
|
187
|
+
globalEffectOptions.splice(index, 1);
|
|
188
|
+
}
|
|
189
|
+
} else if (index >= 0) {
|
|
190
|
+
globalEffectOptions[index] = change;
|
|
191
|
+
} else {
|
|
192
|
+
globalEffectOptions.push(change);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Return an owned snapshot of the current global option overrides.
|
|
199
|
+
*
|
|
200
|
+
* @returns {Array<{name:string,value:string}>} Global option choices.
|
|
201
|
+
*/
|
|
202
|
+
function GetGlobalEffectOptions() {
|
|
203
|
+
return globalEffectOptions.map(option => ({
|
|
204
|
+
...option
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
function validateEffectPayload(payload) {
|
|
208
|
+
const graph = payload.permutationGraph;
|
|
209
|
+
if (graph !== null && graph !== undefined) {
|
|
210
|
+
validatePermutationGraph(graph);
|
|
211
|
+
} else if (Array.isArray(payload.permutations)) {
|
|
212
|
+
if (payload.permutations.every(permutation => Array.isArray(permutation?.options))) {
|
|
213
|
+
payload.permutations.forEach(normalizePermutationAxis);
|
|
214
|
+
} else {
|
|
215
|
+
validateLegacyPermutationDescription(payload.permutations);
|
|
216
|
+
}
|
|
217
|
+
} else if (!_Tr2Shader.isPortableReflection(payload)) {
|
|
218
|
+
throw new TypeError("Tr2EffectRes payload requires a complete permutation graph, permutations array, or one portable reflection");
|
|
219
|
+
}
|
|
220
|
+
if (Array.isArray(payload.portableReflections)) {
|
|
221
|
+
const expectedCount = getPermutationVariantCount(payload);
|
|
222
|
+
if (expectedCount !== null && payload.portableReflections.length !== expectedCount) {
|
|
223
|
+
throw new Error("Tr2EffectRes portable reflection count disagrees with its permutations");
|
|
224
|
+
}
|
|
225
|
+
payload.portableReflections.forEach((reflection, index) => {
|
|
226
|
+
if (!_Tr2Shader.isPortableReflection(reflection) || reflection.permutationIndex !== index) {
|
|
227
|
+
throw new Error(`Tr2EffectRes portable reflection ${index} is malformed`);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function validateLegacyPermutationDescription(permutations) {
|
|
233
|
+
for (const [index, permutation] of permutations.entries()) {
|
|
234
|
+
if (!permutation || typeof permutation !== "object" || Array.isArray(permutation) || typeof permutation.name !== "string" || !permutation.name) {
|
|
235
|
+
throw new TypeError(`Tr2EffectRes legacy permutation ${index} is malformed`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function validatePermutationGraph(graph) {
|
|
240
|
+
if (!graph || typeof graph !== "object" || Array.isArray(graph) || graph.format !== "CJS_EFFECT_PERMUTATION_GRAPH" || graph.formatVersion !== 1 || !graph.coverage || typeof graph.coverage !== "object" || Array.isArray(graph.coverage) || graph.coverage.permutations !== "complete" || graph.coverage.bodies !== "identity-only" || graph.coverage.reflection !== "absent" || !Array.isArray(graph.axes) || !Array.isArray(graph.variants) || !Array.isArray(graph.bodies)) {
|
|
241
|
+
throw new TypeError("Tr2EffectRes requires CJS_EFFECT_PERMUTATION_GRAPH version 1");
|
|
242
|
+
}
|
|
243
|
+
const axisNames = new Set();
|
|
244
|
+
const axes = graph.axes.map((axis, index) => validatePermutationAxis(axis, index, axisNames));
|
|
245
|
+
const expectedCount = getPermutationProduct(axes);
|
|
246
|
+
if (graph.variants.length !== expectedCount || !graph.bodies.length || graph.bodies.length > graph.variants.length) {
|
|
247
|
+
throw new Error("Tr2EffectRes permutation graph requires complete variants and bodies");
|
|
248
|
+
}
|
|
249
|
+
const bodies = new Map();
|
|
250
|
+
const bodyDigests = new Set();
|
|
251
|
+
graph.bodies.forEach((body, bodyIndex) => {
|
|
252
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || typeof body.key !== "string" || !body.key || body.key !== body.key.trim() || !Number.isSafeInteger(body.byteLength) || body.byteLength < 1 || body.byteLength > UINT32_MAX || typeof body.sha256 !== "string" || !SHA256.test(body.sha256) || bodies.has(body.key) || bodyDigests.has(body.sha256)) {
|
|
253
|
+
throw new Error(`Tr2EffectRes permutation body ${bodyIndex} is malformed or duplicated`);
|
|
254
|
+
}
|
|
255
|
+
bodyDigests.add(body.sha256);
|
|
256
|
+
bodies.set(body.key, {
|
|
257
|
+
byteLength: body.byteLength,
|
|
258
|
+
references: 0
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
const bodyKeyBySourceRecord = new Map();
|
|
262
|
+
const sourceRecords = [];
|
|
263
|
+
graph.variants.forEach((variant, permutationIndex) => {
|
|
264
|
+
const expectedOptions = decodePermutationOptions(permutationIndex, axes);
|
|
265
|
+
if (!variant || typeof variant !== "object" || Array.isArray(variant) || variant.permutationIndex !== permutationIndex || !Array.isArray(variant.optionIndices) || variant.optionIndices.length !== expectedOptions.length || variant.optionIndices.some((value, index) => value !== expectedOptions[index]) || typeof variant.bodyKey !== "string" || !bodies.has(variant.bodyKey)) {
|
|
266
|
+
throw new Error(`Tr2EffectRes permutation variant ${permutationIndex} is malformed`);
|
|
267
|
+
}
|
|
268
|
+
const sourceRecord = validatePermutationSourceRecord(variant.sourceRecord, permutationIndex);
|
|
269
|
+
const body = bodies.get(variant.bodyKey);
|
|
270
|
+
if (sourceRecord.byteLength !== body.byteLength) {
|
|
271
|
+
throw new Error(`Tr2EffectRes permutation variant ${permutationIndex} body length disagrees`);
|
|
272
|
+
}
|
|
273
|
+
const recordKey = `${sourceRecord.offset}:${sourceRecord.byteLength}`;
|
|
274
|
+
const existingBodyKey = bodyKeyBySourceRecord.get(recordKey);
|
|
275
|
+
if (existingBodyKey && existingBodyKey !== variant.bodyKey) {
|
|
276
|
+
throw new Error(`Tr2EffectRes source record ${recordKey} maps to multiple bodies`);
|
|
277
|
+
}
|
|
278
|
+
bodyKeyBySourceRecord.set(recordKey, variant.bodyKey);
|
|
279
|
+
sourceRecords.push(sourceRecord);
|
|
280
|
+
body.references += 1;
|
|
281
|
+
});
|
|
282
|
+
validateDisjointPermutationRecords(sourceRecords);
|
|
283
|
+
for (const [bodyKey, body] of bodies) {
|
|
284
|
+
if (!body.references) {
|
|
285
|
+
throw new Error(`Tr2EffectRes permutation body ${bodyKey} is unreferenced`);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function validatePermutationAxis(axis, index, names) {
|
|
290
|
+
if (!axis || typeof axis !== "object" || Array.isArray(axis) || axis.index !== index || typeof axis.name !== "string" || !axis.name || axis.name !== axis.name.trim() || names.has(axis.name) || !Array.isArray(axis.options) || !axis.options.length || axis.options.length > UINT8_MAX || !Number.isSafeInteger(axis.defaultOption) || axis.defaultOption < 0 || axis.defaultOption >= axis.options.length || typeof axis.description !== "string" || !Number.isSafeInteger(axis.type) || axis.type < 0 || axis.type > UINT8_MAX) {
|
|
291
|
+
throw new Error(`Tr2EffectRes permutation axis ${index} is malformed or duplicated`);
|
|
292
|
+
}
|
|
293
|
+
names.add(axis.name);
|
|
294
|
+
const options = new Set();
|
|
295
|
+
for (const option of axis.options) {
|
|
296
|
+
if (typeof option !== "string" || !option || option !== option.trim() || options.has(option)) {
|
|
297
|
+
throw new Error(`Tr2EffectRes permutation axis ${index} options are malformed`);
|
|
298
|
+
}
|
|
299
|
+
options.add(option);
|
|
300
|
+
}
|
|
301
|
+
return normalizePermutationAxis(axis);
|
|
302
|
+
}
|
|
303
|
+
function getPermutationProduct(axes) {
|
|
304
|
+
let product = 1;
|
|
305
|
+
for (const axis of axes) {
|
|
306
|
+
product *= axis.options.length;
|
|
307
|
+
if (!Number.isSafeInteger(product) || product < 1 || product > MAX_EFFECT_PERMUTATIONS) {
|
|
308
|
+
throw new Error("Tr2EffectRes permutation count exceeds the implementation limit");
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return product;
|
|
312
|
+
}
|
|
313
|
+
function decodePermutationOptions(permutationIndex, axes) {
|
|
314
|
+
let value = permutationIndex;
|
|
315
|
+
return axes.map(axis => {
|
|
316
|
+
const optionIndex = value % axis.options.length;
|
|
317
|
+
value = Math.floor(value / axis.options.length);
|
|
318
|
+
return optionIndex;
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function validatePermutationSourceRecord(record, permutationIndex) {
|
|
322
|
+
const offset = record?.offset;
|
|
323
|
+
const byteLength = record?.byteLength;
|
|
324
|
+
const end = offset + byteLength;
|
|
325
|
+
if (!record || typeof record !== "object" || Array.isArray(record) || !Number.isSafeInteger(offset) || offset < 0 || offset > UINT32_MAX || !Number.isSafeInteger(byteLength) || byteLength < 1 || byteLength > UINT32_MAX || !Number.isSafeInteger(end) || end > UINT32_MAX + 1) {
|
|
326
|
+
throw new Error(`Tr2EffectRes permutation variant ${permutationIndex} source record is malformed`);
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
offset,
|
|
330
|
+
byteLength
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function validateDisjointPermutationRecords(records) {
|
|
334
|
+
const unique = new Map();
|
|
335
|
+
for (const record of records) {
|
|
336
|
+
const key = `${record.offset}:${record.byteLength}`;
|
|
337
|
+
if (!unique.has(key)) {
|
|
338
|
+
unique.set(key, {
|
|
339
|
+
offset: record.offset,
|
|
340
|
+
end: record.offset + record.byteLength
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const ordered = Array.from(unique.values()).sort((left, right) => left.offset - right.offset || left.end - right.end);
|
|
345
|
+
for (let index = 1; index < ordered.length; index += 1) {
|
|
346
|
+
if (ordered[index].offset < ordered[index - 1].end) {
|
|
347
|
+
throw new Error("Tr2EffectRes permutation source body records partially overlap");
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function getPermutationAxes(payload) {
|
|
352
|
+
if (!payload) {
|
|
353
|
+
return [];
|
|
354
|
+
}
|
|
355
|
+
if (payload.permutationGraph) {
|
|
356
|
+
return payload.permutationGraph.axes.map(normalizePermutationAxis);
|
|
357
|
+
}
|
|
358
|
+
if (Array.isArray(payload.permutations) && payload.permutations.every(permutation => Array.isArray(permutation?.options))) {
|
|
359
|
+
return payload.permutations.map(normalizePermutationAxis);
|
|
360
|
+
}
|
|
361
|
+
return [];
|
|
362
|
+
}
|
|
363
|
+
function normalizePermutationAxis(axis) {
|
|
364
|
+
if (!axis || typeof axis !== "object" || Array.isArray(axis) || typeof axis.name !== "string" || !axis.name || !Array.isArray(axis.options) || !axis.options.length || axis.options.some(option => typeof option !== "string" || !option) || !Number.isSafeInteger(axis.defaultOption) || axis.defaultOption < 0 || axis.defaultOption >= axis.options.length) {
|
|
365
|
+
throw new TypeError("Tr2EffectRes permutation axis is malformed");
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
name: axis.name,
|
|
369
|
+
options: [...axis.options],
|
|
370
|
+
defaultOption: axis.defaultOption,
|
|
371
|
+
description: String(axis.description ?? ""),
|
|
372
|
+
type: Number(axis.type ?? 0)
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
function getPermutationVariantCount(payload) {
|
|
376
|
+
if (Array.isArray(payload?.permutationGraph?.variants)) {
|
|
377
|
+
return payload.permutationGraph.variants.length;
|
|
378
|
+
}
|
|
379
|
+
const axes = getPermutationAxes(payload);
|
|
380
|
+
if (axes.length) {
|
|
381
|
+
return axes.reduce((count, axis) => count * axis.options.length, 1);
|
|
382
|
+
}
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
function getPortableReflection(payload, index) {
|
|
386
|
+
if (!payload) {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
if (typeof payload.GetPortableEffectReflection === "function") {
|
|
390
|
+
return payload.GetPortableEffectReflection(index);
|
|
391
|
+
}
|
|
392
|
+
if (typeof payload.getPortableEffectReflection === "function") {
|
|
393
|
+
return payload.getPortableEffectReflection(index);
|
|
394
|
+
}
|
|
395
|
+
if (_Tr2Shader.isPortableReflection(payload)) {
|
|
396
|
+
return index === payload.permutationIndex ? payload : null;
|
|
397
|
+
}
|
|
398
|
+
if (Array.isArray(payload.portableReflections)) {
|
|
399
|
+
return payload.portableReflections[index] ?? null;
|
|
400
|
+
}
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
function normalizeShaderOptions(options) {
|
|
404
|
+
if (options instanceof Map) {
|
|
405
|
+
return Array.from(options, ([name, value]) => ({
|
|
406
|
+
name: String(name),
|
|
407
|
+
value: String(value)
|
|
408
|
+
}));
|
|
409
|
+
}
|
|
410
|
+
if (!Array.isArray(options)) {
|
|
411
|
+
return [];
|
|
412
|
+
}
|
|
413
|
+
return options.map(option => ({
|
|
414
|
+
name: String(option?.name ?? ""),
|
|
415
|
+
value: String(option?.value ?? "")
|
|
416
|
+
}));
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export { GetGlobalEffectOptions, ModifyGlobalEffectOptions, _Tr2EffectRes as Tr2EffectRes };
|
|
420
|
+
//# sourceMappingURL=Tr2EffectRes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2EffectRes.js","sources":["../../../../src/resource/shader/Tr2EffectRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2EffectRes.h\n// Source: trinity/trinity/Resources/Tr2EffectRes.cpp\n// Source: trinity/trinity/Resources/Tr2EffectRes_Blue.cpp\nimport { carbon, impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport { validateResourcePayload } from \"../resourceBoundary.js\";\nimport { Tr2Shader } from \"./Tr2Shader.js\";\n\nconst globalEffectOptions = [];\nconst SHA256 = /^[0-9a-f]{64}$/u;\nconst UINT8_MAX = 0xff;\nconst UINT32_MAX = 0xffffffff;\nconst MAX_EFFECT_PERMUTATIONS = 0x10000;\n\n/**\n * Tr2EffectRes resource record.\n *\n * This stores effect/shader payload facts. Engine-gpu decides shader module,\n * pipeline, bind group, and sampler realization.\n */\n@type.define({ className: \"Tr2EffectRes\", family: \"resources\" })\nexport class Tr2EffectRes extends CjsResource\n{\n\n #shaders = new Map();\n\n /** Creates a Tr2EffectRes with caller-provided initial state. */\n constructor(values = null)\n {\n super();\n this.SetValues(values || {}, {\n markDirty: false,\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * Attach a plain shader/effect payload.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {Tr2EffectRes}\n */\n SetPayload(payload = null, options = null)\n {\n if (payload === null)\n {\n this.#shaders.clear();\n super.SetPayload(null);\n return this;\n }\n validateResourcePayload(\n \"Tr2EffectRes\",\n payload,\n validateEffectPayload\n );\n this.#shaders.clear();\n super.SetPayload(payload);\n this.SetValues(options || {});\n return this;\n }\n\n /**\n * Select and hydrate one canonical shader from the complete permutation\n * graph exposed by a CEWG/CEWGPU raw package.\n *\n * Global options have Carbon-compatible precedence over caller options.\n * Unknown option values retain the authored default.\n *\n * @param {Array<object>|Map<string,string>} options Local name/value choices.\n * @param {number|null} count Number of local entries to consider.\n * @returns {Tr2Shader|null} Selected device-free shader reflection.\n */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Carbon reads the selected body directly from compiled effect bytes and registers renderer handles; CarbonEngineJS hydrates the format package's validated portable reflection without realizing GPU state.\")\n GetShader(options = [], count = null)\n {\n const axes = getPermutationAxes(this.GetPayload());\n if (!axes.length)\n {\n const portableIndex = Tr2Shader.isPortableReflection(this.GetPayload())\n ? this.GetPayload().permutationIndex\n : 0;\n return this.GetShaderByIndex(portableIndex);\n }\n const localOptions = normalizeShaderOptions(options);\n const localCount = Number.isSafeInteger(count)\n ? Math.max(0, Math.min(count, localOptions.length))\n : localOptions.length;\n let multiplier = 1;\n let index = 0;\n\n for (const axis of axes)\n {\n let selectedIndex = axis.defaultOption;\n const globalOption = globalEffectOptions.find(\n option => option.name === axis.name\n );\n if (globalOption)\n {\n const requestedIndex = axis.options.indexOf(globalOption.value);\n if (requestedIndex >= 0)\n {\n selectedIndex = requestedIndex;\n }\n }\n else\n {\n for (let optionIndex = 0; optionIndex < localCount; optionIndex += 1)\n {\n const localOption = localOptions[optionIndex];\n if (localOption.name !== axis.name)\n {\n continue;\n }\n const requestedIndex = axis.options.indexOf(localOption.value);\n if (requestedIndex >= 0)\n {\n selectedIndex = requestedIndex;\n }\n }\n }\n\n index += selectedIndex * multiplier;\n multiplier *= axis.options.length;\n }\n\n return this.GetShaderByIndex(index);\n }\n\n /**\n * Hydrate one exact permutation-table index and cache the resulting runtime\n * graph for this payload.\n *\n * @param {number} index Exact permutation index.\n * @returns {Tr2Shader|null} Canonical shader or null when reflection is absent.\n */\n @impl.custom\n @impl.reason(\"Carbon selects compiled bodies through GetShader; CarbonEngineJS exposes exact package-index hydration for deterministic package consumers and tests.\")\n GetShaderByIndex(index)\n {\n if (!Number.isSafeInteger(index) || index < 0)\n {\n throw new TypeError(\n \"Tr2EffectRes shader index must be a non-negative safe integer\"\n );\n }\n if (this.#shaders.has(index))\n {\n return this.#shaders.get(index);\n }\n\n const payload = this.GetPayload();\n const variantCount = getPermutationVariantCount(payload);\n if (variantCount !== null && index >= variantCount)\n {\n return null;\n }\n\n const portable = getPortableReflection(payload, index);\n if (!portable)\n {\n return null;\n }\n if (portable.permutationIndex !== index)\n {\n throw new Error(\n `Portable effect reflection index ${portable.permutationIndex} does not match requested index ${index}`\n );\n }\n\n const shader = Tr2Shader.fromPortable(portable);\n this.#shaders.set(index, shader);\n return shader;\n }\n\n /**\n * Return a small JSON-friendly permutation description.\n *\n * @returns {Array<*>}\n */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Carbon exposes a Python tuple through Blue; CarbonEngineJS returns a JSON-friendly plain axis description.\")\n GetPermutationDescription()\n {\n const payload = this.GetPayload();\n const axes = getPermutationAxes(payload);\n if (!axes.length && Array.isArray(payload?.permutations))\n {\n return payload.permutations.map(permutation => ({ ...permutation }));\n }\n return axes.map(axis => ({\n name: axis.name,\n options: [ ...axis.options ],\n defaultOption: axis.defaultOption,\n description: axis.description,\n type: axis.type\n }));\n }\n\n /**\n * Drop hydrated shader graphs while retaining the validated CPU payload.\n */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Backend resources are engine-owned; the resource-side release clears only hydrated device-free shader graphs.\")\n ReleaseResources()\n {\n this.#shaders.clear();\n }\n\n /** Release the payload and every shader graph hydrated from it. */\n ReleasePayload()\n {\n this.#shaders.clear();\n return super.ReleasePayload();\n }\n\n static payload = \"shader\";\n\n}\n\n/**\n * Merge Carbon-style global effect option overrides.\n *\n * An empty value removes the override. Existing Tr2EffectRes shader caches\n * remain valid objects; callers rebuild effects to request the new selection.\n *\n * @param {Array<object>|Map<string,string>} changes Option changes.\n */\nexport function ModifyGlobalEffectOptions(changes = [])\n{\n for (const change of normalizeShaderOptions(changes))\n {\n const index = globalEffectOptions.findIndex(\n option => option.name === change.name\n );\n if (!change.value)\n {\n if (index >= 0)\n {\n globalEffectOptions.splice(index, 1);\n }\n }\n else if (index >= 0)\n {\n globalEffectOptions[index] = change;\n }\n else\n {\n globalEffectOptions.push(change);\n }\n }\n}\n\n/**\n * Return an owned snapshot of the current global option overrides.\n *\n * @returns {Array<{name:string,value:string}>} Global option choices.\n */\nexport function GetGlobalEffectOptions()\n{\n return globalEffectOptions.map(option => ({ ...option }));\n}\n\nfunction validateEffectPayload(payload)\n{\n const graph = payload.permutationGraph;\n if (graph !== null && graph !== undefined)\n {\n validatePermutationGraph(graph);\n }\n else if (Array.isArray(payload.permutations))\n {\n if (payload.permutations.every(permutation =>\n Array.isArray(permutation?.options)))\n {\n payload.permutations.forEach(normalizePermutationAxis);\n }\n else\n {\n validateLegacyPermutationDescription(payload.permutations);\n }\n }\n else if (!Tr2Shader.isPortableReflection(payload))\n {\n throw new TypeError(\n \"Tr2EffectRes payload requires a complete permutation graph, permutations array, or one portable reflection\"\n );\n }\n\n if (Array.isArray(payload.portableReflections))\n {\n const expectedCount = getPermutationVariantCount(payload);\n if (expectedCount !== null\n && payload.portableReflections.length !== expectedCount)\n {\n throw new Error(\n \"Tr2EffectRes portable reflection count disagrees with its permutations\"\n );\n }\n payload.portableReflections.forEach((reflection, index) =>\n {\n if (!Tr2Shader.isPortableReflection(reflection)\n || reflection.permutationIndex !== index)\n {\n throw new Error(\n `Tr2EffectRes portable reflection ${index} is malformed`\n );\n }\n });\n }\n}\n\nfunction validateLegacyPermutationDescription(permutations)\n{\n for (const [ index, permutation ] of permutations.entries())\n {\n if (!permutation\n || typeof permutation !== \"object\"\n || Array.isArray(permutation)\n || typeof permutation.name !== \"string\"\n || !permutation.name)\n {\n throw new TypeError(\n `Tr2EffectRes legacy permutation ${index} is malformed`\n );\n }\n }\n}\n\nfunction validatePermutationGraph(graph)\n{\n if (!graph || typeof graph !== \"object\" || Array.isArray(graph)\n || graph.format !== \"CJS_EFFECT_PERMUTATION_GRAPH\"\n || graph.formatVersion !== 1\n || !graph.coverage || typeof graph.coverage !== \"object\"\n || Array.isArray(graph.coverage)\n || graph.coverage.permutations !== \"complete\"\n || graph.coverage.bodies !== \"identity-only\"\n || graph.coverage.reflection !== \"absent\"\n || !Array.isArray(graph.axes)\n || !Array.isArray(graph.variants)\n || !Array.isArray(graph.bodies))\n {\n throw new TypeError(\n \"Tr2EffectRes requires CJS_EFFECT_PERMUTATION_GRAPH version 1\"\n );\n }\n\n const axisNames = new Set();\n const axes = graph.axes.map((axis, index) =>\n validatePermutationAxis(axis, index, axisNames));\n const expectedCount = getPermutationProduct(axes);\n if (graph.variants.length !== expectedCount\n || !graph.bodies.length\n || graph.bodies.length > graph.variants.length)\n {\n throw new Error(\n \"Tr2EffectRes permutation graph requires complete variants and bodies\"\n );\n }\n\n const bodies = new Map();\n const bodyDigests = new Set();\n graph.bodies.forEach((body, bodyIndex) =>\n {\n if (!body || typeof body !== \"object\" || Array.isArray(body)\n || typeof body.key !== \"string\" || !body.key\n || body.key !== body.key.trim()\n || !Number.isSafeInteger(body.byteLength) || body.byteLength < 1\n || body.byteLength > UINT32_MAX\n || typeof body.sha256 !== \"string\" || !SHA256.test(body.sha256)\n || bodies.has(body.key)\n || bodyDigests.has(body.sha256))\n {\n throw new Error(\n `Tr2EffectRes permutation body ${bodyIndex} is malformed or duplicated`\n );\n }\n bodyDigests.add(body.sha256);\n bodies.set(body.key, {\n byteLength: body.byteLength,\n references: 0\n });\n });\n\n const bodyKeyBySourceRecord = new Map();\n const sourceRecords = [];\n graph.variants.forEach((variant, permutationIndex) =>\n {\n const expectedOptions = decodePermutationOptions(permutationIndex, axes);\n if (!variant || typeof variant !== \"object\" || Array.isArray(variant)\n || variant.permutationIndex !== permutationIndex\n || !Array.isArray(variant.optionIndices)\n || variant.optionIndices.length !== expectedOptions.length\n || variant.optionIndices.some((value, index) =>\n value !== expectedOptions[index])\n || typeof variant.bodyKey !== \"string\"\n || !bodies.has(variant.bodyKey))\n {\n throw new Error(\n `Tr2EffectRes permutation variant ${permutationIndex} is malformed`\n );\n }\n\n const sourceRecord = validatePermutationSourceRecord(\n variant.sourceRecord,\n permutationIndex\n );\n const body = bodies.get(variant.bodyKey);\n if (sourceRecord.byteLength !== body.byteLength)\n {\n throw new Error(\n `Tr2EffectRes permutation variant ${permutationIndex} body length disagrees`\n );\n }\n const recordKey = `${sourceRecord.offset}:${sourceRecord.byteLength}`;\n const existingBodyKey = bodyKeyBySourceRecord.get(recordKey);\n if (existingBodyKey && existingBodyKey !== variant.bodyKey)\n {\n throw new Error(\n `Tr2EffectRes source record ${recordKey} maps to multiple bodies`\n );\n }\n bodyKeyBySourceRecord.set(recordKey, variant.bodyKey);\n sourceRecords.push(sourceRecord);\n body.references += 1;\n });\n\n validateDisjointPermutationRecords(sourceRecords);\n for (const [ bodyKey, body ] of bodies)\n {\n if (!body.references)\n {\n throw new Error(\n `Tr2EffectRes permutation body ${bodyKey} is unreferenced`\n );\n }\n }\n}\n\nfunction validatePermutationAxis(axis, index, names)\n{\n if (!axis || typeof axis !== \"object\" || Array.isArray(axis)\n || axis.index !== index\n || typeof axis.name !== \"string\" || !axis.name\n || axis.name !== axis.name.trim() || names.has(axis.name)\n || !Array.isArray(axis.options) || !axis.options.length\n || axis.options.length > UINT8_MAX\n || !Number.isSafeInteger(axis.defaultOption)\n || axis.defaultOption < 0\n || axis.defaultOption >= axis.options.length\n || typeof axis.description !== \"string\"\n || !Number.isSafeInteger(axis.type)\n || axis.type < 0 || axis.type > UINT8_MAX)\n {\n throw new Error(\n `Tr2EffectRes permutation axis ${index} is malformed or duplicated`\n );\n }\n names.add(axis.name);\n const options = new Set();\n for (const option of axis.options)\n {\n if (typeof option !== \"string\" || !option\n || option !== option.trim() || options.has(option))\n {\n throw new Error(\n `Tr2EffectRes permutation axis ${index} options are malformed`\n );\n }\n options.add(option);\n }\n return normalizePermutationAxis(axis);\n}\n\nfunction getPermutationProduct(axes)\n{\n let product = 1;\n for (const axis of axes)\n {\n product *= axis.options.length;\n if (!Number.isSafeInteger(product)\n || product < 1\n || product > MAX_EFFECT_PERMUTATIONS)\n {\n throw new Error(\n \"Tr2EffectRes permutation count exceeds the implementation limit\"\n );\n }\n }\n return product;\n}\n\nfunction decodePermutationOptions(permutationIndex, axes)\n{\n let value = permutationIndex;\n return axes.map(axis =>\n {\n const optionIndex = value % axis.options.length;\n value = Math.floor(value / axis.options.length);\n return optionIndex;\n });\n}\n\nfunction validatePermutationSourceRecord(record, permutationIndex)\n{\n const offset = record?.offset;\n const byteLength = record?.byteLength;\n const end = offset + byteLength;\n if (!record || typeof record !== \"object\" || Array.isArray(record)\n || !Number.isSafeInteger(offset) || offset < 0 || offset > UINT32_MAX\n || !Number.isSafeInteger(byteLength) || byteLength < 1\n || byteLength > UINT32_MAX\n || !Number.isSafeInteger(end)\n || end > UINT32_MAX + 1)\n {\n throw new Error(\n `Tr2EffectRes permutation variant ${permutationIndex} source record is malformed`\n );\n }\n return { offset, byteLength };\n}\n\nfunction validateDisjointPermutationRecords(records)\n{\n const unique = new Map();\n for (const record of records)\n {\n const key = `${record.offset}:${record.byteLength}`;\n if (!unique.has(key))\n {\n unique.set(key, {\n offset: record.offset,\n end: record.offset + record.byteLength\n });\n }\n }\n const ordered = Array.from(unique.values()).sort((left, right) =>\n left.offset - right.offset || left.end - right.end);\n for (let index = 1; index < ordered.length; index += 1)\n {\n if (ordered[index].offset < ordered[index - 1].end)\n {\n throw new Error(\n \"Tr2EffectRes permutation source body records partially overlap\"\n );\n }\n }\n}\n\nfunction getPermutationAxes(payload)\n{\n if (!payload)\n {\n return [];\n }\n if (payload.permutationGraph)\n {\n return payload.permutationGraph.axes.map(normalizePermutationAxis);\n }\n if (Array.isArray(payload.permutations)\n && payload.permutations.every(permutation =>\n Array.isArray(permutation?.options)))\n {\n return payload.permutations.map(normalizePermutationAxis);\n }\n return [];\n}\n\nfunction normalizePermutationAxis(axis)\n{\n if (!axis || typeof axis !== \"object\" || Array.isArray(axis)\n || typeof axis.name !== \"string\" || !axis.name\n || !Array.isArray(axis.options) || !axis.options.length\n || axis.options.some(option => typeof option !== \"string\" || !option)\n || !Number.isSafeInteger(axis.defaultOption)\n || axis.defaultOption < 0\n || axis.defaultOption >= axis.options.length)\n {\n throw new TypeError(\"Tr2EffectRes permutation axis is malformed\");\n }\n return {\n name: axis.name,\n options: [ ...axis.options ],\n defaultOption: axis.defaultOption,\n description: String(axis.description ?? \"\"),\n type: Number(axis.type ?? 0)\n };\n}\n\nfunction getPermutationVariantCount(payload)\n{\n if (Array.isArray(payload?.permutationGraph?.variants))\n {\n return payload.permutationGraph.variants.length;\n }\n const axes = getPermutationAxes(payload);\n if (axes.length)\n {\n return axes.reduce((count, axis) => count * axis.options.length, 1);\n }\n return null;\n}\n\nfunction getPortableReflection(payload, index)\n{\n if (!payload)\n {\n return null;\n }\n if (typeof payload.GetPortableEffectReflection === \"function\")\n {\n return payload.GetPortableEffectReflection(index);\n }\n if (typeof payload.getPortableEffectReflection === \"function\")\n {\n return payload.getPortableEffectReflection(index);\n }\n if (Tr2Shader.isPortableReflection(payload))\n {\n return index === payload.permutationIndex ? payload : null;\n }\n if (Array.isArray(payload.portableReflections))\n {\n return payload.portableReflections[index] ?? null;\n }\n return null;\n}\n\nfunction normalizeShaderOptions(options)\n{\n if (options instanceof Map)\n {\n return Array.from(options, ([ name, value ]) => ({\n name: String(name),\n value: String(value)\n }));\n }\n if (!Array.isArray(options))\n {\n return [];\n }\n return options.map(option => ({\n name: String(option?.name ?? \"\"),\n value: String(option?.value ?? \"\")\n }));\n}\n"],"names":["globalEffectOptions","SHA256","UINT8_MAX","UINT32_MAX","MAX_EFFECT_PERMUTATIONS","_Tr2EffectRes","_identity","Tr2EffectRes","CjsResource","e","_initProto","c","_initClass","_applyDecs","type","define","className","family","carbon","method","impl","adapted","reason","custom","Map","constructor","values","SetValues","markDirty","skipUpdate","skipEvents","SetPayload","payload","options","clear","validateResourcePayload","validateEffectPayload","GetShader","count","axes","getPermutationAxes","GetPayload","length","portableIndex","Tr2Shader","isPortableReflection","permutationIndex","GetShaderByIndex","localOptions","normalizeShaderOptions","localCount","Number","isSafeInteger","Math","max","min","multiplier","index","axis","selectedIndex","defaultOption","globalOption","find","option","name","requestedIndex","indexOf","value","optionIndex","localOption","TypeError","has","get","variantCount","getPermutationVariantCount","portable","getPortableReflection","Error","shader","fromPortable","set","GetPermutationDescription","Array","isArray","permutations","map","permutation","description","ReleaseResources","ReleasePayload","ModifyGlobalEffectOptions","changes","change","findIndex","splice","push","GetGlobalEffectOptions","graph","permutationGraph","undefined","validatePermutationGraph","every","forEach","normalizePermutationAxis","validateLegacyPermutationDescription","portableReflections","expectedCount","reflection","entries","format","formatVersion","coverage","bodies","variants","axisNames","Set","validatePermutationAxis","getPermutationProduct","bodyDigests","body","bodyIndex","key","trim","byteLength","sha256","test","add","references","bodyKeyBySourceRecord","sourceRecords","variant","expectedOptions","decodePermutationOptions","optionIndices","some","bodyKey","sourceRecord","validatePermutationSourceRecord","recordKey","offset","existingBodyKey","validateDisjointPermutationRecords","names","product","floor","record","end","records","unique","ordered","from","sort","left","right","String","reduce","GetPortableEffectReflection","getPortableEffectReflection"],"mappings":";;;;;;;AAQA,MAAMA,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,MAAM,GAAG,iBAAiB;AAChC,MAAMC,SAAS,GAAG,IAAI;AACtB,MAAMC,UAAU,GAAG,UAAU;AAC7B,MAAMC,uBAAuB,GAAG,OAAO;;AAEvC;AACA;AACA;AACA;AACA;AACA;AALA,IAAAC;AAAA,IAAA,cAAAC,SAAA,CAAA;AAAA,EAAA,QAMA,MAAAC,YAAA,SACkCC,YAAW,CAC7C;AAAA,IAAA;AAAA,MAAA,CAAA;AAAAC,QAAAA,CAAA,GAAAC,UAAA,CAAA;QAAAC,CAAA,EAAA,CAAAN,aAAA,EAAAO,UAAA;AAAA,OAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,QAAAA,SAAS,EAAE,cAAc;AAAEC,QAAAA,MAAM,EAAE;AAAY,OAAC,CAAC,CAAA,EAAA,CAAA,CAA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IAAI,CAAC;MAClBG,KAAK,EAAEuF,MAAM,CAACvF,KAAK;AACrB,KAAC,CAAC,CAAC;AACL,EAAA;AACA,EAAA,IAAI,CAACe,KAAK,CAACC,OAAO,CAAClD,OAAO,CAAC,EAC3B;AACE,IAAA,OAAO,EAAE;AACX,EAAA;AACA,EAAA,OAAOA,OAAO,CAACoD,GAAG,CAACtB,MAAM,KAAK;IAC5BC,IAAI,EAAE0F,MAAM,CAAC3F,MAAM,EAAEC,IAAI,IAAI,EAAE,CAAC;AAChCG,IAAAA,KAAK,EAAEuF,MAAM,CAAC3F,MAAM,EAAEI,KAAK,IAAI,EAAE;AACnC,GAAC,CAAC,CAAC;AACL;;;;"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { applyDecs2311 as _applyDecs2311 } from '
|
|
1
|
+
import { applyDecs2311 as _applyDecs2311 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { io, type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
3
|
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
4
|
|
|
5
5
|
let _initClass, _init_material, _init_extra_material, _init_metatype, _init_extra_metatype;
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Associates one material-area metatype with its persisted parameter store.
|
|
9
|
+
*
|
|
10
|
+
* The record describes resource data and does not own shader bindings or
|
|
11
|
+
* backend material realization.
|
|
12
|
+
*/
|
|
8
13
|
let _Tr2MaterialArea;
|
|
9
14
|
class Tr2MaterialArea extends CjsModel {
|
|
10
15
|
static {
|
|
@@ -20,10 +25,10 @@ class Tr2MaterialArea extends CjsModel {
|
|
|
20
25
|
super(...args);
|
|
21
26
|
_init_extra_metatype(this);
|
|
22
27
|
}
|
|
23
|
-
/**
|
|
28
|
+
/** Persisted material parameter-store reference. */
|
|
24
29
|
material = _init_material(this, null);
|
|
25
30
|
|
|
26
|
-
/**
|
|
31
|
+
/** Authored material-area metatype. */
|
|
27
32
|
metatype = (_init_extra_material(this), _init_metatype(this, ""));
|
|
28
33
|
static {
|
|
29
34
|
_initClass();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2MaterialArea.js","sources":["../../../../src/resource/shader/Tr2MaterialArea.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2MaterialRes.h\r\n// Schema: format-carbon resources/Tr2MaterialArea.json; maintained by runtime-resource.\r\nimport { io, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\n * Associates one material-area metatype with its persisted parameter store.\n *\n * The record describes resource data and does not own shader bindings or\n * backend material realization.\n */\n@type.define({ className: \"Tr2MaterialArea\", family: \"resources\" })\nexport class Tr2MaterialArea extends CjsModel\n{\n\n /** Persisted material parameter-store reference. */\n @io.persist\n @type.objectRef(\"Tr2MaterialParameterStore\")\n material = null;\n\n /** Authored material-area metatype. */\n @io.persist\n @type.string\n metatype = \"\";\n\r\n}\r\n"],"names":["_Tr2MaterialArea","Tr2MaterialArea","CjsModel","e","_init_material","_init_extra_material","_init_metatype","_init_extra_metatype","c","_initClass","_applyDecs","type","define","className","family","io","persist","objectRef","string","constructor","args","material","metatype"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AALA,IAAAA;AAMA,MAAAC,eAAA,SACqCC,QAAQ,CAC7C;AAAA,EAAA;AAAA,IAAA,CAAA;AAAAC,MAAAA,CAAA,GAAAC,cAAA,EAAAC,oBAAA,EAAAC,cAAA,EAAAC,oBAAA,CAAA;MAAAC,CAAA,EAAA,CAAAR,gBAAA,EAAAS,UAAA;AAAA,KAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,MAAAA,SAAS,EAAE,iBAAiB;AAAEC,MAAAA,MAAM,EAAE;KAAa,CAAC,CAAA,EAAA,CAAA,CAAA,CAKhEC,EAAE,EAAFA,EAAE,CAACC,OAAO,EAAA,MAAA,EACVL,IAAI,CAACM,SAAS,CAAC,2BAA2B,CAAC,CAAA,EAAA,EAAA,EAAA,UAAA,CAAA,EAAA,CAAA,CAI3CF,EAAE,EAAFA,EAAE,CAACC,OAAO,EACVL,IAAI,EAAJA,IAAI,CAACO,MAAM,CAAA,EAAA,EAAA,EAAA,UAAA,CAAA,CAAA,EAAA,CAAA,EAAA,MAAA,EAVuBhB,QAAQ,CAAA;AAAA;AAAAiB,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;IAAAb,oBAAA,CAAA,IAAA,CAAA;AAAA,EAAA;AAG3C;EAGAc,QAAQ,GAAAjB,cAAA,CAAA,IAAA,EAAG,IAAI,CAAA;;AAEf;AAGAkB,EAAAA,QAAQ,IAAAjB,oBAAA,CAAA,IAAA,CAAA,EAAAC,cAAA,OAAG,EAAE,CAAA;AAAC,EAAA;IAAAG,UAAA,EAAA;AAAA;AAEhB;;;;"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { applyDecs2311 as _applyDecs2311 } from '
|
|
1
|
+
import { applyDecs2311 as _applyDecs2311 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { io, type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
3
|
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
4
|
|
|
5
5
|
let _initClass, _init_areas, _init_extra_areas;
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Holds the persisted material-area dictionary for one material mesh.
|
|
9
|
+
*
|
|
10
|
+
* Area lookup remains resource metadata; engines decide how the selected
|
|
11
|
+
* material becomes backend draw state.
|
|
12
|
+
*/
|
|
8
13
|
let _Tr2MaterialMesh;
|
|
9
14
|
class Tr2MaterialMesh extends CjsModel {
|
|
10
15
|
static {
|
|
@@ -20,7 +25,7 @@ class Tr2MaterialMesh extends CjsModel {
|
|
|
20
25
|
super(...args);
|
|
21
26
|
_init_extra_areas(this);
|
|
22
27
|
}
|
|
23
|
-
/**
|
|
28
|
+
/** Persisted dictionary of material areas. */
|
|
24
29
|
areas = _init_areas(this, null);
|
|
25
30
|
static {
|
|
26
31
|
_initClass();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2MaterialMesh.js","sources":["../../../../src/resource/shader/Tr2MaterialMesh.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2MaterialRes.h\r\n// Schema: format-carbon resources/Tr2MaterialMesh.json; maintained by runtime-resource.\r\nimport { io, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\n * Holds the persisted material-area dictionary for one material mesh.\n *\n * Area lookup remains resource metadata; engines decide how the selected\n * material becomes backend draw state.\n */\n@type.define({ className: \"Tr2MaterialMesh\", family: \"resources\" })\nexport class Tr2MaterialMesh extends CjsModel\n{\n\n /** Persisted dictionary of material areas. */\n @io.persist\n @type.objectRef(\"Tr2MaterialAreaDict\")\n areas = null;\n\r\n}\r\n"],"names":["_Tr2MaterialMesh","Tr2MaterialMesh","CjsModel","e","_init_areas","_init_extra_areas","c","_initClass","_applyDecs","type","define","className","family","io","persist","objectRef","constructor","args","areas"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AALA,IAAAA;AAMA,MAAAC,eAAA,SACqCC,QAAQ,CAC7C;AAAA,EAAA;AAAA,IAAA,CAAA;MAAAC,CAAA,EAAA,CAAAC,WAAA,EAAAC,iBAAA,CAAA;MAAAC,CAAA,EAAA,CAAAN,gBAAA,EAAAO,UAAA;AAAA,KAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,MAAAA,SAAS,EAAE,iBAAiB;AAAEC,MAAAA,MAAM,EAAE;AAAY,KAAC,CAAC,CAAA,EAAA,CAAA,CAAA,CAKhEC,EAAE,EAAFA,EAAE,CAACC,OAAO,EAAA,MAAA,EACVL,IAAI,CAACM,SAAS,CAAC,qBAAqB,CAAC,6BALHb,QAAQ,CAAA;AAAA;AAAAc,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;IAAAZ,iBAAA,CAAA,IAAA,CAAA;AAAA,EAAA;AAG3C;EAGAa,KAAK,GAAAd,WAAA,CAAA,IAAA,EAAG,IAAI,CAAA;AAAC,EAAA;IAAAG,UAAA,EAAA;AAAA;AAEf;;;;"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { applyDecs2311 as _applyDecs2311 } from '
|
|
1
|
+
import { applyDecs2311 as _applyDecs2311 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { io, type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
3
|
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
4
|
|
|
5
5
|
let _initClass, _init_meshes, _init_extra_meshes, _init_name, _init_extra_name;
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Root persisted material record containing its authored name and material
|
|
9
|
+
* mesh dictionary.
|
|
10
|
+
*
|
|
11
|
+
* It owns the serializable material description, not device shaders,
|
|
12
|
+
* descriptor bindings, or pipelines.
|
|
13
|
+
*/
|
|
8
14
|
let _Tr2MaterialRes;
|
|
9
15
|
class Tr2MaterialRes extends CjsModel {
|
|
10
16
|
static {
|
|
@@ -20,10 +26,10 @@ class Tr2MaterialRes extends CjsModel {
|
|
|
20
26
|
super(...args);
|
|
21
27
|
_init_extra_name(this);
|
|
22
28
|
}
|
|
23
|
-
/**
|
|
29
|
+
/** Persisted dictionary of material meshes. */
|
|
24
30
|
meshes = _init_meshes(this, null);
|
|
25
31
|
|
|
26
|
-
/**
|
|
32
|
+
/** Authored material name. */
|
|
27
33
|
name = (_init_extra_meshes(this), _init_name(this, ""));
|
|
28
34
|
static {
|
|
29
35
|
_initClass();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2MaterialRes.js","sources":["../../../../src/resource/shader/Tr2MaterialRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2MaterialRes.h\r\n// Schema: format-carbon resources/Tr2MaterialRes.json; maintained by runtime-resource.\r\nimport { io, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\n * Root persisted material record containing its authored name and material\n * mesh dictionary.\n *\n * It owns the serializable material description, not device shaders,\n * descriptor bindings, or pipelines.\n */\n@type.define({ className: \"Tr2MaterialRes\", family: \"resources\" })\nexport class Tr2MaterialRes extends CjsModel\n{\n\n /** Persisted dictionary of material meshes. */\n @io.persist\n @type.objectRef(\"Tr2MaterialMeshDict\")\n meshes = null;\n\n /** Authored material name. */\n @io.persist\n @type.string\n name = \"\";\n\r\n}\r\n"],"names":["_Tr2MaterialRes","Tr2MaterialRes","CjsModel","e","_init_meshes","_init_extra_meshes","_init_name","_init_extra_name","c","_initClass","_applyDecs","type","define","className","family","io","persist","objectRef","string","constructor","args","meshes","name"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAAAA;AAOA,MAAAC,cAAA,SACoCC,QAAQ,CAC5C;AAAA,EAAA;AAAA,IAAA,CAAA;AAAAC,MAAAA,CAAA,GAAAC,YAAA,EAAAC,kBAAA,EAAAC,UAAA,EAAAC,gBAAA,CAAA;MAAAC,CAAA,EAAA,CAAAR,eAAA,EAAAS,UAAA;AAAA,KAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,MAAAA,SAAS,EAAE,gBAAgB;AAAEC,MAAAA,MAAM,EAAE;KAAa,CAAC,CAAA,EAAA,CAAA,CAAA,CAK/DC,EAAE,EAAFA,EAAE,CAACC,OAAO,EAAA,MAAA,EACVL,IAAI,CAACM,SAAS,CAAC,qBAAqB,CAAC,CAAA,EAAA,EAAA,EAAA,QAAA,CAAA,EAAA,CAAA,CAIrCF,EAAE,EAAFA,EAAE,CAACC,OAAO,EACVL,IAAI,EAAJA,IAAI,CAACO,MAAM,CAAA,EAAA,EAAA,EAAA,MAAA,CAAA,CAAA,EAAA,CAAA,EAAA,MAAA,EAVsBhB,QAAQ,CAAA;AAAA;AAAAiB,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;IAAAb,gBAAA,CAAA,IAAA,CAAA;AAAA,EAAA;AAG1C;EAGAc,MAAM,GAAAjB,YAAA,CAAA,IAAA,EAAG,IAAI,CAAA;;AAEb;AAGAkB,EAAAA,IAAI,IAAAjB,kBAAA,CAAA,IAAA,CAAA,EAAAC,UAAA,OAAG,EAAE,CAAA;AAAC,EAAA;IAAAG,UAAA,EAAA;AAAA;AAEZ;;;;"}
|