@carbonenginejs/runtime-resource 0.12.2 → 0.13.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/LICENSE +21 -21
- package/NOTICE +32 -32
- package/README.md +129 -108
- package/dist/CjsMotherLode.js +1271 -1271
- package/dist/CjsResMan.js +3858 -3494
- package/dist/CjsResMan.js.map +1 -1
- package/dist/CjsResManFetchProvider.js +94 -94
- package/dist/CjsResManWorkQueue.js +301 -301
- package/dist/_virtual/_rollupPluginBabelHelpers.js +150 -150
- package/dist/format/CjsBlueReader.js +358 -358
- package/dist/format/CjsByteReader.js +310 -310
- package/dist/format/CjsByteWriter.js +242 -242
- package/dist/format/CjsFormat.js +223 -223
- package/dist/format/CjsFormatError.js +41 -41
- package/dist/format/CjsReader.js +22 -22
- package/dist/format/CjsResourceProbe.js +279 -279
- package/dist/format/CjsStringTable.js +268 -268
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js +408 -361
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -1
- package/dist/format/carbonEffect/CjsCarbonEffectWriter.js +373 -373
- package/dist/format/carbonEffect/buildCarbonEffectContainer.js +182 -0
- package/dist/format/carbonEffect/buildCarbonEffectContainer.js.map +1 -0
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js +321 -427
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
- package/dist/format/carbonEffect/carbonEffectRecords.js +1147 -955
- package/dist/format/carbonEffect/carbonEffectRecords.js.map +1 -1
- package/dist/format/carbonEffect/carbonEffectResourceTransform.js +197 -0
- package/dist/format/carbonEffect/carbonEffectResourceTransform.js.map +1 -0
- package/dist/format/compareUtf8.js +36 -36
- package/dist/format/effect/effectBodyInventory.js +146 -0
- package/dist/format/effect/effectBodyInventory.js.map +1 -0
- package/dist/format/effect/effectPermutationGraph.js +257 -257
- package/dist/format/effect/effectPermutationGraph.js.map +1 -1
- package/dist/format/effect/sha256.js +114 -114
- package/dist/format/index.js +11 -11
- package/dist/format/payloadContract.js +193 -193
- package/dist/formats/black/CjsBlackFormat.js +310 -292
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/black/core/CjsBlackBinaryReader.js +260 -260
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +448 -448
- package/dist/formats/black/core/CjsBlackReader.js +764 -764
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +540 -540
- package/dist/formats/black/core/black-schema-v1-2026-07-23.json.js +4 -4
- package/dist/formats/black/core/blackConstants.js +7 -7
- package/dist/formats/black/core/blackDefinitions.js +10 -10
- package/dist/formats/black/core/blackEnums.js +6 -6
- package/dist/formats/black/core/blackSchema.js +3 -3
- package/dist/formats/black/core/blackVersion.js +22 -22
- package/dist/formats/black/core/helpers.js +199 -199
- package/dist/formats/black/core/schema.js +4 -4
- package/dist/formats/black/index.js +2 -2
- package/dist/formats/bnk/CjsBnkFormat.js +175 -156
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/busNodes.js +252 -0
- package/dist/formats/bnk/core/busNodes.js.map +1 -0
- package/dist/formats/bnk/core/effectNodes.js +147 -0
- package/dist/formats/bnk/core/effectNodes.js.map +1 -0
- package/dist/formats/bnk/core/eventAction.js +416 -305
- package/dist/formats/bnk/core/eventAction.js.map +1 -1
- package/dist/formats/bnk/core/globalSettings.js +215 -0
- package/dist/formats/bnk/core/globalSettings.js.map +1 -0
- package/dist/formats/bnk/core/graph.js +137 -137
- package/dist/formats/bnk/core/helpers.js +512 -480
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/musicNodes.js +533 -509
- package/dist/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/formats/bnk/core/nodeBase.js +553 -532
- package/dist/formats/bnk/core/nodeBase.js.map +1 -1
- package/dist/formats/bnk/core/sfxNodes.js +632 -632
- package/dist/formats/bnk/core/soundbanksInfo.js +209 -209
- package/dist/formats/bnk/index.js +2 -2
- package/dist/formats/cmf/CjsCmfFormat.js +497 -497
- package/dist/formats/cmf/core/binary.js +194 -194
- package/dist/formats/cmf/core/buffers.js +237 -237
- package/dist/formats/cmf/core/constants.js +47 -47
- package/dist/formats/cmf/core/gr2Anim.js +453 -453
- package/dist/formats/cmf/core/helpers.js +318 -318
- package/dist/formats/cmf/core/pack.js +276 -276
- package/dist/formats/cmf/core/schema.js +374 -374
- package/dist/formats/cmf/core/shared.js +277 -277
- package/dist/formats/cmf/core/writer.js +571 -571
- package/dist/formats/cmf/index.js +2 -2
- package/dist/formats/dds/CjsDdsFormat.js +200 -200
- package/dist/formats/dds/core/bc6h.js +298 -298
- package/dist/formats/dds/core/bc7.js +272 -272
- package/dist/formats/dds/core/helpers.js +862 -862
- package/dist/formats/dds/index.js +2 -2
- package/dist/formats/dxbc/CjsDxbcFormat.js +142 -142
- package/dist/formats/dxbc/core/DxbcReader.js +266 -266
- package/dist/formats/dxbc/core/container.js +169 -169
- package/dist/formats/dxbc/core/decoder.js +789 -789
- package/dist/formats/dxbc/core/errors.js +19 -19
- package/dist/formats/dxbc/core/helpers.js +220 -220
- package/dist/formats/dxbc/core/opcodes.js +45 -45
- package/dist/formats/dxbc/core/program.js +91 -91
- package/dist/formats/dxbc/core/signature.js +172 -172
- package/dist/formats/dxbc/index.js +2 -2
- package/dist/formats/fbx/CjsFbxFormat.js +266 -266
- package/dist/formats/fbx/core/helpers.js +3932 -3932
- package/dist/formats/fbx/index.js +2 -2
- package/dist/formats/flac/CjsFlacFormat.js +142 -142
- package/dist/formats/flac/core/helpers.js +315 -315
- package/dist/formats/flac/index.js +2 -2
- package/dist/formats/gif/CjsGifFormat.js +141 -141
- package/dist/formats/gif/core/helpers.js +380 -380
- package/dist/formats/gif/index.js +2 -2
- package/dist/formats/gltf/CjsGltfFormat.js +290 -290
- package/dist/formats/gltf/core/helpers.js +307 -307
- package/dist/formats/gltf/core/json.js +79 -79
- package/dist/formats/gltf/core/parser.js +679 -679
- package/dist/formats/gltf/core/targets.js +173 -173
- package/dist/formats/gltf/index.js +2 -2
- package/dist/formats/gr2/CjsGr2Format.js +289 -289
- package/dist/formats/gr2/core/bitknit2.js +282 -282
- package/dist/formats/gr2/core/curves.js +1047 -1047
- package/dist/formats/gr2/core/gsf.js +72 -72
- package/dist/formats/gr2/core/helpers.js +352 -352
- package/dist/formats/gr2/core/json.js +622 -622
- package/dist/formats/gr2/core/oodle1.js +388 -388
- package/dist/formats/gr2/core/tangents.js +48 -48
- package/dist/formats/gr2/core/targets.js +361 -361
- package/dist/formats/gr2/index.js +2 -2
- package/dist/formats/hlsl/CjsHlslFormat.js +254 -254
- package/dist/formats/hlsl/core/HlslBinaryUtils.js +15 -15
- package/dist/formats/hlsl/core/HlslEffectReadError.js +19 -19
- package/dist/formats/hlsl/core/HlslEffectStateManager.js +130 -130
- package/dist/formats/hlsl/core/HlslRenderStateSetup.js +37 -37
- package/dist/formats/hlsl/core/HlslResourceSetDescription.js +94 -94
- package/dist/formats/hlsl/core/HlslShaderBytecode.js +44 -44
- package/dist/formats/hlsl/core/analysis.js +51 -51
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +850 -781
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
- package/dist/formats/hlsl/core/detailMapFamily.js +128 -0
- package/dist/formats/hlsl/core/detailMapFamily.js.map +1 -0
- package/dist/formats/hlsl/core/helpers.js +270 -270
- package/dist/formats/hlsl/core/json.js +284 -284
- package/dist/formats/hlsl/core/localLightFamily.js +133 -0
- package/dist/formats/hlsl/core/localLightFamily.js.map +1 -0
- package/dist/formats/hlsl/core/metadata.js +327 -327
- package/dist/formats/hlsl/core/render-states.js +280 -280
- package/dist/formats/hlsl/core/tr2/HlslRenderContextEnum.js +43 -43
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +320 -314
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -1
- package/dist/formats/hlsl/core/tr2/resources/HlslShaderPermutation.js +33 -33
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js +416 -416
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectConstant.js +40 -40
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js +62 -742
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js.map +1 -1
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectLibrary.js +52 -52
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectParameterAnnotation.js +38 -38
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectResource.js +50 -50
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js +86 -86
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectTechnique.js +31 -31
- package/dist/formats/hlsl/core/tr2/shader/HlslPass.js +42 -42
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerDescription.js +55 -55
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerSetup.js +29 -29
- package/dist/formats/hlsl/core/tr2/shader/HlslShader.js +220 -220
- package/dist/formats/hlsl/core/tr2/shader/HlslShaderOption.js +30 -30
- package/dist/formats/hlsl/index.js +3 -3
- package/dist/formats/index.js +33 -31
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/jpeg/CjsJpegFormat.js +212 -212
- package/dist/formats/jpeg/core/helpers.js +402 -402
- package/dist/formats/jpeg/core/jpeg.js +480 -480
- package/dist/formats/jpeg/index.js +2 -2
- package/dist/formats/mp3/CjsMp3Format.js +197 -197
- package/dist/formats/mp3/core/helpers.js +375 -375
- package/dist/formats/mp3/index.js +2 -2
- package/dist/formats/mp4/CjsMp4Format.js +197 -197
- package/dist/formats/mp4/core/helpers.js +484 -484
- package/dist/formats/mp4/index.js +2 -2
- package/dist/formats/obj/CjsObjFormat.js +253 -253
- package/dist/formats/obj/core/helpers.js +573 -573
- package/dist/formats/obj/core/json.js +64 -64
- package/dist/formats/obj/core/parser.js +321 -321
- package/dist/formats/obj/index.js +2 -2
- package/dist/formats/ogg/CjsOggFormat.js +143 -143
- package/dist/formats/ogg/core/helpers.js +410 -410
- package/dist/formats/ogg/core/imdct.js +178 -178
- package/dist/formats/ogg/core/vorbis.js +1017 -1017
- package/dist/formats/ogg/index.js +2 -2
- package/dist/formats/pickle/CjsPickleFormat.js +214 -0
- package/dist/formats/pickle/CjsPickleFormat.js.map +1 -0
- package/dist/formats/pickle/core/CjsPickleProtocol0Reader.js +551 -0
- package/dist/formats/pickle/core/CjsPickleProtocol0Reader.js.map +1 -0
- package/dist/formats/pickle/index.js +2 -0
- package/dist/formats/pickle/index.js.map +1 -0
- package/dist/formats/png/CjsPngFormat.js +201 -201
- package/dist/formats/png/core/helpers.js +635 -635
- package/dist/formats/png/index.js +2 -2
- package/dist/formats/red/CjsRedFormat.js +263 -263
- package/dist/formats/red/core/CjsRedReader.js +246 -246
- package/dist/formats/red/core/blackDefinitions.js +3 -3
- package/dist/formats/red/core/helpers.js +158 -158
- package/dist/formats/red/core/redGraph.js +71 -68
- package/dist/formats/red/core/redGraph.js.map +1 -1
- package/dist/formats/red/core/schema.js +4 -4
- package/dist/formats/red/index.js +2 -2
- package/dist/formats/stl/CjsStlFormat.js +365 -365
- package/dist/formats/stl/core/helpers.js +261 -261
- package/dist/formats/stl/core/json.js +51 -51
- package/dist/formats/stl/core/stl.js +642 -642
- package/dist/formats/stl/core/targets.js +173 -173
- package/dist/formats/stl/index.js +2 -2
- package/dist/formats/tga/CjsTgaFormat.js +197 -197
- package/dist/formats/tga/core/helpers.js +493 -493
- package/dist/formats/tga/index.js +2 -2
- package/dist/formats/wav/CjsWavFormat.js +198 -198
- package/dist/formats/wav/core/helpers.js +365 -365
- package/dist/formats/wav/index.js +2 -2
- package/dist/formats/webgl/CjsWebglFormat.js +199 -221
- package/dist/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/formats/webgl/core/buildGlslEffectContainer.js +70 -0
- package/dist/formats/webgl/core/buildGlslEffectContainer.js.map +1 -0
- package/dist/formats/webgl/core/effectPackage.js +900 -792
- package/dist/formats/webgl/core/effectPackage.js.map +1 -1
- package/dist/formats/webgl/core/errors.js +27 -27
- package/dist/formats/webgl/core/errors.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +2820 -2678
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslHelpers.js +89 -89
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +486 -428
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
- package/dist/formats/webgl/core/glsl/packedLightFixups.js +98 -0
- package/dist/formats/webgl/core/glsl/packedLightFixups.js.map +1 -0
- package/dist/formats/webgl/core/glslBackendBlock.js +552 -0
- package/dist/formats/webgl/core/glslBackendBlock.js.map +1 -0
- package/dist/formats/webgl/core/glslBackendBodySet.js +243 -0
- package/dist/formats/webgl/core/glslBackendBodySet.js.map +1 -0
- package/dist/formats/webgl/core/{cewgCompleteness.js → glslEffectCompleteness.js} +85 -81
- package/dist/formats/webgl/core/glslEffectCompleteness.js.map +1 -0
- package/dist/formats/webgl/core/helpers.js +167 -306
- package/dist/formats/webgl/core/helpers.js.map +1 -1
- package/dist/formats/webgl/core/inspectGlslEffectContainer.js +122 -0
- package/dist/formats/webgl/core/inspectGlslEffectContainer.js.map +1 -0
- package/dist/formats/webgl/core/readGlslEffectContainer.js +303 -0
- package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -0
- package/dist/formats/webgl/index.js +2 -2
- package/dist/formats/webgpu/CjsWebgpuFormat.js +357 -357
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +89 -197
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -1
- package/dist/formats/webgpu/core/{cewgpu/CewgpuContainer.js → carbonWebgpu/CarbonWebgpuContainer.js} +354 -368
- package/dist/formats/webgpu/core/carbonWebgpu/CarbonWebgpuContainer.js.map +1 -0
- package/dist/formats/webgpu/core/{cewgpu → carbonWebgpu}/containerViews.js +355 -355
- package/dist/formats/webgpu/core/carbonWebgpu/containerViews.js.map +1 -0
- package/dist/formats/webgpu/core/{cewgpu → carbonWebgpu}/validateContainer.js +90 -90
- package/dist/formats/webgpu/core/carbonWebgpu/validateContainer.js.map +1 -0
- package/dist/formats/webgpu/core/effectAnalysis.js +82 -82
- package/dist/formats/webgpu/core/effectBackendBodySet.js +289 -289
- package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
- package/dist/formats/webgpu/core/errors.js +20 -20
- package/dist/formats/webgpu/core/errors.js.map +1 -1
- package/dist/formats/webgpu/core/helpers.js +443 -443
- package/dist/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js +212 -212
- package/dist/formats/webgpu/core/ir/buildControlFlow.js +220 -220
- package/dist/formats/webgpu/core/ir/indexableTemps.js +137 -137
- package/dist/formats/webgpu/core/ir/inferValueTypes.js +449 -449
- package/dist/formats/webgpu/core/ir/lowerDxbcToIr.js +494 -494
- package/dist/formats/webgpu/core/ir/resolveRegisterFlow.js +177 -177
- package/dist/formats/webgpu/core/ir/sourceLanes.js +61 -61
- package/dist/formats/webgpu/core/packageEffect.js +381 -385
- package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
- package/dist/formats/webgpu/core/packageEffectSelection.js +164 -164
- package/dist/formats/webgpu/core/packageEffectSelection.js.map +1 -1
- package/dist/formats/webgpu/core/packageMetadata.js +17 -17
- package/dist/formats/webgpu/core/schema.js +4 -4
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +263 -263
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js +172 -172
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +320 -320
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/emitWgsl.js +356 -356
- package/dist/formats/webgpu/core/wgsl/hoistEscapingValues.js +77 -77
- package/dist/formats/webgpu/core/wgsl/lowerBindingLayout.js +451 -451
- package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js +735 -735
- package/dist/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js +457 -457
- package/dist/formats/webgpu/core/wgsl/lowerFragmentProgram.js +1572 -1572
- package/dist/formats/webgpu/core/wgsl/lowerMergeHistogramsComputeProgram.js +659 -659
- package/dist/formats/webgpu/core/wgsl/lowerParticleClearComputePrograms.js +734 -734
- package/dist/formats/webgpu/core/wgsl/lowerParticleEmitComputeProgram.js +583 -583
- package/dist/formats/webgpu/core/wgsl/lowerSkinVerticesComputeProgram.js +621 -621
- package/dist/formats/webgpu/core/wgsl/lowerSortComputeProgram.js +824 -824
- package/dist/formats/webgpu/core/wgsl/lowerSortInnerComputeProgram.js +697 -697
- package/dist/formats/webgpu/core/wgsl/lowerSortStepComputeProgram.js +559 -559
- package/dist/formats/webgpu/core/wgsl/lowerVertexProgram.js +1328 -1328
- package/dist/formats/webgpu/core/wgsl/particleEmitSemanticDigest.js +110 -110
- package/dist/formats/webgpu/core/wgsl/precisionControls.js +55 -55
- package/dist/formats/webgpu/core/wgsl/selectionPlans.js +717 -717
- package/dist/formats/webgpu/core/wgsl/uniformity.js +78 -78
- package/dist/formats/webgpu/core/wgsl/validateExactComputeIr.js +196 -196
- package/dist/formats/webgpu/core/wgsl/validateHandleOperand.js +37 -37
- package/dist/formats/webgpu/index.js +2 -2
- package/dist/formats/webm/CjsWebmFormat.js +197 -197
- package/dist/formats/webm/core/helpers.js +572 -572
- package/dist/formats/webm/index.js +2 -2
- package/dist/formats/webp/CjsWebpFormat.js +140 -140
- package/dist/formats/webp/core/helpers.js +237 -237
- package/dist/formats/webp/index.js +2 -2
- package/dist/formats/wem/CjsWemFormat.js +250 -250
- package/dist/formats/wem/core/bitStream.js +261 -261
- package/dist/formats/wem/core/codebookLibrary.js +164 -164
- package/dist/formats/wem/core/helpers.js +437 -437
- package/dist/formats/wem/core/packedCodebooksAotuv603.js +30 -30
- package/dist/formats/wem/core/ptadpcm.js +77 -77
- package/dist/formats/wem/core/resolve.js +121 -121
- package/dist/formats/wem/core/wemToOgg.js +485 -485
- package/dist/formats/wem/index.js +2 -2
- package/dist/formats/yaml/CjsYamlFormat.js +134 -134
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/formats/yaml/core/CjsYamlReader.js +400 -402
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
- package/dist/formats/yaml/core/helpers.js +196 -170
- package/dist/formats/yaml/core/helpers.js.map +1 -1
- package/dist/formats/yaml/index.js +2 -2
- package/dist/index.js +64 -62
- package/dist/index.js.map +1 -1
- package/dist/resource/CjsLoadingObject.js +19 -0
- package/dist/resource/CjsLoadingObject.js.map +1 -0
- package/dist/resource/CjsResource.js +801 -797
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/ResourceHandlerMode.js +14 -0
- package/dist/resource/ResourceHandlerMode.js.map +1 -0
- package/dist/resource/Tr2LightProfileRes.js +32 -32
- package/dist/resource/audio/AudioGeometryResData.js +47 -47
- package/dist/resource/audio/CjsAudioBufferRes.js +86 -86
- package/dist/resource/audio/CjsAudioRes.js +213 -213
- package/dist/resource/audio/index.js +4 -4
- package/dist/resource/geometry/MeshDecalData.js +37 -37
- package/dist/resource/geometry/MeshDecalLodData.js +34 -34
- package/dist/resource/geometry/TriGeometryRes.js +675 -675
- package/dist/resource/geometry/TriGeometryResAreaData.js +59 -59
- package/dist/resource/geometry/TriGeometryResJointData.js +38 -38
- package/dist/resource/geometry/TriGeometryResLodData.js +88 -88
- package/dist/resource/geometry/TriGeometryResMeshData.js +63 -63
- package/dist/resource/geometry/TriGeometryResSkeletonData.js +34 -34
- package/dist/resource/geometry/TriJointBinding.js +38 -38
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js +46 -46
- package/dist/resource/geometry/TriRtGeometryConstants.js +88 -88
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js +31 -31
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js +60 -60
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +36 -36
- package/dist/resource/geometry/granny/TriGrannyRes.js +35 -35
- package/dist/resource/geometry/granny/enums.js +10 -10
- package/dist/resource/geometry/granny/index.js +6 -6
- package/dist/resource/geometry/index.js +17 -17
- package/dist/resource/index.js +54 -52
- package/dist/resource/index.js.map +1 -1
- package/dist/resource/resourceBoundary.js +64 -64
- package/dist/resource/shader/Tr2EffectRes.js +336 -431
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialArea.js +31 -31
- package/dist/resource/shader/Tr2MaterialMesh.js +27 -27
- package/dist/resource/shader/Tr2MaterialRes.js +31 -31
- package/dist/resource/shader/Tr2Shader.js +283 -261
- package/dist/resource/shader/Tr2Shader.js.map +1 -1
- package/dist/resource/shader/Tr2ShaderPermutation.js +43 -43
- package/dist/resource/shader/index.js +17 -17
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +143 -135
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDefine.js +30 -30
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +114 -109
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +168 -147
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +125 -105
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +120 -86
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +372 -241
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +78 -68
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +168 -111
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/shader/reflection/carbonRecordFields.js +159 -0
- package/dist/resource/shader/reflection/carbonRecordFields.js.map +1 -0
- package/dist/resource/shader/reflection/shaderStage.js +22 -0
- package/dist/resource/shader/reflection/shaderStage.js.map +1 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +135 -77
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +472 -472
- package/dist/resource/texture/CjsTextureArrayResParameterProxy.js +179 -179
- package/dist/resource/texture/Tr2ImageRes.js +120 -120
- package/dist/resource/texture/Tr2TextureLodManager.js +82 -82
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js +37 -37
- package/dist/resource/texture/Tr2TexturePackChannel.js +37 -37
- package/dist/resource/texture/Tr2TexturePipeline.js +54 -54
- package/dist/resource/texture/Tr2TexturePipelineParams.js +34 -34
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +40 -40
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +22 -22
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +34 -34
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +31 -31
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js +43 -43
- package/dist/resource/texture/TriTextureRes.js +359 -359
- package/dist/resource/texture/index.js +15 -15
- package/dist/resource/texture/texturePipelineBehavior.js +308 -308
- package/dist/worker/CjsResManMainThreadLoader.js +89 -87
- package/dist/worker/CjsResManMainThreadLoader.js.map +1 -1
- package/dist/worker/CjsResManWorker.js +218 -217
- package/dist/worker/CjsResManWorker.js.map +1 -1
- package/dist/worker/CjsResManWorkerLoader.js +437 -434
- package/dist/worker/CjsResManWorkerLoader.js.map +1 -1
- package/dist/worker/protocol.js +12 -12
- package/docs/README.md +98 -98
- package/docs/architecture.md +118 -109
- package/docs/concepts/resource-lifecycle.md +226 -225
- package/docs/concepts/shader-resource-model.md +111 -114
- package/docs/concepts/writing-an-engine-adapter.md +115 -115
- package/docs/formats/README.md +138 -136
- package/docs/formats/carbon-effect-container.md +553 -452
- package/docs/formats/dxbc/README.md +68 -68
- package/docs/formats/dxbc/architecture.md +80 -80
- package/docs/formats/dxbc/reference/api.md +77 -77
- package/docs/formats/dxbc/reference/classes/README.md +9 -9
- package/docs/formats/dxbc/reference/decoded-output.md +122 -122
- package/docs/formats/gr2.md +160 -160
- package/docs/formats/hlsl/README.md +54 -54
- package/docs/formats/hlsl/architecture.md +65 -67
- package/docs/formats/hlsl/guides/hydrating-json-output.md +60 -62
- package/docs/formats/hlsl/guides/reading-effects.md +64 -64
- package/docs/formats/hlsl/reference/advanced-analysis.md +61 -66
- package/docs/formats/hlsl/reference/api.md +92 -98
- package/docs/formats/hlsl/reference/classes/README.md +11 -11
- package/docs/formats/hlsl/reference/json-graph.md +97 -100
- package/docs/formats/pickle.md +82 -0
- package/docs/formats/provenance.md +196 -196
- package/docs/formats/stl.md +37 -37
- package/docs/formats/webgl/README.md +115 -57
- package/docs/formats/webgl/architecture.md +69 -70
- package/docs/formats/webgl/carbon-constant-layouts.md +326 -326
- package/docs/formats/webgl/decl-io.md +1234 -1234
- package/docs/formats/webgl/memory-structured.md +890 -871
- package/docs/formats/webgl/reference/classes/README.md +9 -9
- package/docs/formats/webgl/texture-sample.md +964 -964
- package/docs/formats/webgpu/README.md +84 -84
- package/docs/formats/webgpu/architecture.md +95 -96
- package/docs/formats/webgpu/formats/{cewgpu.md → carbon-webgpu.md} +215 -216
- package/docs/formats/webgpu/guides/effect-packaging.md +189 -191
- package/docs/formats/webgpu/reference/api.md +196 -197
- package/docs/formats/webgpu/reference/classes/README.md +9 -9
- package/docs/formats/webgpu/reference/wgsl-compatibility.md +1546 -1543
- package/docs/formats/wwise.md +146 -85
- package/docs/reference/classes/README.md +35 -35
- package/docs/reference/classes/audio.md +30 -30
- package/docs/reference/classes/core.md +216 -206
- package/docs/reference/classes/dropped.md +46 -46
- package/docs/reference/classes/formats.md +944 -952
- package/docs/reference/classes/resources.md +456 -456
- package/docs/reference/classes/texture.md +26 -26
- package/docs/reference/events.md +117 -117
- package/docs/reference/motherlode-cache.md +275 -275
- package/docs/reference/queues.md +194 -110
- package/docs/reference/reload.md +107 -107
- package/docs/reference/texture-arrays.md +113 -113
- package/docs/reference/texture-pipeline.md +53 -53
- package/docs/reference/workers.md +142 -135
- package/docs/roadmap.md +150 -150
- package/format-notices/black/LICENSE +21 -21
- package/format-notices/black/NOTICE +47 -47
- package/format-notices/bnk/LICENSE +21 -21
- package/format-notices/bnk/NOTICE +21 -21
- package/format-notices/cmf/LICENSE +21 -21
- package/format-notices/cmf/NOTICE +36 -36
- package/format-notices/dds/LICENSE +21 -21
- package/format-notices/dds/NOTICE +14 -14
- package/format-notices/dxbc/LICENSE +21 -21
- package/format-notices/dxbc/NOTICE +20 -20
- package/format-notices/fbx/LICENSE +21 -21
- package/format-notices/fbx/NOTICE +14 -14
- package/format-notices/flac/LICENSE +21 -21
- package/format-notices/flac/NOTICE +14 -14
- package/format-notices/gif/LICENSE +21 -21
- package/format-notices/gif/NOTICE +14 -14
- package/format-notices/gltf/LICENSE +21 -21
- package/format-notices/gltf/NOTICE +27 -27
- package/format-notices/gr2/LICENSE +21 -21
- package/format-notices/gr2/NOTICE +60 -60
- package/format-notices/gr2/THIRD-PARTY-NOTICES.md +93 -93
- package/format-notices/hlsl/LICENSE +21 -21
- package/format-notices/hlsl/NOTICE +25 -25
- package/format-notices/jpeg/LICENSE +21 -21
- package/format-notices/jpeg/NOTICE +14 -14
- package/format-notices/mp3/LICENSE +21 -21
- package/format-notices/mp3/NOTICE +14 -14
- package/format-notices/mp4/LICENSE +21 -21
- package/format-notices/mp4/NOTICE +14 -14
- package/format-notices/obj/LICENSE +21 -21
- package/format-notices/obj/NOTICE +26 -26
- package/format-notices/ogg/LICENSE +21 -21
- package/format-notices/ogg/NOTICE +28 -28
- package/format-notices/png/LICENSE +21 -21
- package/format-notices/png/NOTICE +14 -14
- package/format-notices/red/LICENSE +21 -21
- package/format-notices/red/NOTICE +31 -31
- package/format-notices/stl/LICENSE +21 -21
- package/format-notices/stl/NOTICE +21 -21
- package/format-notices/tga/LICENSE +21 -21
- package/format-notices/tga/NOTICE +14 -14
- package/format-notices/wav/LICENSE +21 -21
- package/format-notices/wav/NOTICE +14 -14
- package/format-notices/webgl/LICENSE +21 -21
- package/format-notices/webgl/NOTICE +35 -35
- package/format-notices/webgpu/LICENSE +21 -21
- package/format-notices/webgpu/NOTICE +31 -31
- package/format-notices/webm/LICENSE +21 -21
- package/format-notices/webm/NOTICE +14 -14
- package/format-notices/webp/LICENSE +21 -21
- package/format-notices/webp/NOTICE +14 -14
- package/format-notices/wem/LICENSE +57 -57
- package/format-notices/wem/NOTICE +33 -33
- package/format-notices/yaml/LICENSE +21 -21
- package/format-notices/yaml/NOTICE +44 -44
- package/package.json +63 -63
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js +0 -372
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js.map +0 -1
- package/dist/format/effect/effectReflectionPackage.js +0 -636
- package/dist/format/effect/effectReflectionPackage.js.map +0 -1
- package/dist/formats/hlsl/core/HlslReader.js +0 -16
- package/dist/formats/hlsl/core/HlslReader.js.map +0 -1
- package/dist/formats/hlsl/core/portableReflection.js +0 -848
- package/dist/formats/hlsl/core/portableReflection.js.map +0 -1
- package/dist/formats/hlsl/portable.js +0 -2
- package/dist/formats/hlsl/portable.js.map +0 -1
- package/dist/formats/webgl/core/cewg/CewgPackage.js +0 -340
- package/dist/formats/webgl/core/cewg/CewgPackage.js.map +0 -1
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js +0 -104
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js.map +0 -1
- package/dist/formats/webgl/core/cewg/binary.js +0 -19
- package/dist/formats/webgl/core/cewg/binary.js.map +0 -1
- package/dist/formats/webgl/core/cewgCompleteness.js.map +0 -1
- package/dist/formats/webgl/core/effectPackageValidation.js +0 -331
- package/dist/formats/webgl/core/effectPackageValidation.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/containerViews.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/validateContainer.js.map +0 -1
- package/dist/resource/shader/portable.js +0 -33
- package/dist/resource/shader/portable.js.map +0 -1
- package/docs/formats/hlsl/reference/portable-reflection.md +0 -141
- package/docs/formats/webgl/effect-reflection.md +0 -127
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carbonDescriptionToRuntime.js","sources":["../../../../../src/formats/hlsl/core/carbonDescriptionToRuntime.js"],"sourcesContent":["import { CjsFormatReadError } from \"../../../format/CjsFormatError.js\";\nimport { HlslEffectConstant } from \"./tr2/shader/HlslEffectConstant.js\";\nimport { HlslEffectParameterAnnotation } from \"./tr2/shader/HlslEffectParameterAnnotation.js\";\nimport { HlslEffectResource } from \"./tr2/shader/HlslEffectResource.js\";\nimport { HlslEffectStageInput } from \"./tr2/shader/HlslEffectStageInput.js\";\nimport { HlslEffectStateManager } from \"./HlslEffectStateManager.js\";\nimport { HlslEffectTechnique } from \"./tr2/shader/HlslEffectTechnique.js\";\nimport { HlslPass } from \"./tr2/shader/HlslPass.js\";\nimport { HlslRenderContextEnum, HlslUsageCodeNames } from \"./tr2/HlslRenderContextEnum.js\";\nimport { HlslRenderStateSetup } from \"./HlslRenderStateSetup.js\";\nimport { HlslResourceSetDescription } from \"./HlslResourceSetDescription.js\";\nimport { HlslSamplerDescription } from \"./tr2/shader/HlslSamplerDescription.js\";\nimport { HlslSamplerSetup } from \"./tr2/shader/HlslSamplerSetup.js\";\n\n/**\n * Rebuilds the runtime effect-description shape from a Carbon record tree.\n *\n * This is a **shape adapter and nothing else**. It adds no semantics: its whole\n * job is to turn the parsed container records into the object graph\n * `HlslEffectBindingManifest.fromEffectDescription` already consumes, so that\n * `buildEffectAnalysis` runs unchanged on a container-derived description. The\n * derived view stays the same function it has always been rather than a\n * reimplementation free to drift from it.\n *\n * ## Why this is not a field copy\n *\n * The wire shape and the runtime shape are genuinely different shapes, and every\n * difference is a place a copying adapter produces something that reads as\n * plausible and is wrong:\n *\n * | wire | runtime | conversion |\n * |---|---|---|\n * | `name: {offset, value}` | `name: \"NormalMap\"` | unwrap the arena string reference |\n * | `count` | `arrayElements` | **renamed** — see `mapTextureRecord` |\n * | `isSRGB: 0` | `isSRGB: false` | integer to boolean |\n * | flat sampler fields | `{name, sampler: {...}}` | **re-nested** — see `mapSamplerRecord` |\n * | UAV has no `isSRGB` | `isSRGB: false` | **synthesised** — see `mapUavRecord` |\n * | `registerIndex` field | map key | consumed as the key, not a payload field |\n *\n * Three of those are silent when wrong. `arrayElements` is read at\n * `packageHelpers.js:869` and a rename yields `undefined` there. `isSRGB` as `0`\n * is *accidentally correct* — `0` is falsy, `1` is truthy — so it survives every\n * behavioural test and only a structural diff sees it. A flat sampler puts all\n * fourteen descriptor fields at the wrong depth at once.\n *\n * ## The tables are closed\n *\n * Every record is built through `mapClosed`, which walks the **source** keys and\n * throws on any key with no rule. Nothing is spread and nothing is copied\n * wholesale. That converts \"did we enumerate every field?\" — a question whose\n * wrong answer shows up months later as `undefined` in the engine — into an error\n * the first time the adapter meets a record it does not fully understand.\n *\n * This is deliberately redundant with the two-sided diff in\n * `test/formats/webgpu/carbon-analysis-adapter.test.mjs`, and neither replaces the\n * other. The table catches *the wire has something we do not handle*; the diff\n * catches *our output differs from the reference*. A complete table can still map\n * a field wrongly, and a passing diff on one fixture says nothing about a key that\n * fixture never exercises.\n *\n * ## What is derived rather than stored\n *\n * `m_shader`, `pass.shaderProgram` and `pass.renderStates` are registration\n * handles from `HlslEffectStateManager`, which are monotonic counters and\n * therefore reproduce exactly when registration happens in the same order. That\n * is why stages are walked in **wire array order** rather than by ascending\n * stage type: the source reader registers them in the order the file lists them.\n * `resourceSetDesc` and its `heapViews` are likewise rebuilt by running the same\n * derivation the source reader runs, not carried on the wire.\n */\n\n/** Carbon annotation type for a string-valued annotation. */\nconst ANNOTATION_TYPE_STRING = HlslEffectParameterAnnotation.Type.STRING;\n\nconst rawView = new DataView(new ArrayBuffer(4));\n\n/**\n * Unwraps an arena string reference to its text.\n *\n * @param {{offset:number, value:string}|null} reference Wire string reference.\n * @returns {string} The referenced text.\n */\nfunction text(reference)\n{\n return typeof reference?.value === \"string\" ? reference.value : \"\";\n}\n\n/**\n * Converts a wire `u8` flag to the boolean the runtime shape carries.\n *\n * @param {number} value Wire flag.\n * @returns {boolean} Boolean form.\n */\nfunction flag(value)\n{\n return Boolean(value);\n}\n\n/**\n * Reads four wire bytes as the little-endian `u32` the runtime annotation holds.\n *\n * @param {Uint8Array|null} bytes Four raw bytes.\n * @returns {number} Unsigned 32-bit value.\n */\nfunction rawUint32(bytes)\n{\n if (!bytes || bytes.length < 4) return 0;\n rawView.setUint8(0, bytes[0]);\n rawView.setUint8(1, bytes[1]);\n rawView.setUint8(2, bytes[2]);\n rawView.setUint8(3, bytes[3]);\n return rawView.getUint32(0, true);\n}\n\n/**\n * Reinterprets a `u32` bit pattern as the float it encodes.\n *\n * @param {number} bits Raw 32-bit pattern.\n * @returns {number} The float those bits encode.\n */\nfunction floatFromBits(bits)\n{\n rawView.setUint32(0, bits >>> 0, true);\n return rawView.getFloat32(0, true);\n}\n\n/**\n * Builds an object from a record by walking the record's own keys against a\n * closed rule table, throwing on any key the table does not name.\n *\n * Walking the **source** keys is the point. A table walked from its own entries\n * would silently ignore a field the wire gained, which is exactly the failure\n * this exists to make loud.\n *\n * @param {object} record Source wire record.\n * @param {object} rules Rule table keyed by source field name.\n * @param {object} target Object to populate.\n * @param {string} what Record kind, for the error message.\n * @returns {object} The populated target.\n */\nfunction mapClosed(record, rules, target, what)\n{\n for (const key of Object.keys(record))\n {\n const rule = rules[key];\n if (!rule)\n {\n throw new CjsFormatReadError(\n `Carbon ${what} record carries field \"${key}\" with no mapping rule`,\n { record: what, field: key }\n );\n }\n rule(target, record[key], record);\n }\n return target;\n}\n\n/** Consumes a field that is deliberately not part of the runtime payload. */\nconst consumed = () => {};\n\n/** Texture record rules. `count` is Carbon's name for `arrayElements`. */\nconst TEXTURE_RULES = Object.freeze({\n // Carried as the map key by the caller, not as a payload field.\n registerIndex: consumed,\n name: (target, value) => { target.name = text(value); },\n type: (target, value) => { target.type = value; },\n // RENAME: the wire calls this `count`; the runtime calls it `arrayElements`.\n // Copying the field name yields `arrayElements: undefined`, read silently at\n // `packageHelpers.js:869`.\n count: (target, value) => { target.arrayElements = value; },\n isSRGB: (target, value) => { target.isSRGB = flag(value); },\n isAutoregister: (target, value) => { target.isAutoregister = flag(value); }\n});\n\n/** UAV record rules. A UAV record has no `isSRGB`; it is synthesised. */\nconst UAV_RULES = Object.freeze({\n registerIndex: consumed,\n name: (target, value) => { target.name = text(value); },\n type: (target, value) => { target.type = value; },\n // RENAME: same as the texture record.\n count: (target, value) => { target.arrayElements = value; },\n isAutoregister: (target, value) => { target.isAutoregister = flag(value); }\n});\n\n/** Sampler record rules. The wire record is flat; the runtime shape is nested. */\nconst SAMPLER_RULES = Object.freeze({\n registerIndex: consumed,\n // Handled after the walk: the name depends on `isDynamic`, which the walk\n // may not have reached yet.\n name: consumed,\n isDynamic: (target, value) => { target.sampler.isDynamic = flag(value); },\n comparison: (target, value) => { target.sampler.comparison = flag(value); },\n minFilter: (target, value) => { target.sampler.minFilter = value; },\n magFilter: (target, value) => { target.sampler.magFilter = value; },\n mipFilter: (target, value) => { target.sampler.mipFilter = value; },\n addressU: (target, value) => { target.sampler.addressU = value; },\n addressV: (target, value) => { target.sampler.addressV = value; },\n addressW: (target, value) => { target.sampler.addressW = value; },\n mipLODBias: (target, value) => { target.sampler.mipLODBias = value; },\n maxAnisotropy: (target, value) => { target.sampler.maxAnisotropy = value; },\n comparisonFunc: (target, value) => { target.sampler.comparisonFunc = value; },\n borderColor: (target, value) => { target.sampler.borderColor = value.slice(0, 4); },\n minLOD: (target, value) => { target.sampler.minLOD = value; },\n maxLOD: (target, value) => { target.sampler.maxLOD = value; }\n});\n\n/** Static sampler rules. `borderColor` is a one-byte enum here, not four floats. */\nconst STATIC_SAMPLER_RULES = Object.freeze({\n registerIndex: (target, value) => { target.registerIndex = value; },\n registerSpace: (target, value) => { target.registerSpace = value; },\n comparison: (target, value) => { target.sampler.comparison = flag(value); },\n minFilter: (target, value) => { target.sampler.minFilter = value; },\n magFilter: (target, value) => { target.sampler.magFilter = value; },\n mipFilter: (target, value) => { target.sampler.mipFilter = value; },\n addressU: (target, value) => { target.sampler.addressU = value; },\n addressV: (target, value) => { target.sampler.addressV = value; },\n addressW: (target, value) => { target.sampler.addressW = value; },\n mipLODBias: (target, value) => { target.sampler.mipLODBias = value; },\n maxAnisotropy: (target, value) => { target.sampler.maxAnisotropy = value; },\n comparisonFunc: (target, value) => { target.sampler.comparisonFunc = value; },\n borderColor: (target, value) => { target.sampler.borderColor = value; },\n minLOD: (target, value) => { target.sampler.minLOD = value; },\n maxLOD: (target, value) => { target.sampler.maxLOD = value; }\n});\n\n/** Constant record rules. */\nconst CONSTANT_RULES = Object.freeze({\n name: (target, value) => { target.name = text(value); },\n offset: (target, value) => { target.offset = value; },\n size: (target, value) => { target.size = value; },\n type: (target, value) => { target.type = value; },\n dimension: (target, value) => { target.dimension = value; },\n elements: (target, value) => { target.elements = value; },\n isSRGB: (target, value) => { target.isSRGB = flag(value); },\n isAutoregister: (target, value) => { target.isAutoregister = flag(value); }\n});\n\n/** Register declaration rules. */\nconst REGISTER_RULES = Object.freeze({\n registerType: (target, value) => { target.registerType = value; },\n registerIndex: (target, value) => { target.registerIndex = value; },\n // Carbon stores one field its reader calls `arrayCount` and its writer calls\n // `registerCount`. The runtime shape carries both names, always equal — the\n // producer refuses to write them when they disagree.\n registerCount: (target, value) => { target.registerCount = value; target.arrayCount = value; },\n registerSpace: (target, value) => { target.registerSpace = value; }\n});\n\n/**\n * Pipeline input rules.\n *\n * `usageName` is derived from the `usage` byte rather than carried: it is a\n * display name looked up from a table (`HlslEffectDescription.js:592`), exactly\n * as Carbon derives it through `GetStringForUsageCode` (`EffectData.h:86`).\n * Nothing goes on the wire for it.\n */\nconst PIPELINE_INPUT_RULES = Object.freeze({\n usage: (target, value) =>\n {\n target.usage = value;\n target.usageName = HlslUsageCodeNames[value] || `USAGE_${value}`;\n },\n registerIndex: (target, value) => { target.registerIndex = value; },\n usageIndex: (target, value) => { target.usageIndex = value; },\n usedMask: (target, value) => { target.usedMask = value; },\n type: (target, value) => { target.type = value; },\n dimension: (target, value) => { target.dimension = value; }\n});\n\n/** Annotation rules. */\nconst ANNOTATION_RULES = Object.freeze({\n name: (target, value) => { target.name = text(value); },\n type: (target, value) => { target.type = value; },\n stringValue: (target, value) => { if (value) target.stringValue = text(value); },\n // A non-string annotation value is four raw bytes: Carbon writes it through a\n // float union and reads it through a different one, so the bytes are the only\n // faithful form. The three typed views are derived from them exactly as the\n // source reader derives them (`HlslEffectDescription.js:480-483`).\n rawValue: (target, value, record) =>\n {\n if (record.type === ANNOTATION_TYPE_STRING) return;\n const bits = rawUint32(value);\n target.rawValue = bits;\n target.boolValue = bits !== 0;\n target.intValue = bits | 0;\n target.floatValue = floatFromBits(bits);\n }\n});\n\n/**\n * Maps one texture record onto its runtime resource object.\n *\n * @param {object} record Wire texture record.\n * @returns {HlslEffectResource} Runtime resource.\n */\nfunction mapTextureRecord(record)\n{\n return mapClosed(record, TEXTURE_RULES, new HlslEffectResource(), \"texture\");\n}\n\n/**\n * Maps one UAV record onto its runtime resource object.\n *\n * A UAV record is one byte shorter than a texture record: it carries no\n * `isSRGB`. Carbon's reader hardcodes it false (`Tr2EffectDescription.cpp:450`),\n * and so does ours (`HlslEffectDescription.js:434`), so the runtime object's\n * constructor default is restored explicitly rather than left to chance —\n * `metadata.toJSON()` emits the key for a UAV even though the wire never carries\n * it, because both kinds share `HlslEffectResource`.\n *\n * @param {object} record Wire UAV record.\n * @returns {HlslEffectResource} Runtime resource.\n */\nfunction mapUavRecord(record)\n{\n const resource = mapClosed(record, UAV_RULES, new HlslEffectResource(), \"uav\");\n resource.isSRGB = false;\n return resource;\n}\n\n/**\n * Maps one sampler record onto its runtime sampler setup.\n *\n * Two conversions beyond the flat-to-nested reshape:\n *\n * - Carbon nulls a sampler's name when it is not dynamic\n * (`Tr2EffectDescription.cpp:430-433`, mirrored at\n * `HlslEffectDescription.js:414-417`), so the wire's empty string must become\n * `null` again. Like `isSRGB`, this is *accidentally correct* if left alone —\n * `\"\"` and `null` are both falsy, so `metadataName` and the heap-view lookup\n * behave identically — and only a structural diff catches it.\n * - `comparison` and `isDynamic` are `u8` on the wire and boolean at runtime.\n *\n * @param {object} record Wire sampler record.\n * @returns {HlslSamplerSetup} Runtime sampler setup.\n */\nfunction mapSamplerRecord(record)\n{\n const setup = new HlslSamplerSetup();\n setup.sampler = new HlslSamplerDescription();\n mapClosed(record, SAMPLER_RULES, setup, \"sampler\");\n setup.name = setup.sampler.isDynamic ? text(record.name) : null;\n return setup;\n}\n\n/**\n * Maps one static sampler record onto its runtime signature entry.\n *\n * The runtime shape keeps the `*Raw` companions non-enumerable, matching\n * `readStaticSampler`, so a `cloneJson` of the descriptor sees the value form\n * only.\n *\n * @param {object} record Wire static sampler record.\n * @returns {object} Runtime static sampler entry.\n */\nfunction mapStaticSamplerRecord(record)\n{\n const entry = { registerIndex: 0, registerSpace: 0, sampler: {\n comparison: false,\n minFilter: 0,\n magFilter: 0,\n mipFilter: 0,\n addressU: 0,\n addressV: 0,\n addressW: 0,\n mipLODBias: 0,\n maxAnisotropy: 0,\n comparisonFunc: 0,\n borderColor: 0,\n minLOD: 0,\n maxLOD: 0\n } };\n mapClosed(record, STATIC_SAMPLER_RULES, entry, \"static sampler\");\n Object.defineProperties(entry.sampler, {\n mipLODBiasRaw: { value: 0, writable: true },\n minLODRaw: { value: 0, writable: true },\n maxLODRaw: { value: 0, writable: true }\n });\n return entry;\n}\n\n/**\n * Maps one constant record onto its runtime constant object.\n *\n * @param {object} record Wire constant record.\n * @returns {HlslEffectConstant} Runtime constant.\n */\nfunction mapConstantRecord(record)\n{\n return mapClosed(record, CONSTANT_RULES, new HlslEffectConstant(), \"constant\");\n}\n\n/**\n * Maps one annotation record onto its runtime annotation object.\n *\n * @param {object} record Wire annotation record.\n * @returns {HlslEffectParameterAnnotation} Runtime annotation.\n */\nfunction mapAnnotationRecord(record)\n{\n return mapClosed(record, ANNOTATION_RULES, new HlslEffectParameterAnnotation(), \"annotation\");\n}\n\n/**\n * Restores the `dynamic` flag the source reader derives per register.\n *\n * Reproduced rather than stored: it is a function of the register type, the\n * stage type and the caller's per-frame start registers, none of which the\n * container needs to carry (`HlslEffectDescription.js:750-765`).\n *\n * @param {object} register Runtime register declaration.\n * @param {number} stageType Stage enum value.\n * @param {object} context Adapter context carrying the per-frame registers.\n * @returns {boolean} True when the register is dynamic.\n */\nfunction isRegisterDynamic(register, stageType, context)\n{\n if (register.registerType !== 0) return true;\n if (stageType === HlslRenderContextEnum.VERTEX_SHADER\n && register.registerIndex === context.perFrameVSStartRegister) return false;\n if (stageType === HlslRenderContextEnum.PIXEL_SHADER\n && register.registerIndex === context.perFramePSStartRegister) return false;\n return true;\n}\n\n/**\n * Populates one runtime stage input from a wire `StageData` block.\n *\n * @param {HlslEffectStageInput} input Destination stage input.\n * @param {object} data Wire stage data.\n * @param {number} stageType Stage enum value.\n * @param {object} context Adapter context.\n */\nfunction applyStageData(input, data, stageType, context)\n{\n input.signature.registers = (data.registers ?? []).map((record) =>\n {\n const register = mapClosed(record, REGISTER_RULES, {}, \"register\");\n register.dynamic = isRegisterDynamic(register, stageType, context);\n return register;\n });\n input.signature.samplers = (data.staticSamplers ?? []).map(mapStaticSamplerRecord);\n\n input.constants = (data.constants ?? []).map(mapConstantRecord);\n\n // The declared size is the unclamped one; the runtime clamps it to\n // SHADER_CONSTANTS_MAX and slices the payload to match\n // (`HlslEffectDescription.js:381-385`). `packMaterial` allocates an\n // ArrayBuffer of exactly this size, so restoring the unclamped value would\n // write past the layout the shader expects — on any effect above 4096 bytes\n // of constants, which is precisely the size a small fixture never reaches.\n const declaredSize = data.defaultValues?.size ?? 0;\n input.sourceConstantValues = Uint8Array.from(data.defaultValues?.bytes ?? new Uint8Array(0));\n input.m_constantValueSize = Math.min(declaredSize, HlslEffectStageInput.SHADER_CONSTANTS_MAX);\n input.constantValues = input.sourceConstantValues.slice(0, input.m_constantValueSize);\n\n input.resources = new Map((data.textures ?? [])\n .map((record) => [ record.registerIndex, mapTextureRecord(record) ]));\n input.samplers = new Map((data.samplers ?? [])\n .map((record) => [ record.registerIndex, mapSamplerRecord(record) ]));\n input.uavs = new Map((data.uavs ?? [])\n .map((record) => [ record.registerIndex, mapUavRecord(record) ]));\n\n input.annotation = (data.annotations ?? []).map(mapAnnotationRecord);\n\n // Runs last, because it needs the sampler map. See the function's own note\n // for why it exists.\n for (const constant of input.constants) patchSamplerHeapIndexConstant(input, constant);\n}\n\n/**\n * Grows the constant block to cover a sampler heap-index constant.\n *\n * Reproduces `HlslEffectDescription.js:773-791`, which the source reader applies\n * to every constant once samplers are known: a `UINT`/dimension-1 constant whose\n * name matches a sampler is a heap index, and the declared constant-value size\n * can be smaller than the offset it sits at. The reader extends the block rather\n * than reading out of bounds.\n *\n * **This is derived, not stored, and missing it is not cosmetic.** `packMaterial`\n * allocates `new ArrayBuffer(constantValueSize)`, so an unpatched size\n * under-allocates and the write runs past the end of the buffer the shader\n * expects. It appears only on dx12 -- the whole dx11 corpus is unaffected --\n * which is exactly why the analysis diff had to cover dx12 before this was\n * trustworthy. On `quaddetailv5.sm_depth` the declared 608 becomes 620.\n *\n * @param {object} input Runtime stage input, with samplers already populated.\n * @param {object} constant Runtime constant record.\n */\nfunction patchSamplerHeapIndexConstant(input, constant)\n{\n if (constant.type !== HlslEffectConstant.Type.UINT || constant.dimension !== 1) return;\n\n for (const sampler of input.samplers.values())\n {\n if (sampler.name !== constant.name) continue;\n const neededSize = constant.offset + constant.size;\n if (neededSize > input.m_constantValueSize)\n {\n const next = new Uint8Array(neededSize);\n next.set(input.constantValues);\n input.constantValues = next;\n input.m_constantValueSize = neededSize;\n }\n break;\n }\n}\n\n/**\n * Rebuilds one runtime pass from a wire pass record.\n *\n * @param {object} record Wire pass record.\n * @param {object} context Adapter context.\n * @returns {HlslPass} Runtime pass.\n */\nfunction buildPass(record, context)\n{\n const pass = new HlslPass();\n const shaderTypes = [];\n const signatures = [];\n const shaderHandles = [];\n\n // Wire array order, not ascending stage type. The source reader registers\n // shaders in the order the file lists its stages, and the state manager's\n // handles are monotonic counters, so any other order reproduces the shape\n // with the handles permuted.\n for (const stage of record.stages ?? [])\n {\n const stageType = stage.type;\n const input = pass.stageInputs[stageType];\n if (!input)\n {\n throw new CjsFormatReadError(\n `Carbon stage record declares stage type ${stageType}, outside the runtime stage range`,\n { stageType }\n );\n }\n if (input.m_exists)\n {\n throw new CjsFormatReadError(\n `Carbon pass declares stage type ${stageType} twice; the later stage would clobber the earlier`,\n { stageType }\n );\n }\n\n input.m_exists = true;\n input.signature.threadGroupSize = {\n x: stage.threadGroupSize[0],\n y: stage.threadGroupSize[1],\n z: stage.threadGroupSize[2]\n };\n input.signature.pipelineInputs = (stage.pipelineInputs ?? [])\n .map((entry) => mapClosed(entry, PIPELINE_INPUT_RULES, {}, \"pipeline input\"));\n\n applyStageData(input, stage, stageType, context);\n\n input.cjsShaderBytecode = context.bytecodeFor\n ? context.bytecodeFor(stage, stageType, pass)\n : null;\n\n input.m_shader = context.effectStateManager.RegisterShader(\n stageType,\n input.cjsShaderBytecode,\n input.signature,\n context.effectName\n );\n shaderHandles.push(input.m_shader);\n shaderTypes.push(stageType);\n signatures.push(input.signature);\n pass.shaderTypeMask |= (1 << stageType);\n }\n\n pass.resourceSetDesc = new HlslResourceSetDescription(shaderTypes, signatures);\n for (let stageType = 0; stageType < HlslRenderContextEnum.SHADER_TYPE_COUNT; stageType += 1)\n {\n const input = pass.stageInputs[stageType];\n if (!input?.m_exists) continue;\n for (const [ registerIndex, sampler ] of input.samplers.entries())\n {\n pass.resourceSetDesc.SetSampler(stageType, registerIndex, sampler.sampler);\n }\n }\n\n pass.shaderProgram = context.effectStateManager.RegisterShaderProgram(\n shaderHandles,\n shaderHandles.length\n );\n\n const states = new Map();\n for (const entry of record.renderStates ?? [])\n {\n if (states.has(entry.state))\n {\n throw new CjsFormatReadError(\n `Carbon pass declares render state ${entry.state} twice`,\n { state: entry.state }\n );\n }\n states.set(entry.state, entry.value);\n }\n pass.cjsRenderStateSetup = new HlslRenderStateSetup(states);\n pass.renderStates = context.effectStateManager.RegisterRenderStateSetup(pass.cjsRenderStateSetup);\n\n return pass;\n}\n\n/**\n * Applies the `IsHeapView` annotations to the rebuilt resource-set descriptions.\n *\n * Derived exactly as the source reader derives it\n * (`HlslEffectDescription.js:799-851`), over the annotations the container\n * carries.\n *\n * @param {object} effectDescription Rebuilt effect description.\n */\nfunction applyHeapViewAnnotations(effectDescription)\n{\n const isHeapView = (name) =>\n {\n if (!name) return false;\n const annotations = effectDescription.annotations.get(name) || [];\n return annotations.some((annotation) =>\n annotation.name === \"IsHeapView\"\n && annotation.type === HlslEffectParameterAnnotation.Type.BOOL\n && annotation.boolValue);\n };\n\n for (const technique of effectDescription.techniques)\n {\n for (const pass of technique.passes)\n {\n for (let stageType = 0; stageType < pass.stageInputs.length; stageType += 1)\n {\n const stage = pass.stageInputs[stageType];\n if (!stage?.m_exists) continue;\n for (const [ registerIndex, resource ] of stage.resources.entries())\n {\n if (isHeapView(resource.name)) pass.resourceSetDesc?.SetSrvHeapView(stageType, registerIndex);\n }\n for (const [ registerIndex, resource ] of stage.uavs.entries())\n {\n if (isHeapView(resource.name)) pass.resourceSetDesc?.SetUavHeapView(stageType, registerIndex);\n }\n for (const [ registerIndex, sampler ] of stage.samplers.entries())\n {\n if (isHeapView(sampler.name)) pass.resourceSetDesc?.SetSamplerHeapView(stageType, registerIndex);\n }\n }\n }\n }\n}\n\n/**\n * Rebuilds the runtime effect-description shape from a Carbon record tree.\n *\n * @param {object} description Parsed Carbon description record tree.\n * @param {object} [options] Adapter options.\n * @param {string} [options.effectName] Effect name or source path.\n * @param {number} [options.version] Carbon effect-data version.\n * @param {number} [options.perFrameVSStartRegister] Per-frame vertex start register.\n * @param {number} [options.perFramePSStartRegister] Per-frame pixel start register.\n * @param {Function} [options.bytecodeFor] Supplies `cjsShaderBytecode` per stage.\n * @param {HlslEffectStateManager} [options.effectStateManager] Registry override.\n * @returns {object} Runtime-shaped effect description.\n */\nexport function runtimeDescriptionFromCarbon(description, options = {})\n{\n if (!description?.techniques)\n {\n throw new CjsFormatReadError(\"Carbon description has no techniques\", {});\n }\n\n const context = {\n effectName: options.effectName ?? \"\",\n effectStateManager: options.effectStateManager ?? new HlslEffectStateManager(),\n bytecodeFor: options.bytecodeFor ?? null,\n perFrameVSStartRegister: Number.isInteger(options.perFrameVSStartRegister)\n ? options.perFrameVSStartRegister\n : null,\n perFramePSStartRegister: Number.isInteger(options.perFramePSStartRegister)\n ? options.perFramePSStartRegister\n : null\n };\n\n const effectDescription = {\n effectName: context.effectName,\n version: options.version ?? 15,\n techniques: [],\n annotations: new Map(),\n effectStateManager: context.effectStateManager\n };\n\n for (const record of description.techniques)\n {\n const technique = new HlslEffectTechnique();\n technique.name = text(record.name);\n // Raytracing libraries are carried on the wire and are deliberately NOT\n // rebuilt here. `libraries` stays empty.\n //\n // This began as a throw, on the reasoning that a silent drop hides a\n // whole missing section and that no shipped effect declared one. The\n // first half still stands; the second half was wrong, and the way it was\n // wrong is the useful part. The dx11 corpus has no libraries at all —\n // 1611 files, zero — so the refusal never fired. **Every dx12 body of\n // `unpacked_quadv5.sm_hi` carries one**: technique `RtShadow`, a\n // `ClosestHit` export, DXR raytracing shadows that dx11 has no analogue\n // for. All 288 distinct bodies. So the refusal blocked every dx12\n // package for a section nothing downstream reads.\n //\n // Dropping them is safe for a *specific, checked* reason rather than a\n // hopeful one: `buildEffectAnalysis` reaches libraries through no path.\n // `buildPasses` walks `technique.passes`; `buildStages` walks\n // `pass.stageInputs`; neither touches `technique.libraries`. The source\n // reader's heap-view pass does visit libraries, but only to populate\n // `library.globalResourceSetDesc`, which the manifest never reads.\n //\n // That claim is measured, not argued: the corpus analysis diff compares\n // source-derived against container-derived analysis over dx12 as well as\n // dx11, so every one of those library-bearing bodies is proof that the\n // drop is invisible to this view. If the analysis ever grows a library\n // section, that test goes red rather than this comment going stale.\n technique.passes = (record.passes ?? []).map((pass) => buildPass(pass, context));\n for (const pass of technique.passes) technique.shaderTypeMask |= pass.shaderTypeMask;\n effectDescription.techniques.push(technique);\n }\n\n for (const group of description.annotations ?? [])\n {\n effectDescription.annotations.set(\n text(group.name),\n (group.annotations ?? []).map(mapAnnotationRecord)\n );\n }\n\n applyHeapViewAnnotations(effectDescription);\n\n return effectDescription;\n}\n\nexport default runtimeDescriptionFromCarbon;\n"],"names":["ANNOTATION_TYPE_STRING","HlslEffectParameterAnnotation","Type","STRING","rawView","DataView","ArrayBuffer","text","reference","value","flag","Boolean","rawUint32","bytes","length","setUint8","getUint32","floatFromBits","bits","setUint32","getFloat32","mapClosed","record","rules","target","what","key","Object","keys","rule","CjsFormatReadError","field","consumed","TEXTURE_RULES","freeze","registerIndex","name","type","count","arrayElements","isSRGB","isAutoregister","UAV_RULES","SAMPLER_RULES","isDynamic","sampler","comparison","minFilter","magFilter","mipFilter","addressU","addressV","addressW","mipLODBias","maxAnisotropy","comparisonFunc","borderColor","slice","minLOD","maxLOD","STATIC_SAMPLER_RULES","registerSpace","CONSTANT_RULES","offset","size","dimension","elements","REGISTER_RULES","registerType","registerCount","arrayCount","PIPELINE_INPUT_RULES","usage","usageName","HlslUsageCodeNames","usageIndex","usedMask","ANNOTATION_RULES","stringValue","rawValue","boolValue","intValue","floatValue","mapTextureRecord","HlslEffectResource","mapUavRecord","resource","mapSamplerRecord","setup","HlslSamplerSetup","HlslSamplerDescription","mapStaticSamplerRecord","entry","defineProperties","mipLODBiasRaw","writable","minLODRaw","maxLODRaw","mapConstantRecord","HlslEffectConstant","mapAnnotationRecord","isRegisterDynamic","register","stageType","context","HlslRenderContextEnum","VERTEX_SHADER","perFrameVSStartRegister","PIXEL_SHADER","perFramePSStartRegister","applyStageData","input","data","signature","registers","map","dynamic","samplers","staticSamplers","constants","declaredSize","defaultValues","sourceConstantValues","Uint8Array","from","m_constantValueSize","Math","min","HlslEffectStageInput","SHADER_CONSTANTS_MAX","constantValues","resources","Map","textures","uavs","annotation","annotations","constant","patchSamplerHeapIndexConstant","UINT","values","neededSize","next","set","buildPass","pass","HlslPass","shaderTypes","signatures","shaderHandles","stage","stages","stageInputs","m_exists","threadGroupSize","x","y","z","pipelineInputs","cjsShaderBytecode","bytecodeFor","m_shader","effectStateManager","RegisterShader","effectName","push","shaderTypeMask","resourceSetDesc","HlslResourceSetDescription","SHADER_TYPE_COUNT","entries","SetSampler","shaderProgram","RegisterShaderProgram","states","renderStates","has","state","cjsRenderStateSetup","HlslRenderStateSetup","RegisterRenderStateSetup","applyHeapViewAnnotations","effectDescription","isHeapView","get","some","BOOL","technique","techniques","passes","SetSrvHeapView","SetUavHeapView","SetSamplerHeapView","runtimeDescriptionFromCarbon","description","options","HlslEffectStateManager","Number","isInteger","version","HlslEffectTechnique","group"],"mappings":";;;;;;;;;;;;;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMA,sBAAsB,GAAGC,6BAA6B,CAACC,IAA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CAACO,GAAG,CAC7BxI,IAAI,CAACkM,KAAK,CAACrK,IAAI,CAAC,EAChB,CAACqK,KAAK,CAACjE,WAAW,IAAI,EAAE,EAAErB,GAAG,CAACf,mBAAmB,CACrD,CAAC;AACL,EAAA;EAEAiF,wBAAwB,CAACC,iBAAiB,CAAC;AAE3C,EAAA,OAAOA,iBAAiB;AAC5B;;;;"}
|
|
1
|
+
{"version":3,"file":"carbonDescriptionToRuntime.js","sources":["../../../../../src/formats/hlsl/core/carbonDescriptionToRuntime.js"],"sourcesContent":["import { CjsFormatReadError } from \"../../../format/CjsFormatError.js\";\nimport { HlslEffectConstant } from \"./tr2/shader/HlslEffectConstant.js\";\nimport { HlslEffectLibrary } from \"./tr2/shader/HlslEffectLibrary.js\";\nimport { HlslEffectParameterAnnotation } from \"./tr2/shader/HlslEffectParameterAnnotation.js\";\nimport { HlslEffectResource } from \"./tr2/shader/HlslEffectResource.js\";\nimport { HlslEffectStageInput } from \"./tr2/shader/HlslEffectStageInput.js\";\nimport { HlslEffectStateManager } from \"./HlslEffectStateManager.js\";\nimport { HlslEffectTechnique } from \"./tr2/shader/HlslEffectTechnique.js\";\nimport { HlslPass } from \"./tr2/shader/HlslPass.js\";\nimport { HlslShaderBytecode } from \"./HlslShaderBytecode.js\";\nimport { HlslRenderContextEnum, HlslUsageCodeNames } from \"./tr2/HlslRenderContextEnum.js\";\nimport { HlslRenderStateSetup } from \"./HlslRenderStateSetup.js\";\nimport { HlslResourceSetDescription } from \"./HlslResourceSetDescription.js\";\nimport { HlslSamplerDescription } from \"./tr2/shader/HlslSamplerDescription.js\";\nimport { HlslSamplerSetup } from \"./tr2/shader/HlslSamplerSetup.js\";\n\n/**\n * Rebuilds the runtime effect-description shape from a Carbon record tree.\n *\n * This is a **shape adapter and nothing else**. It adds no semantics: its whole\n * job is to turn the parsed container records into the object graph\n * `HlslEffectBindingManifest.fromEffectDescription` already consumes, so that\n * `buildEffectAnalysis` runs unchanged on a container-derived description. The\n * derived view stays the same function it has always been rather than a\n * reimplementation free to drift from it.\n *\n * ## Why this is not a field copy\n *\n * The wire shape and the runtime shape are genuinely different shapes, and every\n * difference is a place a copying adapter produces something that reads as\n * plausible and is wrong:\n *\n * | wire | runtime | conversion |\n * |---|---|---|\n * | `name: {offset, value}` | `name: \"NormalMap\"` | unwrap the arena string reference |\n * | `count` | `arrayElements` | **renamed** — see `mapTextureRecord` |\n * | `isSRGB: 0` | `isSRGB: false` | integer to boolean |\n * | flat sampler fields | `{name, sampler: {...}}` | **re-nested** — see `mapSamplerRecord` |\n * | UAV has no `isSRGB` | `isSRGB: false` | **synthesised** — see `mapUavRecord` |\n * | `registerIndex` field | map key | consumed as the key, not a payload field |\n *\n * Three of those are silent when wrong. `arrayElements` is read at\n * `packageHelpers.js:869` and a rename yields `undefined` there. `isSRGB` as `0`\n * is *accidentally correct* — `0` is falsy, `1` is truthy — so it survives every\n * behavioural test and only a structural diff sees it. A flat sampler puts all\n * fourteen descriptor fields at the wrong depth at once.\n *\n * ## The tables are closed\n *\n * Every record is built through `mapClosed`, which walks the **source** keys and\n * throws on any key with no rule. Nothing is spread and nothing is copied\n * wholesale. That converts \"did we enumerate every field?\" — a question whose\n * wrong answer shows up months later as `undefined` in the engine — into an error\n * the first time the adapter meets a record it does not fully understand.\n *\n * This is deliberately redundant with the two-sided diff in\n * `test/formats/webgpu/carbon-analysis-adapter.test.mjs`, and neither replaces the\n * other. The table catches *the wire has something we do not handle*; the diff\n * catches *our output differs from the reference*. A complete table can still map\n * a field wrongly, and a passing diff on one fixture says nothing about a key that\n * fixture never exercises.\n *\n * ## What is derived rather than stored\n *\n * `m_shader`, `pass.shaderProgram` and `pass.renderStates` are registration\n * handles from `HlslEffectStateManager`, which are monotonic counters and\n * therefore reproduce exactly when registration happens in the same order. That\n * is why stages are walked in **wire array order** rather than by ascending\n * stage type: the source reader registers them in the order the file lists them.\n * `resourceSetDesc` and its `heapViews` are likewise rebuilt by running the same\n * derivation the source reader runs, not carried on the wire.\n */\n\n/** Carbon annotation type for a string-valued annotation. */\nconst ANNOTATION_TYPE_STRING = HlslEffectParameterAnnotation.Type.STRING;\n\nconst rawView = new DataView(new ArrayBuffer(4));\n\n/**\n * Unwraps an arena string reference to its text.\n *\n * @param {{offset:number, value:string}|null} reference Wire string reference.\n * @returns {string} The referenced text.\n */\nfunction text(reference)\n{\n return typeof reference?.value === \"string\" ? reference.value : \"\";\n}\n\n/**\n * Converts a wire `u8` flag to the boolean the runtime shape carries.\n *\n * @param {number} value Wire flag.\n * @returns {boolean} Boolean form.\n */\nfunction flag(value)\n{\n return Boolean(value);\n}\n\n/**\n * Reads four wire bytes as the little-endian `u32` the runtime annotation holds.\n *\n * @param {Uint8Array|null} bytes Four raw bytes.\n * @returns {number} Unsigned 32-bit value.\n */\nfunction rawUint32(bytes)\n{\n if (!bytes || bytes.length < 4) return 0;\n rawView.setUint8(0, bytes[0]);\n rawView.setUint8(1, bytes[1]);\n rawView.setUint8(2, bytes[2]);\n rawView.setUint8(3, bytes[3]);\n return rawView.getUint32(0, true);\n}\n\n/**\n * Reinterprets a `u32` bit pattern as the float it encodes.\n *\n * @param {number} bits Raw 32-bit pattern.\n * @returns {number} The float those bits encode.\n */\nfunction floatFromBits(bits)\n{\n rawView.setUint32(0, bits >>> 0, true);\n return rawView.getFloat32(0, true);\n}\n\n/**\n * Builds an object from a record by walking the record's own keys against a\n * closed rule table, throwing on any key the table does not name.\n *\n * Walking the **source** keys is the point. A table walked from its own entries\n * would silently ignore a field the wire gained, which is exactly the failure\n * this exists to make loud.\n *\n * @param {object} record Source wire record.\n * @param {object} rules Rule table keyed by source field name.\n * @param {object} target Object to populate.\n * @param {string} what Record kind, for the error message.\n * @returns {object} The populated target.\n */\nfunction mapClosed(record, rules, target, what)\n{\n for (const key of Object.keys(record))\n {\n const rule = rules[key];\n if (!rule)\n {\n throw new CjsFormatReadError(\n `Carbon ${what} record carries field \"${key}\" with no mapping rule`,\n { record: what, field: key }\n );\n }\n rule(target, record[key], record);\n }\n return target;\n}\n\n/** Consumes a field that is deliberately not part of the runtime payload. */\nconst consumed = () => {};\n\n/** Texture record rules. `count` is Carbon's name for `arrayElements`. */\nconst TEXTURE_RULES = Object.freeze({\n // Carried as the map key by the caller, not as a payload field.\n registerIndex: consumed,\n name: (target, value) => { target.name = text(value); },\n type: (target, value) => { target.type = value; },\n // RENAME: the wire calls this `count`; the runtime calls it `arrayElements`.\n // Copying the field name yields `arrayElements: undefined`, read silently at\n // `packageHelpers.js:869`.\n count: (target, value) => { target.arrayElements = value; },\n isSRGB: (target, value) => { target.isSRGB = flag(value); },\n isAutoregister: (target, value) => { target.isAutoregister = flag(value); }\n});\n\n/** UAV record rules. A UAV record has no `isSRGB`; it is synthesised. */\nconst UAV_RULES = Object.freeze({\n registerIndex: consumed,\n name: (target, value) => { target.name = text(value); },\n type: (target, value) => { target.type = value; },\n // RENAME: same as the texture record.\n count: (target, value) => { target.arrayElements = value; },\n isAutoregister: (target, value) => { target.isAutoregister = flag(value); }\n});\n\n/** Sampler record rules. The wire record is flat; the runtime shape is nested. */\nconst SAMPLER_RULES = Object.freeze({\n registerIndex: consumed,\n // Handled after the walk: the name depends on `isDynamic`, which the walk\n // may not have reached yet.\n name: consumed,\n isDynamic: (target, value) => { target.sampler.isDynamic = flag(value); },\n comparison: (target, value) => { target.sampler.comparison = flag(value); },\n minFilter: (target, value) => { target.sampler.minFilter = value; },\n magFilter: (target, value) => { target.sampler.magFilter = value; },\n mipFilter: (target, value) => { target.sampler.mipFilter = value; },\n addressU: (target, value) => { target.sampler.addressU = value; },\n addressV: (target, value) => { target.sampler.addressV = value; },\n addressW: (target, value) => { target.sampler.addressW = value; },\n mipLODBias: (target, value) => { target.sampler.mipLODBias = value; },\n maxAnisotropy: (target, value) => { target.sampler.maxAnisotropy = value; },\n comparisonFunc: (target, value) => { target.sampler.comparisonFunc = value; },\n borderColor: (target, value) => { target.sampler.borderColor = value.slice(0, 4); },\n minLOD: (target, value) => { target.sampler.minLOD = value; },\n maxLOD: (target, value) => { target.sampler.maxLOD = value; }\n});\n\n/** Static sampler rules. `borderColor` is a one-byte enum here, not four floats. */\nconst STATIC_SAMPLER_RULES = Object.freeze({\n registerIndex: (target, value) => { target.registerIndex = value; },\n registerSpace: (target, value) => { target.registerSpace = value; },\n comparison: (target, value) => { target.sampler.comparison = flag(value); },\n minFilter: (target, value) => { target.sampler.minFilter = value; },\n magFilter: (target, value) => { target.sampler.magFilter = value; },\n mipFilter: (target, value) => { target.sampler.mipFilter = value; },\n addressU: (target, value) => { target.sampler.addressU = value; },\n addressV: (target, value) => { target.sampler.addressV = value; },\n addressW: (target, value) => { target.sampler.addressW = value; },\n mipLODBias: (target, value) => { target.sampler.mipLODBias = value; },\n maxAnisotropy: (target, value) => { target.sampler.maxAnisotropy = value; },\n comparisonFunc: (target, value) => { target.sampler.comparisonFunc = value; },\n borderColor: (target, value) => { target.sampler.borderColor = value; },\n minLOD: (target, value) => { target.sampler.minLOD = value; },\n maxLOD: (target, value) => { target.sampler.maxLOD = value; }\n});\n\n/** Constant record rules. */\nconst CONSTANT_RULES = Object.freeze({\n name: (target, value) => { target.name = text(value); },\n offset: (target, value) => { target.offset = value; },\n size: (target, value) => { target.size = value; },\n type: (target, value) => { target.type = value; },\n dimension: (target, value) => { target.dimension = value; },\n elements: (target, value) => { target.elements = value; },\n isSRGB: (target, value) => { target.isSRGB = flag(value); },\n isAutoregister: (target, value) => { target.isAutoregister = flag(value); }\n});\n\n/** Register declaration rules. */\nconst REGISTER_RULES = Object.freeze({\n registerType: (target, value) => { target.registerType = value; },\n registerIndex: (target, value) => { target.registerIndex = value; },\n // Carbon stores one field its reader calls `arrayCount` and its writer calls\n // `registerCount`. The runtime shape carries both names, always equal — the\n // producer refuses to write them when they disagree.\n registerCount: (target, value) => { target.registerCount = value; target.arrayCount = value; },\n registerSpace: (target, value) => { target.registerSpace = value; }\n});\n\n/**\n * Pipeline input rules.\n *\n * `usageName` is derived from the `usage` byte rather than carried: it is a\n * display name looked up from a table, exactly as Carbon derives it through\n * `GetStringForUsageCode` (`EffectData.h:86`). Nothing goes on the wire for it.\n */\nconst PIPELINE_INPUT_RULES = Object.freeze({\n usage: (target, value) =>\n {\n target.usage = value;\n target.usageName = HlslUsageCodeNames[value] || `USAGE_${value}`;\n },\n registerIndex: (target, value) => { target.registerIndex = value; },\n usageIndex: (target, value) => { target.usageIndex = value; },\n usedMask: (target, value) => { target.usedMask = value; },\n type: (target, value) => { target.type = value; },\n dimension: (target, value) => { target.dimension = value; }\n});\n\n/** Annotation rules. */\nconst ANNOTATION_RULES = Object.freeze({\n name: (target, value) => { target.name = text(value); },\n type: (target, value) => { target.type = value; },\n stringValue: (target, value) => { if (value) target.stringValue = text(value); },\n // A non-string annotation value is four raw bytes: Carbon writes it through a\n // float union and reads it through a different one, so the bytes are the only\n // faithful form. The three typed views are derived from those bytes, one per\n // union member Carbon reads back through.\n rawValue: (target, value, record) =>\n {\n if (record.type === ANNOTATION_TYPE_STRING) return;\n const bits = rawUint32(value);\n target.rawValue = bits;\n target.boolValue = bits !== 0;\n target.intValue = bits | 0;\n target.floatValue = floatFromBits(bits);\n }\n});\n\n/**\n * Maps one texture record onto its runtime resource object.\n *\n * @param {object} record Wire texture record.\n * @returns {HlslEffectResource} Runtime resource.\n */\nfunction mapTextureRecord(record)\n{\n return mapClosed(record, TEXTURE_RULES, new HlslEffectResource(), \"texture\");\n}\n\n/**\n * Maps one UAV record onto its runtime resource object.\n *\n * A UAV record is one byte shorter than a texture record: it carries no\n * `isSRGB`. Carbon's reader hardcodes it false (`Tr2EffectDescription.cpp:450`),\n * so the runtime object's\n * constructor default is restored explicitly rather than left to chance —\n * `metadata.toJSON()` emits the key for a UAV even though the wire never carries\n * it, because both kinds share `HlslEffectResource`.\n *\n * @param {object} record Wire UAV record.\n * @returns {HlslEffectResource} Runtime resource.\n */\nfunction mapUavRecord(record)\n{\n const resource = mapClosed(record, UAV_RULES, new HlslEffectResource(), \"uav\");\n resource.isSRGB = false;\n return resource;\n}\n\n/**\n * Maps one sampler record onto its runtime sampler setup.\n *\n * Two conversions beyond the flat-to-nested reshape:\n *\n * - Carbon nulls a sampler's name when it is not dynamic\n * (`Tr2EffectDescription.cpp:430-433`), so the wire's empty string must become\n * `null` again. A pre-v13 record carries no `isDynamic` at all; the class\n * default (dynamic) then keeps the name, matching the legacy reader, which\n * never assigned the flag for those versions. Like `isSRGB`, the nulling is\n * *accidentally correct* if left alone —\n * `\"\"` and `null` are both falsy, so `metadataName` and the heap-view lookup\n * behave identically — and only a structural diff catches it.\n * - `comparison` and `isDynamic` are `u8` on the wire and boolean at runtime.\n *\n * @param {object} record Wire sampler record.\n * @returns {HlslSamplerSetup} Runtime sampler setup.\n */\nfunction mapSamplerRecord(record)\n{\n const setup = new HlslSamplerSetup();\n setup.sampler = new HlslSamplerDescription();\n mapClosed(record, SAMPLER_RULES, setup, \"sampler\");\n setup.name = setup.sampler.isDynamic ? text(record.name) : null;\n return setup;\n}\n\n/**\n * Maps one static sampler record onto its runtime signature entry.\n *\n * The runtime shape keeps the `*Raw` companions non-enumerable, so a\n * `cloneJson` of the descriptor sees the value form only.\n *\n * @param {object} record Wire static sampler record.\n * @returns {object} Runtime static sampler entry.\n */\nfunction mapStaticSamplerRecord(record)\n{\n const entry = { registerIndex: 0, registerSpace: 0, sampler: {\n comparison: false,\n minFilter: 0,\n magFilter: 0,\n mipFilter: 0,\n addressU: 0,\n addressV: 0,\n addressW: 0,\n mipLODBias: 0,\n maxAnisotropy: 0,\n comparisonFunc: 0,\n borderColor: 0,\n minLOD: 0,\n maxLOD: 0\n } };\n mapClosed(record, STATIC_SAMPLER_RULES, entry, \"static sampler\");\n Object.defineProperties(entry.sampler, {\n mipLODBiasRaw: { value: 0, writable: true },\n minLODRaw: { value: 0, writable: true },\n maxLODRaw: { value: 0, writable: true }\n });\n return entry;\n}\n\n/**\n * Maps one constant record onto its runtime constant object.\n *\n * @param {object} record Wire constant record.\n * @returns {HlslEffectConstant} Runtime constant.\n */\nfunction mapConstantRecord(record)\n{\n return mapClosed(record, CONSTANT_RULES, new HlslEffectConstant(), \"constant\");\n}\n\n/**\n * Maps one annotation record onto its runtime annotation object.\n *\n * @param {object} record Wire annotation record.\n * @returns {HlslEffectParameterAnnotation} Runtime annotation.\n */\nfunction mapAnnotationRecord(record)\n{\n return mapClosed(record, ANNOTATION_RULES, new HlslEffectParameterAnnotation(), \"annotation\");\n}\n\n/**\n * Restores the `dynamic` flag the source reader derives per register.\n *\n * Reproduced rather than stored: it is a function of the register type, the\n * stage type and the caller's per-frame start registers, none of which the\n * container needs to carry.\n *\n * @param {object} register Runtime register declaration.\n * @param {number} stageType Stage enum value.\n * @param {object} context Adapter context carrying the per-frame registers.\n * @returns {boolean} True when the register is dynamic.\n */\nfunction isRegisterDynamic(register, stageType, context)\n{\n if (register.registerType !== 0) return true;\n if (stageType === HlslRenderContextEnum.VERTEX_SHADER\n && register.registerIndex === context.perFrameVSStartRegister) return false;\n if (stageType === HlslRenderContextEnum.PIXEL_SHADER\n && register.registerIndex === context.perFramePSStartRegister) return false;\n return true;\n}\n\n/**\n * Populates one runtime stage input from a wire `StageData` block.\n *\n * @param {HlslEffectStageInput} input Destination stage input.\n * @param {object} data Wire stage data.\n * @param {number} stageType Stage enum value.\n * @param {object} context Adapter context.\n */\nfunction applyStageData(input, data, stageType, context)\n{\n input.signature.registers = (data.registers ?? []).map((record) =>\n {\n const register = mapClosed(record, REGISTER_RULES, {}, \"register\");\n register.dynamic = isRegisterDynamic(register, stageType, context);\n return register;\n });\n input.signature.samplers = (data.staticSamplers ?? []).map(mapStaticSamplerRecord);\n\n input.constants = (data.constants ?? []).map(mapConstantRecord);\n\n // The declared size is the unclamped one; the runtime clamps it to\n // SHADER_CONSTANTS_MAX and slices the payload to match, as Carbon does\n // (`Tr2EffectDescription.h:160`). `packMaterial` allocates an\n // ArrayBuffer of exactly this size, so restoring the unclamped value would\n // write past the layout the shader expects — on any effect above 4096 bytes\n // of constants, which is precisely the size a small fixture never reaches.\n const declaredSize = data.defaultValues?.size ?? 0;\n input.sourceConstantValueSize = declaredSize;\n input.sourceConstantValues = Uint8Array.from(data.defaultValues?.bytes ?? new Uint8Array(0));\n input.m_constantValueSize = Math.min(declaredSize, HlslEffectStageInput.SHADER_CONSTANTS_MAX);\n input.constantValues = input.sourceConstantValues.slice(0, input.m_constantValueSize);\n\n input.resources = new Map((data.textures ?? [])\n .map((record) => [ record.registerIndex, mapTextureRecord(record) ]));\n input.samplers = new Map((data.samplers ?? [])\n .map((record) => [ record.registerIndex, mapSamplerRecord(record) ]));\n input.uavs = new Map((data.uavs ?? [])\n .map((record) => [ record.registerIndex, mapUavRecord(record) ]));\n\n input.annotation = (data.annotations ?? []).map(mapAnnotationRecord);\n\n // Runs last, because it needs the sampler map. See the function's own note\n // for why it exists.\n for (const constant of input.constants) patchSamplerHeapIndexConstant(input, constant);\n}\n\n/**\n * Grows the constant block to cover a sampler heap-index constant.\n *\n * Applied to every constant once samplers are known, as Carbon's reader does:\n * a `UINT`/dimension-1 constant whose name matches a sampler is a heap index,\n * and the declared constant-value size can be smaller than the offset it sits\n * at. The block is extended rather than read out of bounds.\n *\n * **This is derived, not stored, and missing it is not cosmetic.** `packMaterial`\n * allocates `new ArrayBuffer(constantValueSize)`, so an unpatched size\n * under-allocates and the write runs past the end of the buffer the shader\n * expects. It appears only on dx12 -- the whole dx11 corpus is unaffected --\n * which is exactly why the analysis diff had to cover dx12 before this was\n * trustworthy. On `quaddetailv5.sm_depth` the declared 608 becomes 620.\n *\n * @param {object} input Runtime stage input, with samplers already populated.\n * @param {object} constant Runtime constant record.\n */\nfunction patchSamplerHeapIndexConstant(input, constant)\n{\n if (constant.type !== HlslEffectConstant.Type.UINT || constant.dimension !== 1) return;\n\n for (const sampler of input.samplers.values())\n {\n if (sampler.name !== constant.name) continue;\n const neededSize = constant.offset + constant.size;\n if (neededSize > input.m_constantValueSize)\n {\n const next = new Uint8Array(neededSize);\n next.set(input.constantValues);\n input.constantValues = next;\n input.m_constantValueSize = neededSize;\n }\n break;\n }\n}\n\n/**\n * Rebuilds one runtime pass from a wire pass record.\n *\n * @param {object} record Wire pass record.\n * @param {object} context Adapter context.\n * @returns {HlslPass} Runtime pass.\n */\nfunction buildPass(record, context)\n{\n const pass = new HlslPass();\n const shaderTypes = [];\n const signatures = [];\n const shaderHandles = [];\n\n // Wire array order, not ascending stage type. The source reader registers\n // shaders in the order the file lists its stages, and the state manager's\n // handles are monotonic counters, so any other order reproduces the shape\n // with the handles permuted.\n for (const stage of record.stages ?? [])\n {\n const stageType = stage.type;\n const input = pass.stageInputs[stageType];\n if (!input)\n {\n throw new CjsFormatReadError(\n `Carbon stage record declares stage type ${stageType}, outside the runtime stage range`,\n { stageType }\n );\n }\n if (input.m_exists)\n {\n throw new CjsFormatReadError(\n `Carbon pass declares stage type ${stageType} twice; the later stage would clobber the earlier`,\n { stageType }\n );\n }\n\n input.m_exists = true;\n input.signature.threadGroupSize = {\n x: stage.threadGroupSize[0],\n y: stage.threadGroupSize[1],\n z: stage.threadGroupSize[2]\n };\n input.signature.pipelineInputs = (stage.pipelineInputs ?? [])\n .map((entry) => mapClosed(entry, PIPELINE_INPUT_RULES, {}, \"pipeline input\"));\n\n applyStageData(input, stage, stageType, context);\n\n input.cjsShaderBytecode = context.bytecodeFor\n ? context.bytecodeFor(stage, stageType, pass)\n : null;\n\n input.m_shader = context.effectStateManager.RegisterShader(\n stageType,\n input.cjsShaderBytecode,\n input.signature,\n context.effectName\n );\n shaderHandles.push(input.m_shader);\n shaderTypes.push(stageType);\n signatures.push(input.signature);\n pass.shaderTypeMask |= (1 << stageType);\n }\n\n pass.resourceSetDesc = new HlslResourceSetDescription(shaderTypes, signatures);\n for (let stageType = 0; stageType < HlslRenderContextEnum.SHADER_TYPE_COUNT; stageType += 1)\n {\n const input = pass.stageInputs[stageType];\n if (!input?.m_exists) continue;\n for (const [ registerIndex, sampler ] of input.samplers.entries())\n {\n pass.resourceSetDesc.SetSampler(stageType, registerIndex, sampler.sampler);\n }\n }\n\n pass.shaderProgram = context.effectStateManager.RegisterShaderProgram(\n shaderHandles,\n shaderHandles.length\n );\n\n const states = new Map();\n for (const entry of record.renderStates ?? [])\n {\n if (states.has(entry.state))\n {\n throw new CjsFormatReadError(\n `Carbon pass declares render state ${entry.state} twice`,\n { state: entry.state }\n );\n }\n states.set(entry.state, entry.value);\n }\n pass.cjsRenderStateSetup = new HlslRenderStateSetup(states);\n pass.renderStates = context.effectStateManager.RegisterRenderStateSetup(pass.cjsRenderStateSetup);\n\n return pass;\n}\n\n/** Names an export slot per Carbon's raytracing export type codes. */\nconst LIBRARY_EXPORT_NAME_FIELDS = Object.freeze([\n \"rayGenName\",\n \"missName\",\n \"closestHitName\",\n \"anyHitName\",\n \"intersectionName\"\n]);\n\n/** Library record rules; the nested pieces are handled by `buildLibrary`. */\nconst LIBRARY_RULES = Object.freeze({\n payloadSize: (target, value) => { target.payloadSize = value; },\n hitGroupName: (target, value) => { target.hitGroupName = text(value); },\n // Consumed by buildLibrary: the blob becomes the registered bytecode.\n shaderData: consumed,\n // Consumed by buildLibrary: exports carry per-type name routing.\n exports: consumed,\n globalInputs: consumed,\n localInputs: consumed\n});\n\n/**\n * Rebuilds one runtime shader library from a wire library record.\n *\n * The two stage-data blocks reuse `applyStageData`, so a library's constants,\n * defaults, resources, samplers and UAVs go through exactly the rules a pass\n * stage goes through. The library bytecode is registered the way the runtime\n * registers it: a compute-typed `HlslShaderBytecode` under the state manager's\n * library registry, whose handles are a separate monotonic counter — adding\n * libraries does not shift any shader or program handle.\n *\n * @param {object} record Wire library record.\n * @param {object} context Adapter context.\n * @returns {HlslEffectLibrary} Runtime library.\n */\nfunction buildLibrary(record, context)\n{\n const library = mapClosed(record, LIBRARY_RULES, new HlslEffectLibrary(), \"library\");\n const shaderType = HlslRenderContextEnum.COMPUTE_SHADER;\n\n library.cjsShaderBytecode = new HlslShaderBytecode({\n stageType: shaderType,\n stageName: \"library\",\n bytes: record.shaderData?.bytes ?? new Uint8Array(0),\n shaderSize: record.shaderData?.size ?? 0,\n stringTableOffset: record.shaderData?.offset ?? null\n });\n library.libraryHandle = context.effectStateManager.RegisterShaderLibrary(\n library.cjsShaderBytecode\n );\n\n for (const entry of record.exports ?? [])\n {\n const name = text(entry.name);\n library.exports.push({ type: entry.type, name });\n const field = LIBRARY_EXPORT_NAME_FIELDS[entry.type];\n if (field) library[field] = name;\n }\n\n applyStageData(library.globalInput, record.globalInputs ?? {}, shaderType, context);\n library.globalResourceSetDesc = new HlslResourceSetDescription(\n [ shaderType ],\n [ library.globalInput.signature ]\n );\n for (const [ registerIndex, sampler ] of library.globalInput.samplers.entries())\n {\n library.globalResourceSetDesc.SetSampler(shaderType, registerIndex, sampler.sampler);\n }\n\n applyStageData(library.localInput, record.localInputs ?? {}, shaderType, context);\n\n return library;\n}\n\n/**\n * Applies the `IsHeapView` annotations to the rebuilt resource-set descriptions.\n *\n * Derived rather than carried, over the annotations the container holds,\n * exactly as Carbon derives it after reading\n * (`Tr2EffectDescription.cpp:474-530`): a parameter whose top-level\n * annotations contain a true BOOL `IsHeapView` marks its register as a heap\n * view in the owning resource-set description, for library global inputs as\n * well as pass stages.\n *\n * @param {object} effectDescription Rebuilt effect description.\n */\nfunction applyHeapViewAnnotations(effectDescription)\n{\n const isHeapView = (name) =>\n {\n if (!name) return false;\n const annotations = effectDescription.annotations.get(name) || [];\n return annotations.some((annotation) =>\n annotation.name === \"IsHeapView\"\n && annotation.type === HlslEffectParameterAnnotation.Type.BOOL\n && annotation.boolValue);\n };\n\n for (const technique of effectDescription.techniques)\n {\n for (const library of technique.libraries ?? [])\n {\n const shaderType = HlslRenderContextEnum.COMPUTE_SHADER;\n for (const [ registerIndex, resource ] of library.globalInput.resources.entries())\n {\n if (isHeapView(resource.name)) library.globalResourceSetDesc?.SetSrvHeapView(shaderType, registerIndex);\n }\n for (const [ registerIndex, resource ] of library.globalInput.uavs.entries())\n {\n if (isHeapView(resource.name)) library.globalResourceSetDesc?.SetUavHeapView(shaderType, registerIndex);\n }\n for (const [ registerIndex, sampler ] of library.globalInput.samplers.entries())\n {\n if (isHeapView(sampler.name)) library.globalResourceSetDesc?.SetSamplerHeapView(shaderType, registerIndex);\n }\n }\n\n for (const pass of technique.passes)\n {\n for (let stageType = 0; stageType < pass.stageInputs.length; stageType += 1)\n {\n const stage = pass.stageInputs[stageType];\n if (!stage?.m_exists) continue;\n for (const [ registerIndex, resource ] of stage.resources.entries())\n {\n if (isHeapView(resource.name)) pass.resourceSetDesc?.SetSrvHeapView(stageType, registerIndex);\n }\n for (const [ registerIndex, resource ] of stage.uavs.entries())\n {\n if (isHeapView(resource.name)) pass.resourceSetDesc?.SetUavHeapView(stageType, registerIndex);\n }\n for (const [ registerIndex, sampler ] of stage.samplers.entries())\n {\n if (isHeapView(sampler.name)) pass.resourceSetDesc?.SetSamplerHeapView(stageType, registerIndex);\n }\n }\n }\n }\n}\n\n/**\n * Rebuilds the runtime effect-description shape from a Carbon record tree.\n *\n * @param {object} description Parsed Carbon description record tree.\n * @param {object} [options] Adapter options.\n * @param {string} [options.effectName] Effect name or source path.\n * @param {number} [options.version] Carbon effect-data version.\n * @param {number} [options.perFrameVSStartRegister] Per-frame vertex start register.\n * @param {number} [options.perFramePSStartRegister] Per-frame pixel start register.\n * @param {Function} [options.bytecodeFor] Supplies `cjsShaderBytecode` per stage.\n * @param {HlslEffectStateManager} [options.effectStateManager] Registry override.\n * @returns {object} Runtime-shaped effect description.\n */\nexport function runtimeDescriptionFromCarbon(description, options = {})\n{\n if (!description?.techniques)\n {\n throw new CjsFormatReadError(\"Carbon description has no techniques\", {});\n }\n\n const context = {\n effectName: options.effectName ?? \"\",\n effectStateManager: options.effectStateManager ?? new HlslEffectStateManager(),\n bytecodeFor: options.bytecodeFor ?? null,\n perFrameVSStartRegister: Number.isInteger(options.perFrameVSStartRegister)\n ? options.perFrameVSStartRegister\n : null,\n perFramePSStartRegister: Number.isInteger(options.perFramePSStartRegister)\n ? options.perFramePSStartRegister\n : null\n };\n\n const effectDescription = {\n effectName: context.effectName,\n version: options.version ?? 15,\n techniques: [],\n annotations: new Map(),\n effectStateManager: context.effectStateManager\n };\n\n for (const record of description.techniques)\n {\n const technique = new HlslEffectTechnique();\n technique.name = text(record.name);\n technique.passes = (record.passes ?? []).map((pass) => buildPass(pass, context));\n for (const pass of technique.passes) technique.shaderTypeMask |= pass.shaderTypeMask;\n // Raytracing libraries were once deliberately dropped here, when this\n // adapter served only `buildEffectAnalysis` — which reaches libraries\n // through no path, a claim the dx12 corpus diff measured (every body\n // of `unpacked_quadv5.sm_hi` carries an `RtShadow` library, and the\n // diff stayed green). Since the runtime read path converged on this\n // adapter, that scope no longer holds: `metadata.js` and `json.js`\n // emit `technique.libraries`, and the effect-resource contract\n // requires every library's exports, inputs and payload preserved.\n technique.libraries = (record.libraries ?? []).map((library) => buildLibrary(library, context));\n effectDescription.techniques.push(technique);\n }\n\n for (const group of description.annotations ?? [])\n {\n const name = text(group.name);\n if (effectDescription.annotations.has(name))\n {\n throw new CjsFormatReadError(\n `Duplicate effect parameter annotation group ${name}`,\n { name }\n );\n }\n effectDescription.annotations.set(\n name,\n (group.annotations ?? []).map(mapAnnotationRecord)\n );\n }\n\n applyHeapViewAnnotations(effectDescription);\n\n return effectDescription;\n}\n\nexport default runtimeDescriptionFromCarbon;\n"],"names":["ANNOTATION_TYPE_STRING","HlslEffectParameterAnnotation","Type","STRING","rawView","DataView","ArrayBuffer","text","reference","value","flag","Boolean","rawUint32","bytes","length","setUint8","getUint32","floatFromBits","bits","setUint32","getFloat32","mapClosed","record","rules","target","what","key","Object","keys","rule","CjsFormatReadError","field","consumed","TEXTURE_RULES","freeze","registerIndex","name","type","count","arrayElements","isSRGB","isAutoregister","UAV_RULES","SAMPLER_RULES","isDynamic","sampler","comparison","minFilter","magFilter","mipFilter","addressU","addressV","addressW","mipLODBias","maxAnisotropy","comparisonFunc","borderColor","slice","minLOD","maxLOD","STATIC_SAMPLER_RULES","registerSpace","CONSTANT_RULES","offset","size","dimension","elements","REGISTER_RULES","registerType","registerCount","arrayCount","PIPELINE_INPUT_RULES","usage","usageName","HlslUsageCodeNames","usageIndex","usedMask","ANNOTATION_RULES","stringValue","rawValue","boolValue","intValue","floatValue","mapTextureRecord","HlslEffectResource","mapUavRecord","resource","mapSamplerRecord","setup","HlslSamplerSetup","HlslSamplerDescription","mapStaticSamplerRecord","entry","defineProperties","mipLODBiasRaw","writable","minLODRaw","maxLODRaw","mapConstantRecord","HlslEffectConstant","mapAnnotationRecord","isRegisterDynamic","register","stageType","context","HlslRenderContextEnum","VERTEX_SHADER","perFrameVSStartRegister","PIXEL_SHADER","perFramePSStartRegister","applyStageData","input","data","signature","registers","map","dynamic","samplers","staticSamplers","constants","declaredSize","defaultValues","sourceConstantValueSize","sourceConstantValues","Uint8Array","from","m_constantValueSize","Math","min","HlslEffectStageInput","SHADER_CONSTANTS_MAX","constantValues","resources","Map","textures","uavs","annotation","annotations","constant","patchSamplerHeapIndexConstant","UINT","values","neededSize","next","set","buildPass","pass","HlslPass","shaderTypes","signatures","shaderHandles","stage","stages","stageInputs","m_exists","threadGroupSize","x","y","z","pipelineInputs","cjsShaderBytecode","bytecodeFor","m_shader","effectStateManager","RegisterShader","effectName","push","shaderTypeMask","resourceSetDesc","HlslResourceSetDescription","SHADER_TYPE_COUNT","entries","SetSampler","shaderProgram","RegisterShaderProgram","states","renderStates","has","state","cjsRenderStateSetup","HlslRenderStateSetup","RegisterRenderStateSetup","LIBRARY_EXPORT_NAME_FIELDS","LIBRARY_RULES","payloadSize","hitGroupName","shaderData","exports","globalInputs","localInputs","buildLibrary","library","HlslEffectLibrary","shaderType","COMPUTE_SHADER","HlslShaderBytecode","stageName","shaderSize","stringTableOffset","libraryHandle","RegisterShaderLibrary","globalInput","globalResourceSetDesc","localInput","applyHeapViewAnnotations","effectDescription","isHeapView","get","some","BOOL","technique","techniques","libraries","SetSrvHeapView","SetUavHeapView","SetSamplerHeapView","passes","runtimeDescriptionFromCarbon","description","options","HlslEffectStateManager","Number","isInteger","version","HlslEffectTechnique","group"],"mappings":";;;;;;;;;;;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMA,sBAAsB,GAAGC,6BAA6B,CAACC,IAAI,CAACC,MAAM;AAExE,MAAMC,OAAO,GAAG,IAAIC,QAAQ,CAAC,IAAIC,WAAW,CAAC,CAAC,CAAC,CAAC;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAACC,SAAS,EACvB;EACI,OAAO,OAAOA,SAAS,EAAEC,KAAK,KAAK,QAAQ,GAAGD,SAAS,CAACC,KAAK,GAAG,EAAE;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAACD,KAAK,EACnB;EACI,OAAOE,OAAO,CAACF,KAAK,CAAC;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,SAASA,CAACC,KAAK,EACxB;EACI,IAAI,CAACA,KAAK,IAAIA,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE,OAAO,CAAC;EACxCV,OAAO,CAACW,QAAQ,CAAC,CAAC,EAAEF,KAAK,CAAC,CAAC,CAAC,CAAC;EAC7BT,OAAO,CAACW,QAAQ,CAAC,CAAC,EAAEF,KAAK,CAAC,CAAC,CAAC,CAAC;EAC7BT,OAAO,CAACW,QAAQ,CAAC,CAAC,EAAEF,KAAK,CAAC,CAAC,CAAC,CAAC;EAC7BT,OAAO,CAACW,QAAQ,CAAC,CAAC,EAAEF,KAAK,CAAC,CAAC,CAAC,CAAC;AAC7B,EAAA,OAAOT,OAAO,C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,CAAC8L,SAAS,IAAI,EAAE,EAAEjG,GAAG,CAAE4E,OAAO,IAAKD,YAAY,CAACC,OAAO,EAAEvF,OAAO,CAAC,CAAC;AAC/FqG,IAAAA,iBAAiB,CAACM,UAAU,CAAC7C,IAAI,CAAC4C,SAAS,CAAC;AAChD,EAAA;EAEA,KAAK,MAAMe,KAAK,IAAIP,WAAW,CAACjF,WAAW,IAAI,EAAE,EACjD;AACI,IAAA,MAAMrG,IAAI,GAAG7B,IAAI,CAAC0N,KAAK,CAAC7L,IAAI,CAAC;IAC7B,IAAIyK,iBAAiB,CAACpE,WAAW,CAACwC,GAAG,CAAC7I,IAAI,CAAC,EAC3C;AACI,MAAA,MAAM,IAAIN,kBAAkB,CACxB,CAAA,4CAAA,EAA+CM,IAAI,EAAE,EACrD;AAAEA,QAAAA;AAAK,OACX,CAAC;AACL,IAAA;AACAyK,IAAAA,iBAAiB,CAACpE,WAAW,CAACO,GAAG,CAC7B5G,IAAI,EACJ,CAAC6L,KAAK,CAACxF,WAAW,IAAI,EAAE,EAAEtB,GAAG,CAACf,mBAAmB,CACrD,CAAC;AACL,EAAA;EAEAwG,wBAAwB,CAACC,iBAAiB,CAAC;AAE3C,EAAA,OAAOA,iBAAiB;AAC5B;;;;"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recognises Carbon's Detail-map resource family from reflection alone.
|
|
3
|
+
*
|
|
4
|
+
* Both backends merge `Detail1Map`/`Detail2Map`/`Detail3Map` into a single
|
|
5
|
+
* array texture, and both need to agree exactly on *which* registers take part.
|
|
6
|
+
* That decision is about the resources, not about the shading language, so it
|
|
7
|
+
* lives here rather than twice in the two emitters.
|
|
8
|
+
*
|
|
9
|
+
* What this module does **not** do is prove the merge is safe. Recognising the
|
|
10
|
+
* family is necessary but not sufficient: a backend must also confirm that every
|
|
11
|
+
* use of those registers is a plain sample it can redirect at an array layer. A
|
|
12
|
+
* detail map fetched by integer coordinate, or queried for its size, cannot be
|
|
13
|
+
* merged, and only the code walking the shader can see that. So each backend
|
|
14
|
+
* pairs this recogniser with its own use check and fails closed on anything it
|
|
15
|
+
* does not understand.
|
|
16
|
+
*
|
|
17
|
+
* The WebGL 2 motivation is a hard limit rather than tidiness: the affected
|
|
18
|
+
* shaders sit at exactly 16 textures against a 16-unit guarantee, so merging
|
|
19
|
+
* three maps into one is what creates the headroom lighting needs. See
|
|
20
|
+
* docs/contracts/webgl2-texture-budget.md.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** Resource names that make up the family, in layer order. */
|
|
24
|
+
const DETAIL_PARAMETERS = Object.freeze(["Detail1Map", "Detail2Map", "Detail3Map"]);
|
|
25
|
+
|
|
26
|
+
/** Carbon's resource type code for a 2D texture. */
|
|
27
|
+
const CARBON_TEXTURE_2D = 2;
|
|
28
|
+
|
|
29
|
+
/** The merged array's name, and the transform family it belongs to. */
|
|
30
|
+
const DETAIL_MAP_ARRAY_NAME = "DetailArrayMap";
|
|
31
|
+
const DETAIL_MAP_ARRAY_FAMILY = "detail-map-array";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Recognises the detail-map family in one stage's reflected resources.
|
|
35
|
+
*
|
|
36
|
+
* Requires the maps to be contiguous from `Detail1Map` with no gap, in one
|
|
37
|
+
* register space, at strictly ascending registers, and each an ordinary
|
|
38
|
+
* single-element 2D texture declared linear. Anything else returns null: a
|
|
39
|
+
* partial or unusual family is not merged, because guessing produces a shader
|
|
40
|
+
* that links and samples the wrong thing.
|
|
41
|
+
*
|
|
42
|
+
* `isSRGB` must be present and false rather than merely not true. Carbon's
|
|
43
|
+
* reader always sets it, so an absent flag means the caller is passing
|
|
44
|
+
* something other than resource reflection, and the layers of one array texture
|
|
45
|
+
* cannot disagree about whether sampling decodes sRGB.
|
|
46
|
+
*
|
|
47
|
+
* @param {Array<object>} resources Reflected resources, each carrying
|
|
48
|
+
* `registerIndex`, `name`, `type`, `isSRGB`, and optionally `registerSpace`
|
|
49
|
+
* and `arrayElements`. `parameter` is accepted in place of `name`.
|
|
50
|
+
* @param {object} [options] Recognition options.
|
|
51
|
+
* @param {number} [options.registerSpace] Default register space.
|
|
52
|
+
* @returns {object|null} Frozen plan, or null when the family is absent or unusable.
|
|
53
|
+
*/
|
|
54
|
+
function recogniseDetailMapFamily(resources, options = {}) {
|
|
55
|
+
const registerSpace = options.registerSpace ?? 0;
|
|
56
|
+
const byParameter = new Map();
|
|
57
|
+
for (const resource of resources ?? []) {
|
|
58
|
+
const value = resource?.toJSON?.() ?? resource;
|
|
59
|
+
const name = value?.name ?? value?.parameter;
|
|
60
|
+
if (typeof name !== "string" || !DETAIL_PARAMETERS.includes(name)) continue;
|
|
61
|
+
|
|
62
|
+
// A duplicate name means the reflection is not what this recogniser
|
|
63
|
+
// assumes, so it declines rather than picking one.
|
|
64
|
+
if (byParameter.has(name)) return null;
|
|
65
|
+
byParameter.set(name, {
|
|
66
|
+
registerIndex: value.registerIndex,
|
|
67
|
+
value
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (byParameter.size < 2) return null;
|
|
71
|
+
|
|
72
|
+
// Contiguous from Detail1Map: {1,2} and {1,2,3} merge, {1,3} does not.
|
|
73
|
+
const parameters = DETAIL_PARAMETERS.slice(0, byParameter.size);
|
|
74
|
+
if (parameters.some(parameter => !byParameter.has(parameter))) return null;
|
|
75
|
+
const layers = [];
|
|
76
|
+
for (const [layer, parameter] of parameters.entries()) {
|
|
77
|
+
const {
|
|
78
|
+
registerIndex,
|
|
79
|
+
value
|
|
80
|
+
} = byParameter.get(parameter);
|
|
81
|
+
if (!Number.isInteger(registerIndex) || registerIndex < 0 || value.type !== CARBON_TEXTURE_2D || (value.arrayElements ?? 1) !== 1 || value.isSRGB !== false) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
const space = value.registerSpace ?? registerSpace;
|
|
85
|
+
|
|
86
|
+
// One array texture occupies one binding, so the layers cannot come
|
|
87
|
+
// from different register spaces.
|
|
88
|
+
if (layer > 0 && space !== layers[layer - 1].registerSpace) return null;
|
|
89
|
+
if (layer > 0 && registerIndex <= layers[layer - 1].registerIndex) return null;
|
|
90
|
+
layers.push({
|
|
91
|
+
parameter,
|
|
92
|
+
layer,
|
|
93
|
+
registerIndex,
|
|
94
|
+
registerSpace: space
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return Object.freeze({
|
|
98
|
+
family: DETAIL_MAP_ARRAY_FAMILY,
|
|
99
|
+
outputName: DETAIL_MAP_ARRAY_NAME,
|
|
100
|
+
registerSpace,
|
|
101
|
+
layerCount: layers.length,
|
|
102
|
+
layers: Object.freeze(layers.map(entry => Object.freeze(entry))),
|
|
103
|
+
registers: Object.freeze(layers.map(entry => entry.registerIndex))
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Builds the transform record the container's shared transform section stores.
|
|
109
|
+
*
|
|
110
|
+
* @param {object} plan Recognised family plan.
|
|
111
|
+
* @param {string} layoutKey Enclosing pass key.
|
|
112
|
+
* @returns {object} Transform record.
|
|
113
|
+
*/
|
|
114
|
+
function detailMapTransformFor(plan, layoutKey) {
|
|
115
|
+
return {
|
|
116
|
+
id: `${layoutKey}:${DETAIL_MAP_ARRAY_FAMILY}:sampled-resource:${plan.registerSpace}:${plan.registers[0]}`,
|
|
117
|
+
family: DETAIL_MAP_ARRAY_FAMILY,
|
|
118
|
+
layoutKey,
|
|
119
|
+
inputs: plan.layers.map(entry => ({
|
|
120
|
+
registerSpace: entry.registerSpace,
|
|
121
|
+
registerIndex: entry.registerIndex,
|
|
122
|
+
parameter: entry.parameter
|
|
123
|
+
}))
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { DETAIL_MAP_ARRAY_FAMILY, DETAIL_MAP_ARRAY_NAME, detailMapTransformFor, recogniseDetailMapFamily };
|
|
128
|
+
//# sourceMappingURL=detailMapFamily.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detailMapFamily.js","sources":["../../../../../src/formats/hlsl/core/detailMapFamily.js"],"sourcesContent":["/**\n * Recognises Carbon's Detail-map resource family from reflection alone.\n *\n * Both backends merge `Detail1Map`/`Detail2Map`/`Detail3Map` into a single\n * array texture, and both need to agree exactly on *which* registers take part.\n * That decision is about the resources, not about the shading language, so it\n * lives here rather than twice in the two emitters.\n *\n * What this module does **not** do is prove the merge is safe. Recognising the\n * family is necessary but not sufficient: a backend must also confirm that every\n * use of those registers is a plain sample it can redirect at an array layer. A\n * detail map fetched by integer coordinate, or queried for its size, cannot be\n * merged, and only the code walking the shader can see that. So each backend\n * pairs this recogniser with its own use check and fails closed on anything it\n * does not understand.\n *\n * The WebGL 2 motivation is a hard limit rather than tidiness: the affected\n * shaders sit at exactly 16 textures against a 16-unit guarantee, so merging\n * three maps into one is what creates the headroom lighting needs. See\n * docs/contracts/webgl2-texture-budget.md.\n */\n\n/** Resource names that make up the family, in layer order. */\nconst DETAIL_PARAMETERS = Object.freeze([ \"Detail1Map\", \"Detail2Map\", \"Detail3Map\" ]);\n\n/** Carbon's resource type code for a 2D texture. */\nconst CARBON_TEXTURE_2D = 2;\n\n/** The merged array's name, and the transform family it belongs to. */\nexport const DETAIL_MAP_ARRAY_NAME = \"DetailArrayMap\";\nexport const DETAIL_MAP_ARRAY_FAMILY = \"detail-map-array\";\n\n/**\n * Recognises the detail-map family in one stage's reflected resources.\n *\n * Requires the maps to be contiguous from `Detail1Map` with no gap, in one\n * register space, at strictly ascending registers, and each an ordinary\n * single-element 2D texture declared linear. Anything else returns null: a\n * partial or unusual family is not merged, because guessing produces a shader\n * that links and samples the wrong thing.\n *\n * `isSRGB` must be present and false rather than merely not true. Carbon's\n * reader always sets it, so an absent flag means the caller is passing\n * something other than resource reflection, and the layers of one array texture\n * cannot disagree about whether sampling decodes sRGB.\n *\n * @param {Array<object>} resources Reflected resources, each carrying\n * `registerIndex`, `name`, `type`, `isSRGB`, and optionally `registerSpace`\n * and `arrayElements`. `parameter` is accepted in place of `name`.\n * @param {object} [options] Recognition options.\n * @param {number} [options.registerSpace] Default register space.\n * @returns {object|null} Frozen plan, or null when the family is absent or unusable.\n */\nexport function recogniseDetailMapFamily(resources, options = {})\n{\n const registerSpace = options.registerSpace ?? 0;\n const byParameter = new Map();\n\n for (const resource of resources ?? [])\n {\n const value = resource?.toJSON?.() ?? resource;\n const name = value?.name ?? value?.parameter;\n if (typeof name !== \"string\" || !DETAIL_PARAMETERS.includes(name)) continue;\n\n // A duplicate name means the reflection is not what this recogniser\n // assumes, so it declines rather than picking one.\n if (byParameter.has(name)) return null;\n byParameter.set(name, { registerIndex: value.registerIndex, value });\n }\n\n if (byParameter.size < 2) return null;\n\n // Contiguous from Detail1Map: {1,2} and {1,2,3} merge, {1,3} does not.\n const parameters = DETAIL_PARAMETERS.slice(0, byParameter.size);\n if (parameters.some((parameter) => !byParameter.has(parameter))) return null;\n\n const layers = [];\n for (const [ layer, parameter ] of parameters.entries())\n {\n const { registerIndex, value } = byParameter.get(parameter);\n\n if (!Number.isInteger(registerIndex) || registerIndex < 0\n || value.type !== CARBON_TEXTURE_2D\n || (value.arrayElements ?? 1) !== 1\n || value.isSRGB !== false)\n {\n return null;\n }\n\n const space = value.registerSpace ?? registerSpace;\n\n // One array texture occupies one binding, so the layers cannot come\n // from different register spaces.\n if (layer > 0 && space !== layers[layer - 1].registerSpace) return null;\n if (layer > 0 && registerIndex <= layers[layer - 1].registerIndex) return null;\n\n layers.push({ parameter, layer, registerIndex, registerSpace: space });\n }\n\n return Object.freeze({\n family: DETAIL_MAP_ARRAY_FAMILY,\n outputName: DETAIL_MAP_ARRAY_NAME,\n registerSpace,\n layerCount: layers.length,\n layers: Object.freeze(layers.map((entry) => Object.freeze(entry))),\n registers: Object.freeze(layers.map((entry) => entry.registerIndex))\n });\n}\n\n/**\n * Builds the transform record the container's shared transform section stores.\n *\n * @param {object} plan Recognised family plan.\n * @param {string} layoutKey Enclosing pass key.\n * @returns {object} Transform record.\n */\nexport function detailMapTransformFor(plan, layoutKey)\n{\n return {\n id: `${layoutKey}:${DETAIL_MAP_ARRAY_FAMILY}:sampled-resource:${plan.registerSpace}:${plan.registers[0]}`,\n family: DETAIL_MAP_ARRAY_FAMILY,\n layoutKey,\n inputs: plan.layers.map((entry) => ({\n registerSpace: entry.registerSpace,\n registerIndex: entry.registerIndex,\n parameter: entry.parameter\n }))\n };\n}\n\nexport default recogniseDetailMapFamily;\n"],"names":["DETAIL_PARAMETERS","Object","freeze","CARBON_TEXTURE_2D","DETAIL_MAP_ARRAY_NAME","DETAIL_MAP_ARRAY_FAMILY","recogniseDetailMapFamily","resources","options","registerSpace","byParameter","Map","resource","value","toJSON","name","parameter","includes","has","set","registerIndex","size","parameters","slice","some","layers","layer","entries","get","Number","isInteger","type","arrayElements","isSRGB","space","push","family","outputName","layerCount","length","map","entry","registers","detailMapTransformFor","plan","layoutKey","id","inputs"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMA,iBAAiB,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAE,CAAC;;AAErF;AACA,MAAMC,iBAAiB,GAAG,CAAC;;AAE3B;AACO,MAAMC,qBAAqB,GAAG;AAC9B,MAAMC,uBAAuB,GAAG;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CAACC,SAAS,EAAEC,OAAO,GAAG,EAAE,EAChE;AACI,EAAA,MAAMC,aAAa,GAAGD,OAAO,CAACC,aAAa,IAAI,CAAC;AAChD,EAAA,MAAMC,WAAW,GAAG,IAAIC,GAAG,EAAE;AAE7B,EAAA,KAAK,MAAMC,QAAQ,IAAIL,SAAS,IAAI,EA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