@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,127 @@
|
|
|
1
|
+
# CEWG effect reflection contract
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource/formats/webgl` effect packages and portable reflection
|
|
5
|
+
Audience: Package users, runtime integrators, and GPU-engine maintainers
|
|
6
|
+
Summary: Defines CEWG reflection, validation, ownership, and completeness.
|
|
7
|
+
|
|
8
|
+
`@carbonenginejs/runtime-resource/formats/webgl` packages immutable compiled-effect data. It
|
|
9
|
+
does not create runtime shader classes or WebGL objects.
|
|
10
|
+
|
|
11
|
+
## Ownership
|
|
12
|
+
|
|
13
|
+
- `format-hlsl` owns the portable, GPU-free reflection schema and source
|
|
14
|
+
parser.
|
|
15
|
+
- `format-webgl` owns CEWG serialization, GLSL backend records, integrity
|
|
16
|
+
validation, and reconstruction of one portable body by permutation index.
|
|
17
|
+
- `runtime-resource` owns loaded effect-package bytes, option selection,
|
|
18
|
+
per-index caching, canonical `Tr2Shader`, and its device-free reflection and
|
|
19
|
+
sampler records.
|
|
20
|
+
- `runtime-trinity` owns the mutable `Tr2Effect`/`Tr2Material` facade,
|
|
21
|
+
parameters, authored shader options, and sampler overrides. `Tw2*` is legacy
|
|
22
|
+
ccpwgl comparison terminology, not a maintained runtime class surface.
|
|
23
|
+
- The WebGL engine owns handles, locations, layouts, buffer packing, texture
|
|
24
|
+
binding, and draw-time validation.
|
|
25
|
+
|
|
26
|
+
The current runtime connection is one-way: runtime-resource consumes the
|
|
27
|
+
package's immutable portable data and hydrates a fresh canonical shader graph;
|
|
28
|
+
runtime-trinity depends on and consumes that graph. runtime-resource does not
|
|
29
|
+
import runtime-trinity. Engines add only backend realization.
|
|
30
|
+
|
|
31
|
+
## Container and schemas
|
|
32
|
+
|
|
33
|
+
The binary CEWG container remains version 1. Effect packages use one of these
|
|
34
|
+
INFO schemas:
|
|
35
|
+
|
|
36
|
+
| INFO | Source input | Required chunks | Source reflection |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| v1 | legacy | `INFO META GLSL` | unspecified |
|
|
39
|
+
| v2 | effect v8-v14 | `INFO META PGRF GLSL` | permutation topology only |
|
|
40
|
+
| v3 | effect v15 | `INFO META PGRF RFLX RBLB GLSL` | complete for every unique body |
|
|
41
|
+
|
|
42
|
+
`PGRF` v1 records every Cartesian permutation, its option indices, its exact
|
|
43
|
+
source record, and a content-deduplicated body identity.
|
|
44
|
+
|
|
45
|
+
`RFLX` v2 records complete portable reflection once per unique source body:
|
|
46
|
+
techniques, passes, stages, source programs, exact constant-default bytes,
|
|
47
|
+
constants, resources, UAVs, samplers, signatures, static samplers,
|
|
48
|
+
annotations, render states, and libraries. Binary fields use verified
|
|
49
|
+
references into the shared `RBLB` byte arena.
|
|
50
|
+
|
|
51
|
+
`META` and `GLSL` retain the WebGL backend graph: permutation-to-body
|
|
52
|
+
mappings, Carbon manifests, stage and shader identities, translated source,
|
|
53
|
+
bindings, vertex inputs/outputs, and backend-specific transform contracts.
|
|
54
|
+
Backend body keys deliberately retain the historical
|
|
55
|
+
`body_<offset>_<size>` form; PGRF/RFLX content identities are separate.
|
|
56
|
+
|
|
57
|
+
All cross-document references, counts, SHA-256 digests, source identity,
|
|
58
|
+
package mode, body/stage/shader graph edges, reflection blobs, and reflected
|
|
59
|
+
pass/stage identities are validated while reading a canonical package.
|
|
60
|
+
Generic CEWG containers remain readable, but they cannot use the portable
|
|
61
|
+
reflection accessor.
|
|
62
|
+
|
|
63
|
+
## Runtime accessor
|
|
64
|
+
|
|
65
|
+
Read with `emit: "raw"` and call:
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
const pkg = CjsWebglFormat.read(bytes, {
|
|
69
|
+
emit: CjsWebglFormat.OUTPUT_RAW
|
|
70
|
+
});
|
|
71
|
+
const portable = pkg.GetPortableEffectReflection(permutationIndex);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Omitting the index selects `INFO.defaultPermutationIndex`. The method returns
|
|
75
|
+
`null` for legacy, partial, generic, or unvalidated packages. Every returned
|
|
76
|
+
binary field is a fresh owned `Uint8Array`; callers may mutate it without
|
|
77
|
+
changing subsequent reads. This method is the supported stable exception on
|
|
78
|
+
the otherwise internal `CewgPackage` object.
|
|
79
|
+
|
|
80
|
+
The default JSON read exposes packed PGRF/RFLX documents for inspection, but
|
|
81
|
+
does not inline RBLB. Runtime hydration must retain the package bytes and use
|
|
82
|
+
the accessor.
|
|
83
|
+
|
|
84
|
+
## Completeness
|
|
85
|
+
|
|
86
|
+
- `sourceComplete` is true only for v15 packages with PGRF v1 plus
|
|
87
|
+
all-unique RFLX v2/RBLB.
|
|
88
|
+
- `backendComplete` remains false. Successful translation does not yet prove
|
|
89
|
+
the engine's physical binding/layout and transform contract.
|
|
90
|
+
- `runtimeComplete` remains false. Live shader objects and GPU handles are
|
|
91
|
+
outside the format package.
|
|
92
|
+
- `qualification.ok` separately reports whether the selected WebGL programs
|
|
93
|
+
translated and formed the required raster/compute families.
|
|
94
|
+
|
|
95
|
+
Selected-only or technique/pass/stage-filtered packages still carry complete
|
|
96
|
+
v15 source reflection, but only their selected backend programs.
|
|
97
|
+
|
|
98
|
+
## Tier and permutation policy
|
|
99
|
+
|
|
100
|
+
For EVE shader work:
|
|
101
|
+
|
|
102
|
+
- High is `.sm_depth`.
|
|
103
|
+
- Medium is `.sm_hi`.
|
|
104
|
+
- Low is `.sm_lo`.
|
|
105
|
+
- Unpacked Quad V5 evidence must explicitly select `SOPPT_ENABLED`; the
|
|
106
|
+
default permutation is commonly PPT-off and is not representative.
|
|
107
|
+
|
|
108
|
+
Always resolve an option tuple against the current source axes. Do not persist
|
|
109
|
+
a permutation index across builds.
|
|
110
|
+
|
|
111
|
+
## Validation evidence
|
|
112
|
+
|
|
113
|
+
The 2026-07-28 build-3444265 gate covered 1,074 High/Medium CEWG packages:
|
|
114
|
+
|
|
115
|
+
- all 1,074 baseline/candidate statuses matched;
|
|
116
|
+
- 1,016 remained qualified and 58 remained diagnostic;
|
|
117
|
+
- all 17,444 permutations reconstructed byte-exact portable reflection;
|
|
118
|
+
- all 7,134 unique reflected bodies matched fresh `format-hlsl` output;
|
|
119
|
+
- the oracle covered 49,308 source programs, 2,563,024 exact default bytes,
|
|
120
|
+
148,972 constants, 88,970 resources, 808 UAVs, 25,564 samplers, and 202,147
|
|
121
|
+
annotations; and
|
|
122
|
+
- GLSL source remained unchanged. Vertex-stage metadata was corrected so the
|
|
123
|
+
Carbon `BITANGENT` alias names the actual emitted `in_BITANGENT#`
|
|
124
|
+
declaration instead of stale `in_BINORMAL#` metadata.
|
|
125
|
+
|
|
126
|
+
The real unpacked Quad V5 PPT-on High and Medium bodies compile and link all
|
|
127
|
+
Main, Depth, Picking, Shadow, and DynamicLightShadow programs in WebGL2.
|