@carbonenginejs/runtime-resource 0.10.0 → 0.11.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/format/effect/effectPermutationGraph.js +257 -0
- package/dist/format/effect/effectPermutationGraph.js.map +1 -0
- package/dist/format/effect/effectReflectionPackage.js +636 -0
- package/dist/format/effect/effectReflectionPackage.js.map +1 -0
- package/dist/format/effect/sha256.js +114 -0
- package/dist/format/effect/sha256.js.map +1 -0
- package/dist/formats/dxbc/CjsDxbcFormat.js +142 -0
- package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -0
- package/dist/formats/dxbc/core/DxbcReader.js +266 -0
- package/dist/formats/dxbc/core/DxbcReader.js.map +1 -0
- package/dist/formats/dxbc/core/container.js +169 -0
- package/dist/formats/dxbc/core/container.js.map +1 -0
- package/dist/formats/dxbc/core/decoder.js +789 -0
- package/dist/formats/dxbc/core/decoder.js.map +1 -0
- package/dist/formats/dxbc/core/errors.js +19 -0
- package/dist/formats/dxbc/core/errors.js.map +1 -0
- package/dist/formats/dxbc/core/helpers.js +220 -0
- package/dist/formats/dxbc/core/helpers.js.map +1 -0
- package/dist/formats/dxbc/core/opcodes.js +45 -0
- package/dist/formats/dxbc/core/opcodes.js.map +1 -0
- package/dist/formats/dxbc/core/program.js +91 -0
- package/dist/formats/dxbc/core/program.js.map +1 -0
- package/dist/formats/dxbc/core/signature.js +172 -0
- package/dist/formats/dxbc/core/signature.js.map +1 -0
- package/dist/formats/dxbc/index.js +2 -0
- package/dist/formats/dxbc/index.js.map +1 -0
- package/dist/formats/hlsl/CjsHlslFormat.js +254 -0
- package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -0
- package/dist/formats/hlsl/core/HlslBinaryUtils.js +15 -0
- package/dist/formats/hlsl/core/HlslBinaryUtils.js.map +1 -0
- package/dist/formats/hlsl/core/HlslEffectReadError.js +19 -0
- package/dist/formats/hlsl/core/HlslEffectReadError.js.map +1 -0
- package/dist/formats/hlsl/core/HlslEffectStateManager.js +130 -0
- package/dist/formats/hlsl/core/HlslEffectStateManager.js.map +1 -0
- package/dist/formats/hlsl/core/HlslReader.js +266 -0
- package/dist/formats/hlsl/core/HlslReader.js.map +1 -0
- package/dist/formats/hlsl/core/HlslRenderStateSetup.js +37 -0
- package/dist/formats/hlsl/core/HlslRenderStateSetup.js.map +1 -0
- package/dist/formats/hlsl/core/HlslResourceSetDescription.js +94 -0
- package/dist/formats/hlsl/core/HlslResourceSetDescription.js.map +1 -0
- package/dist/formats/hlsl/core/HlslShaderBytecode.js +44 -0
- package/dist/formats/hlsl/core/HlslShaderBytecode.js.map +1 -0
- package/dist/formats/hlsl/core/analysis.js +51 -0
- package/dist/formats/hlsl/core/analysis.js.map +1 -0
- package/dist/formats/hlsl/core/helpers.js +270 -0
- package/dist/formats/hlsl/core/helpers.js.map +1 -0
- package/dist/formats/hlsl/core/json.js +284 -0
- package/dist/formats/hlsl/core/json.js.map +1 -0
- package/dist/formats/hlsl/core/metadata.js +327 -0
- package/dist/formats/hlsl/core/metadata.js.map +1 -0
- package/dist/formats/hlsl/core/portableReflection.js +848 -0
- package/dist/formats/hlsl/core/portableReflection.js.map +1 -0
- package/dist/formats/hlsl/core/render-states.js +280 -0
- package/dist/formats/hlsl/core/render-states.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/HlslRenderContextEnum.js +43 -0
- package/dist/formats/hlsl/core/tr2/HlslRenderContextEnum.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +294 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslShaderPermutation.js +33 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslShaderPermutation.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js +416 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectConstant.js +40 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectConstant.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js +742 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectLibrary.js +52 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectLibrary.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectParameterAnnotation.js +38 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectParameterAnnotation.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectResource.js +50 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectResource.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js +86 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectTechnique.js +31 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectTechnique.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslPass.js +42 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslPass.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerDescription.js +55 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerDescription.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerSetup.js +29 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerSetup.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslShader.js +220 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslShader.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslShaderOption.js +30 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslShaderOption.js.map +1 -0
- package/dist/formats/hlsl/index.js +2 -0
- package/dist/formats/hlsl/index.js.map +1 -0
- package/dist/formats/hlsl/portable.js +2 -0
- package/dist/formats/hlsl/portable.js.map +1 -0
- package/dist/formats/index.js +4 -0
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/webgl/CjsWebglFormat.js +221 -0
- package/dist/formats/webgl/CjsWebglFormat.js.map +1 -0
- package/dist/formats/webgl/core/cewg/CewgPackage.js +339 -0
- package/dist/formats/webgl/core/cewg/CewgPackage.js.map +1 -0
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js +104 -0
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js.map +1 -0
- package/dist/formats/webgl/core/cewg/binary.js +101 -0
- package/dist/formats/webgl/core/cewg/binary.js.map +1 -0
- package/dist/formats/webgl/core/cewgCompleteness.js +81 -0
- package/dist/formats/webgl/core/cewgCompleteness.js.map +1 -0
- package/dist/formats/webgl/core/effectPackage.js +789 -0
- package/dist/formats/webgl/core/effectPackage.js.map +1 -0
- package/dist/formats/webgl/core/effectPackageValidation.js +331 -0
- package/dist/formats/webgl/core/effectPackageValidation.js.map +1 -0
- package/dist/formats/webgl/core/errors.js +27 -0
- package/dist/formats/webgl/core/errors.js.map +1 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +2678 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslHelpers.js +89 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslHelpers.js.map +1 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +428 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -0
- package/dist/formats/webgl/core/helpers.js +306 -0
- package/dist/formats/webgl/core/helpers.js.map +1 -0
- package/dist/formats/webgl/index.js +2 -0
- package/dist/formats/webgl/index.js.map +1 -0
- package/dist/formats/webgpu/CjsWebgpuFormat.js +376 -0
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js +415 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js +100 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/binary.js +93 -0
- package/dist/formats/webgpu/core/cewgpu/binary.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/tags.js +17 -0
- package/dist/formats/webgpu/core/cewgpu/tags.js.map +1 -0
- package/dist/formats/webgpu/core/effectAnalysis.js +82 -0
- package/dist/formats/webgpu/core/effectAnalysis.js.map +1 -0
- package/dist/formats/webgpu/core/effectBackendBodySet.js +305 -0
- package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -0
- package/dist/formats/webgpu/core/effectPackageValidation.js +1078 -0
- package/dist/formats/webgpu/core/effectPackageValidation.js.map +1 -0
- package/dist/formats/webgpu/core/errors.js +20 -0
- package/dist/formats/webgpu/core/errors.js.map +1 -0
- package/dist/formats/webgpu/core/helpers.js +448 -0
- package/dist/formats/webgpu/core/helpers.js.map +1 -0
- package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js +223 -0
- package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js.map +1 -0
- package/dist/formats/webgpu/core/ir/buildControlFlow.js +220 -0
- package/dist/formats/webgpu/core/ir/buildControlFlow.js.map +1 -0
- package/dist/formats/webgpu/core/ir/indexableTemps.js +137 -0
- package/dist/formats/webgpu/core/ir/indexableTemps.js.map +1 -0
- package/dist/formats/webgpu/core/ir/inferValueTypes.js +454 -0
- package/dist/formats/webgpu/core/ir/inferValueTypes.js.map +1 -0
- package/dist/formats/webgpu/core/ir/lowerDxbcToIr.js +494 -0
- package/dist/formats/webgpu/core/ir/lowerDxbcToIr.js.map +1 -0
- package/dist/formats/webgpu/core/ir/resolveRegisterFlow.js +177 -0
- package/dist/formats/webgpu/core/ir/resolveRegisterFlow.js.map +1 -0
- package/dist/formats/webgpu/core/ir/sourceLanes.js +61 -0
- package/dist/formats/webgpu/core/ir/sourceLanes.js.map +1 -0
- package/dist/formats/webgpu/core/packageEffect.js +300 -0
- package/dist/formats/webgpu/core/packageEffect.js.map +1 -0
- package/dist/formats/webgpu/core/packageEffectSelection.js +164 -0
- package/dist/formats/webgpu/core/packageEffectSelection.js.map +1 -0
- package/dist/formats/webgpu/core/packageMetadata.js +8 -0
- package/dist/formats/webgpu/core/packageMetadata.js.map +1 -0
- package/dist/formats/webgpu/core/schema.js +4 -0
- package/dist/formats/webgpu/core/schema.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +275 -0
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js +182 -0
- package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +324 -0
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/emitWgsl.js +356 -0
- package/dist/formats/webgpu/core/wgsl/emitWgsl.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/hoistEscapingValues.js +77 -0
- package/dist/formats/webgpu/core/wgsl/hoistEscapingValues.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerBindingLayout.js +451 -0
- package/dist/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js +754 -0
- package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js +457 -0
- package/dist/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerFragmentProgram.js +1572 -0
- package/dist/formats/webgpu/core/wgsl/lowerFragmentProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerMergeHistogramsComputeProgram.js +659 -0
- package/dist/formats/webgpu/core/wgsl/lowerMergeHistogramsComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerParticleClearComputePrograms.js +734 -0
- package/dist/formats/webgpu/core/wgsl/lowerParticleClearComputePrograms.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerParticleEmitComputeProgram.js +583 -0
- package/dist/formats/webgpu/core/wgsl/lowerParticleEmitComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerSkinVerticesComputeProgram.js +621 -0
- package/dist/formats/webgpu/core/wgsl/lowerSkinVerticesComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortComputeProgram.js +824 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortInnerComputeProgram.js +697 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortInnerComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortStepComputeProgram.js +559 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortStepComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerVertexProgram.js +1328 -0
- package/dist/formats/webgpu/core/wgsl/lowerVertexProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/particleEmitSemanticDigest.js +110 -0
- package/dist/formats/webgpu/core/wgsl/particleEmitSemanticDigest.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/precisionControls.js +55 -0
- package/dist/formats/webgpu/core/wgsl/precisionControls.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/selectionPlans.js +758 -0
- package/dist/formats/webgpu/core/wgsl/selectionPlans.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/uniformity.js +78 -0
- package/dist/formats/webgpu/core/wgsl/uniformity.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/validateExactComputeIr.js +196 -0
- package/dist/formats/webgpu/core/wgsl/validateExactComputeIr.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/validateHandleOperand.js +37 -0
- package/dist/formats/webgpu/core/wgsl/validateHandleOperand.js.map +1 -0
- package/dist/formats/webgpu/index.js +2 -0
- package/dist/formats/webgpu/index.js.map +1 -0
- package/dist/resource/shader/Tr2EffectRes.js +159 -150
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialArea.js +23 -28
- package/dist/resource/shader/Tr2MaterialArea.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialMesh.js +21 -27
- package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialRes.js +24 -29
- package/dist/resource/shader/Tr2MaterialRes.js.map +1 -1
- package/dist/resource/shader/Tr2Shader.js +45 -39
- package/dist/resource/shader/Tr2Shader.js.map +1 -1
- package/dist/resource/shader/Tr2ShaderPermutation.js +30 -32
- package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +113 -78
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDefine.js +17 -23
- package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +23 -29
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +44 -40
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +82 -86
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +55 -61
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +49 -45
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +25 -30
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +30 -32
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +21 -26
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
- package/docs/formats/README.md +4 -0
- package/docs/formats/provenance.md +11 -3
- package/docs/reference/classes/formats.md +440 -0
- package/format-notices/dxbc/LICENSE +21 -0
- package/format-notices/dxbc/NOTICE +20 -0
- package/format-notices/hlsl/LICENSE +21 -0
- package/format-notices/hlsl/NOTICE +25 -0
- package/format-notices/webgl/LICENSE +21 -0
- package/format-notices/webgl/NOTICE +35 -0
- package/format-notices/webgpu/LICENSE +21 -0
- package/format-notices/webgpu/NOTICE +31 -0
- package/package.json +6 -1
- package/dist/resource/shader/portableValidation.js +0 -461
- package/dist/resource/shader/portableValidation.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { carbon, impl, type } from '@carbonenginejs/runtime-utils/schema';
|
|
1
|
+
import { CjsSchema, carbon, impl } from '@carbonenginejs/runtime-utils/schema';
|
|
3
2
|
import { CjsResource as _CjsResource } from '../CjsResource.js';
|
|
4
3
|
import { validateResourcePayload } from '../resourceBoundary.js';
|
|
5
|
-
import { Tr2Shader
|
|
4
|
+
import { Tr2Shader } from './Tr2Shader.js';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
// Source: trinity/trinity/Resources/Tr2EffectRes.h
|
|
7
|
+
// Source: trinity/trinity/Resources/Tr2EffectRes.cpp
|
|
8
|
+
// Source: trinity/trinity/Resources/Tr2EffectRes_Blue.cpp
|
|
8
9
|
const globalEffectOptions = [];
|
|
9
10
|
const SHA256 = /^[0-9a-f]{64}$/u;
|
|
10
11
|
const UINT8_MAX = 0xff;
|
|
@@ -17,168 +18,162 @@ const MAX_EFFECT_PERMUTATIONS = 0x10000;
|
|
|
17
18
|
* This stores effect/shader payload facts. Engine-gpu decides shader module,
|
|
18
19
|
* pipeline, bind group, and sampler realization.
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
static [class Tr2EffectRes extends _CjsResource {
|
|
23
|
-
static {
|
|
24
|
-
({
|
|
25
|
-
e: [_initProto],
|
|
26
|
-
c: [_Tr2EffectRes, _initClass]
|
|
27
|
-
} = _applyDecs2311(this, [type.define({
|
|
28
|
-
className: "Tr2EffectRes",
|
|
29
|
-
family: "resources"
|
|
30
|
-
})], [[[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Carbon reads the selected body directly from compiled effect bytes and registers renderer handles; CarbonEngineJS hydrates the format package's validated portable reflection without realizing GPU state.")], 18, "GetShader"], [[impl, impl.custom, void 0, impl.reason("Carbon selects compiled bodies through GetShader; CarbonEngineJS exposes exact package-index hydration for deterministic package consumers and tests.")], 18, "GetShaderByIndex"], [[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Carbon exposes a Python tuple through Blue; CarbonEngineJS returns a JSON-friendly plain axis description.")], 18, "GetPermutationDescription"], [[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Backend resources are engine-owned; the resource-side release clears only hydrated device-free shader graphs.")], 18, "ReleaseResources"]], 0, void 0, _CjsResource));
|
|
31
|
-
}
|
|
32
|
-
#shaders = (_initProto(this), new Map());
|
|
21
|
+
class Tr2EffectRes extends _CjsResource {
|
|
22
|
+
#shaders = new Map();
|
|
33
23
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
/** Creates a Tr2EffectRes with caller-provided initial state. */
|
|
25
|
+
constructor(values = null) {
|
|
26
|
+
super();
|
|
27
|
+
this.SetValues(values || {}, {
|
|
28
|
+
markDirty: false,
|
|
29
|
+
skipUpdate: true,
|
|
30
|
+
skipEvents: true
|
|
31
|
+
});
|
|
32
|
+
}
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.#shaders.clear();
|
|
54
|
-
super.SetPayload(null);
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
validateResourcePayload("Tr2EffectRes", payload, validateEffectPayload);
|
|
34
|
+
/**
|
|
35
|
+
* Attach a plain shader/effect payload.
|
|
36
|
+
*
|
|
37
|
+
* @param {object|null} payload
|
|
38
|
+
* @param {object|null} options
|
|
39
|
+
* @returns {Tr2EffectRes}
|
|
40
|
+
*/
|
|
41
|
+
SetPayload(payload = null, options = null) {
|
|
42
|
+
if (payload === null) {
|
|
58
43
|
this.#shaders.clear();
|
|
59
|
-
super.SetPayload(
|
|
60
|
-
this.SetValues(options || {});
|
|
44
|
+
super.SetPayload(null);
|
|
61
45
|
return this;
|
|
62
46
|
}
|
|
47
|
+
validateResourcePayload("Tr2EffectRes", payload, validateEffectPayload);
|
|
48
|
+
this.#shaders.clear();
|
|
49
|
+
super.SetPayload(payload);
|
|
50
|
+
this.SetValues(options || {});
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
63
53
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Select and hydrate one canonical shader from the complete permutation
|
|
56
|
+
* graph exposed by a CEWG/CEWGPU raw package.
|
|
57
|
+
*
|
|
58
|
+
* Global options have Carbon-compatible precedence over caller options.
|
|
59
|
+
* Unknown option values retain the authored default.
|
|
60
|
+
*
|
|
61
|
+
* @param {Array<object>|Map<string,string>} options Local name/value choices.
|
|
62
|
+
* @param {number|null} count Number of local entries to consider.
|
|
63
|
+
* @returns {Tr2Shader|null} Selected device-free shader reflection.
|
|
64
|
+
*/
|
|
65
|
+
GetShader(options = [], count = null) {
|
|
66
|
+
const axes = getPermutationAxes(this.GetPayload());
|
|
67
|
+
if (!axes.length) {
|
|
68
|
+
const portableIndex = Tr2Shader.isPortableReflection(this.GetPayload()) ? this.GetPayload().permutationIndex : 0;
|
|
69
|
+
return this.GetShaderByIndex(portableIndex);
|
|
70
|
+
}
|
|
71
|
+
const localOptions = normalizeShaderOptions(options);
|
|
72
|
+
const localCount = Number.isSafeInteger(count) ? Math.max(0, Math.min(count, localOptions.length)) : localOptions.length;
|
|
73
|
+
let multiplier = 1;
|
|
74
|
+
let index = 0;
|
|
75
|
+
for (const axis of axes) {
|
|
76
|
+
let selectedIndex = axis.defaultOption;
|
|
77
|
+
const globalOption = globalEffectOptions.find(option => option.name === axis.name);
|
|
78
|
+
if (globalOption) {
|
|
79
|
+
const requestedIndex = axis.options.indexOf(globalOption.value);
|
|
80
|
+
if (requestedIndex >= 0) {
|
|
81
|
+
selectedIndex = requestedIndex;
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
for (let optionIndex = 0; optionIndex < localCount; optionIndex += 1) {
|
|
85
|
+
const localOption = localOptions[optionIndex];
|
|
86
|
+
if (localOption.name !== axis.name) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const requestedIndex = axis.options.indexOf(localOption.value);
|
|
90
90
|
if (requestedIndex >= 0) {
|
|
91
91
|
selectedIndex = requestedIndex;
|
|
92
92
|
}
|
|
93
|
-
} else {
|
|
94
|
-
for (let optionIndex = 0; optionIndex < localCount; optionIndex += 1) {
|
|
95
|
-
const localOption = localOptions[optionIndex];
|
|
96
|
-
if (localOption.name !== axis.name) {
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
const requestedIndex = axis.options.indexOf(localOption.value);
|
|
100
|
-
if (requestedIndex >= 0) {
|
|
101
|
-
selectedIndex = requestedIndex;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
93
|
}
|
|
105
|
-
index += selectedIndex * multiplier;
|
|
106
|
-
multiplier *= axis.options.length;
|
|
107
94
|
}
|
|
108
|
-
|
|
95
|
+
index += selectedIndex * multiplier;
|
|
96
|
+
multiplier *= axis.options.length;
|
|
109
97
|
}
|
|
98
|
+
return this.GetShaderByIndex(index);
|
|
99
|
+
}
|
|
110
100
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
const payload = this.GetPayload();
|
|
126
|
-
const variantCount = getPermutationVariantCount(payload);
|
|
127
|
-
if (variantCount !== null && index >= variantCount) {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
const portable = getPortableReflection(payload, index);
|
|
131
|
-
if (!portable) {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
if (portable.permutationIndex !== index) {
|
|
135
|
-
throw new Error(`Portable effect reflection index ${portable.permutationIndex} does not match requested index ${index}`);
|
|
136
|
-
}
|
|
137
|
-
const shader = _Tr2Shader.fromPortable(portable);
|
|
138
|
-
this.#shaders.set(index, shader);
|
|
139
|
-
return shader;
|
|
101
|
+
/**
|
|
102
|
+
* Hydrate one exact permutation-table index and cache the resulting runtime
|
|
103
|
+
* graph for this payload.
|
|
104
|
+
*
|
|
105
|
+
* @param {number} index Exact permutation index.
|
|
106
|
+
* @returns {Tr2Shader|null} Canonical shader or null when reflection is absent.
|
|
107
|
+
*/
|
|
108
|
+
GetShaderByIndex(index) {
|
|
109
|
+
if (!Number.isSafeInteger(index) || index < 0) {
|
|
110
|
+
throw new TypeError("Tr2EffectRes shader index must be a non-negative safe integer");
|
|
111
|
+
}
|
|
112
|
+
if (this.#shaders.has(index)) {
|
|
113
|
+
return this.#shaders.get(index);
|
|
140
114
|
}
|
|
115
|
+
const payload = this.GetPayload();
|
|
116
|
+
const variantCount = getPermutationVariantCount(payload);
|
|
117
|
+
if (variantCount !== null && index >= variantCount) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
const portable = getPortableReflection(payload, index);
|
|
121
|
+
if (!portable) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
if (portable.permutationIndex !== index) {
|
|
125
|
+
throw new Error(`Portable effect reflection index ${portable.permutationIndex} does not match requested index ${index}`);
|
|
126
|
+
}
|
|
127
|
+
const shader = Tr2Shader.fromPortable(portable);
|
|
128
|
+
this.#shaders.set(index, shader);
|
|
129
|
+
return shader;
|
|
130
|
+
}
|
|
141
131
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}));
|
|
154
|
-
}
|
|
155
|
-
return axes.map(axis => ({
|
|
156
|
-
name: axis.name,
|
|
157
|
-
options: [...axis.options],
|
|
158
|
-
defaultOption: axis.defaultOption,
|
|
159
|
-
description: axis.description,
|
|
160
|
-
type: axis.type
|
|
132
|
+
/**
|
|
133
|
+
* Return a small JSON-friendly permutation description.
|
|
134
|
+
*
|
|
135
|
+
* @returns {Array<*>}
|
|
136
|
+
*/
|
|
137
|
+
GetPermutationDescription() {
|
|
138
|
+
const payload = this.GetPayload();
|
|
139
|
+
const axes = getPermutationAxes(payload);
|
|
140
|
+
if (!axes.length && Array.isArray(payload?.permutations)) {
|
|
141
|
+
return payload.permutations.map(permutation => ({
|
|
142
|
+
...permutation
|
|
161
143
|
}));
|
|
162
144
|
}
|
|
145
|
+
return axes.map(axis => ({
|
|
146
|
+
name: axis.name,
|
|
147
|
+
options: [...axis.options],
|
|
148
|
+
defaultOption: axis.defaultOption,
|
|
149
|
+
description: axis.description,
|
|
150
|
+
type: axis.type
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
163
153
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Drop hydrated shader graphs while retaining the validated CPU payload.
|
|
156
|
+
*/
|
|
157
|
+
ReleaseResources() {
|
|
158
|
+
this.#shaders.clear();
|
|
159
|
+
}
|
|
170
160
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
}];
|
|
177
|
-
payload = "shader";
|
|
178
|
-
constructor() {
|
|
179
|
-
super(_Tr2EffectRes), _initClass();
|
|
161
|
+
/** Release the payload and every shader graph hydrated from it. */
|
|
162
|
+
ReleasePayload() {
|
|
163
|
+
this.#shaders.clear();
|
|
164
|
+
return super.ReleasePayload();
|
|
180
165
|
}
|
|
181
|
-
|
|
166
|
+
static payload = "shader";
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Merge Carbon-style global effect option overrides.
|
|
171
|
+
*
|
|
172
|
+
* An empty value removes the override. Existing Tr2EffectRes shader caches
|
|
173
|
+
* remain valid objects; callers rebuild effects to request the new selection.
|
|
174
|
+
*
|
|
175
|
+
* @param {Array<object>|Map<string,string>} changes Option changes.
|
|
176
|
+
*/
|
|
182
177
|
function ModifyGlobalEffectOptions(changes = []) {
|
|
183
178
|
for (const change of normalizeShaderOptions(changes)) {
|
|
184
179
|
const index = globalEffectOptions.findIndex(option => option.name === change.name);
|
|
@@ -214,7 +209,7 @@ function validateEffectPayload(payload) {
|
|
|
214
209
|
} else {
|
|
215
210
|
validateLegacyPermutationDescription(payload.permutations);
|
|
216
211
|
}
|
|
217
|
-
} else if (!
|
|
212
|
+
} else if (!Tr2Shader.isPortableReflection(payload)) {
|
|
218
213
|
throw new TypeError("Tr2EffectRes payload requires a complete permutation graph, permutations array, or one portable reflection");
|
|
219
214
|
}
|
|
220
215
|
if (Array.isArray(payload.portableReflections)) {
|
|
@@ -223,7 +218,7 @@ function validateEffectPayload(payload) {
|
|
|
223
218
|
throw new Error("Tr2EffectRes portable reflection count disagrees with its permutations");
|
|
224
219
|
}
|
|
225
220
|
payload.portableReflections.forEach((reflection, index) => {
|
|
226
|
-
if (!
|
|
221
|
+
if (!Tr2Shader.isPortableReflection(reflection) || reflection.permutationIndex !== index) {
|
|
227
222
|
throw new Error(`Tr2EffectRes portable reflection ${index} is malformed`);
|
|
228
223
|
}
|
|
229
224
|
});
|
|
@@ -392,7 +387,7 @@ function getPortableReflection(payload, index) {
|
|
|
392
387
|
if (typeof payload.getPortableEffectReflection === "function") {
|
|
393
388
|
return payload.getPortableEffectReflection(index);
|
|
394
389
|
}
|
|
395
|
-
if (
|
|
390
|
+
if (Tr2Shader.isPortableReflection(payload)) {
|
|
396
391
|
return index === payload.permutationIndex ? payload : null;
|
|
397
392
|
}
|
|
398
393
|
if (Array.isArray(payload.portableReflections)) {
|
|
@@ -416,5 +411,19 @@ function normalizeShaderOptions(options) {
|
|
|
416
411
|
}));
|
|
417
412
|
}
|
|
418
413
|
|
|
419
|
-
|
|
414
|
+
// Declared imperatively rather than with decorators, so this module stays
|
|
415
|
+
// plain ESM that loads from source without a transform. The decorator
|
|
416
|
+
// expressions are reused verbatim, so the registered metadata is identical.
|
|
417
|
+
// Statics belong in `methods`: decorateMethod targets the prototype and
|
|
418
|
+
// would register a static as an instance field.
|
|
419
|
+
CjsSchema.define(Tr2EffectRes, {
|
|
420
|
+
className: "Tr2EffectRes",
|
|
421
|
+
family: "resources"
|
|
422
|
+
});
|
|
423
|
+
CjsSchema.decorateMethod(Tr2EffectRes, "GetShader", carbon.method, impl.adapted, impl.reason("Carbon reads the selected body directly from compiled effect bytes and registers renderer handles; CarbonEngineJS hydrates the format package's validated portable reflection without realizing GPU state."));
|
|
424
|
+
CjsSchema.decorateMethod(Tr2EffectRes, "GetShaderByIndex", impl.custom, impl.reason("Carbon selects compiled bodies through GetShader; CarbonEngineJS exposes exact package-index hydration for deterministic package consumers and tests."));
|
|
425
|
+
CjsSchema.decorateMethod(Tr2EffectRes, "GetPermutationDescription", carbon.method, impl.adapted, impl.reason("Carbon exposes a Python tuple through Blue; CarbonEngineJS returns a JSON-friendly plain axis description."));
|
|
426
|
+
CjsSchema.decorateMethod(Tr2EffectRes, "ReleaseResources", carbon.method, impl.adapted, impl.reason("Backend resources are engine-owned; the resource-side release clears only hydrated device-free shader graphs."));
|
|
427
|
+
|
|
428
|
+
export { GetGlobalEffectOptions, ModifyGlobalEffectOptions, Tr2EffectRes };
|
|
420
429
|
//# sourceMappingURL=Tr2EffectRes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2EffectRes.js","sources":["../../../../src/resource/shader/Tr2EffectRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2EffectRes.h\n// Source: trinity/trinity/Resources/Tr2EffectRes.cpp\n// Source: trinity/trinity/Resources/Tr2EffectRes_Blue.cpp\nimport { carbon, impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport { validateResourcePayload } from \"../resourceBoundary.js\";\nimport { Tr2Shader } from \"./Tr2Shader.js\";\n\nconst globalEffectOptions = [];\nconst SHA256 = /^[0-9a-f]{64}$/u;\nconst UINT8_MAX = 0xff;\nconst UINT32_MAX = 0xffffffff;\nconst MAX_EFFECT_PERMUTATIONS = 0x10000;\n\n/**\n * Tr2EffectRes resource record.\n *\n * This stores effect/shader payload facts. Engine-gpu decides shader module,\n * pipeline, bind group, and sampler realization.\n */\n@type.define({ className: \"Tr2EffectRes\", family: \"resources\" })\nexport class Tr2EffectRes extends CjsResource\n{\n\n #shaders = new Map();\n\n /** Creates a Tr2EffectRes with caller-provided initial state. */\n constructor(values = null)\n {\n super();\n this.SetValues(values || {}, {\n markDirty: false,\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * Attach a plain shader/effect payload.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {Tr2EffectRes}\n */\n SetPayload(payload = null, options = null)\n {\n if (payload === null)\n {\n this.#shaders.clear();\n super.SetPayload(null);\n return this;\n }\n validateResourcePayload(\n \"Tr2EffectRes\",\n payload,\n validateEffectPayload\n );\n this.#shaders.clear();\n super.SetPayload(payload);\n this.SetValues(options || {});\n return this;\n }\n\n /**\n * Select and hydrate one canonical shader from the complete permutation\n * graph exposed by a CEWG/CEWGPU raw package.\n *\n * Global options have Carbon-compatible precedence over caller options.\n * Unknown option values retain the authored default.\n *\n * @param {Array<object>|Map<string,string>} options Local name/value choices.\n * @param {number|null} count Number of local entries to consider.\n * @returns {Tr2Shader|null} Selected device-free shader reflection.\n */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Carbon reads the selected body directly from compiled effect bytes and registers renderer handles; CarbonEngineJS hydrates the format package's validated portable reflection without realizing GPU state.\")\n GetShader(options = [], count = null)\n {\n const axes = getPermutationAxes(this.GetPayload());\n if (!axes.length)\n {\n const portableIndex = Tr2Shader.isPortableReflection(this.GetPayload())\n ? this.GetPayload().permutationIndex\n : 0;\n return this.GetShaderByIndex(portableIndex);\n }\n const localOptions = normalizeShaderOptions(options);\n const localCount = Number.isSafeInteger(count)\n ? Math.max(0, Math.min(count, localOptions.length))\n : localOptions.length;\n let multiplier = 1;\n let index = 0;\n\n for (const axis of axes)\n {\n let selectedIndex = axis.defaultOption;\n const globalOption = globalEffectOptions.find(\n option => option.name === axis.name\n );\n if (globalOption)\n {\n const requestedIndex = axis.options.indexOf(globalOption.value);\n if (requestedIndex >= 0)\n {\n selectedIndex = requestedIndex;\n }\n }\n else\n {\n for (let optionIndex = 0; optionIndex < localCount; optionIndex += 1)\n {\n const localOption = localOptions[optionIndex];\n if (localOption.name !== axis.name)\n {\n continue;\n }\n const requestedIndex = axis.options.indexOf(localOption.value);\n if (requestedIndex >= 0)\n {\n selectedIndex = requestedIndex;\n }\n }\n }\n\n index += selectedIndex * multiplier;\n multiplier *= axis.options.length;\n }\n\n return this.GetShaderByIndex(index);\n }\n\n /**\n * Hydrate one exact permutation-table index and cache the resulting runtime\n * graph for this payload.\n *\n * @param {number} index Exact permutation index.\n * @returns {Tr2Shader|null} Canonical shader or null when reflection is absent.\n */\n @impl.custom\n @impl.reason(\"Carbon selects compiled bodies through GetShader; CarbonEngineJS exposes exact package-index hydration for deterministic package consumers and tests.\")\n GetShaderByIndex(index)\n {\n if (!Number.isSafeInteger(index) || index < 0)\n {\n throw new TypeError(\n \"Tr2EffectRes shader index must be a non-negative safe integer\"\n );\n }\n if (this.#shaders.has(index))\n {\n return this.#shaders.get(index);\n }\n\n const payload = this.GetPayload();\n const variantCount = getPermutationVariantCount(payload);\n if (variantCount !== null && index >= variantCount)\n {\n return null;\n }\n\n const portable = getPortableReflection(payload, index);\n if (!portable)\n {\n return null;\n }\n if (portable.permutationIndex !== index)\n {\n throw new Error(\n `Portable effect reflection index ${portable.permutationIndex} does not match requested index ${index}`\n );\n }\n\n const shader = Tr2Shader.fromPortable(portable);\n this.#shaders.set(index, shader);\n return shader;\n }\n\n /**\n * Return a small JSON-friendly permutation description.\n *\n * @returns {Array<*>}\n */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Carbon exposes a Python tuple through Blue; CarbonEngineJS returns a JSON-friendly plain axis description.\")\n GetPermutationDescription()\n {\n const payload = this.GetPayload();\n const axes = getPermutationAxes(payload);\n if (!axes.length && Array.isArray(payload?.permutations))\n {\n return payload.permutations.map(permutation => ({ ...permutation }));\n }\n return axes.map(axis => ({\n name: axis.name,\n options: [ ...axis.options ],\n defaultOption: axis.defaultOption,\n description: axis.description,\n type: axis.type\n }));\n }\n\n /**\n * Drop hydrated shader graphs while retaining the validated CPU payload.\n */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Backend resources are engine-owned; the resource-side release clears only hydrated device-free shader graphs.\")\n ReleaseResources()\n {\n this.#shaders.clear();\n }\n\n /** Release the payload and every shader graph hydrated from it. */\n ReleasePayload()\n {\n this.#shaders.clear();\n return super.ReleasePayload();\n }\n\n static payload = \"shader\";\n\n}\n\n/**\n * Merge Carbon-style global effect option overrides.\n *\n * An empty value removes the override. Existing Tr2EffectRes shader caches\n * remain valid objects; callers rebuild effects to request the new selection.\n *\n * @param {Array<object>|Map<string,string>} changes Option changes.\n */\nexport function ModifyGlobalEffectOptions(changes = [])\n{\n for (const change of normalizeShaderOptions(changes))\n {\n const index = globalEffectOptions.findIndex(\n option => option.name === change.name\n );\n if (!change.value)\n {\n if (index >= 0)\n {\n globalEffectOptions.splice(index, 1);\n }\n }\n else if (index >= 0)\n {\n globalEffectOptions[index] = change;\n }\n else\n {\n globalEffectOptions.push(change);\n }\n }\n}\n\n/**\n * Return an owned snapshot of the current global option overrides.\n *\n * @returns {Array<{name:string,value:string}>} Global option choices.\n */\nexport function GetGlobalEffectOptions()\n{\n return globalEffectOptions.map(option => ({ ...option }));\n}\n\nfunction validateEffectPayload(payload)\n{\n const graph = payload.permutationGraph;\n if (graph !== null && graph !== undefined)\n {\n validatePermutationGraph(graph);\n }\n else if (Array.isArray(payload.permutations))\n {\n if (payload.permutations.every(permutation =>\n Array.isArray(permutation?.options)))\n {\n payload.permutations.forEach(normalizePermutationAxis);\n }\n else\n {\n validateLegacyPermutationDescription(payload.permutations);\n }\n }\n else if (!Tr2Shader.isPortableReflection(payload))\n {\n throw new TypeError(\n \"Tr2EffectRes payload requires a complete permutation graph, permutations array, or one portable reflection\"\n );\n }\n\n if (Array.isArray(payload.portableReflections))\n {\n const expectedCount = getPermutationVariantCount(payload);\n if (expectedCount !== null\n && payload.portableReflections.length !== expectedCount)\n {\n throw new Error(\n \"Tr2EffectRes portable reflection count disagrees with its permutations\"\n );\n }\n payload.portableReflections.forEach((reflection, index) =>\n {\n if (!Tr2Shader.isPortableReflection(reflection)\n || reflection.permutationIndex !== index)\n {\n throw new Error(\n `Tr2EffectRes portable reflection ${index} is malformed`\n );\n }\n });\n }\n}\n\nfunction validateLegacyPermutationDescription(permutations)\n{\n for (const [ index, permutation ] of permutations.entries())\n {\n if (!permutation\n || typeof permutation !== \"object\"\n || Array.isArray(permutation)\n || typeof permutation.name !== \"string\"\n || !permutation.name)\n {\n throw new TypeError(\n `Tr2EffectRes legacy permutation ${index} is malformed`\n );\n }\n }\n}\n\nfunction validatePermutationGraph(graph)\n{\n if (!graph || typeof graph !== \"object\" || Array.isArray(graph)\n || graph.format !== \"CJS_EFFECT_PERMUTATION_GRAPH\"\n || graph.formatVersion !== 1\n || !graph.coverage || typeof graph.coverage !== \"object\"\n || Array.isArray(graph.coverage)\n || graph.coverage.permutations !== \"complete\"\n || graph.coverage.bodies !== \"identity-only\"\n || graph.coverage.reflection !== \"absent\"\n || !Array.isArray(graph.axes)\n || !Array.isArray(graph.variants)\n || !Array.isArray(graph.bodies))\n {\n throw new TypeError(\n \"Tr2EffectRes requires CJS_EFFECT_PERMUTATION_GRAPH version 1\"\n );\n }\n\n const axisNames = new Set();\n const axes = graph.axes.map((axis, index) =>\n validatePermutationAxis(axis, index, axisNames));\n const expectedCount = getPermutationProduct(axes);\n if (graph.variants.length !== expectedCount\n || !graph.bodies.length\n || graph.bodies.length > graph.variants.length)\n {\n throw new Error(\n \"Tr2EffectRes permutation graph requires complete variants and bodies\"\n );\n }\n\n const bodies = new Map();\n const bodyDigests = new Set();\n graph.bodies.forEach((body, bodyIndex) =>\n {\n if (!body || typeof body !== \"object\" || Array.isArray(body)\n || typeof body.key !== \"string\" || !body.key\n || body.key !== body.key.trim()\n || !Number.isSafeInteger(body.byteLength) || body.byteLength < 1\n || body.byteLength > UINT32_MAX\n || typeof body.sha256 !== \"string\" || !SHA256.test(body.sha256)\n || bodies.has(body.key)\n || bodyDigests.has(body.sha256))\n {\n throw new Error(\n `Tr2EffectRes permutation body ${bodyIndex} is malformed or duplicated`\n );\n }\n bodyDigests.add(body.sha256);\n bodies.set(body.key, {\n byteLength: body.byteLength,\n references: 0\n });\n });\n\n const bodyKeyBySourceRecord = new Map();\n const sourceRecords = [];\n graph.variants.forEach((variant, permutationIndex) =>\n {\n const expectedOptions = decodePermutationOptions(permutationIndex, axes);\n if (!variant || typeof variant !== \"object\" || Array.isArray(variant)\n || variant.permutationIndex !== permutationIndex\n || !Array.isArray(variant.optionIndices)\n || variant.optionIndices.length !== expectedOptions.length\n || variant.optionIndices.some((value, index) =>\n value !== expectedOptions[index])\n || typeof variant.bodyKey !== \"string\"\n || !bodies.has(variant.bodyKey))\n {\n throw new Error(\n `Tr2EffectRes permutation variant ${permutationIndex} is malformed`\n );\n }\n\n const sourceRecord = validatePermutationSourceRecord(\n variant.sourceRecord,\n permutationIndex\n );\n const body = bodies.get(variant.bodyKey);\n if (sourceRecord.byteLength !== body.byteLength)\n {\n throw new Error(\n `Tr2EffectRes permutation variant ${permutationIndex} body length disagrees`\n );\n }\n const recordKey = `${sourceRecord.offset}:${sourceRecord.byteLength}`;\n const existingBodyKey = bodyKeyBySourceRecord.get(recordKey);\n if (existingBodyKey && existingBodyKey !== variant.bodyKey)\n {\n throw new Error(\n `Tr2EffectRes source record ${recordKey} maps to multiple bodies`\n );\n }\n bodyKeyBySourceRecord.set(recordKey, variant.bodyKey);\n sourceRecords.push(sourceRecord);\n body.references += 1;\n });\n\n validateDisjointPermutationRecords(sourceRecords);\n for (const [ bodyKey, body ] of bodies)\n {\n if (!body.references)\n {\n throw new Error(\n `Tr2EffectRes permutation body ${bodyKey} is unreferenced`\n );\n }\n }\n}\n\nfunction validatePermutationAxis(axis, index, names)\n{\n if (!axis || typeof axis !== \"object\" || Array.isArray(axis)\n || axis.index !== index\n || typeof axis.name !== \"string\" || !axis.name\n || axis.name !== axis.name.trim() || names.has(axis.name)\n || !Array.isArray(axis.options) || !axis.options.length\n || axis.options.length > UINT8_MAX\n || !Number.isSafeInteger(axis.defaultOption)\n || axis.defaultOption < 0\n || axis.defaultOption >= axis.options.length\n || typeof axis.description !== \"string\"\n || !Number.isSafeInteger(axis.type)\n || axis.type < 0 || axis.type > UINT8_MAX)\n {\n throw new Error(\n `Tr2EffectRes permutation axis ${index} is malformed or duplicated`\n );\n }\n names.add(axis.name);\n const options = new Set();\n for (const option of axis.options)\n {\n if (typeof option !== \"string\" || !option\n || option !== option.trim() || options.has(option))\n {\n throw new Error(\n `Tr2EffectRes permutation axis ${index} options are malformed`\n );\n }\n options.add(option);\n }\n return normalizePermutationAxis(axis);\n}\n\nfunction getPermutationProduct(axes)\n{\n let product = 1;\n for (const axis of axes)\n {\n product *= axis.options.length;\n if (!Number.isSafeInteger(product)\n || product < 1\n || product > MAX_EFFECT_PERMUTATIONS)\n {\n throw new Error(\n \"Tr2EffectRes permutation count exceeds the implementation limit\"\n );\n }\n }\n return product;\n}\n\nfunction decodePermutationOptions(permutationIndex, axes)\n{\n let value = permutationIndex;\n return axes.map(axis =>\n {\n const optionIndex = value % axis.options.length;\n value = Math.floor(value / axis.options.length);\n return optionIndex;\n });\n}\n\nfunction validatePermutationSourceRecord(record, permutationIndex)\n{\n const offset = record?.offset;\n const byteLength = record?.byteLength;\n const end = offset + byteLength;\n if (!record || typeof record !== \"object\" || Array.isArray(record)\n || !Number.isSafeInteger(offset) || offset < 0 || offset > UINT32_MAX\n || !Number.isSafeInteger(byteLength) || byteLength < 1\n || byteLength > UINT32_MAX\n || !Number.isSafeInteger(end)\n || end > UINT32_MAX + 1)\n {\n throw new Error(\n `Tr2EffectRes permutation variant ${permutationIndex} source record is malformed`\n );\n }\n return { offset, byteLength };\n}\n\nfunction validateDisjointPermutationRecords(records)\n{\n const unique = new Map();\n for (const record of records)\n {\n const key = `${record.offset}:${record.byteLength}`;\n if (!unique.has(key))\n {\n unique.set(key, {\n offset: record.offset,\n end: record.offset + record.byteLength\n });\n }\n }\n const ordered = Array.from(unique.values()).sort((left, right) =>\n left.offset - right.offset || left.end - right.end);\n for (let index = 1; index < ordered.length; index += 1)\n {\n if (ordered[index].offset < ordered[index - 1].end)\n {\n throw new Error(\n \"Tr2EffectRes permutation source body records partially overlap\"\n );\n }\n }\n}\n\nfunction getPermutationAxes(payload)\n{\n if (!payload)\n {\n return [];\n }\n if (payload.permutationGraph)\n {\n return payload.permutationGraph.axes.map(normalizePermutationAxis);\n }\n if (Array.isArray(payload.permutations)\n && payload.permutations.every(permutation =>\n Array.isArray(permutation?.options)))\n {\n return payload.permutations.map(normalizePermutationAxis);\n }\n return [];\n}\n\nfunction normalizePermutationAxis(axis)\n{\n if (!axis || typeof axis !== \"object\" || Array.isArray(axis)\n || typeof axis.name !== \"string\" || !axis.name\n || !Array.isArray(axis.options) || !axis.options.length\n || axis.options.some(option => typeof option !== \"string\" || !option)\n || !Number.isSafeInteger(axis.defaultOption)\n || axis.defaultOption < 0\n || axis.defaultOption >= axis.options.length)\n {\n throw new TypeError(\"Tr2EffectRes permutation axis is malformed\");\n }\n return {\n name: axis.name,\n options: [ ...axis.options ],\n defaultOption: axis.defaultOption,\n description: String(axis.description ?? \"\"),\n type: Number(axis.type ?? 0)\n };\n}\n\nfunction getPermutationVariantCount(payload)\n{\n if (Array.isArray(payload?.permutationGraph?.variants))\n {\n return payload.permutationGraph.variants.length;\n }\n const axes = getPermutationAxes(payload);\n if (axes.length)\n {\n return axes.reduce((count, axis) => count * axis.options.length, 1);\n }\n return null;\n}\n\nfunction getPortableReflection(payload, index)\n{\n if (!payload)\n {\n return null;\n }\n if (typeof payload.GetPortableEffectReflection === \"function\")\n {\n return payload.GetPortableEffectReflection(index);\n }\n if (typeof payload.getPortableEffectReflection === \"function\")\n {\n return payload.getPortableEffectReflection(index);\n }\n if (Tr2Shader.isPortableReflection(payload))\n {\n return index === payload.permutationIndex ? payload : null;\n }\n if (Array.isArray(payload.portableReflections))\n {\n return payload.portableReflections[index] ?? null;\n }\n return null;\n}\n\nfunction normalizeShaderOptions(options)\n{\n if (options instanceof Map)\n {\n return Array.from(options, ([ name, value ]) => ({\n name: String(name),\n value: String(value)\n }));\n }\n if (!Array.isArray(options))\n {\n return [];\n }\n return options.map(option => ({\n name: String(option?.name ?? \"\"),\n value: String(option?.value ?? \"\")\n }));\n}\n"],"names":["globalEffectOptions","SHA256","UINT8_MAX","UINT32_MAX","MAX_EFFECT_PERMUTATIONS","_Tr2EffectRes","_identity","Tr2EffectRes","CjsResource","e","_initProto","c","_initClass","_applyDecs","type","define","className","family","carbon","method","impl","adapted","reason","custom","Map","constructor","values","SetValues","markDirty","skipUpdate","skipEvents","SetPayload","payload","options","clear","validateResourcePayload","validateEffectPayload","GetShader","count","axes","getPermutationAxes","GetPayload","length","portableIndex","Tr2Shader","isPortableReflection","permutationIndex","GetShaderByIndex","localOptions","normalizeShaderOptions","localCount","Number","isSafeInteger","Math","max","min","multiplier","index","axis","selectedIndex","defaultOption","globalOption","find","option","name","requestedIndex","indexOf","value","optionIndex","localOption","TypeError","has","get","variantCount","getPermutationVariantCount","portable","getPortableReflection","Error","shader","fromPortable","set","GetPermutationDescription","Array","isArray","permutations","map","permutation","description","ReleaseResources","ReleasePayload","ModifyGlobalEffectOptions","changes","change","findIndex","splice","push","GetGlobalEffectOptions","graph","permutationGraph","undefined","validatePermutationGraph","every","forEach","normalizePermutationAxis","validateLegacyPermutationDescription","portableReflections","expectedCount","reflection","entries","format","formatVersion","coverage","bodies","variants","axisNames","Set","validatePermutationAxis","getPermutationProduct","bodyDigests","body","bodyIndex","key","trim","byteLength","sha256","test","add","references","bodyKeyBySourceRecord","sourceRecords","variant","expectedOptions","decodePermutationOptions","optionIndices","some","bodyKey","sourceRecord","validatePermutationSourceRecord","recordKey","offset","existingBodyKey","validateDisjointPermutationRecords","names","product","floor","record","end","records","unique","ordered","from","sort","left","right","String","reduce","GetPortableE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,OAAO,CAAC6H,2BAA2B,CAACpG,KAAK,CAAC;AACnD,EAAA;AACA,EAAA,IAAIb,UAAS,CAACC,oBAAoB,CAACb,OAAO,CAAC,EAC3C;IACE,OAAOyB,KAAK,KAAKzB,OAAO,CAACc,gBAAgB,GAAGd,OAAO,GAAG,IAAI;AAC5D,EAAA;EACA,IAAIkD,KAAK,CAACC,OAAO,CAACnD,OAAO,CAACyE,mBAAmB,CAAC,EAC9C;AACE,IAAA,OAAOzE,OAAO,CAACyE,mBAAmB,CAAChD,KAAK,CAAC,IAAI,IAAI;AACnD,EAAA;AACA,EAAA,OAAO,IAAI;AACb;AAEA,SAASR,sBAAsBA,CAAChB,OAAO,EACvC;EACE,IAAIA,OAAO,YAAYT,GAAG,EAC1B;AACE,IAAA,OAAO0D,KAAK,CAACoE,IAAI,CAACrH,OAAO,EAAE,CAAC,CAAE+B,IAAI,EAAEG,KAAK,CAAE,MAAM;AAC/CH,MAAAA,IAAI,EAAE0F,MAAM,CAAC1F,IAAI,CAAC;MAClBG,KAAK,EAAEuF,MAAM,CAACvF,KAAK;AACrB,KAAC,CAAC,CAAC;AACL,EAAA;AACA,EAAA,IAAI,CAACe,KAAK,CAACC,OAAO,CAAClD,OAAO,CAAC,EAC3B;AACE,IAAA,OAAO,EAAE;AACX,EAAA;AACA,EAAA,OAAOA,OAAO,CAACoD,GAAG,CAACtB,MAAM,KAAK;IAC5BC,IAAI,EAAE0F,MAAM,CAAC3F,MAAM,EAAEC,IAAI,IAAI,EAAE,CAAC;AAChCG,IAAAA,KAAK,EAAEuF,MAAM,CAAC3F,MAAM,EAAEI,KAAK,IAAI,EAAE;AACnC,GAAC,CAAC,CAAC;AACL;;;;"}
|
|
1
|
+
{"version":3,"file":"Tr2EffectRes.js","sources":["../../../../src/resource/shader/Tr2EffectRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2EffectRes.h\n// Source: trinity/trinity/Resources/Tr2EffectRes.cpp\n// Source: trinity/trinity/Resources/Tr2EffectRes_Blue.cpp\nimport { CjsSchema, carbon, impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport { validateResourcePayload } from \"../resourceBoundary.js\";\nimport { Tr2Shader } from \"./Tr2Shader.js\";\n\nconst globalEffectOptions = [];\nconst SHA256 = /^[0-9a-f]{64}$/u;\nconst UINT8_MAX = 0xff;\nconst UINT32_MAX = 0xffffffff;\nconst MAX_EFFECT_PERMUTATIONS = 0x10000;\n\n/**\n * Tr2EffectRes resource record.\n *\n * This stores effect/shader payload facts. Engine-gpu decides shader module,\n * pipeline, bind group, and sampler realization.\n */\nexport class Tr2EffectRes extends CjsResource\n{\n\n #shaders = new Map();\n\n /** Creates a Tr2EffectRes with caller-provided initial state. */\n constructor(values = null)\n {\n super();\n this.SetValues(values || {}, {\n markDirty: false,\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * Attach a plain shader/effect payload.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {Tr2EffectRes}\n */\n SetPayload(payload = null, options = null)\n {\n if (payload === null)\n {\n this.#shaders.clear();\n super.SetPayload(null);\n return this;\n }\n validateResourcePayload(\n \"Tr2EffectRes\",\n payload,\n validateEffectPayload\n );\n this.#shaders.clear();\n super.SetPayload(payload);\n this.SetValues(options || {});\n return this;\n }\n\n /**\n * Select and hydrate one canonical shader from the complete permutation\n * graph exposed by a CEWG/CEWGPU raw package.\n *\n * Global options have Carbon-compatible precedence over caller options.\n * Unknown option values retain the authored default.\n *\n * @param {Array<object>|Map<string,string>} options Local name/value choices.\n * @param {number|null} count Number of local entries to consider.\n * @returns {Tr2Shader|null} Selected device-free shader reflection.\n */\n GetShader(options = [], count = null)\n {\n const axes = getPermutationAxes(this.GetPayload());\n if (!axes.length)\n {\n const portableIndex = Tr2Shader.isPortableReflection(this.GetPayload())\n ? this.GetPayload().permutationIndex\n : 0;\n return this.GetShaderByIndex(portableIndex);\n }\n const localOptions = normalizeShaderOptions(options);\n const localCount = Number.isSafeInteger(count)\n ? Math.max(0, Math.min(count, localOptions.length))\n : localOptions.length;\n let multiplier = 1;\n let index = 0;\n\n for (const axis of axes)\n {\n let selectedIndex = axis.defaultOption;\n const globalOption = globalEffectOptions.find(\n option => option.name === axis.name\n );\n if (globalOption)\n {\n const requestedIndex = axis.options.indexOf(globalOption.value);\n if (requestedIndex >= 0)\n {\n selectedIndex = requestedIndex;\n }\n }\n else\n {\n for (let optionIndex = 0; optionIndex < localCount; optionIndex += 1)\n {\n const localOption = localOptions[optionIndex];\n if (localOption.name !== axis.name)\n {\n continue;\n }\n const requestedIndex = axis.options.indexOf(localOption.value);\n if (requestedIndex >= 0)\n {\n selectedIndex = requestedIndex;\n }\n }\n }\n\n index += selectedIndex * multiplier;\n multiplier *= axis.options.length;\n }\n\n return this.GetShaderByIndex(index);\n }\n\n /**\n * Hydrate one exact permutation-table index and cache the resulting runtime\n * graph for this payload.\n *\n * @param {number} index Exact permutation index.\n * @returns {Tr2Shader|null} Canonical shader or null when reflection is absent.\n */\n GetShaderByIndex(index)\n {\n if (!Number.isSafeInteger(index) || index < 0)\n {\n throw new TypeError(\n \"Tr2EffectRes shader index must be a non-negative safe integer\"\n );\n }\n if (this.#shaders.has(index))\n {\n return this.#shaders.get(index);\n }\n\n const payload = this.GetPayload();\n const variantCount = getPermutationVariantCount(payload);\n if (variantCount !== null && index >= variantCount)\n {\n return null;\n }\n\n const portable = getPortableReflection(payload, index);\n if (!portable)\n {\n return null;\n }\n if (portable.permutationIndex !== index)\n {\n throw new Error(\n `Portable effect reflection index ${portable.permutationIndex} does not match requested index ${index}`\n );\n }\n\n const shader = Tr2Shader.fromPortable(portable);\n this.#shaders.set(index, shader);\n return shader;\n }\n\n /**\n * Return a small JSON-friendly permutation description.\n *\n * @returns {Array<*>}\n */\n GetPermutationDescription()\n {\n const payload = this.GetPayload();\n const axes = getPermutationAxes(payload);\n if (!axes.length && Array.isArray(payload?.permutations))\n {\n return payload.permutations.map(permutation => ({ ...permutation }));\n }\n return axes.map(axis => ({\n name: axis.name,\n options: [ ...axis.options ],\n defaultOption: axis.defaultOption,\n description: axis.description,\n type: axis.type\n }));\n }\n\n /**\n * Drop hydrated shader graphs while retaining the validated CPU payload.\n */\n ReleaseResources()\n {\n this.#shaders.clear();\n }\n\n /** Release the payload and every shader graph hydrated from it. */\n ReleasePayload()\n {\n this.#shaders.clear();\n return super.ReleasePayload();\n }\n\n static payload = \"shader\";\n\n}\n\n/**\n * Merge Carbon-style global effect option overrides.\n *\n * An empty value removes the override. Existing Tr2EffectRes shader caches\n * remain valid objects; callers rebuild effects to request the new selection.\n *\n * @param {Array<object>|Map<string,string>} changes Option changes.\n */\nexport function ModifyGlobalEffectOptions(changes = [])\n{\n for (const change of normalizeShaderOptions(changes))\n {\n const index = globalEffectOptions.findIndex(\n option => option.name === change.name\n );\n if (!change.value)\n {\n if (index >= 0)\n {\n globalEffectOptions.splice(index, 1);\n }\n }\n else if (index >= 0)\n {\n globalEffectOptions[index] = change;\n }\n else\n {\n globalEffectOptions.push(change);\n }\n }\n}\n\n/**\n * Return an owned snapshot of the current global option overrides.\n *\n * @returns {Array<{name:string,value:string}>} Global option choices.\n */\nexport function GetGlobalEffectOptions()\n{\n return globalEffectOptions.map(option => ({ ...option }));\n}\n\nfunction validateEffectPayload(payload)\n{\n const graph = payload.permutationGraph;\n if (graph !== null && graph !== undefined)\n {\n validatePermutationGraph(graph);\n }\n else if (Array.isArray(payload.permutations))\n {\n if (payload.permutations.every(permutation =>\n Array.isArray(permutation?.options)))\n {\n payload.permutations.forEach(normalizePermutationAxis);\n }\n else\n {\n validateLegacyPermutationDescription(payload.permutations);\n }\n }\n else if (!Tr2Shader.isPortableReflection(payload))\n {\n throw new TypeError(\n \"Tr2EffectRes payload requires a complete permutation graph, permutations array, or one portable reflection\"\n );\n }\n\n if (Array.isArray(payload.portableReflections))\n {\n const expectedCount = getPermutationVariantCount(payload);\n if (expectedCount !== null\n && payload.portableReflections.length !== expectedCount)\n {\n throw new Error(\n \"Tr2EffectRes portable reflection count disagrees with its permutations\"\n );\n }\n payload.portableReflections.forEach((reflection, index) =>\n {\n if (!Tr2Shader.isPortableReflection(reflection)\n || reflection.permutationIndex !== index)\n {\n throw new Error(\n `Tr2EffectRes portable reflection ${index} is malformed`\n );\n }\n });\n }\n}\n\nfunction validateLegacyPermutationDescription(permutations)\n{\n for (const [ index, permutation ] of permutations.entries())\n {\n if (!permutation\n || typeof permutation !== \"object\"\n || Array.isArray(permutation)\n || typeof permutation.name !== \"string\"\n || !permutation.name)\n {\n throw new TypeError(\n `Tr2EffectRes legacy permutation ${index} is malformed`\n );\n }\n }\n}\n\nfunction validatePermutationGraph(graph)\n{\n if (!graph || typeof graph !== \"object\" || Array.isArray(graph)\n || graph.format !== \"CJS_EFFECT_PERMUTATION_GRAPH\"\n || graph.formatVersion !== 1\n || !graph.coverage || typeof graph.coverage !== \"object\"\n || Array.isArray(graph.coverage)\n || graph.coverage.permutations !== \"complete\"\n || graph.coverage.bodies !== \"identity-only\"\n || graph.coverage.reflection !== \"absent\"\n || !Array.isArray(graph.axes)\n || !Array.isArray(graph.variants)\n || !Array.isArray(graph.bodies))\n {\n throw new TypeError(\n \"Tr2EffectRes requires CJS_EFFECT_PERMUTATION_GRAPH version 1\"\n );\n }\n\n const axisNames = new Set();\n const axes = graph.axes.map((axis, index) =>\n validatePermutationAxis(axis, index, axisNames));\n const expectedCount = getPermutationProduct(axes);\n if (graph.variants.length !== expectedCount\n || !graph.bodies.length\n || graph.bodies.length > graph.variants.length)\n {\n throw new Error(\n \"Tr2EffectRes permutation graph requires complete variants and bodies\"\n );\n }\n\n const bodies = new Map();\n const bodyDigests = new Set();\n graph.bodies.forEach((body, bodyIndex) =>\n {\n if (!body || typeof body !== \"object\" || Array.isArray(body)\n || typeof body.key !== \"string\" || !body.key\n || body.key !== body.key.trim()\n || !Number.isSafeInteger(body.byteLength) || body.byteLength < 1\n || body.byteLength > UINT32_MAX\n || typeof body.sha256 !== \"string\" || !SHA256.test(body.sha256)\n || bodies.has(body.key)\n || bodyDigests.has(body.sha256))\n {\n throw new Error(\n `Tr2EffectRes permutation body ${bodyIndex} is malformed or duplicated`\n );\n }\n bodyDigests.add(body.sha256);\n bodies.set(body.key, {\n byteLength: body.byteLength,\n references: 0\n });\n });\n\n const bodyKeyBySourceRecord = new Map();\n const sourceRecords = [];\n graph.variants.forEach((variant, permutationIndex) =>\n {\n const expectedOptions = decodePermutationOptions(permutationIndex, axes);\n if (!variant || typeof variant !== \"object\" || Array.isArray(variant)\n || variant.permutationIndex !== permutationIndex\n || !Array.isArray(variant.optionIndices)\n || variant.optionIndices.length !== expectedOptions.length\n || variant.optionIndices.some((value, index) =>\n value !== expectedOptions[index])\n || typeof variant.bodyKey !== \"string\"\n || !bodies.has(variant.bodyKey))\n {\n throw new Error(\n `Tr2EffectRes permutation variant ${permutationIndex} is malformed`\n );\n }\n\n const sourceRecord = validatePermutationSourceRecord(\n variant.sourceRecord,\n permutationIndex\n );\n const body = bodies.get(variant.bodyKey);\n if (sourceRecord.byteLength !== body.byteLength)\n {\n throw new Error(\n `Tr2EffectRes permutation variant ${permutationIndex} body length disagrees`\n );\n }\n const recordKey = `${sourceRecord.offset}:${sourceRecord.byteLength}`;\n const existingBodyKey = bodyKeyBySourceRecord.get(recordKey);\n if (existingBodyKey && existingBodyKey !== variant.bodyKey)\n {\n throw new Error(\n `Tr2EffectRes source record ${recordKey} maps to multiple bodies`\n );\n }\n bodyKeyBySourceRecord.set(recordKey, variant.bodyKey);\n sourceRecords.push(sourceRecord);\n body.references += 1;\n });\n\n validateDisjointPermutationRecords(sourceRecords);\n for (const [ bodyKey, body ] of bodies)\n {\n if (!body.references)\n {\n throw new Error(\n `Tr2EffectRes permutation body ${bodyKey} is unreferenced`\n );\n }\n }\n}\n\nfunction validatePermutationAxis(axis, index, names)\n{\n if (!axis || typeof axis !== \"object\" || Array.isArray(axis)\n || axis.index !== index\n || typeof axis.name !== \"string\" || !axis.name\n || axis.name !== axis.name.trim() || names.has(axis.name)\n || !Array.isArray(axis.options) || !axis.options.length\n || axis.options.length > UINT8_MAX\n || !Number.isSafeInteger(axis.defaultOption)\n || axis.defaultOption < 0\n || axis.defaultOption >= axis.options.length\n || typeof axis.description !== \"string\"\n || !Number.isSafeInteger(axis.type)\n || axis.type < 0 || axis.type > UINT8_MAX)\n {\n throw new Error(\n `Tr2EffectRes permutation axis ${index} is malformed or duplicated`\n );\n }\n names.add(axis.name);\n const options = new Set();\n for (const option of axis.options)\n {\n if (typeof option !== \"string\" || !option\n || option !== option.trim() || options.has(option))\n {\n throw new Error(\n `Tr2EffectRes permutation axis ${index} options are malformed`\n );\n }\n options.add(option);\n }\n return normalizePermutationAxis(axis);\n}\n\nfunction getPermutationProduct(axes)\n{\n let product = 1;\n for (const axis of axes)\n {\n product *= axis.options.length;\n if (!Number.isSafeInteger(product)\n || product < 1\n || product > MAX_EFFECT_PERMUTATIONS)\n {\n throw new Error(\n \"Tr2EffectRes permutation count exceeds the implementation limit\"\n );\n }\n }\n return product;\n}\n\nfunction decodePermutationOptions(permutationIndex, axes)\n{\n let value = permutationIndex;\n return axes.map(axis =>\n {\n const optionIndex = value % axis.options.length;\n value = Math.floor(value / axis.options.length);\n return optionIndex;\n });\n}\n\nfunction validatePermutationSourceRecord(record, permutationIndex)\n{\n const offset = record?.offset;\n const byteLength = record?.byteLength;\n const end = offset + byteLength;\n if (!record || typeof record !== \"object\" || Array.isArray(record)\n || !Number.isSafeInteger(offset) || offset < 0 || offset > UINT32_MAX\n || !Number.isSafeInteger(byteLength) || byteLength < 1\n || byteLength > UINT32_MAX\n || !Number.isSafeInteger(end)\n || end > UINT32_MAX + 1)\n {\n throw new Error(\n `Tr2EffectRes permutation variant ${permutationIndex} source record is malformed`\n );\n }\n return { offset, byteLength };\n}\n\nfunction validateDisjointPermutationRecords(records)\n{\n const unique = new Map();\n for (const record of records)\n {\n const key = `${record.offset}:${record.byteLength}`;\n if (!unique.has(key))\n {\n unique.set(key, {\n offset: record.offset,\n end: record.offset + record.byteLength\n });\n }\n }\n const ordered = Array.from(unique.values()).sort((left, right) =>\n left.offset - right.offset || left.end - right.end);\n for (let index = 1; index < ordered.length; index += 1)\n {\n if (ordered[index].offset < ordered[index - 1].end)\n {\n throw new Error(\n \"Tr2EffectRes permutation source body records partially overlap\"\n );\n }\n }\n}\n\nfunction getPermutationAxes(payload)\n{\n if (!payload)\n {\n return [];\n }\n if (payload.permutationGraph)\n {\n return payload.permutationGraph.axes.map(normalizePermutationAxis);\n }\n if (Array.isArray(payload.permutations)\n && payload.permutations.every(permutation =>\n Array.isArray(permutation?.options)))\n {\n return payload.permutations.map(normalizePermutationAxis);\n }\n return [];\n}\n\nfunction normalizePermutationAxis(axis)\n{\n if (!axis || typeof axis !== \"object\" || Array.isArray(axis)\n || typeof axis.name !== \"string\" || !axis.name\n || !Array.isArray(axis.options) || !axis.options.length\n || axis.options.some(option => typeof option !== \"string\" || !option)\n || !Number.isSafeInteger(axis.defaultOption)\n || axis.defaultOption < 0\n || axis.defaultOption >= axis.options.length)\n {\n throw new TypeError(\"Tr2EffectRes permutation axis is malformed\");\n }\n return {\n name: axis.name,\n options: [ ...axis.options ],\n defaultOption: axis.defaultOption,\n description: String(axis.description ?? \"\"),\n type: Number(axis.type ?? 0)\n };\n}\n\nfunction getPermutationVariantCount(payload)\n{\n if (Array.isArray(payload?.permutationGraph?.variants))\n {\n return payload.permutationGraph.variants.length;\n }\n const axes = getPermutationAxes(payload);\n if (axes.length)\n {\n return axes.reduce((count, axis) => count * axis.options.length, 1);\n }\n return null;\n}\n\nfunction getPortableReflection(payload, index)\n{\n if (!payload)\n {\n return null;\n }\n if (typeof payload.GetPortableEffectReflection === \"function\")\n {\n return payload.GetPortableEffectReflection(index);\n }\n if (typeof payload.getPortableEffectReflection === \"function\")\n {\n return payload.getPortableEffectReflection(index);\n }\n if (Tr2Shader.isPortableReflection(payload))\n {\n return index === payload.permutationIndex ? payload : null;\n }\n if (Array.isArray(payload.portableReflections))\n {\n return payload.portableReflections[index] ?? null;\n }\n return null;\n}\n\nfunction normalizeShaderOptions(options)\n{\n if (options instanceof Map)\n {\n return Array.from(options, ([ name, value ]) => ({\n name: String(name),\n value: String(value)\n }));\n }\n if (!Array.isArray(options))\n {\n return [];\n }\n return options.map(option => ({\n name: String(option?.name ?? \"\"),\n value: String(option?.value ?? \"\")\n }));\n}\n\n// Declared imperatively rather than with decorators, so this module stays\n// plain ESM that loads from source without a transform. The decorator\n// expressions are reused verbatim, so the registered metadata is identical.\n// Statics belong in `methods`: decorateMethod targets the prototype and\n// would register a static as an instance field.\nCjsSchema.define(Tr2EffectRes, {\n className: \"Tr2EffectRes\",\n family: \"resources\"\n});\nCjsSchema.decorateMethod(Tr2EffectRes, \"GetShader\", carbon.method, impl.adapted, impl.reason(\"Carbon reads the selected body directly from compiled effect bytes and registers renderer handles; CarbonEngineJS hydrates the format package's validated portable reflection without realizing GPU state.\"));\nCjsSchema.decorateMethod(Tr2EffectRes, \"GetShaderByIndex\", impl.custom, impl.reason(\"Carbon selects compiled bodies through GetShader; CarbonEngineJS exposes exact package-index hydration for deterministic package consumers and tests.\"));\nCjsSchema.decorateMethod(Tr2EffectRes, \"GetPermutationDescription\", carbon.method, impl.adapted, impl.reason(\"Carbon exposes a Python tuple through Blue; CarbonEngineJS returns a JSON-friendly plain axis description.\"));\nCjsSchema.decorateMethod(Tr2EffectRes, \"ReleaseResources\", carbon.method, impl.adapted, impl.reason(\"Backend resources are engine-owned; the resource-side release clears only hydrated device-free shader graphs.\"));\n"],"names":["globalEffectOptions","SHA256","UINT8_MAX","UINT32_MAX","MAX_EFFECT_PERMUTATIONS","Tr2EffectRes","CjsResource","Map","constructor","values","SetValues","markDirty","skipUpdate","skipEvents","SetPayload","payload","options","clear","validateResourcePayload","validateEffectPayload","GetShader","count","axes","getPermutationAxes","GetPayload","length","portableIndex","Tr2Shader","isPortableReflection","permutationIndex","GetShaderByIndex","localOptions","normalizeShaderOptions","localCount","Number","isSafeInteger","Math","max","min","multiplier","index","axis","selectedIndex","defaultOption","globalOption","find","option","name","requestedIndex","indexOf","value","optionIndex","localOption","TypeError","has","get","variantCount","getPermutationVariantCount","portable","getPortableReflection","Error","shader","fromPortable","set","GetPermutationDescription","Array","isArray","permutations","map","permutation","description","type","ReleaseResources","ReleasePayload","ModifyGlobalEffectOptions","changes","change","findIndex","splice","push","GetGlobalEffectOptions","graph","permutationGraph","undefined","validatePermutationGraph","every","forEach","normalizePermutationAxis","validateLegacyPermutationDescription","portableReflections","expectedCount","reflection","entries","format","formatVersion","coverage","bodies","variants","axisNames","Set","validatePermutationAxis","getPermutationProduct","bodyDigests","body","bodyIndex","key","trim","byteLength","sha256","test","add","references","bodyKeyBySourceRecord","sourceRecords","variant","expectedOptions","decodePermutationOptions","optionIndices","some","bodyKey","sourceRecord","validatePermutationSourceRecord","recordKey","offset","existingBodyKey","validateDisjointPermutationRecords","names","product","floor","record","end","records","unique","ordered","from","sort","left","right","String","reduce","GetPortableEffectReflection","getPortableEffectReflection","CjsSchema","define","className","family","decorateMethod","carbon","method","impl","adapted","reason","custom"],"mappings":";;;;;AAAA;AACA;AACA;AAMA,MAAMA,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,MAAM,GAAG,iBAAiB;AAChC,MAAMC,SAAS,GAAG,IAAI;AACtB,MAAMC,UAAU,GAAG,UAAU;AAC7B,MAAMC,uBAAuB,GAAG,OAAO;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,SAASC,YAAW,CAC7C;AAEE,EAAA,QAAQ,GAAG,IAAIC,GAAG,EAAE;;AAEpB;AACAC,EAAAA,WAAWA,CAACC,MAAM,GAAG,IAAI,EACzB;AACE,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,MAAM,IAAI,EAAE,EAAE;AAC3BE,MAAAA,SAAS,EAAE,KAAK;AAChBC,MAAAA,UAAU,EAAE,IAAI;AAChBC,MAAAA,UAAU,EAAE;AACd,KAAC,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,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,4GAA4G,CAAC,CAAC;AAC3NT,SAAS,CAACI,cAAc,CAAC7I,YAAY,EAAE,kBAAkB,EAAE8I,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,+GAA+G,CAAC,CAAC;;;;"}
|
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { io, type } from '@carbonenginejs/runtime-utils/schema';
|
|
1
|
+
import { CjsSchema, io, type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
2
|
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
// Source: trinity/trinity/Resources/Tr2MaterialRes.h
|
|
5
|
+
// Schema: format-carbon resources/Tr2MaterialArea.json; maintained by runtime-resource.
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Associates one material-area metatype with its persisted parameter store.
|
|
9
|
-
*
|
|
10
|
-
* The record describes resource data and does not own shader bindings or
|
|
11
|
-
* backend material realization.
|
|
7
|
+
/**
|
|
8
|
+
* Associates one material-area metatype with its persisted parameter store.
|
|
9
|
+
*
|
|
10
|
+
* The record describes resource data and does not own shader bindings or
|
|
11
|
+
* backend material realization.
|
|
12
12
|
*/
|
|
13
|
-
let _Tr2MaterialArea;
|
|
14
13
|
class Tr2MaterialArea extends CjsModel {
|
|
15
|
-
static {
|
|
16
|
-
({
|
|
17
|
-
e: [_init_material, _init_extra_material, _init_metatype, _init_extra_metatype],
|
|
18
|
-
c: [_Tr2MaterialArea, _initClass]
|
|
19
|
-
} = _applyDecs2311(this, [type.define({
|
|
20
|
-
className: "Tr2MaterialArea",
|
|
21
|
-
family: "resources"
|
|
22
|
-
})], [[[io, io.persist, void 0, type.objectRef("Tr2MaterialParameterStore")], 16, "material"], [[io, io.persist, type, type.string], 16, "metatype"]], 0, void 0, CjsModel));
|
|
23
|
-
}
|
|
24
|
-
constructor(...args) {
|
|
25
|
-
super(...args);
|
|
26
|
-
_init_extra_metatype(this);
|
|
27
|
-
}
|
|
28
14
|
/** Persisted material parameter-store reference. */
|
|
29
|
-
material =
|
|
15
|
+
material = null;
|
|
30
16
|
|
|
31
17
|
/** Authored material-area metatype. */
|
|
32
|
-
metatype =
|
|
33
|
-
static {
|
|
34
|
-
_initClass();
|
|
35
|
-
}
|
|
18
|
+
metatype = "";
|
|
36
19
|
}
|
|
37
20
|
|
|
38
|
-
|
|
21
|
+
// Declared imperatively rather than with decorators, so this module stays
|
|
22
|
+
// plain ESM that loads from source without a transform. The decorator
|
|
23
|
+
// expressions are reused verbatim, so the registered metadata is identical.
|
|
24
|
+
// Statics belong in `methods`: decorateMethod targets the prototype and
|
|
25
|
+
// would register a static as an instance field.
|
|
26
|
+
CjsSchema.define(Tr2MaterialArea, {
|
|
27
|
+
className: "Tr2MaterialArea",
|
|
28
|
+
family: "resources"
|
|
29
|
+
});
|
|
30
|
+
CjsSchema.decorateField(Tr2MaterialArea, "material", io.persist, type.objectRef("Tr2MaterialParameterStore"));
|
|
31
|
+
CjsSchema.decorateField(Tr2MaterialArea, "metatype", io.persist, type.string);
|
|
32
|
+
|
|
33
|
+
export { Tr2MaterialArea };
|
|
39
34
|
//# sourceMappingURL=Tr2MaterialArea.js.map
|