@carbonenginejs/runtime-resource 0.11.0 → 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.
Files changed (76) hide show
  1. package/dist/formats/bnk/CjsBnkFormat.js +12 -2
  2. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
  3. package/dist/formats/bnk/core/graph.js +3 -6
  4. package/dist/formats/bnk/core/graph.js.map +1 -1
  5. package/dist/formats/bnk/core/helpers.js +53 -11
  6. package/dist/formats/bnk/core/helpers.js.map +1 -1
  7. package/dist/formats/bnk/core/sfxNodes.js +532 -0
  8. package/dist/formats/bnk/core/sfxNodes.js.map +1 -0
  9. package/dist/formats/bnk/core/soundbanksInfo.js +59 -51
  10. package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
  11. package/dist/formats/gr2/CjsGr2Format.js +256 -13
  12. package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
  13. package/dist/formats/gr2/core/helpers.js +15 -15
  14. package/dist/formats/gr2/core/helpers.js.map +1 -1
  15. package/dist/formats/gr2/core/json.js +1 -1
  16. package/dist/formats/gr2/core/json.js.map +1 -1
  17. package/dist/formats/gr2/core/targets.js +1 -1
  18. package/dist/formats/gr2/core/targets.js.map +1 -1
  19. package/dist/formats/gr2/index.js +0 -1
  20. package/dist/formats/gr2/index.js.map +1 -1
  21. package/dist/formats/hlsl/core/analysis.js +1 -1
  22. package/dist/formats/hlsl/index.js +1 -0
  23. package/dist/formats/hlsl/index.js.map +1 -1
  24. package/dist/formats/index.js +3 -6
  25. package/dist/formats/index.js.map +1 -1
  26. package/dist/formats/webgl/core/cewg/binary.js +3 -3
  27. package/dist/formats/webgl/core/cewg/binary.js.map +1 -1
  28. package/dist/formats/webgl/core/effectPackage.js +6 -3
  29. package/dist/formats/webgl/core/effectPackage.js.map +1 -1
  30. package/dist/formats/webgl/core/effectPackageValidation.js +1 -1
  31. package/dist/formats/webgl/core/effectPackageValidation.js.map +1 -1
  32. package/dist/formats/webgl/core/errors.js +3 -3
  33. package/dist/formats/webgl/core/errors.js.map +1 -1
  34. package/dist/formats/webgpu/core/packageMetadata.js +2 -2
  35. package/dist/formats/webgpu/core/packageMetadata.js.map +1 -1
  36. package/docs/formats/dxbc/README.md +68 -0
  37. package/docs/formats/dxbc/architecture.md +80 -0
  38. package/docs/formats/dxbc/reference/api.md +77 -0
  39. package/docs/formats/dxbc/reference/classes/README.md +76 -0
  40. package/docs/formats/dxbc/reference/decoded-output.md +122 -0
  41. package/docs/formats/gr2.md +3 -4
  42. package/docs/formats/hlsl/README.md +54 -0
  43. package/docs/formats/hlsl/architecture.md +67 -0
  44. package/docs/formats/hlsl/guides/hydrating-json-output.md +62 -0
  45. package/docs/formats/hlsl/guides/reading-effects.md +64 -0
  46. package/docs/formats/hlsl/reference/advanced-analysis.md +66 -0
  47. package/docs/formats/hlsl/reference/api.md +97 -0
  48. package/docs/formats/hlsl/reference/classes/README.md +16 -0
  49. package/docs/formats/hlsl/reference/classes/carbon-compatibility.md +66 -0
  50. package/docs/formats/hlsl/reference/classes/public-api.md +26 -0
  51. package/docs/formats/hlsl/reference/classes/tr2-effect-model.md +150 -0
  52. package/docs/formats/hlsl/reference/json-graph.md +100 -0
  53. package/docs/formats/hlsl/reference/portable-reflection.md +141 -0
  54. package/docs/formats/provenance.md +9 -4
  55. package/docs/formats/webgl/README.md +57 -0
  56. package/docs/formats/webgl/architecture.md +70 -0
  57. package/docs/formats/webgl/carbon-constant-layouts.md +326 -0
  58. package/docs/formats/webgl/decl-io.md +1234 -0
  59. package/docs/formats/webgl/effect-reflection.md +127 -0
  60. package/docs/formats/webgl/memory-structured.md +871 -0
  61. package/docs/formats/webgl/reference/classes/README.md +96 -0
  62. package/docs/formats/webgl/texture-sample.md +964 -0
  63. package/docs/formats/webgpu/README.md +81 -0
  64. package/docs/formats/webgpu/architecture.md +93 -0
  65. package/docs/formats/webgpu/formats/cewgpu.md +479 -0
  66. package/docs/formats/webgpu/guides/effect-packaging.md +199 -0
  67. package/docs/formats/webgpu/reference/api.md +197 -0
  68. package/docs/formats/webgpu/reference/classes/README.md +66 -0
  69. package/docs/formats/webgpu/reference/wgsl-compatibility.md +1442 -0
  70. package/docs/formats/wwise.md +16 -1
  71. package/docs/reference/classes/formats.md +10 -10
  72. package/format-notices/bnk/NOTICE +5 -4
  73. package/format-notices/webgl/NOTICE +1 -1
  74. package/package.json +1 -1
  75. package/dist/formats/gr2/core/CjsFormatGr2.js +0 -273
  76. package/dist/formats/gr2/core/CjsFormatGr2.js.map +0 -1
