@carbonenginejs/runtime-resource 0.16.0 → 0.18.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.
Files changed (54) hide show
  1. package/dist/format/CjsFormat.js +84 -83
  2. package/dist/format/CjsFormat.js.map +1 -1
  3. package/dist/format/CjsResourceProbe.js +87 -86
  4. package/dist/format/CjsResourceProbe.js.map +1 -1
  5. package/dist/format/carbonEffect/backendEngineId.js +98 -0
  6. package/dist/format/carbonEffect/backendEngineId.js.map +1 -0
  7. package/dist/format/carbonEffect/carbonEffectBackendBlock.js +24 -23
  8. package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  9. package/dist/format/carbonEffect/carbonEffectResourceTransform.js +1 -1
  10. package/dist/format/carbonEffect/carbonEffectResourceTransform.js.map +1 -1
  11. package/dist/format/effect/effectPermutationGraph.js +46 -29
  12. package/dist/format/effect/effectPermutationGraph.js.map +1 -1
  13. package/dist/format/index.js +1 -1
  14. package/dist/formats/hlsl/core/detailMapFamily.js +1 -1
  15. package/dist/formats/hlsl/core/detailMapFamily.js.map +1 -1
  16. package/dist/formats/hlsl/core/localLightFamily.js +1 -1
  17. package/dist/formats/hlsl/core/localLightFamily.js.map +1 -1
  18. package/dist/formats/png/core/helpers.js +27 -8
  19. package/dist/formats/png/core/helpers.js.map +1 -1
  20. package/dist/formats/webgl/core/effectPackage.js +143 -56
  21. package/dist/formats/webgl/core/effectPackage.js.map +1 -1
  22. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +799 -456
  23. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  24. package/dist/formats/webgl/core/glslBackendBlock.js +74 -30
  25. package/dist/formats/webgl/core/glslBackendBlock.js.map +1 -1
  26. package/dist/formats/webgl/core/glslBackendBodySet.js +0 -1
  27. package/dist/formats/webgl/core/glslBackendBodySet.js.map +1 -1
  28. package/dist/formats/webgl/core/helpers.js +53 -53
  29. package/dist/formats/webgl/core/helpers.js.map +1 -1
  30. package/dist/formats/webgl/core/readGlslEffectContainer.js +82 -67
  31. package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -1
  32. package/dist/formats/webgpu/CjsWebgpuFormat.js +161 -163
  33. package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  34. package/dist/formats/webgpu/core/carbonWebgpu/CarbonWebgpuContainer.js +10 -1
  35. package/dist/formats/webgpu/core/carbonWebgpu/CarbonWebgpuContainer.js.map +1 -1
  36. package/dist/formats/webgpu/core/effectBackendBodySet.js +21 -22
  37. package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
  38. package/dist/formats/webgpu/core/helpers.js +111 -99
  39. package/dist/formats/webgpu/core/helpers.js.map +1 -1
  40. package/dist/formats/webgpu/core/packageEffect.js +30 -32
  41. package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
  42. package/dist/formats/wem/CjsWemFormat.js +121 -121
  43. package/dist/formats/wem/CjsWemFormat.js.map +1 -1
  44. package/dist/formats/wem/core/resolve.js +8 -8
  45. package/dist/formats/wem/core/resolve.js.map +1 -1
  46. package/dist/resource/shader/reflection/Tr2EffectStageInput.js +102 -60
  47. package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
  48. package/docs/concepts/format-type-resolution.md +79 -0
  49. package/docs/formats/README.md +11 -0
  50. package/docs/formats/webgpu/formats/carbon-webgpu.md +11 -4
  51. package/docs/formats/webgpu/reference/api.md +7 -6
  52. package/docs/formats/wwise.md +25 -0
  53. package/docs/roadmap.md +19 -0
  54. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"packageEffect.js","sources":["../../../../../src/formats/webgpu/core/packageEffect.js"],"sourcesContent":["import { readEffectAnalysis } from \"./effectAnalysis.js\";\nimport { buildEffectAnalysis, inspectWithValues } from \"./helpers.js\";\nimport { buildCarbonEffectContainer } from \"./buildCarbonEffectContainer.js\";\nimport { lowerDxbcToIr } from \"./ir/lowerDxbcToIr.js\";\nimport { buildWgslBindingPlan } from \"./wgsl/buildWgslBindingPlan.js\";\nimport { buildWgsl } from \"./wgsl/emitWgsl.js\";\nimport { buildWgslSet } from \"./wgsl/buildWgslSet.js\";\nimport { buildResourceTransformPlan } from \"./wgsl/buildResourceTransformPlan.js\";\nimport {\n buildEffectPermutationGraph,\n EFFECT_PERMUTATION_GRAPH_CHUNK,\n EFFECT_PERMUTATION_GRAPH_FORMAT,\n EFFECT_PERMUTATION_GRAPH_VERSION\n} from \"../../../format/effect/effectPermutationGraph.js\";\nimport {\n buildEffectBackendBodySet,\n EFFECT_BACKEND_BODY_SET_CHUNK,\n EFFECT_BACKEND_BODY_SET_FORMAT,\n EFFECT_BACKEND_BODY_SET_VERSION\n} from \"./effectBackendBodySet.js\";\nimport {\n DXBC_WGSL_TRANSLATOR_NAME,\n DXBC_WGSL_TRANSLATOR_VERSION,\n EFFECT_INFO_VERSION,\n FORMAT_WEBGPU_PACKAGE_NAME,\n FORMAT_WEBGPU_PACKAGE_VERSION,\n WEBGPU_BACKEND_NAME\n} from \"./packageMetadata.js\";\nimport { sha256Bytes, sha256Utf8 } from \"../../../format/effect/sha256.js\";\nimport {\n isParticleClearEffectCandidate,\n particleClearEffectProofFor,\n preflightParticleClearEffectProfile\n} from \"./wgsl/lowerParticleClearComputePrograms.js\";\nimport {\n buildWgslSelectionMetadata,\n normalizeEffectPermutation,\n selectEffectStages,\n validateResolvedPermutation\n} from \"./packageEffectSelection.js\";\n\n/**\n * Build one structurally valid Carbon WebGPU package from compiled Tr2 effect bytes.\n *\n * The version-15 build result retains every unique body's portable source\n * reflection as in-memory evidence while the emitted Carbon wire stores WGSL\n * or empty program slots plus representable non-program fields. Filesystem\n * concerns remain in callers.\n *\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\n * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.\n * @returns {object} Package bytes plus inspection and provenance documents.\n */\nexport function buildEffectPackage(input, options = {})\n{\n const mode = normalizeMode(options.mode, options.allPermutations);\n const source = normalizeSource(options.source);\n const outputPath = normalizeOptionalString(options.outputPath, \"Effect outputPath\");\n const sourceIdentity = normalizeSourceIdentity(\n options.sourceIdentity,\n source,\n input\n );\n const permutation = normalizeEffectPermutation(options.permutation);\n const selection = normalizeSelection(options.selection);\n const resolved = readEffectAnalysis(input, { source, permutation });\n\n // One INFO version means one contract, and that contract requires complete\n // source reflection, which only version-15 input can supply.\n if (resolved.effectRes?.m_version !== 15)\n {\n throw new Error(\n \"Effect package requires a version-15 compiled effect, got version \"\n + (resolved.effectRes?.m_version ?? \"unknown\")\n );\n }\n\n validateResolvedPermutation(permutation, resolved.selection?.selectedOptions ?? []);\n\n const analysis = buildEffectAnalysis(resolved, {\n source,\n decodeBytecode: false,\n decodeInstructions: false\n });\n const bytecodeByKey = resolved.stageBytecodeByKey;\n const selectedStages = selectEffectStages(analysis.stages, selection);\n const programsByKey = new Map();\n const programForKey = (key) =>\n {\n if (programsByKey.has(key)) return programsByKey.get(key);\n const bytecode = bytecodeByKey.get(key)?.bytes;\n\n if (!bytecode?.length)\n {\n throw new Error(`${key} has no shader bytecode`);\n }\n const program = lowerDxbcToIr(\n bytecode,\n { source: `${source}#${key}` }\n );\n programsByKey.set(key, program);\n return program;\n };\n let effectProfileContext = null;\n if (isParticleClearEffectCandidate(resolved.effectDescription))\n {\n programForKey(\"Main.pass0.compute\");\n programForKey(\"Main.pass1.compute\");\n effectProfileContext = preflightParticleClearEffectProfile(\n resolved.effectDescription,\n programsByKey\n );\n }\n const irEntries = selectedStages.map((stage) => ({\n key: stage.key,\n passKey: `${stage.techniqueName}.pass${stage.passIndex}`,\n ir: programForKey(stage.key),\n semanticBindings: analysis.stages.find((candidate) =>\n candidate.techniqueName === stage.techniqueName\n && candidate.passIndex === stage.passIndex\n && candidate.stageName === stage.stageName)?.bindings || [],\n effectProfileProof: particleClearEffectProofFor(\n effectProfileContext,\n stage.key\n )\n }));\n const programsByPass = new Map();\n\n for (const entry of irEntries)\n {\n if (!programsByPass.has(entry.passKey))\n {\n programsByPass.set(entry.passKey, []);\n }\n\n programsByPass.get(entry.passKey).push(entry);\n }\n\n const resourceTransformPlans = new Map(Array.from(programsByPass, ([ key, entries ]) => [\n key,\n buildResourceTransformPlan(\n entries.map((entry) => ({\n ir: entry.ir,\n semanticBindings: entry.semanticBindings\n })),\n { layoutKey: key }\n )\n ]));\n const plans = new Map(Array.from(programsByPass, ([ key, entries ]) =>\n {\n const proof = entries.find((entry) => entry.effectProfileProof)\n ?.effectProfileProof ?? null;\n const resourceTransformPlan = resourceTransformPlans.get(key);\n return [\n key,\n buildWgslBindingPlan(\n entries.map((entry) => entry.ir),\n {\n ...(options.bindingPolicy ?? {}),\n ...(proof ? { effectProfileProof: proof } : {}),\n ...(resourceTransformPlan ? { resourceTransformPlan } : {})\n }\n )\n ];\n }));\n const shaderEntries = irEntries.map((entry) => ({\n key: entry.key,\n shader: buildWgsl(entry.ir, {\n bindingPlan: plans.get(entry.passKey),\n ...(resourceTransformPlans.get(entry.passKey)\n ? { resourceTransformPlan: resourceTransformPlans.get(entry.passKey) }\n : {}),\n ...(entry.effectProfileProof\n ? { effectProfileProof: entry.effectProfileProof }\n : {})\n })\n }));\n const wgsl = buildWgslSet(shaderEntries);\n const wgslSelection = buildWgslSelectionMetadata(selection, selectedStages);\n const permutationGraph = buildEffectPermutationGraph(resolved.effectRes);\n // The source is complete when it is a version-15 container. This used to be\n // read off a built reflection document, which made the document look load\n // bearing when it was only ever a consequence of the same version check.\n const sourceComplete = resolved.effectRes.m_version === 15;\n if (mode === \"all\" && !sourceComplete)\n {\n throw new Error(\n \"Effect package mode all requires a complete version-15 source\"\n );\n }\n\n const backendBodySet = mode === \"all\"\n ? buildEffectBackendBodySet(resolved.effectRes, permutationGraph, {\n source,\n selection,\n bindingPolicy: options.bindingPolicy\n })\n : null;\n const completeness = Object.freeze({\n packageValid: true,\n sourceComplete,\n backendComplete: false,\n runtimeComplete: false\n });\n const info = {\n format: \"CARBON_WEBGPU\",\n formatVersion: EFFECT_INFO_VERSION,\n packageKind: \"tr2-effect-webgpu\",\n sourcePath: source,\n outputPath,\n sourceIdentity,\n targetBackend: WEBGPU_BACKEND_NAME,\n backendPackage: FORMAT_WEBGPU_PACKAGE_NAME,\n backendPackageVersion: FORMAT_WEBGPU_PACKAGE_VERSION,\n translator: DXBC_WGSL_TRANSLATOR_NAME,\n translatorVersion: DXBC_WGSL_TRANSLATOR_VERSION,\n permutationGraph: Object.freeze({\n chunk: EFFECT_PERMUTATION_GRAPH_CHUNK,\n format: EFFECT_PERMUTATION_GRAPH_FORMAT,\n formatVersion: EFFECT_PERMUTATION_GRAPH_VERSION,\n sha256: sha256Utf8(`${JSON.stringify(permutationGraph)}\\n`),\n permutationCount: permutationGraph.variants.length,\n uniqueBodyCount: permutationGraph.bodies.length\n }),\n ...(sourceComplete\n ? {\n sourceBodyCoverage: \"all-unique\",\n backendBodyCoverage: backendBodySet\n ? backendBodySet.coverage.bodies\n : \"selected\"\n }\n : {}),\n ...(backendBodySet\n ? {\n backendBodySet: Object.freeze({\n chunk: EFFECT_BACKEND_BODY_SET_CHUNK,\n format: EFFECT_BACKEND_BODY_SET_FORMAT,\n formatVersion: EFFECT_BACKEND_BODY_SET_VERSION,\n sha256: sha256Utf8(`${JSON.stringify(backendBodySet)}\\n`),\n bodyCount: backendBodySet.bodyCount,\n translatedBodyCount: backendBodySet.translatedBodyCount,\n passUnitCount: backendBodySet.passUnitCount\n })\n }\n : {}),\n bodyMode: mode,\n completeness,\n stageCount: analysis.stages.length,\n selectedStageCount: selectedStages.length,\n shaderCount: wgsl.shaders.length,\n layoutCount: wgsl.layouts.length\n };\n const metadata = {\n effectName: analysis.effectName,\n sourcePath: source,\n bodyMode: mode,\n bodyIndex: analysis.bodyIndex,\n selectedOptions: analysis.selectedOptions,\n ...(wgslSelection ? { wgslSelection } : {})\n };\n // The switchover. Former stored chunks are now compatibility views over the\n // Carbon records: the permutation graph comes from the header and offset\n // table, and a translated pass comes from shaderData plus its trailing\n // block. The description tree retains only representable non-program\n // reflection; full portable source reflection remains in the rich\n // in-memory return value below.\n //\n // The wire no longer stores cross-chunk digests. The rich return value keeps\n // hashes as build evidence; they are not records in the emitted container.\n const emittedBodySet = backendBodySet\n ?? selectedModeBodySet(permutationGraph, wgsl, analysis.bodyIndex);\n const container = buildCarbonEffectContainer(\n resolved.effectRes,\n permutationGraph,\n emittedBodySet,\n { compilerVersion: resolved.effectRes.m_compilerVersionBytes }\n );\n const bytes = container.bytes;\n const inspection = inspectWithValues(bytes, {\n source,\n emit: \"json\"\n });\n const qualification = Object.freeze({\n ok: true,\n level: \"structural\",\n validator: \"carbon-webgpu-structural\",\n mode,\n ...completeness,\n selectedStageCount: selectedStages.length,\n shaderCount: wgsl.shaders.length,\n layoutCount: wgsl.layouts.length,\n ...(backendBodySet\n ? {\n backendBodyCount: backendBodySet.bodyCount,\n backendTranslatedBodyCount: backendBodySet.translatedBodyCount,\n backendPassUnitCount: backendBodySet.passUnitCount\n }\n : {}),\n nativeComparison: false\n });\n\n return Object.freeze({\n bytes,\n info: Object.freeze(info),\n metadata: Object.freeze(metadata),\n permutationGraph,\n analysis,\n wgsl,\n backendBodySet,\n inspection: Object.freeze(inspection),\n qualification\n });\n}\n\n/**\n * Wraps a selected-mode translation as the body set the container emitter takes.\n *\n * `mode: \"all\"` builds a real body set covering every unique body. `mode:\n * \"selected\"` translates exactly one, and the container still carries every\n * permutation — that asymmetry is the format working as intended rather than a\n * gap. When the container emitter rebuilds an untranslated body, it retains\n * representable non-program description fields and writes zero-length program\n * slots.\n *\n * So this does not translate anything. It reshapes the one translation already\n * performed into the body-set contract, and marks every other body unsupported.\n *\n * @param {object} permutationGraph Validated permutation graph.\n * @param {object} wgsl Emitted WGSL set for the selected body.\n * @param {number} bodyIndex Selected permutation index.\n * @returns {object} Body set covering one translated body.\n */\nfunction selectedModeBodySet(permutationGraph, wgsl, bodyIndex)\n{\n const selectedBodyKey = permutationGraph.variants\n .find((variant) => variant.permutationIndex === bodyIndex)?.bodyKey\n ?? permutationGraph.variants[0]?.bodyKey\n ?? null;\n\n const shadersByPass = new Map();\n for (const shader of wgsl.shaders)\n {\n const passKey = `${shader.techniqueName}.pass${shader.passIndex}`;\n if (!shadersByPass.has(passKey)) shadersByPass.set(passKey, []);\n shadersByPass.get(passKey).push(shader);\n }\n\n const passUnits = [];\n const passes = [];\n for (const [ passKey, shaders ] of shadersByPass)\n {\n const transforms = (wgsl.resourceTransforms ?? [])\n .filter((transform) => transform.layoutKey === passKey);\n const unit = {\n key: `unit${passUnits.length}`,\n wgslSetVersion: wgsl.formatVersion,\n shaders,\n layouts: wgsl.layouts.filter((layout) => layout.key === passKey),\n ...(transforms.length ? { resourceTransforms: transforms } : {})\n };\n passUnits.push(unit);\n passes.push({ passKey, unitKey: unit.key });\n }\n\n const bodies = permutationGraph.bodies.map((body) => (body.key === selectedBodyKey\n ? {\n bodyKey: body.key,\n representativePermutationIndex: bodyIndex,\n status: \"translated\",\n error: null,\n passCount: passes.length,\n passes\n }\n : {\n bodyKey: body.key,\n representativePermutationIndex: permutationGraph.variants\n .find((variant) => variant.bodyKey === body.key)?.permutationIndex ?? 0,\n status: \"unsupported\",\n error: \"not translated in selected mode\",\n passCount: 0,\n passes: []\n }));\n\n return {\n bodyCount: bodies.length,\n translatedBodyCount: 1,\n passUnitCount: passUnits.length,\n passUnits,\n bodies\n };\n}\n\nfunction normalizeMode(value, allPermutations)\n{\n if (allPermutations !== undefined && typeof allPermutations !== \"boolean\")\n {\n throw new TypeError(\"Effect allPermutations compatibility option must be boolean\");\n }\n\n const mode = String(allPermutations === true ? \"all\" : value ?? \"selected\").trim();\n\n if (mode !== \"selected\" && mode !== \"all\")\n {\n throw new Error(\n `Effect package mode ${mode || \"<empty>\"} is not supported; `\n + \"supported modes are selected and all\"\n );\n }\n\n return mode;\n}\n\nfunction normalizeSource(value)\n{\n const source = String(value ?? \"memory\").trim();\n\n return source || \"memory\";\n}\n\nfunction normalizeOptionalString(value, name)\n{\n if (value === undefined || value === null)\n {\n return null;\n }\n\n const result = String(value).trim();\n\n if (!result)\n {\n throw new TypeError(`${name} must be a non-empty string or null`);\n }\n\n return result;\n}\n\nfunction normalizeSelection(value)\n{\n if (value === undefined || value === null)\n {\n return null;\n }\n\n if (!value || typeof value !== \"object\" || Array.isArray(value))\n {\n throw new TypeError(\"Effect stage selection must be an object\");\n }\n\n const techniqueName = String(value.techniqueName ?? \"\").trim();\n const passIndex = value.passIndex ?? null;\n const stageNames = value.stageNames ?? [];\n\n if (!techniqueName)\n {\n throw new TypeError(\"Effect stage selection requires techniqueName\");\n }\n\n if (passIndex !== null && (!Number.isSafeInteger(passIndex) || passIndex < 0))\n {\n throw new TypeError(\"Effect stage selection passIndex must be a non-negative integer or null\");\n }\n\n if (!Array.isArray(stageNames)\n || stageNames.some((stageName) => ![ \"vertex\", \"pixel\", \"compute\" ].includes(stageName)))\n {\n throw new TypeError(\"Effect stage selection supports only vertex, pixel, and compute stageNames\");\n }\n\n if (stageNames.length && passIndex === null)\n {\n throw new TypeError(\"Effect stageNames require an exact passIndex\");\n }\n\n return Object.freeze({\n techniqueName,\n passIndex,\n stageNames: Object.freeze([ ...new Set(stageNames) ])\n });\n}\n\nfunction normalizeSourceIdentity(value, source, input)\n{\n if (value !== undefined && value !== null\n && (!value || typeof value !== \"object\" || Array.isArray(value)))\n {\n throw new TypeError(\"Effect sourceIdentity must be an object\");\n }\n\n const bytes = input instanceof Uint8Array\n ? input\n : input instanceof ArrayBuffer\n ? new Uint8Array(input)\n : ArrayBuffer.isView(input)\n ? new Uint8Array(input.buffer, input.byteOffset, input.byteLength)\n : null;\n\n if (!bytes)\n {\n throw new TypeError(\"Effect input must be Uint8Array, ArrayBuffer, or ArrayBufferView bytes\");\n }\n\n const sha256 = sha256Bytes(bytes);\n if (value?.sha256 !== undefined && value?.sha256 !== null\n && value.sha256 !== sha256)\n {\n throw new Error(\n \"Effect sourceIdentity.sha256 does not match the exact effect input bytes\"\n );\n }\n\n return Object.freeze({\n logicalPath: value?.logicalPath ?? source,\n game: value?.game ?? null,\n client: value?.client ?? null,\n build: value?.build === undefined || value?.build === null ? null : String(value.build),\n byteLength: bytes.byteLength,\n md5: value?.md5 ?? null,\n sha256\n });\n}\n"],"names":["buildEffectPackage","input","options","mode","normalizeMode","allPermutations","source","normalizeSource","outputPath","normalizeOptionalString","sourceIdentity","normalizeSourceIdentity","permutation","normalizeEffectPermutation","selection","normalizeSelection","resolved","readEffectAnalysis","effectRes","m_version","Error","validateResolvedPermutation","selectedOptions","analysis","buildEffectAnalysis","decodeBytecode","decodeInstructions","bytecodeByKey","stageBytecodeByKey","selectedStages","selectEffectStages","stages","programsByKey","Map","programForKey","key","has","get","bytecode","bytes","length","program","lowerDxbcToIr","set","effectProfileContext","isParticleClearEffectCandidate","effectDescription","preflightParticleClearEffectProfile","irEntries","map","stage","passKey","techniqueName","passIndex","ir","semanticBindings","find","candidate","stageName","bindings","effectProfileProof","particleClearEffectProofFor","programsByPass","entry","push","resourceTransformPlans","Array","from","entries","buildResourceTransformPlan","layoutKey","plans","proof","resourceTransformPlan","buildWgslBindingPlan","bindingPolicy","shaderEntries","shader","buildWgsl","bindingPlan","wgsl","buildWgslSet","wgslSelection","buildWgslSelectionMetadata","permutationGraph","buildEffectPermutationGraph","sourceComplete","backendBodySet","buildEffectBackendBodySet","completeness","Object","freeze","packageValid","backendComplete","runtimeComplete","info","format","formatVersion","EFFECT_INFO_VERSION","packageKind","sourcePath","targetBackend","WEBGPU_BACKEND_NAME","backendPackage","FORMAT_WEBGPU_PACKAGE_NAME","backendPackageVersion","FORMAT_WEBGPU_PACKAGE_VERSION","translator","DXBC_WGSL_TRANSLATOR_NAME","translatorVersion","DXBC_WGSL_TRANSLATOR_VERSION","chunk","EFFECT_PERMUTATION_GRAPH_CHUNK","EFFECT_PERMUTATION_GRAPH_FORMAT","EFFECT_PERMUTATION_GRAPH_VERSION","sha256","sha256Utf8","JSON","stringify","permutationCount","variants","uniqueBodyCount","bodies","sourceBodyCoverage","backendBodyCoverage","coverage","EFFECT_BACKEND_BODY_SET_CHUNK","EFFECT_BACKEND_BODY_SET_FORMAT","EFFECT_BACKEND_BODY_SET_VERSION","bodyCount","translatedBodyCount","passUnitCount","bodyMode","stageCount","selectedStageCount","shaderCount","shaders","layoutCount","layouts","metadata","effectName","bodyIndex","emittedBodySet","selectedModeBodySet","container","buildCarbonEffectContainer","compilerVersion","m_compilerVersionBytes","inspection","inspectWithValues","emit","qualification","ok","level","validator","backendBodyCount","backendTranslatedBodyCount","backendPassUnitCount","nativeComparison","selectedBodyKey","variant","permutationIndex","bodyKey","shadersByPass","passUnits","passes","transforms","resourceTransforms","filter","transform","unit","wgslSetVersion","layout","unitKey","body","representativePermutationIndex","status","error","passCount","value","undefined","TypeError","String","trim","name","result","isArray","stageNames","Number","isSafeInteger","some","includes","Set","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","sha256Bytes","logicalPath","game","client","build","md5"],"mappings":";;;;;;;;;;;;;;;AAyCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAACC,KAAK,EAAEC,OAAO,GAAG,EAAE,EACtD;EACI,MAAMC,IAAI,GAAGC,aAAa,CAACF,OAAO,CAACC,IAAI,EAAED,OAAO,CAACG,eAAe,CAAC;AACjE,EAAA,MAAMC,MAAM,GAAGC,eAAe,CAACL,OAAO,CAACI,MAAM,CAAC;EAC9C,MAAME,UAAU,GAAGC,uBAAuB,CAACP,OAAO,CAACM,UAAU,EAAE,mBAAmB,CAAC;EACnF,MAAME,cAAc,GAAGC,uBAAuB,CAC1CT,OAAO,CAACQ,cAAc,EACtBJ,MAAM,EACNL,KACJ,CAAC;AACD,EAAA,MAAMW,WAAW,GAAGC,0BAA0B,CAACX,OAAO,CAACU,WAAW,CAAC;AACnE,EAAA,MAAME,SAAS,GAAGC,kBAAkB,CAACb,OAAO,CAACY,SAAS,CAAC;AACvD,EAAA,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,IAAI;IAC7BC,KAAK,EAAExB,KAAK,EAAEwB,KAAK,KAAKvB,SAAS,IAAID,KAAK,EAAEwB,KAAK,KAAK,IAAI,GAAG,IAAI,GAAGrB,MAAM,CAACH,KAAK,CAACwB,KAAK,CAAC;IACvFL,UAAU,EAAE/J,KAAK,CAAC+J,UAAU;AAC5BM,IAAAA,GAAG,EAAEzB,KAAK,EAAEyB,GAAG,IAAI,IAAI;AACvBzF,IAAAA;AACJ,GAAC,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"packageEffect.js","sources":["../../../../../src/formats/webgpu/core/packageEffect.js"],"sourcesContent":["import { readEffectAnalysis } from \"./effectAnalysis.js\";\r\nimport { buildEffectAnalysis, inspectWithValues } from \"./helpers.js\";\r\nimport { buildCarbonEffectContainer } from \"./buildCarbonEffectContainer.js\";\r\nimport { lowerDxbcToIr } from \"./ir/lowerDxbcToIr.js\";\r\nimport { buildWgslBindingPlan } from \"./wgsl/buildWgslBindingPlan.js\";\r\nimport { buildWgsl } from \"./wgsl/emitWgsl.js\";\r\nimport { buildWgslSet } from \"./wgsl/buildWgslSet.js\";\r\nimport { buildResourceTransformPlan } from \"./wgsl/buildResourceTransformPlan.js\";\r\nimport {\r\n buildEffectPermutationGraph,\r\n EFFECT_PERMUTATION_GRAPH_FORMAT,\r\n EFFECT_PERMUTATION_GRAPH_VERSION\r\n} from \"../../../format/effect/effectPermutationGraph.js\";\r\nimport {\r\n buildEffectBackendBodySet,\r\n EFFECT_BACKEND_BODY_SET_FORMAT,\r\n EFFECT_BACKEND_BODY_SET_VERSION\r\n} from \"./effectBackendBodySet.js\";\r\nimport {\r\n DXBC_WGSL_TRANSLATOR_NAME,\r\n DXBC_WGSL_TRANSLATOR_VERSION,\r\n EFFECT_INFO_VERSION,\r\n FORMAT_WEBGPU_PACKAGE_NAME,\r\n FORMAT_WEBGPU_PACKAGE_VERSION,\r\n WEBGPU_BACKEND_NAME\r\n} from \"./packageMetadata.js\";\r\nimport { sha256Bytes, sha256Utf8 } from \"../../../format/effect/sha256.js\";\r\nimport {\r\n isParticleClearEffectCandidate,\r\n particleClearEffectProofFor,\r\n preflightParticleClearEffectProfile\r\n} from \"./wgsl/lowerParticleClearComputePrograms.js\";\r\nimport {\r\n buildWgslSelectionMetadata,\r\n normalizeEffectPermutation,\r\n selectEffectStages,\r\n validateResolvedPermutation\r\n} from \"./packageEffectSelection.js\";\r\n\r\n/**\r\n * Build one structurally valid Carbon WebGPU package from compiled Tr2 effect bytes.\r\n *\r\n * The version-15 build result retains every unique body's portable source\r\n * reflection as in-memory evidence while the emitted Carbon wire stores WGSL\r\n * or empty program slots plus representable non-program fields. Filesystem\r\n * concerns remain in callers.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\r\n * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.\r\n * @returns {object} Package bytes plus inspection and provenance documents.\r\n */\r\nexport function buildEffectPackage(input, options = {})\r\n{\r\n const mode = normalizeMode(options.mode, options.allPermutations);\r\n const source = normalizeSource(options.source);\r\n const outputPath = normalizeOptionalString(options.outputPath, \"Effect outputPath\");\r\n const sourceIdentity = normalizeSourceIdentity(\r\n options.sourceIdentity,\r\n source,\r\n input\r\n );\r\n const permutation = normalizeEffectPermutation(options.permutation);\r\n const selection = normalizeSelection(options.selection);\r\n const resolved = readEffectAnalysis(input, { source, permutation });\r\n\r\n // One INFO version means one contract, and that contract requires complete\r\n // source reflection, which only version-15 input can supply.\r\n if (resolved.effectRes?.m_version !== 15)\r\n {\r\n throw new Error(\r\n \"Effect package requires a version-15 compiled effect, got version \"\r\n + (resolved.effectRes?.m_version ?? \"unknown\")\r\n );\r\n }\r\n\r\n validateResolvedPermutation(permutation, resolved.selection?.selectedOptions ?? []);\r\n\r\n const analysis = buildEffectAnalysis(resolved, {\r\n source,\r\n decodeBytecode: false,\r\n decodeInstructions: false\r\n });\r\n const bytecodeByKey = resolved.stageBytecodeByKey;\r\n const selectedStages = selectEffectStages(analysis.stages, selection);\r\n const programsByKey = new Map();\r\n const programForKey = (key) =>\r\n {\r\n if (programsByKey.has(key)) return programsByKey.get(key);\r\n const bytecode = bytecodeByKey.get(key)?.bytes;\r\n\r\n if (!bytecode?.length)\r\n {\r\n throw new Error(`${key} has no shader bytecode`);\r\n }\r\n const program = lowerDxbcToIr(\r\n bytecode,\r\n { source: `${source}#${key}` }\r\n );\r\n programsByKey.set(key, program);\r\n return program;\r\n };\r\n let effectProfileContext = null;\r\n if (isParticleClearEffectCandidate(resolved.effectDescription))\r\n {\r\n programForKey(\"Main.pass0.compute\");\r\n programForKey(\"Main.pass1.compute\");\r\n effectProfileContext = preflightParticleClearEffectProfile(\r\n resolved.effectDescription,\r\n programsByKey\r\n );\r\n }\r\n const irEntries = selectedStages.map((stage) => ({\r\n key: stage.key,\r\n passKey: `${stage.techniqueName}.pass${stage.passIndex}`,\r\n ir: programForKey(stage.key),\r\n semanticBindings: analysis.stages.find((candidate) =>\r\n candidate.techniqueName === stage.techniqueName\r\n && candidate.passIndex === stage.passIndex\r\n && candidate.stageName === stage.stageName)?.bindings || [],\r\n effectProfileProof: particleClearEffectProofFor(\r\n effectProfileContext,\r\n stage.key\r\n )\r\n }));\r\n const programsByPass = new Map();\r\n\r\n for (const entry of irEntries)\r\n {\r\n if (!programsByPass.has(entry.passKey))\r\n {\r\n programsByPass.set(entry.passKey, []);\r\n }\r\n\r\n programsByPass.get(entry.passKey).push(entry);\r\n }\r\n\r\n const resourceTransformPlans = new Map(Array.from(programsByPass, ([ key, entries ]) => [\r\n key,\r\n buildResourceTransformPlan(\r\n entries.map((entry) => ({\r\n ir: entry.ir,\r\n semanticBindings: entry.semanticBindings\r\n })),\r\n { layoutKey: key }\r\n )\r\n ]));\r\n const plans = new Map(Array.from(programsByPass, ([ key, entries ]) =>\r\n {\r\n const proof = entries.find((entry) => entry.effectProfileProof)\r\n ?.effectProfileProof ?? null;\r\n const resourceTransformPlan = resourceTransformPlans.get(key);\r\n return [\r\n key,\r\n buildWgslBindingPlan(\r\n entries.map((entry) => entry.ir),\r\n {\r\n ...(options.bindingPolicy ?? {}),\r\n ...(proof ? { effectProfileProof: proof } : {}),\r\n ...(resourceTransformPlan ? { resourceTransformPlan } : {})\r\n }\r\n )\r\n ];\r\n }));\r\n const shaderEntries = irEntries.map((entry) => ({\r\n key: entry.key,\r\n shader: buildWgsl(entry.ir, {\r\n bindingPlan: plans.get(entry.passKey),\r\n ...(resourceTransformPlans.get(entry.passKey)\r\n ? { resourceTransformPlan: resourceTransformPlans.get(entry.passKey) }\r\n : {}),\r\n ...(entry.effectProfileProof\r\n ? { effectProfileProof: entry.effectProfileProof }\r\n : {})\r\n })\r\n }));\r\n const wgsl = buildWgslSet(shaderEntries);\r\n const wgslSelection = buildWgslSelectionMetadata(selection, selectedStages);\r\n const permutationGraph = buildEffectPermutationGraph(resolved.effectRes);\r\n // The source is complete when it is a version-15 container. This used to be\r\n // read off a built reflection document, which made the document look load\r\n // bearing when it was only ever a consequence of the same version check.\r\n const sourceComplete = resolved.effectRes.m_version === 15;\r\n if (mode === \"all\" && !sourceComplete)\r\n {\r\n throw new Error(\r\n \"Effect package mode all requires a complete version-15 source\"\r\n );\r\n }\r\n\r\n const backendBodySet = mode === \"all\"\r\n ? buildEffectBackendBodySet(resolved.effectRes, permutationGraph, {\r\n source,\r\n selection,\r\n bindingPolicy: options.bindingPolicy\r\n })\r\n : null;\r\n const completeness = Object.freeze({\r\n packageValid: true,\r\n sourceComplete,\r\n backendComplete: false,\r\n runtimeComplete: false\r\n });\r\n const info = {\r\n format: \"CARBON_WEBGPU\",\r\n formatVersion: EFFECT_INFO_VERSION,\r\n packageKind: \"tr2-effect-webgpu\",\r\n sourcePath: source,\r\n outputPath,\r\n sourceIdentity,\r\n targetBackend: WEBGPU_BACKEND_NAME,\r\n backendPackage: FORMAT_WEBGPU_PACKAGE_NAME,\r\n backendPackageVersion: FORMAT_WEBGPU_PACKAGE_VERSION,\r\n translator: DXBC_WGSL_TRANSLATOR_NAME,\r\n translatorVersion: DXBC_WGSL_TRANSLATOR_VERSION,\r\n permutationGraph: Object.freeze({\r\n format: EFFECT_PERMUTATION_GRAPH_FORMAT,\r\n formatVersion: EFFECT_PERMUTATION_GRAPH_VERSION,\r\n sha256: sha256Utf8(`${JSON.stringify(permutationGraph)}\\n`),\r\n permutationCount: permutationGraph.variants.length,\r\n uniqueBodyCount: permutationGraph.bodies.length\r\n }),\r\n ...(sourceComplete\r\n ? {\r\n sourceBodyCoverage: \"all-unique\",\r\n backendBodyCoverage: backendBodySet\r\n ? backendBodySet.coverage.bodies\r\n : \"selected\"\r\n }\r\n : {}),\r\n ...(backendBodySet\r\n ? {\r\n backendBodySet: Object.freeze({\r\n format: EFFECT_BACKEND_BODY_SET_FORMAT,\r\n formatVersion: EFFECT_BACKEND_BODY_SET_VERSION,\r\n sha256: sha256Utf8(`${JSON.stringify(backendBodySet)}\\n`),\r\n bodyCount: backendBodySet.bodyCount,\r\n translatedBodyCount: backendBodySet.translatedBodyCount,\r\n passUnitCount: backendBodySet.passUnitCount\r\n })\r\n }\r\n : {}),\r\n bodyMode: mode,\r\n completeness,\r\n stageCount: analysis.stages.length,\r\n selectedStageCount: selectedStages.length,\r\n shaderCount: wgsl.shaders.length,\r\n layoutCount: wgsl.layouts.length\r\n };\r\n const metadata = {\r\n effectName: analysis.effectName,\r\n sourcePath: source,\r\n bodyMode: mode,\r\n bodyIndex: analysis.bodyIndex,\r\n selectedOptions: analysis.selectedOptions,\r\n ...(wgslSelection ? { wgslSelection } : {})\r\n };\r\n // The switchover. Former stored chunks are now compatibility views over the\r\n // Carbon records: the permutation graph comes from the header and offset\r\n // table, and a translated pass comes from shaderData plus its trailing\r\n // block. The description tree retains only representable non-program\r\n // reflection; full portable source reflection remains in the rich\r\n // in-memory return value below.\r\n //\r\n // The wire no longer stores cross-chunk digests. The rich return value keeps\r\n // hashes as build evidence; they are not records in the emitted container.\r\n const emittedBodySet = backendBodySet\r\n ?? selectedModeBodySet(permutationGraph, wgsl, analysis.bodyIndex);\r\n const container = buildCarbonEffectContainer(\r\n resolved.effectRes,\r\n permutationGraph,\r\n emittedBodySet,\r\n { compilerVersion: resolved.effectRes.m_compilerVersionBytes }\r\n );\r\n const bytes = container.bytes;\r\n const inspection = inspectWithValues(bytes, {\r\n source,\r\n emit: \"json\"\r\n });\r\n const qualification = Object.freeze({\r\n ok: true,\r\n level: \"structural\",\r\n validator: \"carbon-webgpu-structural\",\r\n mode,\r\n ...completeness,\r\n selectedStageCount: selectedStages.length,\r\n shaderCount: wgsl.shaders.length,\r\n layoutCount: wgsl.layouts.length,\r\n ...(backendBodySet\r\n ? {\r\n backendBodyCount: backendBodySet.bodyCount,\r\n backendTranslatedBodyCount: backendBodySet.translatedBodyCount,\r\n backendPassUnitCount: backendBodySet.passUnitCount\r\n }\r\n : {}),\r\n nativeComparison: false\r\n });\r\n\r\n return Object.freeze({\r\n bytes,\r\n info: Object.freeze(info),\r\n metadata: Object.freeze(metadata),\r\n permutationGraph,\r\n analysis,\r\n wgsl,\r\n backendBodySet,\r\n inspection: Object.freeze(inspection),\r\n qualification\r\n });\r\n}\r\n\r\n/**\r\n * Wraps a selected-mode translation as the body set the container emitter takes.\r\n *\r\n * `mode: \"all\"` builds a real body set covering every unique body. `mode:\r\n * \"selected\"` translates exactly one, and the container still carries every\r\n * permutation — that asymmetry is the format working as intended rather than a\r\n * gap. When the container emitter rebuilds an untranslated body, it retains\r\n * representable non-program description fields and writes zero-length program\r\n * slots.\r\n *\r\n * So this does not translate anything. It reshapes the one translation already\r\n * performed into the body-set contract, and marks every other body unsupported.\r\n *\r\n * @param {object} permutationGraph Validated permutation graph.\r\n * @param {object} wgsl Emitted WGSL set for the selected body.\r\n * @param {number} bodyIndex Selected permutation index.\r\n * @returns {object} Body set covering one translated body.\r\n */\r\nfunction selectedModeBodySet(permutationGraph, wgsl, bodyIndex)\r\n{\r\n const selectedBodyKey = permutationGraph.variants\r\n .find((variant) => variant.permutationIndex === bodyIndex)?.bodyKey\r\n ?? permutationGraph.variants[0]?.bodyKey\r\n ?? null;\r\n\r\n const shadersByPass = new Map();\r\n for (const shader of wgsl.shaders)\r\n {\r\n const passKey = `${shader.techniqueName}.pass${shader.passIndex}`;\r\n if (!shadersByPass.has(passKey)) shadersByPass.set(passKey, []);\r\n shadersByPass.get(passKey).push(shader);\r\n }\r\n\r\n const passUnits = [];\r\n const passes = [];\r\n for (const [ passKey, shaders ] of shadersByPass)\r\n {\r\n const transforms = (wgsl.resourceTransforms ?? [])\r\n .filter((transform) => transform.layoutKey === passKey);\r\n const unit = {\r\n key: `unit${passUnits.length}`,\r\n wgslSetVersion: wgsl.formatVersion,\r\n shaders,\r\n layouts: wgsl.layouts.filter((layout) => layout.key === passKey),\r\n ...(transforms.length ? { resourceTransforms: transforms } : {})\r\n };\r\n passUnits.push(unit);\r\n passes.push({ passKey, unitKey: unit.key });\r\n }\r\n\r\n const bodies = permutationGraph.bodies.map((body) => (body.key === selectedBodyKey\r\n ? {\r\n bodyKey: body.key,\r\n representativePermutationIndex: bodyIndex,\r\n status: \"translated\",\r\n error: null,\r\n passCount: passes.length,\r\n passes\r\n }\r\n : {\r\n bodyKey: body.key,\r\n representativePermutationIndex: permutationGraph.variants\r\n .find((variant) => variant.bodyKey === body.key)?.permutationIndex ?? 0,\r\n status: \"unsupported\",\r\n error: \"not translated in selected mode\",\r\n passCount: 0,\r\n passes: []\r\n }));\r\n\r\n return {\r\n bodyCount: bodies.length,\r\n translatedBodyCount: 1,\r\n passUnitCount: passUnits.length,\r\n passUnits,\r\n bodies\r\n };\r\n}\r\n\r\nfunction normalizeMode(value, allPermutations)\r\n{\r\n if (allPermutations !== undefined && typeof allPermutations !== \"boolean\")\r\n {\r\n throw new TypeError(\"Effect allPermutations compatibility option must be boolean\");\r\n }\r\n\r\n const mode = String(allPermutations === true ? \"all\" : value ?? \"selected\").trim();\r\n\r\n if (mode !== \"selected\" && mode !== \"all\")\r\n {\r\n throw new Error(\r\n `Effect package mode ${mode || \"<empty>\"} is not supported; `\r\n + \"supported modes are selected and all\"\r\n );\r\n }\r\n\r\n return mode;\r\n}\r\n\r\nfunction normalizeSource(value)\r\n{\r\n const source = String(value ?? \"memory\").trim();\r\n\r\n return source || \"memory\";\r\n}\r\n\r\nfunction normalizeOptionalString(value, name)\r\n{\r\n if (value === undefined || value === null)\r\n {\r\n return null;\r\n }\r\n\r\n const result = String(value).trim();\r\n\r\n if (!result)\r\n {\r\n throw new TypeError(`${name} must be a non-empty string or null`);\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction normalizeSelection(value)\r\n{\r\n if (value === undefined || value === null)\r\n {\r\n return null;\r\n }\r\n\r\n if (!value || typeof value !== \"object\" || Array.isArray(value))\r\n {\r\n throw new TypeError(\"Effect stage selection must be an object\");\r\n }\r\n\r\n const techniqueName = String(value.techniqueName ?? \"\").trim();\r\n const passIndex = value.passIndex ?? null;\r\n const stageNames = value.stageNames ?? [];\r\n\r\n if (!techniqueName)\r\n {\r\n throw new TypeError(\"Effect stage selection requires techniqueName\");\r\n }\r\n\r\n if (passIndex !== null && (!Number.isSafeInteger(passIndex) || passIndex < 0))\r\n {\r\n throw new TypeError(\"Effect stage selection passIndex must be a non-negative integer or null\");\r\n }\r\n\r\n if (!Array.isArray(stageNames)\r\n || stageNames.some((stageName) => ![ \"vertex\", \"pixel\", \"compute\" ].includes(stageName)))\r\n {\r\n throw new TypeError(\"Effect stage selection supports only vertex, pixel, and compute stageNames\");\r\n }\r\n\r\n if (stageNames.length && passIndex === null)\r\n {\r\n throw new TypeError(\"Effect stageNames require an exact passIndex\");\r\n }\r\n\r\n return Object.freeze({\r\n techniqueName,\r\n passIndex,\r\n stageNames: Object.freeze([ ...new Set(stageNames) ])\r\n });\r\n}\r\n\r\nfunction normalizeSourceIdentity(value, source, input)\r\n{\r\n if (value !== undefined && value !== null\r\n && (!value || typeof value !== \"object\" || Array.isArray(value)))\r\n {\r\n throw new TypeError(\"Effect sourceIdentity must be an object\");\r\n }\r\n\r\n const bytes = input instanceof Uint8Array\r\n ? input\r\n : input instanceof ArrayBuffer\r\n ? new Uint8Array(input)\r\n : ArrayBuffer.isView(input)\r\n ? new Uint8Array(input.buffer, input.byteOffset, input.byteLength)\r\n : null;\r\n\r\n if (!bytes)\r\n {\r\n throw new TypeError(\"Effect input must be Uint8Array, ArrayBuffer, or ArrayBufferView bytes\");\r\n }\r\n\r\n const sha256 = sha256Bytes(bytes);\r\n if (value?.sha256 !== undefined && value?.sha256 !== null\r\n && value.sha256 !== sha256)\r\n {\r\n throw new Error(\r\n \"Effect sourceIdentity.sha256 does not match the exact effect input bytes\"\r\n );\r\n }\r\n\r\n return Object.freeze({\r\n logicalPath: value?.logicalPath ?? source,\r\n game: value?.game ?? null,\r\n client: value?.client ?? null,\r\n build: value?.build === undefined || value?.build === null ? null : String(value.build),\r\n byteLength: bytes.byteLength,\r\n md5: value?.md5 ?? null,\r\n sha256\r\n });\r\n}\r\n"],"names":["buildEffectPackage","input","options","mode","normalizeMode","allPermutations","source","normalizeSource","outputPath","normalizeOptionalString","sourceIdentity","normalizeSourceIdentity","permutation","normalizeEffectPermutation","selection","normalizeSelection","resolved","readEffectAnalysis","effectRes","m_version","Error","validateResolvedPermutation","selectedOptions","analysis","buildEffectAnalysis","decodeBytecode","decodeInstructions","bytecodeByKey","stageBytecodeByKey","selectedStages","selectEffectStages","stages","programsByKey","Map","programForKey","key","has","get","bytecode","bytes","length","program","lowerDxbcToIr","set","effectProfileContext","isParticleClearEffectCandidate","effectDescription","preflightParticleClearEffectProfile","irEntries","map","stage","passKey","techniqueName","passIndex","ir","semanticBindings","find","candidate","stageName","bindings","effectProfileProof","particleClearEffectProofFor","programsByPass","entry","push","resourceTransformPlans","Array","from","entries","buildResourceTransformPlan","layoutKey","plans","proof","resourceTransformPlan","buildWgslBindingPlan","bindingPolicy","shaderEntries","shader","buildWgsl","bindingPlan","wgsl","buildWgslSet","wgslSelection","buildWgslSelectionMetadata","permutationGraph","buildEffectPermutationGraph","sourceComplete","backendBodySet","buildEffectBackendBodySet","completeness","Object","freeze","packageValid","backendComplete","runtimeComplete","info","format","formatVersion","EFFECT_INFO_VERSION","packageKind","sourcePath","targetBackend","WEBGPU_BACKEND_NAME","backendPackage","FORMAT_WEBGPU_PACKAGE_NAME","backendPackageVersion","FORMAT_WEBGPU_PACKAGE_VERSION","translator","DXBC_WGSL_TRANSLATOR_NAME","translatorVersion","DXBC_WGSL_TRANSLATOR_VERSION","EFFECT_PERMUTATION_GRAPH_FORMAT","EFFECT_PERMUTATION_GRAPH_VERSION","sha256","sha256Utf8","JSON","stringify","permutationCount","variants","uniqueBodyCount","bodies","sourceBodyCoverage","backendBodyCoverage","coverage","EFFECT_BACKEND_BODY_SET_FORMAT","EFFECT_BACKEND_BODY_SET_VERSION","bodyCount","translatedBodyCount","passUnitCount","bodyMode","stageCount","selectedStageCount","shaderCount","shaders","layoutCount","layouts","metadata","effectName","bodyIndex","emittedBodySet","selectedModeBodySet","container","buildCarbonEffectContainer","compilerVersion","m_compilerVersionBytes","inspection","inspectWithValues","emit","qualification","ok","level","validator","backendBodyCount","backendTranslatedBodyCount","backendPassUnitCount","nativeComparison","selectedBodyKey","variant","permutationIndex","bodyKey","shadersByPass","passUnits","passes","transforms","resourceTransforms","filter","transform","unit","wgslSetVersion","layout","unitKey","body","representativePermutationIndex","status","error","passCount","value","undefined","TypeError","String","trim","name","result","isArray","stageNames","Number","isSafeInteger","some","includes","Set","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","sha256Bytes","logicalPath","game","client","build","md5"],"mappings":";;;;;;;;;;;;;;;AAuCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAACC,KAAK,EAAEC,OAAO,GAAG,EAAE,EACtD;EACI,MAAMC,IAAI,GAAGC,aAAa,CAACF,OAAO,CAACC,IAAI,EAAED,OAAO,CAACG,eAAe,CAAC;AACjE,EAAA,MAAMC,MAAM,GAAGC,eAAe,CA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,IAAI7F,KAAK,CACX,0EACJ,CAAC;AACL,EAAA;EAEA,OAAOsE,MAAM,CAACC,MAAM,CAAC;AACjB0G,IAAAA,WAAW,EAAErB,KAAK,EAAEqB,WAAW,IAAI/L,MAAM;AACzCgM,IAAAA,IAAI,EAAEtB,KAAK,EAAEsB,IAAI,IAAI,IAAI;AACzBC,IAAAA,MAAM,EAAEvB,KAAK,EAAEuB,MAAM,IAAI,IAAI;IAC7BC,KAAK,EAAExB,KAAK,EAAEwB,KAAK,KAAKvB,SAAS,IAAID,KAAK,EAAEwB,KAAK,KAAK,IAAI,GAAG,IAAI,GAAGrB,MAAM,CAACH,KAAK,CAACwB,KAAK,CAAC;IACvFL,UAAU,EAAE5J,KAAK,CAAC4J,UAAU;AAC5BM,IAAAA,GAAG,EAAEzB,KAAK,EAAEyB,GAAG,IAAI,IAAI;AACvBxF,IAAAA;AACJ,GAAC,CAAC;AACN;;;;"}
