@carbonenginejs/runtime-resource 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formats/bnk/CjsBnkFormat.js +12 -2
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- 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 +53 -11
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/sfxNodes.js +532 -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/analysis.js +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/binary.js +3 -3
- 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/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 +76 -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 +97 -0
- package/docs/formats/hlsl/reference/classes/README.md +16 -0
- package/docs/formats/hlsl/reference/classes/carbon-compatibility.md +66 -0
- package/docs/formats/hlsl/reference/classes/public-api.md +26 -0
- package/docs/formats/hlsl/reference/classes/tr2-effect-model.md +150 -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 +9 -4
- 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 +96 -0
- package/docs/formats/webgl/texture-sample.md +964 -0
- package/docs/formats/webgpu/README.md +81 -0
- package/docs/formats/webgpu/architecture.md +93 -0
- package/docs/formats/webgpu/formats/cewgpu.md +479 -0
- package/docs/formats/webgpu/guides/effect-packaging.md +199 -0
- package/docs/formats/webgpu/reference/api.md +197 -0
- package/docs/formats/webgpu/reference/classes/README.md +66 -0
- package/docs/formats/webgpu/reference/wgsl-compatibility.md +1442 -0
- package/docs/formats/wwise.md +16 -1
- package/docs/reference/classes/formats.md +10 -10
- package/format-notices/bnk/NOTICE +5 -4
- package/format-notices/webgl/NOTICE +1 -1
- package/package.json +1 -1
- package/dist/formats/gr2/core/CjsFormatGr2.js +0 -273
- package/dist/formats/gr2/core/CjsFormatGr2.js.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Carbon compatibility classes
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource/formats/hlsl` package-local compatibility classes
|
|
5
|
+
Audience: Maintainers and automated readers
|
|
6
|
+
Summary: Describes internal utilities and Carbon-shaped compatibility records used by the reader.
|
|
7
|
+
|
|
8
|
+
<!-- class:CjsBinaryReader -->
|
|
9
|
+
## `CjsBinaryReader`
|
|
10
|
+
|
|
11
|
+
Little-endian binary reader for Carbon/Trinity compiled effect data.
|
|
12
|
+
|
|
13
|
+
- Export: None
|
|
14
|
+
- Source: `src/carbon/cjs/CjsBinaryReader.js`
|
|
15
|
+
- Visibility: Internal
|
|
16
|
+
- Kind: Internal implementation
|
|
17
|
+
|
|
18
|
+
<!-- class:CjsEffectReadError -->
|
|
19
|
+
## `CjsEffectReadError`
|
|
20
|
+
|
|
21
|
+
Error raised when a Carbon/Trinity effect payload cannot be decoded safely.
|
|
22
|
+
|
|
23
|
+
- Export: None
|
|
24
|
+
- Source: `src/carbon/cjs/CjsEffectReadError.js`
|
|
25
|
+
- Visibility: Internal
|
|
26
|
+
- Kind: Internal implementation
|
|
27
|
+
|
|
28
|
+
<!-- class:CjsEffectStateManager -->
|
|
29
|
+
## `CjsEffectStateManager`
|
|
30
|
+
|
|
31
|
+
In-memory JavaScript substitute for Carbon's effect state manager registry.
|
|
32
|
+
|
|
33
|
+
- Export: None
|
|
34
|
+
- Source: `src/carbon/cjs/CjsEffectStateManager.js`
|
|
35
|
+
- Visibility: Internal
|
|
36
|
+
- Kind: Adapted Carbon concept
|
|
37
|
+
|
|
38
|
+
<!-- class:CjsRenderStateSetup -->
|
|
39
|
+
## `CjsRenderStateSetup`
|
|
40
|
+
|
|
41
|
+
JavaScript mirror of a registered Carbon render-state setup.
|
|
42
|
+
|
|
43
|
+
- Export: None
|
|
44
|
+
- Source: `src/carbon/cjs/CjsRenderStateSetup.js`
|
|
45
|
+
- Visibility: Internal
|
|
46
|
+
- Kind: Adapted Carbon concept
|
|
47
|
+
|
|
48
|
+
<!-- class:CjsResourceSetDescription -->
|
|
49
|
+
## `CjsResourceSetDescription`
|
|
50
|
+
|
|
51
|
+
JavaScript mirror of Carbon's resource-set descriptor builder.
|
|
52
|
+
|
|
53
|
+
- Export: None
|
|
54
|
+
- Source: `src/carbon/cjs/CjsResourceSetDescription.js`
|
|
55
|
+
- Visibility: Internal
|
|
56
|
+
- Kind: Adapted Carbon concept
|
|
57
|
+
|
|
58
|
+
<!-- class:CjsShaderBytecode -->
|
|
59
|
+
## `CjsShaderBytecode`
|
|
60
|
+
|
|
61
|
+
JavaScript stand-in for Carbon's shader-bytecode handle payload.
|
|
62
|
+
|
|
63
|
+
- Export: None
|
|
64
|
+
- Source: `src/carbon/cjs/CjsShaderBytecode.js`
|
|
65
|
+
- Visibility: Internal
|
|
66
|
+
- Kind: Adapted Carbon concept
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Public API classes
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource/formats/hlsl` package-root classes
|
|
5
|
+
Audience: Users, maintainers, and automated readers
|
|
6
|
+
Summary: Describes the supported reader class and the advanced exported binding-manifest class.
|
|
7
|
+
|
|
8
|
+
<!-- class:CjsHlslFormat -->
|
|
9
|
+
## `CjsHlslFormat`
|
|
10
|
+
|
|
11
|
+
CarbonEngineJS-facing reader for CCP's Tr2 compiled effect container format (`.sm_hi` / `.sm_lo` / `.sm_depth` bodies).
|
|
12
|
+
|
|
13
|
+
- Export: `@carbonenginejs/runtime-resource/formats/hlsl`
|
|
14
|
+
- Source: `src/CjsHlslFormat.js`
|
|
15
|
+
- Visibility: Public
|
|
16
|
+
- Kind: CarbonEngineJS
|
|
17
|
+
|
|
18
|
+
<!-- class:Tr2EffectBindingManifest -->
|
|
19
|
+
## `Tr2EffectBindingManifest`
|
|
20
|
+
|
|
21
|
+
Carbon-backed binding manifest for register-named shader outputs.
|
|
22
|
+
|
|
23
|
+
- Export: `@carbonenginejs/runtime-resource/formats/hlsl`
|
|
24
|
+
- Source: `src/core/tr2/shader/Tr2EffectBindingManifest.js`
|
|
25
|
+
- Visibility: Public
|
|
26
|
+
- Kind: Adapted Carbon concept
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Tr2 effect-model classes
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource/formats/hlsl` internal Tr2 graph
|
|
5
|
+
Audience: Maintainers and automated readers
|
|
6
|
+
Summary: Describes internal parser DTOs for resource, permutation, effect, pass, and stage metadata; these are not canonical runtime-resource classes.
|
|
7
|
+
|
|
8
|
+
Every same-named `Tr2*` entry in this catalog is package-internal binary parser
|
|
9
|
+
state. Canonical device-free runtime `Tr2EffectRes`, `Tr2Shader`, and reflection
|
|
10
|
+
identity belong to `@carbonenginejs/runtime-resource`.
|
|
11
|
+
|
|
12
|
+
<!-- class:Tr2EffectRes -->
|
|
13
|
+
## `Tr2EffectRes`
|
|
14
|
+
|
|
15
|
+
Carbon/Trinity effect resource reader for compiled shader metadata.
|
|
16
|
+
|
|
17
|
+
- Export: None
|
|
18
|
+
- Source: `src/core/tr2/resources/Tr2EffectRes.js`
|
|
19
|
+
- Visibility: Internal
|
|
20
|
+
- Kind: Adapted Carbon concept
|
|
21
|
+
|
|
22
|
+
<!-- class:Tr2ShaderPermutation -->
|
|
23
|
+
## `Tr2ShaderPermutation`
|
|
24
|
+
|
|
25
|
+
Trinity shader permutation axis and option metadata.
|
|
26
|
+
|
|
27
|
+
- Export: None
|
|
28
|
+
- Source: `src/core/tr2/resources/Tr2ShaderPermutation.js`
|
|
29
|
+
- Visibility: Internal
|
|
30
|
+
- Kind: Adapted Carbon concept
|
|
31
|
+
|
|
32
|
+
<!-- class:Tr2EffectConstant -->
|
|
33
|
+
## `Tr2EffectConstant`
|
|
34
|
+
|
|
35
|
+
Constant-buffer parameter metadata read from a Trinity effect body.
|
|
36
|
+
|
|
37
|
+
- Export: None
|
|
38
|
+
- Source: `src/core/tr2/shader/Tr2EffectConstant.js`
|
|
39
|
+
- Visibility: Internal
|
|
40
|
+
- Kind: Adapted Carbon concept
|
|
41
|
+
|
|
42
|
+
<!-- class:Tr2EffectDescription -->
|
|
43
|
+
## `Tr2EffectDescription`
|
|
44
|
+
|
|
45
|
+
Trinity effect-description body decoded from one compiled permutation record.
|
|
46
|
+
|
|
47
|
+
- Export: None
|
|
48
|
+
- Source: `src/core/tr2/shader/Tr2EffectDescription.js`
|
|
49
|
+
- Visibility: Internal
|
|
50
|
+
- Kind: Adapted Carbon concept
|
|
51
|
+
|
|
52
|
+
<!-- class:Tr2EffectLibrary -->
|
|
53
|
+
## `Tr2EffectLibrary`
|
|
54
|
+
|
|
55
|
+
Ray-tracing shader library metadata from v14+ Trinity effects.
|
|
56
|
+
|
|
57
|
+
- Export: None
|
|
58
|
+
- Source: `src/core/tr2/shader/Tr2EffectLibrary.js`
|
|
59
|
+
- Visibility: Internal
|
|
60
|
+
- Kind: Adapted Carbon concept
|
|
61
|
+
|
|
62
|
+
<!-- class:Tr2EffectParameterAnnotation -->
|
|
63
|
+
## `Tr2EffectParameterAnnotation`
|
|
64
|
+
|
|
65
|
+
Parameter annotation value attached to a Trinity effect parameter.
|
|
66
|
+
|
|
67
|
+
- Export: None
|
|
68
|
+
- Source: `src/core/tr2/shader/Tr2EffectParameterAnnotation.js`
|
|
69
|
+
- Visibility: Internal
|
|
70
|
+
- Kind: Adapted Carbon concept
|
|
71
|
+
|
|
72
|
+
<!-- class:Tr2EffectResource -->
|
|
73
|
+
## `Tr2EffectResource`
|
|
74
|
+
|
|
75
|
+
Shader resource or UAV metadata read from a Trinity effect body.
|
|
76
|
+
|
|
77
|
+
- Export: None
|
|
78
|
+
- Source: `src/core/tr2/shader/Tr2EffectResource.js`
|
|
79
|
+
- Visibility: Internal
|
|
80
|
+
- Kind: Adapted Carbon concept
|
|
81
|
+
|
|
82
|
+
<!-- class:Tr2EffectStageInput -->
|
|
83
|
+
## `Tr2EffectStageInput`
|
|
84
|
+
|
|
85
|
+
Decoded per-stage input metadata for constants, resources, samplers, and signatures.
|
|
86
|
+
|
|
87
|
+
- Export: None
|
|
88
|
+
- Source: `src/core/tr2/shader/Tr2EffectStageInput.js`
|
|
89
|
+
- Visibility: Internal
|
|
90
|
+
- Kind: Adapted Carbon concept
|
|
91
|
+
|
|
92
|
+
<!-- class:Tr2EffectTechnique -->
|
|
93
|
+
## `Tr2EffectTechnique`
|
|
94
|
+
|
|
95
|
+
Trinity effect technique containing passes and optional shader libraries.
|
|
96
|
+
|
|
97
|
+
- Export: None
|
|
98
|
+
- Source: `src/core/tr2/shader/Tr2EffectTechnique.js`
|
|
99
|
+
- Visibility: Internal
|
|
100
|
+
- Kind: Adapted Carbon concept
|
|
101
|
+
|
|
102
|
+
<!-- class:Tr2Pass -->
|
|
103
|
+
## `Tr2Pass`
|
|
104
|
+
|
|
105
|
+
Trinity effect pass containing shader stages, resource metadata, and render state.
|
|
106
|
+
|
|
107
|
+
- Export: None
|
|
108
|
+
- Source: `src/core/tr2/shader/Tr2Pass.js`
|
|
109
|
+
- Visibility: Internal
|
|
110
|
+
- Kind: Adapted Carbon concept
|
|
111
|
+
|
|
112
|
+
<!-- class:Tr2SamplerDescription -->
|
|
113
|
+
## `Tr2SamplerDescription`
|
|
114
|
+
|
|
115
|
+
Trinity sampler descriptor read from compiled effect metadata.
|
|
116
|
+
|
|
117
|
+
- Export: None
|
|
118
|
+
- Source: `src/core/tr2/shader/Tr2SamplerDescription.js`
|
|
119
|
+
- Visibility: Internal
|
|
120
|
+
- Kind: Adapted Carbon concept
|
|
121
|
+
|
|
122
|
+
<!-- class:Tr2SamplerSetup -->
|
|
123
|
+
## `Tr2SamplerSetup`
|
|
124
|
+
|
|
125
|
+
Trinity sampler binding that pairs a metadata name with a sampler descriptor.
|
|
126
|
+
|
|
127
|
+
- Export: None
|
|
128
|
+
- Source: `src/core/tr2/shader/Tr2SamplerSetup.js`
|
|
129
|
+
- Visibility: Internal
|
|
130
|
+
- Kind: Adapted Carbon concept
|
|
131
|
+
|
|
132
|
+
<!-- class:Tr2Shader -->
|
|
133
|
+
## `Tr2Shader`
|
|
134
|
+
|
|
135
|
+
Trinity shader wrapper around a decoded `Tr2EffectDescription`.
|
|
136
|
+
|
|
137
|
+
- Export: None
|
|
138
|
+
- Source: `src/core/tr2/shader/Tr2Shader.js`
|
|
139
|
+
- Visibility: Internal
|
|
140
|
+
- Kind: Adapted Carbon concept
|
|
141
|
+
|
|
142
|
+
<!-- class:Tr2ShaderOption -->
|
|
143
|
+
## `Tr2ShaderOption`
|
|
144
|
+
|
|
145
|
+
Name/value shader permutation option used during effect lookup.
|
|
146
|
+
|
|
147
|
+
- Export: None
|
|
148
|
+
- Source: `src/core/tr2/shader/Tr2ShaderOption.js`
|
|
149
|
+
- Visibility: Internal
|
|
150
|
+
- Kind: Adapted Carbon concept
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# JSON and metadata graphs
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource/formats/hlsl` emitted data
|
|
5
|
+
Audience: Users and integrators
|
|
6
|
+
Summary: Documents the default JSON graph, compact metadata graph, and permutation selection.
|
|
7
|
+
|
|
8
|
+
## Default JSON graph
|
|
9
|
+
|
|
10
|
+
`emit: "json"` is the default:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
Root
|
|
14
|
+
|- version, compilerVersion, sourcePath, bodyCount, loadError
|
|
15
|
+
|- permutations: Permutation[]
|
|
16
|
+
`- effect: EffectDescription | null
|
|
17
|
+
|- version, effectName, annotations, readError
|
|
18
|
+
`- techniques: Technique[]
|
|
19
|
+
`- passes: Pass[]
|
|
20
|
+
|- renderStates: { key, value }[]
|
|
21
|
+
`- stageInputs: (StageInput | null)[]
|
|
22
|
+
|- constants: Constant[]
|
|
23
|
+
|- resources: Resource[]
|
|
24
|
+
|- uavs: Resource[]
|
|
25
|
+
|- samplers: Sampler[]
|
|
26
|
+
|- signature
|
|
27
|
+
`- bytecode: ShaderBytecode | null
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Bytecode values are opaque payloads. A compatible bytecode-format package
|
|
31
|
+
must decode their instruction streams.
|
|
32
|
+
|
|
33
|
+
## Permutation selection
|
|
34
|
+
|
|
35
|
+
By default, `effect` represents the container's default option set. Select
|
|
36
|
+
another compiled body with an array or `Map`:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const effect = CjsHlslFormat.read(bytes, {
|
|
40
|
+
permutation: [
|
|
41
|
+
{ name: "BLEND_MODE", value: "TRANSPARENT" }
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Metadata graph
|
|
47
|
+
|
|
48
|
+
`emit: "metadata"` returns compact inspection data without bytecode,
|
|
49
|
+
constant-value bytes, or runtime handles:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
MetadataRoot
|
|
53
|
+
|- version, compilerVersion, sourcePath, bodyCount, loadError
|
|
54
|
+
|- permutations: Permutation[]
|
|
55
|
+
|- bodyIndex
|
|
56
|
+
|- selectedOptions: Option[]
|
|
57
|
+
`- effect: MetadataEffect | null
|
|
58
|
+
`- techniques: Technique[]
|
|
59
|
+
`- passes: Pass[]
|
|
60
|
+
|- renderStates: RenderState[]
|
|
61
|
+
`- stageInputs: (StageInput | null)[]
|
|
62
|
+
|- constantValueSize
|
|
63
|
+
|- constants: Constant[]
|
|
64
|
+
|- resources: Resource[]
|
|
65
|
+
|- uavs: Resource[]
|
|
66
|
+
|- samplers: Sampler[]
|
|
67
|
+
|- annotations
|
|
68
|
+
`- signature
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Each render-state record retains its numeric `key` and `value`. Known state
|
|
72
|
+
types can also include readable or typed fields such as `name`, `valueName`,
|
|
73
|
+
`valueFloat`, `valueHex`, or `valueFlags`.
|
|
74
|
+
|
|
75
|
+
## Raw graph
|
|
76
|
+
|
|
77
|
+
`emit: "raw"` returns the internal parser-DTO `Tr2EffectRes` graph. It is not
|
|
78
|
+
the canonical runtime-resource class. It allows advanced callers to resolve
|
|
79
|
+
multiple permutations after one parse, but it is not a stable or
|
|
80
|
+
serialization-safe schema.
|
|
81
|
+
|
|
82
|
+
Raw stage and library inputs retain authored `sourceConstantValueSize` /
|
|
83
|
+
`sourceConstantValues` separately from Carbon-compatible mutable constant
|
|
84
|
+
buffers. Libraries retain their source `cjsShaderBytecode` directly. Use
|
|
85
|
+
`@carbonenginejs/runtime-resource/formats/hlsl/portable` to copy those facts into a validated
|
|
86
|
+
handle-free contract.
|
|
87
|
+
|
|
88
|
+
## Compatibility and failures
|
|
89
|
+
|
|
90
|
+
The reader supports compiled effect versions 8 through 15. The root or
|
|
91
|
+
selected effect can contain format-defined error fields when a compiled body
|
|
92
|
+
cannot be decoded. Invalid input reads and unsupported layout decisions throw
|
|
93
|
+
rather than being filled with guessed values.
|
|
94
|
+
|
|
95
|
+
## Related documentation
|
|
96
|
+
|
|
97
|
+
- [API reference](api.md)
|
|
98
|
+
- [Advanced analysis exports](advanced-analysis.md)
|
|
99
|
+
- [Portable body reflection](portable-reflection.md)
|
|
100
|
+
- [Reading effects](../guides/reading-effects.md)
|
|
@@ -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)
|
|
@@ -53,10 +53,10 @@ GR2/GSF reader joined the runtime copies:
|
|
|
53
53
|
|---|---|---|---|
|
|
54
54
|
| `format-gr2` | `fa64607de7a3a96ed3b1aec5288bf71057642043` (v0.2.0, MIT) | `CjsGr2Format` | `@carbonenginejs/runtime-resource/formats/gr2` |
|
|
55
55
|
|
|
56
|
-
The
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`format-notices/gr2/`.
|
|
56
|
+
The donor engine was folded into the single public `CjsGr2Format` class, so
|
|
57
|
+
the copied `CjsFormatGr2` name is gone and `formats/gr2/core/` holds only
|
|
58
|
+
role-named helper modules, matching every other format. Donor license and
|
|
59
|
+
notice files are kept under `format-notices/gr2/`.
|
|
60
60
|
|
|
61
61
|
## Black definition snapshot
|
|
62
62
|
|
|
@@ -85,6 +85,11 @@ format attribution rather than fork provenance.
|
|
|
85
85
|
| 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
86
|
| 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
87
|
|
|
88
|
+
The BNK toolkit also exposes `wwise.sfxNodesFromBanks`: typed, exact-end
|
|
89
|
+
version-150 Random/Sequence, Switch/State, and Layer tails plus event/action
|
|
90
|
+
records and explicit parser diagnostics. It preserves resource facts for
|
|
91
|
+
consumer-owned lowering and is never invoked by the resource lifecycle.
|
|
92
|
+
|
|
88
93
|
## Post-fork additions inside copied formats
|
|
89
94
|
|
|
90
95
|
- `formats/dds` gained original, dependency-free **BC6H and BC7 CPU decoders**
|
|
@@ -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)
|