@@ -0,0 +1,64 @@
1
+ # Reading effects
2
+
3
+ Status: Evolving
4
+ Scope: `@carbonenginejs/runtime-resource/formats/hlsl` read workflows
5
+ Audience: Users and integrators
6
+ Summary: Shows browser-neutral byte reads, permutation selection, inspection, and Node file workflows.
7
+
8
+ ## Read caller-provided bytes
9
+
10
+ ```js
11
+ import CjsHlslFormat from "@carbonenginejs/runtime-resource/formats/hlsl";
12
+
13
+ const response = await fetch("/shaders/effect.sm_hi");
14
+ const bytes = new Uint8Array(await response.arrayBuffer());
15
+ const effect = CjsHlslFormat.read(bytes);
16
+ ```
17
+
18
+ Use `inspect` when only header and technique summary information is needed:
19
+
20
+ ```js
21
+ const summary = CjsHlslFormat.inspect(bytes, {
22
+ source: "effect.sm_hi"
23
+ });
24
+ ```
25
+
26
+ ## Select a permutation
27
+
28
+ Without a `permutation` option, the reader applies the container's default
29
+ selection rules. Override individual axes by name and value:
30
+
31
+ ```js
32
+ const effect = CjsHlslFormat.read(bytes, {
33
+ permutation: [
34
+ { name: "BLEND_MODE", value: "TRANSPARENT" }
35
+ ]
36
+ });
37
+ ```
38
+
39
+ A `Map` of names to values is also accepted. Unknown axes or invalid values
40
+ are rejected rather than silently ignored.
41
+
42
+ ## Read compact metadata
43
+
44
+ ```js
45
+ const metadata = CjsHlslFormat.read(bytes, {
46
+ emit: CjsHlslFormat.OUTPUT_METADATA
47
+ });
48
+ ```
49
+
50
+ Metadata output omits embedded bytecode and constant-value bytes. It retains
51
+ the selected options, techniques, passes, stage resources, signatures, and
52
+ render-state records needed for inspection and pipeline planning.
53
+
54
+ ## Read a file in Node
55
+
56
+ ```js
57
+ const effect = await CjsHlslFormat.readFile("effect.sm_hi");
58
+ ```
59
+
60
+ The CLI provides the same metadata workflow:
61
+
62
+ ```sh
63
+ format-hlsl metadata effect.sm_hi effect.json
64
+ ```
@@ -0,0 +1,66 @@
1
+ # Advanced analysis exports
2
+
3
+ Status: Experimental
4
+ Scope: `@carbonenginejs/runtime-resource/formats/hlsl` advanced named exports
5
+ Audience: Translation-tool authors and maintainers
6
+ Summary: Documents unstable helpers for raw graph analysis and binding-manifest construction.
7
+
8
+ ## Stability
9
+
10
+ These exports support translation and inspection tooling that needs internal
11
+ effect-model objects. Their shapes may change without a major version bump.
12
+ Use `CjsHlslFormat.read(..., { emit: "json" })` or `"metadata"` for the
13
+ supported data contracts.
14
+
15
+ ## `readEffectAnalysis`
16
+
17
+ ```js
18
+ import { readEffectAnalysis } from "@carbonenginejs/runtime-resource/formats/hlsl";
19
+
20
+ const analysis = readEffectAnalysis(bytes, {
21
+ source: "effect.sm_hi",
22
+ permutation: [
23
+ { name: "BLEND_MODE", value: "TRANSPARENT" }
24
+ ]
25
+ });
26
+ ```
27
+
28
+ The result contains the loaded effect resource, resolved shader, selected
29
+ option and body-index data, effect description, and a binding manifest when
30
+ an effect description is available.
31
+
32
+ The returned internal parser-DTO effect resource also has
33
+ `GetShaderByIndex(index)`. It decodes one exact permutation-table slot without
34
+ applying global or local option overrides; it is distinct from the canonical
35
+ runtime-resource method that hydrates and caches `Tr2Shader`. Use the versioned
36
+ portable subpath when the result must cross a package or serialization
37
+ boundary. Its `enumerateUniqueEffectBodies(effectRes)` helper inventories
38
+ first-seen raw body identities without populating the parser's mutable shader
39
+ cache.
40
+
41
+ ## `Tr2EffectBindingManifest`
42
+
43
+ `Tr2EffectBindingManifest` is an exported advanced class that derives
44
+ register-named constant, resource, sampler, and UAV bindings from an internal
45
+ effect description.
46
+
47
+ ```js
48
+ import {
49
+ readEffectAnalysis,
50
+ Tr2EffectBindingManifest
51
+ } from "@carbonenginejs/runtime-resource/formats/hlsl";
52
+
53
+ const analysis = readEffectAnalysis(bytes);
54
+ analysis.bindingManifest instanceof Tr2EffectBindingManifest;
55
+ ```
56
+
57
+ ## Render-context helpers
58
+
59
+ `Tr2RenderContextEnum` contains the format's stage and render-context numeric
60
+ constants. `tr2ShaderStageName(value)` maps a known stage value to its
61
+ readable name. Both are advanced compatibility helpers rather than a stable
62
+ cross-package enumeration contract.
63
+
64
+ ## Related documentation
65
+
66
+ - [Portable body reflection](portable-reflection.md)
@@ -0,0 +1,97 @@
1
+ # API reference
2
+
3
+ Status: Evolving
4
+ Scope: `@carbonenginejs/runtime-resource/formats/hlsl` supported reader API
5
+ Audience: Users and integrators
6
+ Summary: Documents the reader class, options, output modes, and Node adapters.
7
+
8
+ ## Imports
9
+
10
+ The package root exports `CjsHlslFormat` as both the default and a named
11
+ export:
12
+
13
+ ```js
14
+ import CjsHlslFormat from "@carbonenginejs/runtime-resource/formats/hlsl";
15
+ import { CjsHlslFormat as NamedReader } from "@carbonenginejs/runtime-resource/formats/hlsl";
16
+ ```
17
+
18
+ Additional named exports intended for advanced tooling are documented
19
+ separately in [advanced-analysis.md](advanced-analysis.md).
20
+
21
+ The versioned `@carbonenginejs/runtime-resource/formats/hlsl/portable` subpath exposes exact
22
+ version-15 body-index reflection plus first-seen exact-byte unique-body
23
+ enumeration for backend packagers. See
24
+ [portable-reflection.md](portable-reflection.md).
25
+
26
+ ## Constructor
27
+
28
+ ```js
29
+ const reader = new CjsHlslFormat({
30
+ emit: "json",
31
+ source: "effect.sm_hi",
32
+ permutation: null,
33
+ classes: {}
34
+ });
35
+ ```
36
+
37
+ Options are reusable on an instance and can be overridden per call:
38
+
39
+ - `emit`: `"json"` (default), `"metadata"`, or advanced `"raw"` output.
40
+ - `source`: a caller-supplied label used in diagnostics and output.
41
+ - `permutation`: a `Map` or an array of `{ name, value }` selections.
42
+ - `classes`: constructors used for caller-selected JSON-node projection; this
43
+ is not canonical runtime shader hydration.
44
+
45
+ ## Instance methods
46
+
47
+ - `SetValues(options)` updates the reusable profile and returns the reader.
48
+ - `GetValues(options)` returns effective values with optional overrides.
49
+ - `SetClasses(classes)` and `SetClass(type, Class)` configure hydration.
50
+ - `GetClass(type)` and `HasClass(type)` inspect hydration registrations.
51
+ - `Read(input, options)` parses input and emits the configured graph.
52
+ - `Inspect(input, options)` returns header and technique summary data.
53
+ - `ToJSON(value)` converts reader output to JSON-compatible data.
54
+
55
+ ## Static methods
56
+
57
+ - `CjsHlslFormat.isSupported(input)` performs a header-level support check.
58
+ - `CjsHlslFormat.read(input, options)` performs a one-shot read.
59
+ - `CjsHlslFormat.inspect(input, options)` performs a one-shot inspection.
60
+ - `CjsHlslFormat.toJSON(value)` converts output to JSON-compatible data.
61
+ - `CjsHlslFormat.readFile(path, options)` reads and parses a file in Node.
62
+
63
+ Inputs may be `Uint8Array`, `ArrayBuffer`, `Buffer`, or `DataView` values.
64
+ Supported container versions are 8 through 15.
65
+
66
+ ## Constants
67
+
68
+ The class exposes `OUTPUT_JSON`, `OUTPUT_METADATA`, `OUTPUT_RAW`,
69
+ `CLASS_KEYS`, `type`, `mediaTypes`, `inputTypes`, `outputTypes`, and
70
+ `debugOutputTypes`. `inputTypes` contains `sm_hi`, `sm_lo`, and `sm_depth`.
71
+
72
+ ## Output stability
73
+
74
+ The `json` and `metadata` modes are the supported data contracts described in
75
+ [json-graph.md](json-graph.md). `raw` returns internal parser-DTO
76
+ `Tr2EffectRes` objects, not the canonical runtime-resource class, and may
77
+ change without a major version bump.
78
+
79
+ ## CLI
80
+
81
+ The package installs a Node CLI that writes metadata JSON:
82
+
83
+ ```sh
84
+ format-hlsl metadata effect.sm_hi
85
+ format-hlsl metadata effect.sm_hi effect.json
86
+ ```
87
+
88
+ When the output path is omitted, the CLI writes `<input-name>.json` in the
89
+ current working directory.
90
+
91
+ ## Related documentation
92
+
93
+ - [Reading effects](../guides/reading-effects.md)
94
+ - [Hydrating JSON output](../guides/hydrating-json-output.md)
95
+ - [Advanced analysis exports](advanced-analysis.md)
96
+ - [Portable body reflection](portable-reflection.md)
97
+ - [Class catalog](classes/README.md)
@@ -0,0 +1,16 @@
1
+ # Class catalog
2
+
3
+ Status: Evolving
4
+ Scope: `@carbonenginejs/runtime-resource/formats/hlsl` maintained classes
5
+ Audience: Users, maintainers, and automated readers
6
+ Summary: Indexes the one-sentence purpose descriptors for every maintained class in the package.
7
+
8
+ ## Catalog pages
9
+
10
+ - [Public API classes](public-api.md)
11
+ - [Carbon compatibility classes](carbon-compatibility.md)
12
+ - [Tr2 effect-model classes](tr2-effect-model.md)
13
+
14
+ Public availability and stability are separate concerns. In particular,
15
+ `Tr2EffectBindingManifest` is exported for advanced tooling but remains an
16
+ experimental surface.
@@ -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)