@@ -3,186 +3,186 @@ import { resolveTypeWithValues } from './core/resolve.js';
3
3
 
4
4
  const FORMAT_NAME = "CjsWemFormat";
5
5
 
6
- /**
7
- * Reader for Audiokinetic Wwise media (.wem) containers.
8
- *
9
- * Inspection identifies the codec, channel/rate layout, and Vorbis duration
10
- * without decoding audio data. Read emits the container bytes untouched by
11
- * default; `emit: "ogg"` repacks Wwise Vorbis into a standard Ogg stream and
12
- * `emit: "pcm"` decodes PTADPCM / 16-bit PCM media to float32 samples.
6
+ /**
7
+ * Reader for Audiokinetic Wwise media (.wem) containers.
8
+ *
9
+ * Inspection identifies the codec, channel/rate layout, and Vorbis duration
10
+ * without decoding audio data. Read emits the container bytes untouched by
11
+ * default; `emit: "ogg"` repacks Wwise Vorbis into a standard Ogg stream and
12
+ * `emit: "pcm"` decodes PTADPCM / 16-bit PCM media to float32 samples.
13
13
  */
14
14
  class CjsWemFormat {
15
15
  #values = DEFAULT_VALUES;
16
16
 
17
- /**
18
- * Browser-worker module declaration consumed by CjsResManWorkerLoader.
17
+ /**
18
+ * Browser-worker module declaration consumed by CjsResManWorkerLoader.
19
19
  */
20
20
  static worker = Object.freeze({
21
21
  module: import.meta.url,
22
22
  exportName: "CjsWemFormat"
23
23
  });
24
24
 
25
- /**
26
- * Create a reusable wem format profile.
27
- *
28
- * @param {object} [options] Default read/inspect options.
25
+ /**
26
+ * Create a reusable wem format profile.
27
+ *
28
+ * @param {object} [options] Default read/inspect options.
29
29
  */
30
30
  constructor(options = {}) {
31
31
  this.SetValues(options);
32
32
  }
33
33
 
34
- /**
35
- * Merge options into this profile.
36
- *
37
- * @param {object} [options] Values to merge.
38
- * @returns {CjsWemFormat} This format profile.
34
+ /**
35
+ * Merge options into this profile.
36
+ *
37
+ * @param {object} [options] Values to merge.
38
+ * @returns {CjsWemFormat} This format profile.
39
39
  */
40
40
  SetValues(options = {}) {
41
41
  this.#values = normalizeValues(this.#values, options, FORMAT_NAME);
42
42
  return this;
43
43
  }
44
44
 
45
- /**
46
- * Get normalized profile values with optional per-call overrides.
47
- *
48
- * @param {object} [options] Per-call values.
49
- * @returns {object} Normalized read values.
45
+ /**
46
+ * Get normalized profile values with optional per-call overrides.
47
+ *
48
+ * @param {object} [options] Per-call values.
49
+ * @returns {object} Normalized read values.
50
50
  */
51
51
  GetValues(options = {}) {
52
52
  return normalizeValues(this.#values, options, FORMAT_NAME);
53
53
  }
54
54
 
55
- /**
56
- * Read wem bytes with this profile.
57
- *
58
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
59
- * @param {object} [options] Per-call values.
60
- * @returns {object} GPU-free raw/debug payload for the selected emit target.
55
+ /**
56
+ * Read wem bytes with this profile.
57
+ *
58
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
59
+ * @param {object} [options] Per-call values.
60
+ * @returns {object} GPU-free raw/debug payload for the selected emit target.
61
61
  */
62
62
  Read(input, options = {}) {
63
63
  return readWithValues(input, this.GetValues(options));
64
64
  }
65
65
 
66
- /**
67
- * Read wem bytes asynchronously with this profile.
68
- *
69
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
70
- * @param {object} [options] Per-call values.
71
- * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.
66
+ /**
67
+ * Read wem bytes asynchronously with this profile.
68
+ *
69
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
70
+ * @param {object} [options] Per-call values.
71
+ * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.
72
72
  */
73
73
  async ReadAsync(input, options = {}) {
74
74
  return this.Read(input, options);
75
75
  }
76
76
 
77
- /**
78
- * Inspect wem bytes without decoding audio data.
79
- *
80
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
81
- * @param {object} [options] Per-call values.
82
- * @returns {object} Wwise container metadata.
77
+ /**
78
+ * Inspect wem bytes without decoding audio data.
79
+ *
80
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
81
+ * @param {object} [options] Per-call values.
82
+ * @returns {object} Wwise container metadata.
83
83
  */
84
84
  Inspect(input, options = {}) {
85
85
  return inspectWithValues(input, this.GetValues(options));
86
86
  }
87
87
 
88
- /**
89
- * Report whether wem input and requested output variants are supported.
90
- *
91
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
92
- * @param {object} [options] Per-call values.
93
- * @returns {object} Support/probe report.
88
+ /**
89
+ * Report whether wem input and requested output variants are supported.
90
+ *
91
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
92
+ * @param {object} [options] Per-call values.
93
+ * @returns {object} Support/probe report.
94
94
  */
95
95
  IsSupported(input, options = {}) {
96
96
  return isSupportedWithValues(input, this.GetValues(options));
97
97
  }
98
98
 
99
- /**
100
- * Convert format output into JSON-compatible debug data.
101
- *
102
- * @param {any} value Format output.
103
- * @returns {any} JSON-compatible value.
99
+ /**
100
+ * Convert format output into JSON-compatible debug data.
101
+ *
102
+ * @param {any} value Format output.
103
+ * @returns {any} JSON-compatible value.
104
104
  */
105
105
  ToJSON(value) {
106
106
  return toJsonValue(value);
107
107
  }
108
108
 
109
- /**
110
- * One-shot wem read.
111
- *
112
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
113
- * @param {object} [options] Read options.
114
- * @returns {object} GPU-free raw/debug payload for the selected emit target.
109
+ /**
110
+ * One-shot wem read.
111
+ *
112
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
113
+ * @param {object} [options] Read options.
114
+ * @returns {object} GPU-free raw/debug payload for the selected emit target.
115
115
  */
116
116
  static read(input, options = {}) {
117
117
  return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
118
118
  }
119
119
 
120
- /**
121
- * One-shot asynchronous wem read.
122
- *
123
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
124
- * @param {object} [options] Read options.
125
- * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.
120
+ /**
121
+ * One-shot asynchronous wem read.
122
+ *
123
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
124
+ * @param {object} [options] Read options.
125
+ * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.
126
126
  */
127
127
  static async readAsync(input, options = {}) {
128
128
  return CjsWemFormat.read(input, options);
129
129
  }
130
130
 
131
- /**
132
- * One-shot wem inspection.
133
- *
134
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
135
- * @param {object} [options] Inspect options.
136
- * @returns {object} Wwise container metadata.
131
+ /**
132
+ * One-shot wem inspection.
133
+ *
134
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
135
+ * @param {object} [options] Inspect options.
136
+ * @returns {object} Wwise container metadata.
137
137
  */
138
138
  static inspect(input, options = {}) {
139
139
  return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
140
140
  }
141
141
 
142
- /**
143
- * One-shot wem support probe.
144
- *
145
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
146
- * @param {object} [options] Probe options.
147
- * @returns {object} Support/probe report.
142
+ /**
143
+ * One-shot wem support probe.
144
+ *
145
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
146
+ * @param {object} [options] Probe options.
147
+ * @returns {object} Support/probe report.
148
148
  */
149
149
  static isSupported(input, options = {}) {
150
150
  return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
151
151
  }
152
152
 
153
- /**
154
- * Content-verified codec/route resolution (kb §5 resolveType seam).
155
- *
156
- * Where `isSupported` trusts the fmt tag, this validates the declared
157
- * codec against the container's actual structure (Vorbis sidecar,
158
- * PTADPCM frame layout, PCM size consistency - bounded, no audio
159
- * decode) and tries the other codecs when the declaration fails.
160
- * The report carries `verified: true`, `preferred` = `ogg`/`pcm`/`raw`,
161
- * and declared/resolved/mismatch evidence in `metadata`.
162
- *
163
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
164
- * @param {object} [options] Probe options.
165
- * @returns {Promise<object>} Content-verified probe report.
153
+ /**
154
+ * Content-verified codec/route resolution (resolveType seam; see docs/concepts/format-type-resolution.md).
155
+ *
156
+ * Where `isSupported` trusts the fmt tag, this validates the declared
157
+ * codec against the container's actual structure (Vorbis sidecar,
158
+ * PTADPCM frame layout, PCM size consistency - bounded, no audio
159
+ * decode) and tries the other codecs when the declaration fails.
160
+ * The report carries `verified: true`, `preferred` = `ogg`/`pcm`/`raw`,
161
+ * and declared/resolved/mismatch evidence in `metadata`.
162
+ *
163
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
164
+ * @param {object} [options] Probe options.
165
+ * @returns {Promise<object>} Content-verified probe report.
166
166
  */
167
167
  static async resolveType(input, options = {}) {
168
168
  return resolveTypeWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
169
169
  }
170
170
 
171
- /**
172
- * Convert format output into JSON-compatible debug data.
173
- *
174
- * @param {any} value Format output.
175
- * @returns {any} JSON-compatible value.
171
+ /**
172
+ * Convert format output into JSON-compatible debug data.
173
+ *
174
+ * @param {any} value Format output.
175
+ * @returns {any} JSON-compatible value.
176
176
  */
177
177
  static toJSON(value) {
178
178
  return toJsonValue(value);
179
179
  }
180
180
 
181
- /**
182
- * Test whether bytes look like a Wwise media container.
183
- *
184
- * @param {Uint8Array|ArrayBuffer|DataView} input Candidate wem bytes.
185
- * @returns {boolean} True when RIFF/RIFX WAVE signatures are present.
181
+ /**
182
+ * Test whether bytes look like a Wwise media container.
183
+ *
184
+ * @param {Uint8Array|ArrayBuffer|DataView} input Candidate wem bytes.
185
+ * @returns {boolean} True when RIFF/RIFX WAVE signatures are present.
186
186
  */
187
187
  static isWEM(input) {
188
188
  try {
@@ -192,16 +192,16 @@ class CjsWemFormat {
192
192
  }
193
193
  }
194
194
 
195
- /**
196
- * Repack Wwise Vorbis wem bytes into a standard Ogg Vorbis stream.
197
- *
198
- * Lossless container transform (no audio decode/re-encode); output plays
199
- * natively where Ogg Vorbis is supported. Equivalent to
200
- * `read(input, { emit: "ogg" })`.
201
- *
202
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
203
- * @param {object} [options] Options, including a `codebooks` override.
204
- * @returns {object} Ogg payload with bytes, timing, and loop metadata.
195
+ /**
196
+ * Repack Wwise Vorbis wem bytes into a standard Ogg Vorbis stream.
197
+ *
198
+ * Lossless container transform (no audio decode/re-encode); output plays
199
+ * natively where Ogg Vorbis is supported. Equivalent to
200
+ * `read(input, { emit: "ogg" })`.
201
+ *
202
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
203
+ * @param {object} [options] Options, including a `codebooks` override.
204
+ * @returns {object} Ogg payload with bytes, timing, and loop metadata.
205
205
  */
206
206
  static toOgg(input, options = {}) {
207
207
  return CjsWemFormat.read(input, {
@@ -210,16 +210,16 @@ class CjsWemFormat {
210
210
  });
211
211
  }
212
212
 
213
- /**
214
- * Decode wem audio data to per-channel float32 PCM (AudioBuffer-ready).
215
- *
216
- * Covers Wwise PTADPCM (0x8311) and uncompressed 16-bit PCM. Wwise Vorbis
217
- * is not decoded here - repack it with `toOgg()` instead. Equivalent to
218
- * `read(input, { emit: "pcm" })`.
219
- *
220
- * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
221
- * @param {object} [options] Read options.
222
- * @returns {object} PCM payload with channelData, sample rate, and timing.
213
+ /**
214
+ * Decode wem audio data to per-channel float32 PCM (AudioBuffer-ready).
215
+ *
216
+ * Covers Wwise PTADPCM (0x8311) and uncompressed 16-bit PCM. Wwise Vorbis
217
+ * is not decoded here - repack it with `toOgg()` instead. Equivalent to
218
+ * `read(input, { emit: "pcm" })`.
219
+ *
220
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
221
+ * @param {object} [options] Read options.
222
+ * @returns {object} PCM payload with channelData, sample rate, and timing.
223
223
  */
224
224
  static toPcm(input, options = {}) {
225
225
  return CjsWemFormat.read(input, {
@@ -228,8 +228,8 @@ class CjsWemFormat {
228
228
  });
229
229
  }
230
230
 
231
- /**
232
- * Emit targets for this format (canonical frozen enum).
231
+ /**
232
+ * Emit targets for this format (canonical frozen enum).
233
233
  */
234
234
  static Output = Object.freeze({
235
235
  RAW: OUTPUT_RAW,
@@ -1 +1 @@
1
- {"version":3,"file":"CjsWemFormat.js","sources":["../../../../src/formats/wem/CjsWemFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_OGG,\n OUTPUT_PCM,\n OUTPUT_RAW,\n OUTPUT_WEM_JSON,\n WEM_CODEC_NAMES,\n inspectWithValues,\n isSupportedWithValues,\n isWEM,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\nimport { resolveTypeWithValues } from \"./core/resolve.js\";\n\nconst FORMAT_NAME = \"CjsWemFormat\";\n\n/**\n * Reader for Audiokinetic Wwise media (.wem) containers.\n *\n * Inspection identifies the codec, channel/rate layout, and Vorbis duration\n * without decoding audio data. Read emits the container bytes untouched by\n * default; `emit: \"ogg\"` repacks Wwise Vorbis into a standard Ogg stream and\n * `emit: \"pcm\"` decodes PTADPCM / 16-bit PCM media to float32 samples.\n */\nexport class CjsWemFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Browser-worker module declaration consumed by CjsResManWorkerLoader.\n */\n static worker = Object.freeze({\n module: import.meta.url,\n exportName: \"CjsWemFormat\"\n });\n\n /**\n * Create a reusable wem format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsWemFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, options, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, options, FORMAT_NAME);\n }\n\n /**\n * Read wem bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options));\n }\n\n /**\n * Read wem bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect wem bytes without decoding audio data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Wwise container metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n /**\n * Report whether wem input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options));\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot wem read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * One-shot asynchronous wem read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsWemFormat.read(input, options);\n }\n\n /**\n * One-shot wem inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} Wwise container metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * One-shot wem support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Content-verified codec/route resolution (kb §5 resolveType seam).\n *\n * Where `isSupported` trusts the fmt tag, this validates the declared\n * codec against the container's actual structure (Vorbis sidecar,\n * PTADPCM frame layout, PCM size consistency - bounded, no audio\n * decode) and tries the other codecs when the declaration fails.\n * The report carries `verified: true`, `preferred` = `ogg`/`pcm`/`raw`,\n * and declared/resolved/mismatch evidence in `metadata`.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Probe options.\n * @returns {Promise<object>} Content-verified probe report.\n */\n static async resolveType(input, options = {})\n {\n return resolveTypeWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a Wwise media container.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate wem bytes.\n * @returns {boolean} True when RIFF/RIFX WAVE signatures are present.\n */\n static isWEM(input)\n {\n try\n {\n return isWEM(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Repack Wwise Vorbis wem bytes into a standard Ogg Vorbis stream.\n *\n * Lossless container transform (no audio decode/re-encode); output plays\n * natively where Ogg Vorbis is supported. Equivalent to\n * `read(input, { emit: \"ogg\" })`.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Options, including a `codebooks` override.\n * @returns {object} Ogg payload with bytes, timing, and loop metadata.\n */\n static toOgg(input, options = {})\n {\n return CjsWemFormat.read(input, { ...options, emit: OUTPUT_OGG });\n }\n\n /**\n * Decode wem audio data to per-channel float32 PCM (AudioBuffer-ready).\n *\n * Covers Wwise PTADPCM (0x8311) and uncompressed 16-bit PCM. Wwise Vorbis\n * is not decoded here - repack it with `toOgg()` instead. Equivalent to\n * `read(input, { emit: \"pcm\" })`.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Read options.\n * @returns {object} PCM payload with channelData, sample rate, and timing.\n */\n static toPcm(input, options = {})\n {\n return CjsWemFormat.read(input, { ...options, emit: OUTPUT_PCM });\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON,\n WEM_JSON: OUTPUT_WEM_JSON,\n OGG: OUTPUT_OGG,\n PCM: OUTPUT_PCM\n });\n static CODEC_NAMES = WEM_CODEC_NAMES;\n static type = Object.freeze([ \"audio\" ]);\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static inputTypes = Object.freeze([ \"wem\" ]);\n static outputTypes = Object.freeze([ OUTPUT_RAW, OUTPUT_OGG, OUTPUT_PCM ]);\n static debugOutputTypes = Object.freeze([ OUTPUT_WEM_JSON, OUTPUT_RAW ]);\n}\n\nexport default CjsWemFormat;\n"],"names":["FORMAT_NAME","CjsWemFormat","DEFAULT_VALUES","worker","Object","freeze","module","import","meta","url","exportName","constructor","options","SetValues","normalizeValues","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","resolveType","resolveTypeWithValues","toJSON","isWEM","toBytes","toOgg","emit","OUTPUT_OGG","toPcm","OUTPUT_PCM","Output","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","WEM_JSON","OUTPUT_WEM_JSON","OGG","PCM","CODEC_NAMES","WEM_CODEC_NAMES","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;;AAkBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;AACJ;AACA;AACI,EAAA,OAAOC,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG;AACvBC,IAAAA,UAAU,EAAE;AAChB,GAAC,CAAC;;AAEF;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAEF,O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1E,OAAOgB,gBAAgB,GAAGpD,MAAM,CAACC,MAAM,CAAC,CAAE0C,eAAe,EAAEJ,UAAU,CAAE,CAAC;AAC5E;;;;"}
1
+ {"version":3,"file":"CjsWemFormat.js","sources":["../../../../src/formats/wem/CjsWemFormat.js"],"sourcesContent":["import {\r\n DEFAULT_VALUES,\r\n OUTPUT_JSON,\r\n OUTPUT_OGG,\r\n OUTPUT_PCM,\r\n OUTPUT_RAW,\r\n OUTPUT_WEM_JSON,\r\n WEM_CODEC_NAMES,\r\n inspectWithValues,\r\n isSupportedWithValues,\r\n isWEM,\r\n normalizeValues,\r\n readWithValues,\r\n toBytes,\r\n toJsonValue\r\n} from \"./core/helpers.js\";\r\nimport { resolveTypeWithValues } from \"./core/resolve.js\";\r\n\r\nconst FORMAT_NAME = \"CjsWemFormat\";\r\n\r\n/**\r\n * Reader for Audiokinetic Wwise media (.wem) containers.\r\n *\r\n * Inspection identifies the codec, channel/rate layout, and Vorbis duration\r\n * without decoding audio data. Read emits the container bytes untouched by\r\n * default; `emit: \"ogg\"` repacks Wwise Vorbis into a standard Ogg stream and\r\n * `emit: \"pcm\"` decodes PTADPCM / 16-bit PCM media to float32 samples.\r\n */\r\nexport class CjsWemFormat\r\n{\r\n #values = DEFAULT_VALUES;\r\n\r\n /**\r\n * Browser-worker module declaration consumed by CjsResManWorkerLoader.\r\n */\r\n static worker = Object.freeze({\r\n module: import.meta.url,\r\n exportName: \"CjsWemFormat\"\r\n });\r\n\r\n /**\r\n * Create a reusable wem format profile.\r\n *\r\n * @param {object} [options] Default read/inspect options.\r\n */\r\n constructor(options = {})\r\n {\r\n this.SetValues(options);\r\n }\r\n\r\n /**\r\n * Merge options into this profile.\r\n *\r\n * @param {object} [options] Values to merge.\r\n * @returns {CjsWemFormat} This format profile.\r\n */\r\n SetValues(options = {})\r\n {\r\n this.#values = normalizeValues(this.#values, options, FORMAT_NAME);\r\n return this;\r\n }\r\n\r\n /**\r\n * Get normalized profile values with optional per-call overrides.\r\n *\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} Normalized read values.\r\n */\r\n GetValues(options = {})\r\n {\r\n return normalizeValues(this.#values, options, FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Read wem bytes with this profile.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\r\n */\r\n Read(input, options = {})\r\n {\r\n return readWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Read wem bytes asynchronously with this profile.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\r\n */\r\n async ReadAsync(input, options = {})\r\n {\r\n return this.Read(input, options);\r\n }\r\n\r\n /**\r\n * Inspect wem bytes without decoding audio data.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} Wwise container metadata.\r\n */\r\n Inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Report whether wem input and requested output variants are supported.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} Support/probe report.\r\n */\r\n IsSupported(input, options = {})\r\n {\r\n return isSupportedWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Convert format output into JSON-compatible debug data.\r\n *\r\n * @param {any} value Format output.\r\n * @returns {any} JSON-compatible value.\r\n */\r\n ToJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * One-shot wem read.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Read options.\r\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\r\n */\r\n static read(input, options = {})\r\n {\r\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * One-shot asynchronous wem read.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Read options.\r\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\r\n */\r\n static async readAsync(input, options = {})\r\n {\r\n return CjsWemFormat.read(input, options);\r\n }\r\n\r\n /**\r\n * One-shot wem inspection.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Inspect options.\r\n * @returns {object} Wwise container metadata.\r\n */\r\n static inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * One-shot wem support probe.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Probe options.\r\n * @returns {object} Support/probe report.\r\n */\r\n static isSupported(input, options = {})\r\n {\r\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Content-verified codec/route resolution (resolveType seam; see docs/concepts/format-type-resolution.md).\r\n *\r\n * Where `isSupported` trusts the fmt tag, this validates the declared\r\n * codec against the container's actual structure (Vorbis sidecar,\r\n * PTADPCM frame layout, PCM size consistency - bounded, no audio\r\n * decode) and tries the other codecs when the declaration fails.\r\n * The report carries `verified: true`, `preferred` = `ogg`/`pcm`/`raw`,\r\n * and declared/resolved/mismatch evidence in `metadata`.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Probe options.\r\n * @returns {Promise<object>} Content-verified probe report.\r\n */\r\n static async resolveType(input, options = {})\r\n {\r\n return resolveTypeWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Convert format output into JSON-compatible debug data.\r\n *\r\n * @param {any} value Format output.\r\n * @returns {any} JSON-compatible value.\r\n */\r\n static toJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * Test whether bytes look like a Wwise media container.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate wem bytes.\r\n * @returns {boolean} True when RIFF/RIFX WAVE signatures are present.\r\n */\r\n static isWEM(input)\r\n {\r\n try\r\n {\r\n return isWEM(toBytes(input));\r\n }\r\n catch\r\n {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Repack Wwise Vorbis wem bytes into a standard Ogg Vorbis stream.\r\n *\r\n * Lossless container transform (no audio decode/re-encode); output plays\r\n * natively where Ogg Vorbis is supported. Equivalent to\r\n * `read(input, { emit: \"ogg\" })`.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Options, including a `codebooks` override.\r\n * @returns {object} Ogg payload with bytes, timing, and loop metadata.\r\n */\r\n static toOgg(input, options = {})\r\n {\r\n return CjsWemFormat.read(input, { ...options, emit: OUTPUT_OGG });\r\n }\r\n\r\n /**\r\n * Decode wem audio data to per-channel float32 PCM (AudioBuffer-ready).\r\n *\r\n * Covers Wwise PTADPCM (0x8311) and uncompressed 16-bit PCM. Wwise Vorbis\r\n * is not decoded here - repack it with `toOgg()` instead. Equivalent to\r\n * `read(input, { emit: \"pcm\" })`.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\r\n * @param {object} [options] Read options.\r\n * @returns {object} PCM payload with channelData, sample rate, and timing.\r\n */\r\n static toPcm(input, options = {})\r\n {\r\n return CjsWemFormat.read(input, { ...options, emit: OUTPUT_PCM });\r\n }\r\n\r\n /**\r\n * Emit targets for this format (canonical frozen enum).\r\n */\r\n static Output = Object.freeze({\r\n RAW: OUTPUT_RAW,\r\n JSON: OUTPUT_JSON,\r\n WEM_JSON: OUTPUT_WEM_JSON,\r\n OGG: OUTPUT_OGG,\r\n PCM: OUTPUT_PCM\r\n });\r\n static CODEC_NAMES = WEM_CODEC_NAMES;\r\n static type = Object.freeze([ \"audio\" ]);\r\n static mediaTypes = Object.freeze([ \"audio\" ]);\r\n static inputTypes = Object.freeze([ \"wem\" ]);\r\n static outputTypes = Object.freeze([ OUTPUT_RAW, OUTPUT_OGG, OUTPUT_PCM ]);\r\n static debugOutputTypes = Object.freeze([ OUTPUT_WEM_JSON, OUTPUT_RAW ]);\r\n}\r\n\r\nexport default CjsWemFormat;\r\n"],"names":["FORMAT_NAME","CjsWemFormat","DEFAULT_VALUES","worker","Object","freeze","module","import","meta","url","exportName","constructor","options","SetValues","normalizeValues","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","resolveType","resolveTypeWithValues","toJSON","isWEM","toBytes","toOgg","emit","OUTPUT_OGG","toPcm","OUTPUT_PCM","Output","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","WEM_JSON","OUTPUT_WEM_JSON","OGG","PCM","CODEC_NAMES","WEM_CODEC_NAMES","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;;AAkBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;AACJ;AACA;AACI,EAAA,OAAOC,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG;AACvBC,IAAAA,UAAU,EAAE;AAChB,GAAC,CAAC;;AAEF;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,E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GnD,MAAM,CAACC,MAAM,CAAC,CAAEsC,UAAU,EAAEL,UAAU,EAAEE,UAAU,CAAE,CAAC;EAC1E,OAAOgB,gBAAgB,GAAGpD,MAAM,CAACC,MAAM,CAAC,CAAE0C,eAAe,EAAEJ,UAAU,CAAE,CAAC;AAC5E;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { inspectWithValues } from './helpers.js';
2
2
 
3
- // Content-verified codec resolution for wem media (kb §5 resolveType seam).
3
+ // Content-verified codec resolution for wem media (resolveType seam; see docs/concepts/format-type-resolution.md).
4
4
  // The fmt tag is the declaration; each candidate codec gets ONE bounded
5
5
  // structural check against the actual container facts - no audio is decoded:
6
6
  //
@@ -49,13 +49,13 @@ function emitFor(candidate) {
49
49
  return "raw";
50
50
  }
51
51
 
52
- /**
53
- * Resolve a wem's actual decode route from content, not just its fmt tag.
54
- *
55
- * @param {*} input Wem bytes.
56
- * @param {object} values Normalized read values.
57
- * @returns {object} Probe-shaped report: verified variant flags, `preferred`
58
- * route, and declared/resolved/mismatch evidence in `metadata`.
52
+ /**
53
+ * Resolve a wem's actual decode route from content, not just its fmt tag.
54
+ *
55
+ * @param {*} input Wem bytes.
56
+ * @param {object} values Normalized read values.
57
+ * @returns {object} Probe-shaped report: verified variant flags, `preferred`
58
+ * route, and declared/resolved/mismatch evidence in `metadata`.
59
59
  */
60
60
  function resolveTypeWithValues(input, values) {
61
61
  const metadata = inspectWithValues(input, values);