@carbonenginejs/runtime-resource 0.11.1 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CjsResMan.js +4 -4
- package/dist/CjsResMan.js.map +1 -1
- package/dist/_virtual/_rollupPluginBabelHelpers.js +1 -4
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/dist/format/CjsByteReader.js +310 -0
- package/dist/format/CjsByteReader.js.map +1 -0
- package/dist/format/CjsByteWriter.js +242 -0
- package/dist/format/CjsByteWriter.js.map +1 -0
- package/dist/format/CjsFormatError.js +41 -0
- package/dist/format/CjsFormatError.js.map +1 -0
- package/dist/format/CjsStringTable.js +268 -0
- package/dist/format/CjsStringTable.js.map +1 -0
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js +361 -0
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -0
- package/dist/format/carbonEffect/CjsCarbonEffectWriter.js +373 -0
- package/dist/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -0
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js +372 -0
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js.map +1 -0
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js +427 -0
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -0
- package/dist/format/carbonEffect/carbonEffectRecords.js +955 -0
- package/dist/format/carbonEffect/carbonEffectRecords.js.map +1 -0
- package/dist/format/compareUtf8.js +36 -0
- package/dist/format/compareUtf8.js.map +1 -0
- package/dist/format/index.js +11 -0
- package/dist/format/index.js.map +1 -0
- package/dist/formats/bnk/CjsBnkFormat.js +18 -2
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/eventAction.js +305 -0
- package/dist/formats/bnk/core/eventAction.js.map +1 -0
- package/dist/formats/bnk/core/graph.js +3 -6
- package/dist/formats/bnk/core/graph.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +62 -11
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/nodeBase.js +532 -0
- package/dist/formats/bnk/core/nodeBase.js.map +1 -0
- package/dist/formats/bnk/core/sfxNodes.js +632 -0
- package/dist/formats/bnk/core/sfxNodes.js.map +1 -0
- package/dist/formats/bnk/core/soundbanksInfo.js +59 -51
- package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
- package/dist/formats/gr2/CjsGr2Format.js +256 -13
- package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/formats/gr2/core/helpers.js +15 -15
- package/dist/formats/gr2/core/helpers.js.map +1 -1
- package/dist/formats/gr2/core/json.js +1 -1
- package/dist/formats/gr2/core/json.js.map +1 -1
- package/dist/formats/gr2/core/targets.js +1 -1
- package/dist/formats/gr2/core/targets.js.map +1 -1
- package/dist/formats/gr2/index.js +0 -1
- package/dist/formats/gr2/index.js.map +1 -1
- package/dist/formats/hlsl/core/HlslReader.js +7 -257
- package/dist/formats/hlsl/core/HlslReader.js.map +1 -1
- package/dist/formats/hlsl/core/analysis.js +1 -1
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +781 -0
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +21 -1
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -1
- package/dist/formats/hlsl/index.js +1 -0
- package/dist/formats/hlsl/index.js.map +1 -1
- package/dist/formats/index.js +3 -6
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/webgl/core/cewg/CewgPackage.js +2 -1
- package/dist/formats/webgl/core/cewg/CewgPackage.js.map +1 -1
- package/dist/formats/webgl/core/cewg/binary.js +11 -93
- package/dist/formats/webgl/core/cewg/binary.js.map +1 -1
- package/dist/formats/webgl/core/effectPackage.js +4 -1
- package/dist/formats/webgl/core/effectPackage.js.map +1 -1
- package/dist/formats/webgl/core/errors.js +3 -3
- package/dist/formats/webgl/core/errors.js.map +1 -1
- package/dist/formats/webgpu/CjsWebgpuFormat.js +4 -23
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +197 -0
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js +368 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/containerViews.js +355 -0
- package/dist/formats/webgpu/core/cewgpu/containerViews.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/validateContainer.js +90 -0
- package/dist/formats/webgpu/core/cewgpu/validateContainer.js.map +1 -0
- package/dist/formats/webgpu/core/effectBackendBodySet.js +21 -20
- package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
- package/dist/formats/webgpu/core/helpers.js +87 -92
- package/dist/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js +14 -13
- package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js.map +1 -1
- package/dist/formats/webgpu/core/ir/inferValueTypes.js +10 -8
- package/dist/formats/webgpu/core/ir/inferValueTypes.js.map +1 -1
- package/dist/formats/webgpu/core/packageEffect.js +94 -9
- package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
- package/dist/formats/webgpu/core/packageMetadata.js +10 -1
- package/dist/formats/webgpu/core/packageMetadata.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +17 -15
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js +13 -12
- package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +9 -8
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js +23 -22
- package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/selectionPlans.js +46 -44
- package/dist/formats/webgpu/core/wgsl/selectionPlans.js.map +1 -1
- package/dist/resource/CjsResource.js +700 -684
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/Tr2LightProfileRes.js +18 -27
- package/dist/resource/Tr2LightProfileRes.js.map +1 -1
- package/dist/resource/audio/CjsAudioBufferRes.js +2 -2
- package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -1
- package/dist/resource/audio/CjsAudioRes.js +2 -2
- package/dist/resource/audio/CjsAudioRes.js.map +1 -1
- package/dist/resource/geometry/TriGeometryRes.js +605 -586
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +21 -30
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
- package/dist/resource/geometry/granny/TriGrannyRes.js +21 -30
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
- package/dist/resource/shader/Tr2EffectRes.js +9 -7
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialArea.js +5 -3
- package/dist/resource/shader/Tr2MaterialArea.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialMesh.js +4 -2
- package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialRes.js +5 -3
- package/dist/resource/shader/Tr2MaterialRes.js.map +1 -1
- package/dist/resource/shader/Tr2Shader.js +26 -21
- package/dist/resource/shader/Tr2Shader.js.map +1 -1
- package/dist/resource/shader/Tr2ShaderPermutation.js +8 -6
- package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDefine.js +5 -3
- package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +5 -3
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +17 -15
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +11 -9
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +8 -6
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +15 -13
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +7 -5
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +11 -9
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +8 -6
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +400 -411
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
- package/dist/resource/texture/Tr2ImageRes.js +99 -95
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
- package/dist/resource/texture/TriTextureRes.js +312 -273
- package/dist/resource/texture/TriTextureRes.js.map +1 -1
- package/docs/README.md +13 -1
- package/docs/architecture.md +3 -3
- package/docs/concepts/resource-lifecycle.md +9 -2
- package/docs/concepts/shader-resource-model.md +114 -0
- package/docs/concepts/writing-an-engine-adapter.md +115 -0
- package/docs/formats/README.md +24 -1
- package/docs/formats/carbon-effect-container.md +452 -0
- package/docs/formats/dxbc/README.md +68 -0
- package/docs/formats/dxbc/architecture.md +80 -0
- package/docs/formats/dxbc/reference/api.md +77 -0
- package/docs/formats/dxbc/reference/classes/README.md +9 -0
- package/docs/formats/dxbc/reference/decoded-output.md +122 -0
- package/docs/formats/gr2.md +3 -4
- package/docs/formats/hlsl/README.md +54 -0
- package/docs/formats/hlsl/architecture.md +67 -0
- package/docs/formats/hlsl/guides/hydrating-json-output.md +62 -0
- package/docs/formats/hlsl/guides/reading-effects.md +64 -0
- package/docs/formats/hlsl/reference/advanced-analysis.md +66 -0
- package/docs/formats/hlsl/reference/api.md +98 -0
- package/docs/formats/hlsl/reference/classes/README.md +11 -0
- package/docs/formats/hlsl/reference/json-graph.md +100 -0
- package/docs/formats/hlsl/reference/portable-reflection.md +141 -0
- package/docs/formats/provenance.md +32 -17
- package/docs/formats/webgl/README.md +57 -0
- package/docs/formats/webgl/architecture.md +70 -0
- package/docs/formats/webgl/carbon-constant-layouts.md +326 -0
- package/docs/formats/webgl/decl-io.md +1234 -0
- package/docs/formats/webgl/effect-reflection.md +127 -0
- package/docs/formats/webgl/memory-structured.md +871 -0
- package/docs/formats/webgl/reference/classes/README.md +9 -0
- package/docs/formats/webgl/texture-sample.md +964 -0
- package/docs/formats/webgpu/README.md +84 -0
- package/docs/formats/webgpu/architecture.md +96 -0
- package/docs/formats/webgpu/formats/cewgpu.md +216 -0
- package/docs/formats/webgpu/guides/effect-packaging.md +191 -0
- package/docs/formats/webgpu/reference/api.md +197 -0
- package/docs/formats/webgpu/reference/classes/README.md +9 -0
- package/docs/formats/webgpu/reference/wgsl-compatibility.md +1543 -0
- package/docs/formats/wwise.md +45 -4
- package/docs/reference/classes/core.md +80 -0
- package/docs/reference/classes/formats.md +24 -34
- package/docs/reference/events.md +25 -0
- package/docs/reference/motherlode-cache.md +22 -8
- package/docs/reference/workers.md +5 -5
- package/docs/roadmap.md +61 -41
- package/format-notices/bnk/NOTICE +5 -4
- package/format-notices/webgl/NOTICE +1 -1
- package/package.json +2 -1
- package/dist/formats/gr2/core/CjsFormatGr2.js +0 -273
- package/dist/formats/gr2/core/CjsFormatGr2.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js +0 -415
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js +0 -100
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/binary.js +0 -93
- package/dist/formats/webgpu/core/cewgpu/binary.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/tags.js +0 -17
- package/dist/formats/webgpu/core/cewgpu/tags.js.map +0 -1
- package/dist/formats/webgpu/core/effectPackageValidation.js +0 -1078
- package/dist/formats/webgpu/core/effectPackageValidation.js.map +0 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Portable body reflection
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource/formats/hlsl/portable`
|
|
5
|
+
Audience: Backend effect-packager authors
|
|
6
|
+
Summary: Defines exact, handle-free reflection for one compiled effect body.
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
The ordinary JSON and metadata modes describe one option-selected effect for
|
|
11
|
+
inspection. Backend package builders need a stronger boundary: exact
|
|
12
|
+
permutation-table selection, authored constant defaults, source programs, and
|
|
13
|
+
all reflection fields without renderer handles.
|
|
14
|
+
|
|
15
|
+
The portable subpath supplies that boundary:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import {
|
|
19
|
+
buildEffectBodyReflection,
|
|
20
|
+
enumerateUniqueEffectBodies,
|
|
21
|
+
readEffectBodyReflection,
|
|
22
|
+
validateEffectBodyReflection
|
|
23
|
+
} from "@carbonenginejs/runtime-resource/formats/hlsl/portable";
|
|
24
|
+
|
|
25
|
+
const document = readEffectBodyReflection(bytes, {
|
|
26
|
+
source: "effect.sm_depth",
|
|
27
|
+
permutationIndex: 4
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
validateEffectBodyReflection(document);
|
|
31
|
+
|
|
32
|
+
const groups = enumerateUniqueEffectBodies(effectRes);
|
|
33
|
+
const uniqueReflections = groups.map((group) =>
|
|
34
|
+
buildEffectBodyReflection(effectRes, group.permutationIndex));
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`buildEffectBodyReflection(effectRes, permutationIndex)` accepts an already
|
|
38
|
+
loaded raw `Tr2EffectRes`. This avoids reparsing when a backend builder already
|
|
39
|
+
uses `readEffectAnalysis`.
|
|
40
|
+
|
|
41
|
+
`enumerateUniqueEffectBodies(effectRes)` inspects version-15 source records and
|
|
42
|
+
bytes without decoding. It returns first-occurrence-ordered groups containing
|
|
43
|
+
one canonical `permutationIndex`/`sourceRecord` plus every byte-identical
|
|
44
|
+
variant alias. Exact range aliases are a fast path; distinct ranges are
|
|
45
|
+
fingerprinted and then compared byte-for-byte. The inventory caps the
|
|
46
|
+
Cartesian body table at 65,536 records, rejects partial overlaps, and leaves
|
|
47
|
+
the effect cache and state-manager registries unchanged.
|
|
48
|
+
|
|
49
|
+
## Contract
|
|
50
|
+
|
|
51
|
+
Version 1 accepts compiled effect version 15 only. Earlier container versions
|
|
52
|
+
synthesize or normalize several signature fields while reading; rejecting them
|
|
53
|
+
keeps every portable field source-exact.
|
|
54
|
+
|
|
55
|
+
The root identifies `CJS_EFFECT_BODY_REFLECTION` version 1,
|
|
56
|
+
`mode: "single-body"`, `keyScope: "body-local"`,
|
|
57
|
+
`coverage.bodies: "single"`, the diagnostic source label and
|
|
58
|
+
compiled-effect version/compiler/shared-table/source envelope in `source`, the exact
|
|
59
|
+
`permutationIndex`, and its
|
|
60
|
+
`sourceRecord.offset` / `sourceRecord.byteLength` span. Its effect graph
|
|
61
|
+
preserves:
|
|
62
|
+
|
|
63
|
+
- ordered parameter annotation groups;
|
|
64
|
+
- ordered techniques, passes, raw render-state pairs, and libraries;
|
|
65
|
+
- every present vertex, pixel, compute, geometry, hull, or domain stage;
|
|
66
|
+
- constant, resource, UAV, dynamic sampler, and stage-annotation metadata;
|
|
67
|
+
- complete pipeline-input, register, static-sampler, and thread-group
|
|
68
|
+
signatures;
|
|
69
|
+
- exact authored constant-default bytes and declared length; and
|
|
70
|
+
- owned copies of every stage and library source-program payload.
|
|
71
|
+
|
|
72
|
+
Every source-program record retains its exact shared-table offset. The
|
|
73
|
+
validator requires its complete byte range to remain within
|
|
74
|
+
`source.stringTableByteLength`.
|
|
75
|
+
Stage programs are explicitly `kind: "stage"` and carry their authored stage
|
|
76
|
+
identity. DXR library programs are `kind: "library"` and deliberately carry no
|
|
77
|
+
synthetic compute-stage identity.
|
|
78
|
+
|
|
79
|
+
Numeric BOOL, INT, and FLOAT annotations retain their exact serialized
|
|
80
|
+
`rawValue`. Sampler floats retain raw IEEE-754 bits. Static sampler border
|
|
81
|
+
colors remain their source enum byte; dynamic sampler border colors remain
|
|
82
|
+
four float bit patterns.
|
|
83
|
+
|
|
84
|
+
`source.nativeHash` is the compiler-provided v15 hash field, not a package
|
|
85
|
+
content digest. The backend package must independently hash its whole source
|
|
86
|
+
and body payloads.
|
|
87
|
+
|
|
88
|
+
Version-15 resource and signature counts retain Carbon's authored zero value.
|
|
89
|
+
For heap-view/bindless SRV, UAV, and sampler bindings, `arrayElements: 0` and
|
|
90
|
+
the matching signature `arrayCount: 0` / `registerCount: 0` represent an
|
|
91
|
+
unbounded descriptor range; they are valid source reflection, not an empty or
|
|
92
|
+
malformed binding. Every resource and UAV map entry must reconcile with
|
|
93
|
+
exactly one signature register; signature-only records remain valid.
|
|
94
|
+
|
|
95
|
+
The compiled body has no authored effect-name field. The caller-supplied
|
|
96
|
+
diagnostic name or path is retained only as `source.label`.
|
|
97
|
+
|
|
98
|
+
The serializer rejects defaults or constant extents beyond Carbon's 4,096-byte
|
|
99
|
+
stage constant-buffer limit.
|
|
100
|
+
|
|
101
|
+
## Source truth and realization
|
|
102
|
+
|
|
103
|
+
The portable document excludes shader, program, render-state, sampler, and
|
|
104
|
+
library handles. It also excludes resource-set descriptions, heap-view arrays,
|
|
105
|
+
backend layouts, masks, sort values, and caches. `runtime-resource` consumes
|
|
106
|
+
the document to hydrate the canonical device-free shader/reflection graph,
|
|
107
|
+
select permutations, and cache shaders. Engines own handles, layouts,
|
|
108
|
+
resource sets, programs, pipelines, and other GPU realization.
|
|
109
|
+
|
|
110
|
+
Register dynamic classification is not persisted. It depends on per-frame
|
|
111
|
+
reader/engine policy and is not an authored binary field.
|
|
112
|
+
|
|
113
|
+
Authored constant defaults are separate from the raw model's mutable
|
|
114
|
+
`constantValues`. Carbon-compatible sampler-heap realization may zero-extend
|
|
115
|
+
the latter; it cannot change the portable source prefix.
|
|
116
|
+
|
|
117
|
+
## Selection and completeness
|
|
118
|
+
|
|
119
|
+
The parser-internal `GetShaderByIndex(index)` and the portable serializer
|
|
120
|
+
bypass global and local option selection. This is distinct from
|
|
121
|
+
`runtime-resource` `Tr2EffectRes.GetShaderByIndex`, which hydrates and caches a
|
|
122
|
+
canonical shader. The portable serializer performs a fresh non-caching decode
|
|
123
|
+
with a temporary state manager, so mutation of a previously cached raw shader
|
|
124
|
+
cannot change reflection rebuilt from the same owned source bytes.
|
|
125
|
+
This makes a body-table index stable even when an application has global
|
|
126
|
+
effect options.
|
|
127
|
+
|
|
128
|
+
Version 1 describes one complete listed body. Body-local technique, pass,
|
|
129
|
+
stage, and library keys must be namespaced by a backend package before they are
|
|
130
|
+
flattened across bodies. This document does not claim that a backend package
|
|
131
|
+
contains every permutation body or a program for every body. A backend
|
|
132
|
+
container must reconcile all three of `permutationIndex`,
|
|
133
|
+
`sourceRecord.offset`, and `sourceRecord.byteLength` with its own body identity
|
|
134
|
+
and permutation graph, then reconcile the source byte length and native hash
|
|
135
|
+
before claiming completeness.
|
|
136
|
+
|
|
137
|
+
## Related documentation
|
|
138
|
+
|
|
139
|
+
- [JSON and metadata graphs](json-graph.md)
|
|
140
|
+
- [Advanced analysis exports](advanced-analysis.md)
|
|
141
|
+
- [Architecture](../architecture.md)
|
|
@@ -6,8 +6,10 @@ Audience: Users, integrators, and maintainers
|
|
|
6
6
|
Summary: Records where each format implementation came from, retained snapshots and digests, and what was deliberately not copied.
|
|
7
7
|
|
|
8
8
|
On 2026-07-13, the non-shader runtime format implementations below were copied
|
|
9
|
-
once into `runtime-resource`.
|
|
10
|
-
|
|
9
|
+
once into `runtime-resource`. The table records the donor revisions or
|
|
10
|
+
working-tree states used for that migration; it does not assert that a
|
|
11
|
+
standalone repository still exists. Any surviving standalone repository is
|
|
12
|
+
historical provenance, not an upstream for the runtime copy.
|
|
11
13
|
|
|
12
14
|
Copied paths were `src/` and the behavioral `test/` corpus. Package publishing
|
|
13
15
|
scripts and CLIs were not copied. Exact donor license and notice files are kept
|
|
@@ -53,26 +55,32 @@ GR2/GSF reader joined the runtime copies:
|
|
|
53
55
|
|---|---|---|---|
|
|
54
56
|
| `format-gr2` | `fa64607de7a3a96ed3b1aec5288bf71057642043` (v0.2.0, MIT) | `CjsGr2Format` | `@carbonenginejs/runtime-resource/formats/gr2` |
|
|
55
57
|
|
|
56
|
-
The
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`format-notices/gr2/`.
|
|
58
|
+
The donor engine was folded into the single public `CjsGr2Format` class, so
|
|
59
|
+
the copied `CjsFormatGr2` name is gone and `formats/gr2/core/` holds only
|
|
60
|
+
role-named helper modules, matching every other format. Donor license and
|
|
61
|
+
notice files are kept under `format-notices/gr2/`.
|
|
60
62
|
|
|
61
63
|
## Black definition snapshot
|
|
62
64
|
|
|
63
65
|
The Black reader uses the package-owned generated definition snapshot at
|
|
64
|
-
`src/formats/black/core/black-schema-v1-2026-07-
|
|
66
|
+
`src/formats/black/core/black-schema-v1-2026-07-23.json`. The Red format exposes
|
|
65
67
|
the same catalog for discovery, but its YAML reader currently accepts named
|
|
66
|
-
fields without registry enforcement. The
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
fields without registry enforcement. The refreshed consumer snapshot landed
|
|
69
|
+
in runtime-resource revision `6beda70` with SHA-256
|
|
70
|
+
`9234DD86DBB5EB3676EF060E383ADBCE8F073941E76A32865D3528DD5DA7B737`.
|
|
71
|
+
Its exact tools-core generator revision was not recorded and remains unknown;
|
|
72
|
+
this page does not infer one from the consumer commit.
|
|
70
73
|
|
|
71
74
|
This retained generated artifact keeps the published readers deterministic and
|
|
72
75
|
browser-safe without a runtime dependency on a sibling checkout or an
|
|
73
|
-
unpublished
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
unpublished generator export. Future schema generation is owned by
|
|
77
|
+
`tools-core/schema`. A consumer of generated output is responsible for
|
|
78
|
+
reviewing and copying the result into its own worktree; an updated snapshot
|
|
79
|
+
must record the generator revision and new digest here.
|
|
80
|
+
|
|
81
|
+
This generator boundary is transitional. As runtime classes gain embedded
|
|
82
|
+
schema, the shared snapshot and its copy-in step can be reduced and eventually
|
|
83
|
+
removed once every required class is self-describing.
|
|
76
84
|
|
|
77
85
|
## Native additions
|
|
78
86
|
|
|
@@ -85,6 +93,11 @@ format attribution rather than fork provenance.
|
|
|
85
93
|
| Wwise soundbank (`.bnk`) | `CjsBnkFormat` | `@carbonenginejs/runtime-resource/formats/bnk` | Original code; chunk layout from public community documentation (ww2ogg, vgmstream, wwiser), no code copied. Also carries the SoundbanksInfo JSON helpers (`parseSoundbanksInfo`, `buildSoundbanksCatalog`, `joinSoundbanksInfo`) and `wwiseIdFromName` (FNV-1 32 of the lowercased name, verified against EVE bank/language ids). HIRC entries additionally decode version-stable typed fields (event action lists, action type/target, sound and music-track source ids), pinned by hexdump against bank generator version 150, and the `wwise` static namespace groups the domain toolkit (SoundbanksInfo helpers, id hash, `wwise.eventMediaFromBanks` event → media resolution over inspected banks — graph interpretation for consumers; never used by the resource lifecycle). |
|
|
86
94
|
| Wwise media (`.wem`) | `CjsWemFormat` | `@carbonenginejs/runtime-resource/formats/wem` | Original code; container/codec-tag behavior from public community documentation (ww2ogg, vgmstream, wwiser), no code copied. Includes a Wwise-Vorbis→Ogg repacker (`emit: "ogg"`), an original reimplementation of the ww2ogg algorithm with inline granule computation (no revorb pass needed), and a PTADPCM/16-bit-PCM decoder (`emit: "pcm"` / `toPcm()`, AudioBuffer-ready float32; PTADPCM algorithm from community documentation, verified against EVE media). |
|
|
87
95
|
|
|
96
|
+
The BNK toolkit also exposes `wwise.sfxNodesFromBanks`: typed, exact-end
|
|
97
|
+
version-150 Random/Sequence, Switch/State, and Layer tails plus event/action
|
|
98
|
+
records and explicit parser diagnostics. It preserves resource facts for
|
|
99
|
+
consumer-owned lowering and is never invoked by the resource lifecycle.
|
|
100
|
+
|
|
88
101
|
## Post-fork additions inside copied formats
|
|
89
102
|
|
|
90
103
|
- `formats/dds` gained original, dependency-free **BC6H and BC7 CPU decoders**
|
|
@@ -157,9 +170,11 @@ snapshot must record its new source and digest here.
|
|
|
157
170
|
- `format-gr2` migrated into `formats/gr2` on 2026-07-24 (see the dated
|
|
158
171
|
table above) after its EUPL constraint was resolved; its standalone
|
|
159
172
|
repository is now a frozen legacy distribution like the other donors.
|
|
160
|
-
- `format-carbon`
|
|
161
|
-
|
|
162
|
-
|
|
173
|
+
- `format-carbon` is historical provenance for the current copied snapshot,
|
|
174
|
+
not the authority for future regeneration. `tools-core/schema` owns schema
|
|
175
|
+
generation, while each consuming package reviews and copies generated output
|
|
176
|
+
into its own worktree. Black consumes the retained snapshot; Red exposes the
|
|
177
|
+
copied catalog but does not yet enforce it while reading YAML fields.
|
|
163
178
|
- The shader formats were excluded from the original migration while their
|
|
164
179
|
implementations were still being finished. That sequencing guard was lifted
|
|
165
180
|
on 2026-07-29 and they moved in as ordinary formats. All four landed:
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# WebGL format documentation
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource/formats/webgl`
|
|
5
|
+
Audience: Shader-tool authors, runtime integrators, and maintainers
|
|
6
|
+
Summary: Explains CEWG packages, portable reflection, and DXBC-to-GLSL conversion.
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
`@carbonenginejs/runtime-resource/formats/webgl` reads and builds CEWG packages and converts
|
|
11
|
+
supported compiled Carbon effect stages into GLSL ES 3.00 package data. It
|
|
12
|
+
preserves complete source permutation topology and, for version-15 effects,
|
|
13
|
+
portable reflection for every unique body without creating live shader or GPU
|
|
14
|
+
objects.
|
|
15
|
+
|
|
16
|
+
## Use this package when
|
|
17
|
+
|
|
18
|
+
Use `format-webgl` to inspect or build CEWG bytes, translate supported DXBC
|
|
19
|
+
stages, or convert one compiled effect while preserving all source
|
|
20
|
+
permutations and portable reflection. Use runtime and engine packages for live
|
|
21
|
+
shader objects, resource selection, bindings, and draws.
|
|
22
|
+
|
|
23
|
+
## Where it fits
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
compiled effect bytes
|
|
27
|
+
|
|
|
28
|
+
+---- format-hlsl ---- portable source reflection
|
|
29
|
+
+---- format-dxbc ---- decoded shader programs
|
|
30
|
+
|
|
|
31
|
+
v
|
|
32
|
+
format-webgl
|
|
33
|
+
CEWG + GLSL ES 3.00
|
|
34
|
+
|
|
|
35
|
+
+---- runtime-resource ---- selection, cache, Tr2Shader hydration
|
|
36
|
+
+---- runtime-trinity ----- effect/material facade and parameters
|
|
37
|
+
`---- WebGL engine -------- programs, bindings, and draws
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Start here
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
import { CjsWebglFormat } from "@carbonenginejs/runtime-resource/formats/webgl";
|
|
44
|
+
|
|
45
|
+
const summary = CjsWebglFormat.inspect(packageBytes);
|
|
46
|
+
const packageData = CjsWebglFormat.read(packageBytes);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Documentation map
|
|
50
|
+
|
|
51
|
+
- [Architecture and ownership](architecture.md)
|
|
52
|
+
- [Effect reflection contract](effect-reflection.md)
|
|
53
|
+
- [Constant-buffer layouts](carbon-constant-layouts.md)
|
|
54
|
+
- [Declaration and I/O lowering](decl-io.md)
|
|
55
|
+
- [Structured-memory lowering](memory-structured.md)
|
|
56
|
+
- [Texture sampling](texture-sample.md)
|
|
57
|
+
- [Class-purpose catalog](reference/classes/README.md)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Architecture and ownership
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource/formats/webgl`
|
|
5
|
+
Audience: Shader-tool authors, runtime integrators, and maintainers
|
|
6
|
+
Summary: Defines the package's compiler, container, runtime, and engine boundaries.
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
`format-webgl` is the transformation and package layer between compiled
|
|
11
|
+
Carbon-style effects and WebGL engine realization. It emits portable CEWG data
|
|
12
|
+
and GLSL ES 3.00 without constructing mutable runtime shader classes or WebGL
|
|
13
|
+
objects.
|
|
14
|
+
|
|
15
|
+
## Dependency direction
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
@carbonenginejs/runtime-resource/formats/hlsl
|
|
19
|
+
|
|
|
20
|
+
+---- effect parsing and portable reflection
|
|
21
|
+
|
|
|
22
|
+
v
|
|
23
|
+
@carbonenginejs/runtime-resource/formats/webgl <---- @carbonenginejs/runtime-resource/formats/dxbc
|
|
24
|
+
| decoded DXBC
|
|
25
|
+
|
|
|
26
|
+
+---- CEWG bytes, metadata, reflection, GLSL
|
|
27
|
+
|
|
|
28
|
+
+---- runtime-resource ---- package selection + Tr2Shader hydration
|
|
29
|
+
+---- runtime-trinity ----- effect/material facade + parameters
|
|
30
|
+
`---- WebGL engine -------- GPU realization
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Tools may call the public byte-oriented API, but the format package does not
|
|
34
|
+
import the toolchain. Runtime packages consume immutable package data through
|
|
35
|
+
an explicit adapter boundary.
|
|
36
|
+
|
|
37
|
+
## Owned responsibilities
|
|
38
|
+
|
|
39
|
+
- Reading, inspecting, validating, and building CEWG v1 containers.
|
|
40
|
+
- Preserving every source permutation and unique body identity.
|
|
41
|
+
- Packing complete version-15 portable reflection and exact shared bytes.
|
|
42
|
+
- Translating supported DXBC vertex, pixel, and bounded map-style compute
|
|
43
|
+
stages into GLSL ES 3.00.
|
|
44
|
+
- Preserving backend bodies, stages, programs, manifests, and render states.
|
|
45
|
+
- Rejecting incomplete or inconsistent canonical effect packages.
|
|
46
|
+
|
|
47
|
+
## Ownership elsewhere
|
|
48
|
+
|
|
49
|
+
- `format-hlsl` owns compiled-effect parsing and the portable reflection
|
|
50
|
+
schema.
|
|
51
|
+
- `format-dxbc` owns DXBC decoding.
|
|
52
|
+
- `runtime-resource` owns `Tr2EffectRes`, package bytes, option selection,
|
|
53
|
+
per-permutation cache identity, canonical `Tr2Shader`, reflection records,
|
|
54
|
+
sampler setup records, and portable hydration.
|
|
55
|
+
- `runtime-trinity` owns the mutable `Tr2Effect`/`Tr2Material` facade,
|
|
56
|
+
parameters, authored options, and sampler overrides.
|
|
57
|
+
- The WebGL engine owns program compilation, locations, layouts, resource
|
|
58
|
+
binding, uploads, draws, and context recovery.
|
|
59
|
+
|
|
60
|
+
## Completeness boundary
|
|
61
|
+
|
|
62
|
+
Version-15 CEWG can be source-complete while remaining backend- and
|
|
63
|
+
runtime-incomplete. Successful GLSL translation and compile/link do not prove
|
|
64
|
+
the engine's physical binding/layout contract or a rendered result.
|
|
65
|
+
|
|
66
|
+
## Related documentation
|
|
67
|
+
|
|
68
|
+
- [Package documentation](README.md)
|
|
69
|
+
- [Effect reflection contract](effect-reflection.md)
|
|
70
|
+
- [Class-purpose catalog](reference/classes/README.md)
|