@carbonenginejs/runtime-resource 0.12.0 → 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 +10 -4
- 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/helpers.js +11 -2
- 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 +252 -152
- package/dist/formats/bnk/core/sfxNodes.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/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/index.js +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 +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/reference/classes/README.md +5 -72
- package/docs/formats/hlsl/reference/api.md +5 -4
- package/docs/formats/hlsl/reference/classes/README.md +6 -11
- package/docs/formats/provenance.md +23 -13
- package/docs/formats/webgl/reference/classes/README.md +5 -92
- package/docs/formats/webgpu/README.md +19 -16
- package/docs/formats/webgpu/architecture.md +15 -12
- package/docs/formats/webgpu/formats/cewgpu.md +175 -438
- package/docs/formats/webgpu/guides/effect-packaging.md +132 -140
- package/docs/formats/webgpu/reference/api.md +131 -131
- package/docs/formats/webgpu/reference/classes/README.md +5 -62
- package/docs/formats/webgpu/reference/wgsl-compatibility.md +146 -45
- package/docs/formats/wwise.md +34 -8
- package/docs/reference/classes/core.md +80 -0
- package/docs/reference/classes/formats.md +18 -28
- 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/package.json +2 -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
- package/docs/formats/hlsl/reference/classes/carbon-compatibility.md +0 -66
- package/docs/formats/hlsl/reference/classes/public-api.md +0 -26
- package/docs/formats/hlsl/reference/classes/tr2-effect-model.md +0 -150
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { CjsFormatWriteError } from '../CjsFormatError.js';
|
|
2
|
+
import { compareUtf8 } from '../compareUtf8.js';
|
|
3
|
+
import { CARBON_ANNOTATION_TYPE } from './carbonEffectRecords.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Maps a portable effect-body reflection onto Carbon v15 description records.
|
|
7
|
+
*
|
|
8
|
+
* This is the one mapping in the port with no oracle in CCP's files, because CCP
|
|
9
|
+
* never wrote one of our packages. Everything else the container does — arena
|
|
10
|
+
* policy, offset arithmetic, alias decisions, exhaustiveness — is Carbon records in
|
|
11
|
+
* and the same Carbon records out, checkable against shipped bytes. This direction
|
|
12
|
+
* is new: *our producer's data* into Carbon records.
|
|
13
|
+
*
|
|
14
|
+
* There is still an oracle, and it is strong. Our reflection is derived from a dx11
|
|
15
|
+
* file's own reflection through the HLSL reader, so the Carbon region we emit for an
|
|
16
|
+
* effect should be near-identical to the Carbon region of the file it came from —
|
|
17
|
+
* same constants at the same offsets, same texture and sampler slots, same
|
|
18
|
+
* registers, same render states. Every difference must be nameable. See
|
|
19
|
+
* `test/format/carbon-mapping.test.js`, which diffs the two field for field and
|
|
20
|
+
* fails on anything unexplained.
|
|
21
|
+
*
|
|
22
|
+
* Ordering is a mapping decision, not a copy. Carbon writes `textures`, `samplers`
|
|
23
|
+
* and `uavs` in ascending register index because they are `std::map`s
|
|
24
|
+
* (`EffectData.h:683-685`), render states likewise (`:719`), and it sorts annotation
|
|
25
|
+
* keys by `strcmp` before writing (`:613-616`, `:839-842`). The portable reflection
|
|
26
|
+
* preserves whatever order it was read in, so this module sorts explicitly rather
|
|
27
|
+
* than trusting that the input happened to arrive sorted.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Wraps a string as the record codec's arena reference shape.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} value Text value.
|
|
34
|
+
* @returns {{offset:number, value:string}} String reference.
|
|
35
|
+
*/
|
|
36
|
+
function str(value) {
|
|
37
|
+
return {
|
|
38
|
+
offset: 0,
|
|
39
|
+
value: String(value ?? "")
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Wraps bytes as the record codec's sized blob reference.
|
|
45
|
+
*
|
|
46
|
+
* A zero-length blob keeps Carbon's null offset: the writer leaves the reference
|
|
47
|
+
* unset and the reader consumes the word without dereferencing it.
|
|
48
|
+
*
|
|
49
|
+
* @param {Uint8Array} bytes Blob bytes.
|
|
50
|
+
* @param {number} [declaredSize] Size to declare, when it is tracked separately.
|
|
51
|
+
* @returns {{size:number, offset:number, bytes:Uint8Array}} Blob reference.
|
|
52
|
+
*/
|
|
53
|
+
function blob(bytes, declaredSize) {
|
|
54
|
+
const owned = bytes instanceof Uint8Array ? bytes : new Uint8Array(0);
|
|
55
|
+
const size = declaredSize ?? owned.byteLength;
|
|
56
|
+
return {
|
|
57
|
+
size,
|
|
58
|
+
offset: size === 0 ? 0xffffffff : 0,
|
|
59
|
+
bytes: owned
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const rawFloatBuffer = new DataView(new ArrayBuffer(4));
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Reinterprets a portable `*Raw` field's `u32` bit pattern as the float it encodes.
|
|
66
|
+
*
|
|
67
|
+
* The portable reflection stores sampler LOD and border-colour values as raw bits —
|
|
68
|
+
* `mipLODBiasRaw`, `minLODRaw`, `maxLODRaw`, `borderColorRaw` — precisely so that a
|
|
69
|
+
* value like `-FLT_MAX` survives JSON without going through a decimal round trip.
|
|
70
|
+
* Carbon's records store them as `float` (`EffectData.h:379,387-388`), so the bits
|
|
71
|
+
* have to be reinterpreted rather than assigned. Assigning the `u32` straight across
|
|
72
|
+
* writes `4286578687.0` where the file says `-3.4028235e38`, which every structural
|
|
73
|
+
* check in the container would accept.
|
|
74
|
+
*
|
|
75
|
+
* @param {number} bits Raw 32-bit pattern.
|
|
76
|
+
* @returns {number} The float those bits encode.
|
|
77
|
+
*/
|
|
78
|
+
function floatFromRaw(bits) {
|
|
79
|
+
if (!Number.isFinite(bits)) return 0;
|
|
80
|
+
rawFloatBuffer.setUint32(0, bits >>> 0, true);
|
|
81
|
+
return rawFloatBuffer.getFloat32(0, true);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Encodes a portable annotation's `u32` value as Carbon's four raw bytes.
|
|
86
|
+
*
|
|
87
|
+
* Carbon writes the value through the `float` member of a `{float,int32_t}` union
|
|
88
|
+
* and reads it back through a different union (`EffectData.h:582-593`,
|
|
89
|
+
* `Tr2EffectDescription.cpp:129-132`), so the bytes are the only faithful
|
|
90
|
+
* representation and no numeric conversion may happen here.
|
|
91
|
+
*
|
|
92
|
+
* @param {number} rawValue Portable annotation value.
|
|
93
|
+
* @returns {Uint8Array} Four little-endian bytes.
|
|
94
|
+
*/
|
|
95
|
+
function annotationBytes(rawValue) {
|
|
96
|
+
const bytes = new Uint8Array(4);
|
|
97
|
+
new DataView(bytes.buffer).setUint32(0, rawValue >>> 0, true);
|
|
98
|
+
return bytes;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Maps one annotation list, in Carbon's `strcmp` key order.
|
|
103
|
+
*
|
|
104
|
+
* @param {object[]} annotations Portable annotations.
|
|
105
|
+
* @returns {object[]} Annotation records.
|
|
106
|
+
*/
|
|
107
|
+
function mapAnnotations(annotations) {
|
|
108
|
+
return (annotations ?? []).map(annotation => annotation.type === CARBON_ANNOTATION_TYPE.STRING ? {
|
|
109
|
+
name: str(annotation.name),
|
|
110
|
+
type: annotation.type,
|
|
111
|
+
stringValue: str(annotation.stringValue),
|
|
112
|
+
rawValue: null
|
|
113
|
+
} : {
|
|
114
|
+
name: str(annotation.name),
|
|
115
|
+
type: annotation.type,
|
|
116
|
+
stringValue: null,
|
|
117
|
+
rawValue: annotationBytes(annotation.rawValue)
|
|
118
|
+
}).sort((left, right) => compareUtf8(left.name.value, right.name.value));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Maps a portable sampler descriptor onto Carbon's sampler record.
|
|
123
|
+
*
|
|
124
|
+
* @param {object} entry Portable sampler entry.
|
|
125
|
+
* @returns {object} Sampler record.
|
|
126
|
+
*/
|
|
127
|
+
function mapSampler(entry) {
|
|
128
|
+
const descriptor = entry.descriptor ?? {};
|
|
129
|
+
return {
|
|
130
|
+
registerIndex: entry.registerIndex,
|
|
131
|
+
// Carbon nulls a sampler's name when it is not dynamic
|
|
132
|
+
// (`Tr2EffectDescription.cpp:430-433`), so an absent name round-trips as
|
|
133
|
+
// the empty string rather than being dropped.
|
|
134
|
+
name: str(entry.name ?? ""),
|
|
135
|
+
comparison: descriptor.comparison ? 1 : 0,
|
|
136
|
+
minFilter: descriptor.minFilter,
|
|
137
|
+
magFilter: descriptor.magFilter,
|
|
138
|
+
mipFilter: descriptor.mipFilter,
|
|
139
|
+
addressU: descriptor.addressU,
|
|
140
|
+
addressV: descriptor.addressV,
|
|
141
|
+
addressW: descriptor.addressW,
|
|
142
|
+
mipLODBias: floatFromRaw(descriptor.mipLODBiasRaw),
|
|
143
|
+
maxAnisotropy: descriptor.maxAnisotropy,
|
|
144
|
+
comparisonFunc: descriptor.comparisonFunc,
|
|
145
|
+
// On one line deliberately: the raw-field guard requires the
|
|
146
|
+
// reinterpretation to be visible on the same line as the raw access.
|
|
147
|
+
borderColor: (descriptor.borderColorRaw ?? [0, 0, 0, 0]).slice(0, 4).map(floatFromRaw),
|
|
148
|
+
minLOD: floatFromRaw(descriptor.minLODRaw),
|
|
149
|
+
maxLOD: floatFromRaw(descriptor.maxLODRaw),
|
|
150
|
+
isDynamic: entry.isDynamic ? 1 : 0
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Maps a portable static sampler onto Carbon's static-sampler record.
|
|
156
|
+
*
|
|
157
|
+
* Border colour is a one-byte enum here, unlike the four floats on a dynamic
|
|
158
|
+
* sampler (`EffectData.h:565` versus `:453`).
|
|
159
|
+
*
|
|
160
|
+
* @param {object} entry Portable static sampler entry.
|
|
161
|
+
* @returns {object} Static sampler record.
|
|
162
|
+
*/
|
|
163
|
+
function mapStaticSampler(entry) {
|
|
164
|
+
const descriptor = entry.descriptor ?? {};
|
|
165
|
+
return {
|
|
166
|
+
registerIndex: entry.registerIndex,
|
|
167
|
+
registerSpace: entry.registerSpace,
|
|
168
|
+
comparison: descriptor.comparison ? 1 : 0,
|
|
169
|
+
minFilter: descriptor.minFilter,
|
|
170
|
+
magFilter: descriptor.magFilter,
|
|
171
|
+
mipFilter: descriptor.mipFilter,
|
|
172
|
+
addressU: descriptor.addressU,
|
|
173
|
+
addressV: descriptor.addressV,
|
|
174
|
+
addressW: descriptor.addressW,
|
|
175
|
+
mipLODBias: floatFromRaw(descriptor.mipLODBiasRaw),
|
|
176
|
+
maxAnisotropy: descriptor.maxAnisotropy,
|
|
177
|
+
comparisonFunc: descriptor.comparisonFunc,
|
|
178
|
+
borderColor: descriptor.borderColor,
|
|
179
|
+
minLOD: floatFromRaw(descriptor.minLODRaw),
|
|
180
|
+
maxLOD: floatFromRaw(descriptor.maxLODRaw)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Maps a portable resource entry onto Carbon's texture record.
|
|
186
|
+
*
|
|
187
|
+
* @param {object} entry Portable resource entry.
|
|
188
|
+
* @returns {object} Texture record.
|
|
189
|
+
*/
|
|
190
|
+
function mapTexture(entry) {
|
|
191
|
+
return {
|
|
192
|
+
registerIndex: entry.registerIndex,
|
|
193
|
+
name: str(entry.name),
|
|
194
|
+
type: entry.type,
|
|
195
|
+
count: entry.arrayElements,
|
|
196
|
+
isSRGB: entry.isSRGB ? 1 : 0,
|
|
197
|
+
isAutoregister: entry.isAutoregister ? 1 : 0
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Maps a portable resource entry onto Carbon's UAV record.
|
|
203
|
+
*
|
|
204
|
+
* A UAV record is one byte shorter than a texture record: it carries no `isSRGB`
|
|
205
|
+
* (`EffectData.h:345-352`, `Tr2EffectDescription.cpp:450`).
|
|
206
|
+
*
|
|
207
|
+
* @param {object} entry Portable resource entry.
|
|
208
|
+
* @returns {object} UAV record.
|
|
209
|
+
*/
|
|
210
|
+
function mapUav(entry) {
|
|
211
|
+
return {
|
|
212
|
+
registerIndex: entry.registerIndex,
|
|
213
|
+
name: str(entry.name),
|
|
214
|
+
type: entry.type,
|
|
215
|
+
count: entry.arrayElements,
|
|
216
|
+
isAutoregister: entry.isAutoregister ? 1 : 0
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Maps a portable input onto Carbon's `StageData` block.
|
|
222
|
+
*
|
|
223
|
+
* @param {object} input Portable input.
|
|
224
|
+
* @returns {object} Stage data record.
|
|
225
|
+
*/
|
|
226
|
+
function mapStageData(input) {
|
|
227
|
+
const signature = input?.signature ?? {};
|
|
228
|
+
const byRegister = (left, right) => left.registerIndex - right.registerIndex;
|
|
229
|
+
return {
|
|
230
|
+
registers: (signature.registers ?? []).map(entry => {
|
|
231
|
+
// Carbon stores one field that its reader calls `arrayCount` and its
|
|
232
|
+
// writer calls `registerCount` (`EffectData.h:495` / `Tr2ShaderAL.h:100`).
|
|
233
|
+
// The portable reflection carries both names; they must agree, or the
|
|
234
|
+
// collapse to one wire field would silently pick a side.
|
|
235
|
+
if (entry.arrayCount !== entry.registerCount) {
|
|
236
|
+
throw new CjsFormatWriteError("Portable register arrayCount and registerCount disagree; Carbon stores one field", {
|
|
237
|
+
arrayCount: entry.arrayCount,
|
|
238
|
+
registerCount: entry.registerCount
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
registerType: entry.registerType,
|
|
243
|
+
registerIndex: entry.registerIndex,
|
|
244
|
+
registerCount: entry.registerCount,
|
|
245
|
+
registerSpace: entry.registerSpace
|
|
246
|
+
};
|
|
247
|
+
}),
|
|
248
|
+
staticSamplers: (signature.staticSamplers ?? []).map(mapStaticSampler),
|
|
249
|
+
constants: (input?.constants ?? []).map(constant => ({
|
|
250
|
+
name: str(constant.name),
|
|
251
|
+
offset: constant.offset,
|
|
252
|
+
size: constant.size,
|
|
253
|
+
type: constant.type,
|
|
254
|
+
dimension: constant.dimension,
|
|
255
|
+
elements: constant.elements,
|
|
256
|
+
isSRGB: constant.isSRGB ? 1 : 0,
|
|
257
|
+
isAutoregister: constant.isAutoregister ? 1 : 0
|
|
258
|
+
})),
|
|
259
|
+
defaultValues: blob(input?.constantDefaults?.bytes, input?.constantDefaults?.declaredByteLength),
|
|
260
|
+
textures: (input?.resources ?? []).map(mapTexture).sort(byRegister),
|
|
261
|
+
samplers: (input?.samplers ?? []).map(mapSampler).sort(byRegister),
|
|
262
|
+
uavs: (input?.uavs ?? []).map(mapUav).sort(byRegister),
|
|
263
|
+
annotations: mapAnnotations(input?.annotations)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Maps one portable stage onto Carbon's `StageInput` record.
|
|
269
|
+
*
|
|
270
|
+
* @param {object} stage Portable stage.
|
|
271
|
+
* @param {object} context Mapping context carrying the program substitution.
|
|
272
|
+
* @returns {object} Stage record.
|
|
273
|
+
*/
|
|
274
|
+
function mapStage(stage, context) {
|
|
275
|
+
const signature = stage.input?.signature ?? {};
|
|
276
|
+
const program = stage.sourceProgram ?? {};
|
|
277
|
+
const threadGroupSize = signature.threadGroupSize ?? {};
|
|
278
|
+
const substituted = context.programFor ? context.programFor(stage, context) : null;
|
|
279
|
+
return {
|
|
280
|
+
type: stage.stageType,
|
|
281
|
+
// `shaderData` is the one field a backend replaces: the record layout is
|
|
282
|
+
// backend-invariant, so a WGSL or GLSL program occupies exactly the slot
|
|
283
|
+
// DXBC occupies in a shipped file. Absent a substitution the source
|
|
284
|
+
// program passes through, which is what re-emitting a dx11 file does.
|
|
285
|
+
shaderData: substituted ? blob(substituted.bytes, substituted.size) : blob(program.bytes, program.shaderSize),
|
|
286
|
+
threadGroupSize: [threadGroupSize.x ?? 0, threadGroupSize.y ?? 0, threadGroupSize.z ?? 0],
|
|
287
|
+
pipelineInputs: (signature.pipelineInputs ?? []).map(entry => ({
|
|
288
|
+
usage: entry.usage,
|
|
289
|
+
registerIndex: entry.registerIndex,
|
|
290
|
+
usageIndex: entry.usageIndex,
|
|
291
|
+
usedMask: entry.usedMask,
|
|
292
|
+
type: entry.type,
|
|
293
|
+
dimension: entry.dimension
|
|
294
|
+
})),
|
|
295
|
+
...mapStageData(stage.input)
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Maps one portable library onto Carbon's raytracing library record.
|
|
301
|
+
*
|
|
302
|
+
* @param {object} library Portable library.
|
|
303
|
+
* @returns {object} Library record.
|
|
304
|
+
*/
|
|
305
|
+
function mapLibrary(library) {
|
|
306
|
+
const program = library.sourceProgram ?? {};
|
|
307
|
+
return {
|
|
308
|
+
payloadSize: library.payloadSize >>> 0,
|
|
309
|
+
shaderData: blob(program.bytes, program.shaderSize),
|
|
310
|
+
exports: (library.exports ?? []).map(entry => ({
|
|
311
|
+
type: entry.type,
|
|
312
|
+
name: str(entry.name)
|
|
313
|
+
})),
|
|
314
|
+
hitGroupName: str(library.hitGroupName),
|
|
315
|
+
globalInputs: mapStageData(library.globalInput),
|
|
316
|
+
localInputs: mapStageData(library.localInput)
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Maps a portable effect-body reflection onto a Carbon v15 description record tree.
|
|
322
|
+
*
|
|
323
|
+
* Two optional hooks make the same mapping serve a backend emit. Both are pure
|
|
324
|
+
* functions of the record being mapped, so the mapping stays a mapping: nothing
|
|
325
|
+
* about the Carbon region changes shape when a backend supplies them, only which
|
|
326
|
+
* bytes land in `shaderData` and whether the one optional trailing block per pass
|
|
327
|
+
* carries anything.
|
|
328
|
+
*
|
|
329
|
+
* @param {object} reflection Portable effect-body reflection.
|
|
330
|
+
* @param {object} [hooks] Backend substitution hooks.
|
|
331
|
+
* @param {Function} [hooks.programFor] Returns `{bytes, size}` for one stage.
|
|
332
|
+
* @param {Function} [hooks.backendBlockFor] Returns block bytes for one pass.
|
|
333
|
+
* @returns {object} Description record tree, ready for `writeEffectDescription`.
|
|
334
|
+
*/
|
|
335
|
+
function carbonDescriptionFromPortable(reflection, hooks = {}) {
|
|
336
|
+
const effect = reflection?.effect;
|
|
337
|
+
if (!effect) {
|
|
338
|
+
throw new CjsFormatWriteError("Portable reflection has no effect", {});
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
techniques: (effect.techniques ?? []).map(technique => ({
|
|
342
|
+
name: str(technique.name),
|
|
343
|
+
passes: (technique.passes ?? []).map((pass, passIndex) => {
|
|
344
|
+
const context = {
|
|
345
|
+
techniqueName: String(technique.name ?? ""),
|
|
346
|
+
passIndex,
|
|
347
|
+
passKey: `${technique.name}.pass${passIndex}`,
|
|
348
|
+
programFor: hooks.programFor
|
|
349
|
+
};
|
|
350
|
+
const block = hooks.backendBlockFor ? hooks.backendBlockFor(context, pass) : null;
|
|
351
|
+
return {
|
|
352
|
+
stages: (pass.stages ?? []).map(stage => mapStage(stage, context)),
|
|
353
|
+
renderStates: (pass.renderStates ?? []).map(entry => ({
|
|
354
|
+
state: entry.state >>> 0,
|
|
355
|
+
value: entry.value >>> 0
|
|
356
|
+
})).sort((left, right) => left.state - right.state),
|
|
357
|
+
...(block ? {
|
|
358
|
+
backendBlock: blob(block)
|
|
359
|
+
} : {})
|
|
360
|
+
};
|
|
361
|
+
}),
|
|
362
|
+
libraries: (technique.libraries ?? []).map(mapLibrary)
|
|
363
|
+
})),
|
|
364
|
+
annotations: (effect.annotations ?? []).map(group => ({
|
|
365
|
+
name: str(group.parameterName),
|
|
366
|
+
annotations: mapAnnotations(group.annotations)
|
|
367
|
+
})).sort((left, right) => compareUtf8(left.name.value, right.name.value))
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export { carbonDescriptionFromPortable };
|
|
372
|
+
//# sourceMappingURL=carbonDescriptionFromPortable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carbonDescriptionFromPortable.js","sources":["../../../../src/format/carbonEffect/carbonDescriptionFromPortable.js"],"sourcesContent":["import { CjsFormatWriteError } from \"../CjsFormatError.js\";\r\nimport { compareUtf8 } from \"../compareUtf8.js\";\r\nimport { CARBON_ANNOTATION_TYPE } from \"./carbonEffectRecords.js\";\r\n\r\n/**\r\n * Maps a portable effect-body reflection onto Carbon v15 description records.\r\n *\r\n * This is the one mapping in the port with no oracle in CCP's files, because CCP\r\n * never wrote one of our packages. Everything else the container does — arena\r\n * policy, offset arithmetic, alias decisions, exhaustiveness — is Carbon records in\r\n * and the same Carbon records out, checkable against shipped bytes. This direction\r\n * is new: *our producer's data* into Carbon records.\r\n *\r\n * There is still an oracle, and it is strong. Our reflection is derived from a dx11\r\n * file's own reflection through the HLSL reader, so the Carbon region we emit for an\r\n * effect should be near-identical to the Carbon region of the file it came from —\r\n * same constants at the same offsets, same texture and sampler slots, same\r\n * registers, same render states. Every difference must be nameable. See\r\n * `test/format/carbon-mapping.test.js`, which diffs the two field for field and\r\n * fails on anything unexplained.\r\n *\r\n * Ordering is a mapping decision, not a copy. Carbon writes `textures`, `samplers`\r\n * and `uavs` in ascending register index because they are `std::map`s\r\n * (`EffectData.h:683-685`), render states likewise (`:719`), and it sorts annotation\r\n * keys by `strcmp` before writing (`:613-616`, `:839-842`). The portable reflection\r\n * preserves whatever order it was read in, so this module sorts explicitly rather\r\n * than trusting that the input happened to arrive sorted.\r\n */\r\n\r\n/**\r\n * Wraps a string as the record codec's arena reference shape.\r\n *\r\n * @param {string} value Text value.\r\n * @returns {{offset:number, value:string}} String reference.\r\n */\r\nfunction str(value)\r\n{\r\n return { offset: 0, value: String(value ?? \"\") };\r\n}\r\n\r\n/**\r\n * Wraps bytes as the record codec's sized blob reference.\r\n *\r\n * A zero-length blob keeps Carbon's null offset: the writer leaves the reference\r\n * unset and the reader consumes the word without dereferencing it.\r\n *\r\n * @param {Uint8Array} bytes Blob bytes.\r\n * @param {number} [declaredSize] Size to declare, when it is tracked separately.\r\n * @returns {{size:number, offset:number, bytes:Uint8Array}} Blob reference.\r\n */\r\nfunction blob(bytes, declaredSize)\r\n{\r\n const owned = bytes instanceof Uint8Array ? bytes : new Uint8Array(0);\r\n const size = declaredSize ?? owned.byteLength;\r\n return { size, offset: size === 0 ? 0xffffffff : 0, bytes: owned };\r\n}\r\n\r\nconst rawFloatBuffer = new DataView(new ArrayBuffer(4));\r\n\r\n/**\r\n * Reinterprets a portable `*Raw` field's `u32` bit pattern as the float it encodes.\r\n *\r\n * The portable reflection stores sampler LOD and border-colour values as raw bits —\r\n * `mipLODBiasRaw`, `minLODRaw`, `maxLODRaw`, `borderColorRaw` — precisely so that a\r\n * value like `-FLT_MAX` survives JSON without going through a decimal round trip.\r\n * Carbon's records store them as `float` (`EffectData.h:379,387-388`), so the bits\r\n * have to be reinterpreted rather than assigned. Assigning the `u32` straight across\r\n * writes `4286578687.0` where the file says `-3.4028235e38`, which every structural\r\n * check in the container would accept.\r\n *\r\n * @param {number} bits Raw 32-bit pattern.\r\n * @returns {number} The float those bits encode.\r\n */\r\nfunction floatFromRaw(bits)\r\n{\r\n if (!Number.isFinite(bits)) return 0;\r\n rawFloatBuffer.setUint32(0, bits >>> 0, true);\r\n return rawFloatBuffer.getFloat32(0, true);\r\n}\r\n\r\n/**\r\n * Encodes a portable annotation's `u32` value as Carbon's four raw bytes.\r\n *\r\n * Carbon writes the value through the `float` member of a `{float,int32_t}` union\r\n * and reads it back through a different union (`EffectData.h:582-593`,\r\n * `Tr2EffectDescription.cpp:129-132`), so the bytes are the only faithful\r\n * representation and no numeric conversion may happen here.\r\n *\r\n * @param {number} rawValue Portable annotation value.\r\n * @returns {Uint8Array} Four little-endian bytes.\r\n */\r\nfunction annotationBytes(rawValue)\r\n{\r\n const bytes = new Uint8Array(4);\r\n new DataView(bytes.buffer).setUint32(0, rawValue >>> 0, true);\r\n return bytes;\r\n}\r\n\r\n/**\r\n * Maps one annotation list, in Carbon's `strcmp` key order.\r\n *\r\n * @param {object[]} annotations Portable annotations.\r\n * @returns {object[]} Annotation records.\r\n */\r\nfunction mapAnnotations(annotations)\r\n{\r\n return (annotations ?? [])\r\n .map((annotation) => (annotation.type === CARBON_ANNOTATION_TYPE.STRING\r\n ? {\r\n name: str(annotation.name),\r\n type: annotation.type,\r\n stringValue: str(annotation.stringValue),\r\n rawValue: null\r\n }\r\n : {\r\n name: str(annotation.name),\r\n type: annotation.type,\r\n stringValue: null,\r\n rawValue: annotationBytes(annotation.rawValue)\r\n }))\r\n .sort((left, right) => compareUtf8(left.name.value, right.name.value));\r\n}\r\n\r\n/**\r\n * Maps a portable sampler descriptor onto Carbon's sampler record.\r\n *\r\n * @param {object} entry Portable sampler entry.\r\n * @returns {object} Sampler record.\r\n */\r\nfunction mapSampler(entry)\r\n{\r\n const descriptor = entry.descriptor ?? {};\r\n return {\r\n registerIndex: entry.registerIndex,\r\n // Carbon nulls a sampler's name when it is not dynamic\r\n // (`Tr2EffectDescription.cpp:430-433`), so an absent name round-trips as\r\n // the empty string rather than being dropped.\r\n name: str(entry.name ?? \"\"),\r\n comparison: descriptor.comparison ? 1 : 0,\r\n minFilter: descriptor.minFilter,\r\n magFilter: descriptor.magFilter,\r\n mipFilter: descriptor.mipFilter,\r\n addressU: descriptor.addressU,\r\n addressV: descriptor.addressV,\r\n addressW: descriptor.addressW,\r\n mipLODBias: floatFromRaw(descriptor.mipLODBiasRaw),\r\n maxAnisotropy: descriptor.maxAnisotropy,\r\n comparisonFunc: descriptor.comparisonFunc,\r\n // On one line deliberately: the raw-field guard requires the\r\n // reinterpretation to be visible on the same line as the raw access.\r\n borderColor: (descriptor.borderColorRaw ?? [ 0, 0, 0, 0 ]).slice(0, 4).map(floatFromRaw),\r\n minLOD: floatFromRaw(descriptor.minLODRaw),\r\n maxLOD: floatFromRaw(descriptor.maxLODRaw),\r\n isDynamic: entry.isDynamic ? 1 : 0\r\n };\r\n}\r\n\r\n/**\r\n * Maps a portable static sampler onto Carbon's static-sampler record.\r\n *\r\n * Border colour is a one-byte enum here, unlike the four floats on a dynamic\r\n * sampler (`EffectData.h:565` versus `:453`).\r\n *\r\n * @param {object} entry Portable static sampler entry.\r\n * @returns {object} Static sampler record.\r\n */\r\nfunction mapStaticSampler(entry)\r\n{\r\n const descriptor = entry.descriptor ?? {};\r\n return {\r\n registerIndex: entry.registerIndex,\r\n registerSpace: entry.registerSpace,\r\n comparison: descriptor.comparison ? 1 : 0,\r\n minFilter: descriptor.minFilter,\r\n magFilter: descriptor.magFilter,\r\n mipFilter: descriptor.mipFilter,\r\n addressU: descriptor.addressU,\r\n addressV: descriptor.addressV,\r\n addressW: descriptor.addressW,\r\n mipLODBias: floatFromRaw(descriptor.mipLODBiasRaw),\r\n maxAnisotropy: descriptor.maxAnisotropy,\r\n comparisonFunc: descriptor.comparisonFunc,\r\n borderColor: descriptor.borderColor,\r\n minLOD: floatFromRaw(descriptor.minLODRaw),\r\n maxLOD: floatFromRaw(descriptor.maxLODRaw)\r\n };\r\n}\r\n\r\n/**\r\n * Maps a portable resource entry onto Carbon's texture record.\r\n *\r\n * @param {object} entry Portable resource entry.\r\n * @returns {object} Texture record.\r\n */\r\nfunction mapTexture(entry)\r\n{\r\n return {\r\n registerIndex: entry.registerIndex,\r\n name: str(entry.name),\r\n type: entry.type,\r\n count: entry.arrayElements,\r\n isSRGB: entry.isSRGB ? 1 : 0,\r\n isAutoregister: entry.isAutoregister ? 1 : 0\r\n };\r\n}\r\n\r\n/**\r\n * Maps a portable resource entry onto Carbon's UAV record.\r\n *\r\n * A UAV record is one byte shorter than a texture record: it carries no `isSRGB`\r\n * (`EffectData.h:345-352`, `Tr2EffectDescription.cpp:450`).\r\n *\r\n * @param {object} entry Portable resource entry.\r\n * @returns {object} UAV record.\r\n */\r\nfunction mapUav(entry)\r\n{\r\n return {\r\n registerIndex: entry.registerIndex,\r\n name: str(entry.name),\r\n type: entry.type,\r\n count: entry.arrayElements,\r\n isAutoregister: entry.isAutoregister ? 1 : 0\r\n };\r\n}\r\n\r\n/**\r\n * Maps a portable input onto Carbon's `StageData` block.\r\n *\r\n * @param {object} input Portable input.\r\n * @returns {object} Stage data record.\r\n */\r\nfunction mapStageData(input)\r\n{\r\n const signature = input?.signature ?? {};\r\n const byRegister = (left, right) => left.registerIndex - right.registerIndex;\r\n\r\n return {\r\n registers: (signature.registers ?? []).map((entry) =>\r\n {\r\n // Carbon stores one field that its reader calls `arrayCount` and its\r\n // writer calls `registerCount` (`EffectData.h:495` / `Tr2ShaderAL.h:100`).\r\n // The portable reflection carries both names; they must agree, or the\r\n // collapse to one wire field would silently pick a side.\r\n if (entry.arrayCount !== entry.registerCount)\r\n {\r\n throw new CjsFormatWriteError(\r\n \"Portable register arrayCount and registerCount disagree; Carbon stores one field\",\r\n { arrayCount: entry.arrayCount, registerCount: entry.registerCount }\r\n );\r\n }\r\n return {\r\n registerType: entry.registerType,\r\n registerIndex: entry.registerIndex,\r\n registerCount: entry.registerCount,\r\n registerSpace: entry.registerSpace\r\n };\r\n }),\r\n staticSamplers: (signature.staticSamplers ?? []).map(mapStaticSampler),\r\n constants: (input?.constants ?? []).map((constant) => ({\r\n name: str(constant.name),\r\n offset: constant.offset,\r\n size: constant.size,\r\n type: constant.type,\r\n dimension: constant.dimension,\r\n elements: constant.elements,\r\n isSRGB: constant.isSRGB ? 1 : 0,\r\n isAutoregister: constant.isAutoregister ? 1 : 0\r\n })),\r\n defaultValues: blob(\r\n input?.constantDefaults?.bytes,\r\n input?.constantDefaults?.declaredByteLength\r\n ),\r\n textures: (input?.resources ?? []).map(mapTexture).sort(byRegister),\r\n samplers: (input?.samplers ?? []).map(mapSampler).sort(byRegister),\r\n uavs: (input?.uavs ?? []).map(mapUav).sort(byRegister),\r\n annotations: mapAnnotations(input?.annotations)\r\n };\r\n}\r\n\r\n/**\r\n * Maps one portable stage onto Carbon's `StageInput` record.\r\n *\r\n * @param {object} stage Portable stage.\r\n * @param {object} context Mapping context carrying the program substitution.\r\n * @returns {object} Stage record.\r\n */\r\nfunction mapStage(stage, context)\r\n{\r\n const signature = stage.input?.signature ?? {};\r\n const program = stage.sourceProgram ?? {};\r\n const threadGroupSize = signature.threadGroupSize ?? {};\r\n const substituted = context.programFor\r\n ? context.programFor(stage, context)\r\n : null;\r\n\r\n return {\r\n type: stage.stageType,\r\n // `shaderData` is the one field a backend replaces: the record layout is\r\n // backend-invariant, so a WGSL or GLSL program occupies exactly the slot\r\n // DXBC occupies in a shipped file. Absent a substitution the source\r\n // program passes through, which is what re-emitting a dx11 file does.\r\n shaderData: substituted\r\n ? blob(substituted.bytes, substituted.size)\r\n : blob(program.bytes, program.shaderSize),\r\n threadGroupSize: [\r\n threadGroupSize.x ?? 0,\r\n threadGroupSize.y ?? 0,\r\n threadGroupSize.z ?? 0\r\n ],\r\n pipelineInputs: (signature.pipelineInputs ?? []).map((entry) => ({\r\n usage: entry.usage,\r\n registerIndex: entry.registerIndex,\r\n usageIndex: entry.usageIndex,\r\n usedMask: entry.usedMask,\r\n type: entry.type,\r\n dimension: entry.dimension\r\n })),\r\n ...mapStageData(stage.input)\r\n };\r\n}\r\n\r\n/**\r\n * Maps one portable library onto Carbon's raytracing library record.\r\n *\r\n * @param {object} library Portable library.\r\n * @returns {object} Library record.\r\n */\r\nfunction mapLibrary(library)\r\n{\r\n const program = library.sourceProgram ?? {};\r\n return {\r\n payloadSize: library.payloadSize >>> 0,\r\n shaderData: blob(program.bytes, program.shaderSize),\r\n exports: (library.exports ?? []).map((entry) => ({\r\n type: entry.type,\r\n name: str(entry.name)\r\n })),\r\n hitGroupName: str(library.hitGroupName),\r\n globalInputs: mapStageData(library.globalInput),\r\n localInputs: mapStageData(library.localInput)\r\n };\r\n}\r\n\r\n/**\r\n * Maps a portable effect-body reflection onto a Carbon v15 description record tree.\r\n *\r\n * Two optional hooks make the same mapping serve a backend emit. Both are pure\r\n * functions of the record being mapped, so the mapping stays a mapping: nothing\r\n * about the Carbon region changes shape when a backend supplies them, only which\r\n * bytes land in `shaderData` and whether the one optional trailing block per pass\r\n * carries anything.\r\n *\r\n * @param {object} reflection Portable effect-body reflection.\r\n * @param {object} [hooks] Backend substitution hooks.\r\n * @param {Function} [hooks.programFor] Returns `{bytes, size}` for one stage.\r\n * @param {Function} [hooks.backendBlockFor] Returns block bytes for one pass.\r\n * @returns {object} Description record tree, ready for `writeEffectDescription`.\r\n */\r\nexport function carbonDescriptionFromPortable(reflection, hooks = {})\r\n{\r\n const effect = reflection?.effect;\r\n if (!effect)\r\n {\r\n throw new CjsFormatWriteError(\"Portable reflection has no effect\", {});\r\n }\r\n\r\n return {\r\n techniques: (effect.techniques ?? []).map((technique) => ({\r\n name: str(technique.name),\r\n passes: (technique.passes ?? []).map((pass, passIndex) =>\r\n {\r\n const context = {\r\n techniqueName: String(technique.name ?? \"\"),\r\n passIndex,\r\n passKey: `${technique.name}.pass${passIndex}`,\r\n programFor: hooks.programFor\r\n };\r\n const block = hooks.backendBlockFor\r\n ? hooks.backendBlockFor(context, pass)\r\n : null;\r\n\r\n return {\r\n stages: (pass.stages ?? []).map((stage) => mapStage(stage, context)),\r\n renderStates: (pass.renderStates ?? [])\r\n .map((entry) => ({ state: entry.state >>> 0, value: entry.value >>> 0 }))\r\n .sort((left, right) => left.state - right.state),\r\n ...(block ? { backendBlock: blob(block) } : {})\r\n };\r\n }),\r\n libraries: (technique.libraries ?? []).map(mapLibrary)\r\n })),\r\n annotations: (effect.annotations ?? [])\r\n .map((group) => ({\r\n name: str(group.parameterName),\r\n annotations: mapAnnotations(group.annotations)\r\n }))\r\n .sort((left, right) => compareUtf8(left.name.value, right.name.value))\r\n };\r\n}\r\n\r\nexport default carbonDescriptionFromPortable;\r\n"],"names":["str","value","offset","String","blob","bytes","declaredSize","owned","Uint8Array","size","byteLength","rawFloatBuffer","DataView","ArrayBuffer","floatFromRaw","bits","Number","isFinite","setUint32","getFloat32","annotationBytes","rawValue","buffer","mapAnnotations","annotations","map","annotation","type","CARBON_ANNOTATION_TYPE","STRING","name","stringValue","sort","left","right","compareUtf8","mapSampler","entry","descriptor","registerIndex","comparison","minFilter","magFilter","mipFilter","addressU","addressV","addressW","mipLODBias","mipLODBiasRaw","maxAnisotropy","comparisonFunc","borderColor","borderColorRaw","slice","minLOD","minLODRaw","maxLOD","maxLODRaw","isDynamic","mapStaticSampler","registerSpace","mapTexture","count","arrayElements","isSRGB","isAutoregister","mapUav","mapStageData","input","signature","byRegister","registers","arrayCount","registerCount","CjsFormatWriteError","registerType","staticSamplers","constants","constant","dimension","elements","defaultValues","constantDefaults","declaredByteLength","textures","resources","samplers","uavs","mapStage","stage","context","program","sourceProgram","threadGroupSize","substituted","programFor","stageType","shaderData","shaderSize","x","y","z","pipelineInputs","usage","usageIndex","usedMask","mapLibrary","library","payloadSize","exports","hitGroupName","globalInputs","globalInput","localInputs","localInput","carbonDescriptionFromPortable","reflection","hooks","effect","techniques","technique","passes","pass","passIndex","techniqueName","passKey","block","backendBlockFor","stages","renderStates","state","backendBlock","libraries","group","parameterName"],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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