@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2MaterialArea.js","sources":["../../../../src/resource/shader/Tr2MaterialArea.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2MaterialRes.h\r\n// Schema: format-carbon resources/Tr2MaterialArea.json; maintained by runtime-resource.\r\nimport { io, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\n * Associates one material-area metatype with its persisted parameter store.\n *\n * The record describes resource data and does not own shader bindings or\n * backend material realization.\n */\
|
|
1
|
+
{"version":3,"file":"Tr2MaterialArea.js","sources":["../../../../src/resource/shader/Tr2MaterialArea.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2MaterialRes.h\r\n// Schema: format-carbon resources/Tr2MaterialArea.json; maintained by runtime-resource.\r\nimport { CjsSchema, io, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\r\n * Associates one material-area metatype with its persisted parameter store.\r\n *\r\n * The record describes resource data and does not own shader bindings or\r\n * backend material realization.\r\n */\r\nexport class Tr2MaterialArea extends CjsModel\r\n{\r\n\r\n /** Persisted material parameter-store reference. */\r\n material = null;\r\n\r\n /** Authored material-area metatype. */\r\n metatype = \"\";\r\n\r\n}\r\n\r\n// Declared imperatively rather than with decorators, so this module stays\r\n// plain ESM that loads from source without a transform. The decorator\r\n// expressions are reused verbatim, so the registered metadata is identical.\r\n// Statics belong in `methods`: decorateMethod targets the prototype and\r\n// would register a static as an instance field.\r\nCjsSchema.define(Tr2MaterialArea, {\r\n className: \"Tr2MaterialArea\",\r\n family: \"resources\"\r\n});\r\nCjsSchema.decorateField(Tr2MaterialArea, \"material\", io.persist, type.objectRef(\"Tr2MaterialParameterStore\"));\r\nCjsSchema.decorateField(Tr2MaterialArea, \"metatype\", io.persist, type.string);\r\n"],"names":["Tr2MaterialArea","CjsModel","material","metatype","CjsSchema","define","className","family","decorateField","io","persist","type","objectRef","string"],"mappings":";;;AAAA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,eAAe,SAASC,QAAQ,CAC7C;AAEE;AACAC,EAAAA,QAAQ,GAAG,IAAI;;AAEf;AACAC,EAAAA,QAAQ,GAAG,EAAE;AAEf;;AAEA;AACA;AACA;AACA;AACA;AACAC,SAAS,CAACC,MAAM,CAACL,eAAe,EAAE;AAChCM,EAAAA,SAAS,EAAE,iBAAiB;AAC5BC,EAAAA,MAAM,EAAE;AACV,CAAC,CAAC;AACFH,SAAS,CAACI,aAAa,CAACR,eAAe,EAAE,UAAU,EAAES,EAAE,CAACC,OAAO,EAAEC,IAAI,CAACC,SAAS,CAAC,2BAA2B,CAAC,CAAC;AAC7GR,SAAS,CAACI,aAAa,CAACR,eAAe,EAAE,UAAU,EAAES,EAAE,CAACC,OAAO,EAAEC,IAAI,CAACE,MAAM,CAAC;;;;"}
|
|
@@ -1,36 +1,30 @@
|
|
|
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/Tr2MaterialMesh.json; maintained by runtime-resource.
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Holds the persisted material-area dictionary for one material mesh.
|
|
9
|
-
*
|
|
10
|
-
* Area lookup remains resource metadata; engines decide how the selected
|
|
11
|
-
* material becomes backend draw state.
|
|
7
|
+
/**
|
|
8
|
+
* Holds the persisted material-area dictionary for one material mesh.
|
|
9
|
+
*
|
|
10
|
+
* Area lookup remains resource metadata; engines decide how the selected
|
|
11
|
+
* material becomes backend draw state.
|
|
12
12
|
*/
|
|
13
|
-
let _Tr2MaterialMesh;
|
|
14
13
|
class Tr2MaterialMesh extends CjsModel {
|
|
15
|
-
static {
|
|
16
|
-
({
|
|
17
|
-
e: [_init_areas, _init_extra_areas],
|
|
18
|
-
c: [_Tr2MaterialMesh, _initClass]
|
|
19
|
-
} = _applyDecs2311(this, [type.define({
|
|
20
|
-
className: "Tr2MaterialMesh",
|
|
21
|
-
family: "resources"
|
|
22
|
-
})], [[[io, io.persist, void 0, type.objectRef("Tr2MaterialAreaDict")], 16, "areas"]], 0, void 0, CjsModel));
|
|
23
|
-
}
|
|
24
|
-
constructor(...args) {
|
|
25
|
-
super(...args);
|
|
26
|
-
_init_extra_areas(this);
|
|
27
|
-
}
|
|
28
14
|
/** Persisted dictionary of material areas. */
|
|
29
|
-
areas =
|
|
30
|
-
static {
|
|
31
|
-
_initClass();
|
|
32
|
-
}
|
|
15
|
+
areas = null;
|
|
33
16
|
}
|
|
34
17
|
|
|
35
|
-
|
|
18
|
+
// Declared imperatively rather than with decorators, so this module stays
|
|
19
|
+
// plain ESM that loads from source without a transform. The decorator
|
|
20
|
+
// expressions are reused verbatim, so the registered metadata is identical.
|
|
21
|
+
// Statics belong in `methods`: decorateMethod targets the prototype and
|
|
22
|
+
// would register a static as an instance field.
|
|
23
|
+
CjsSchema.define(Tr2MaterialMesh, {
|
|
24
|
+
className: "Tr2MaterialMesh",
|
|
25
|
+
family: "resources"
|
|
26
|
+
});
|
|
27
|
+
CjsSchema.decorateField(Tr2MaterialMesh, "areas", io.persist, type.objectRef("Tr2MaterialAreaDict"));
|
|
28
|
+
|
|
29
|
+
export { Tr2MaterialMesh };
|
|
36
30
|
//# sourceMappingURL=Tr2MaterialMesh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2MaterialMesh.js","sources":["../../../../src/resource/shader/Tr2MaterialMesh.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2MaterialRes.h\r\n// Schema: format-carbon resources/Tr2MaterialMesh.json; maintained by runtime-resource.\r\nimport { io, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\n * Holds the persisted material-area dictionary for one material mesh.\n *\n * Area lookup remains resource metadata; engines decide how the selected\n * material becomes backend draw state.\n */\
|
|
1
|
+
{"version":3,"file":"Tr2MaterialMesh.js","sources":["../../../../src/resource/shader/Tr2MaterialMesh.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2MaterialRes.h\r\n// Schema: format-carbon resources/Tr2MaterialMesh.json; maintained by runtime-resource.\r\nimport { CjsSchema, io, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\r\n * Holds the persisted material-area dictionary for one material mesh.\r\n *\r\n * Area lookup remains resource metadata; engines decide how the selected\r\n * material becomes backend draw state.\r\n */\r\nexport class Tr2MaterialMesh extends CjsModel\r\n{\r\n\r\n /** Persisted dictionary of material areas. */\r\n areas = null;\r\n\r\n}\r\n\r\n// Declared imperatively rather than with decorators, so this module stays\r\n// plain ESM that loads from source without a transform. The decorator\r\n// expressions are reused verbatim, so the registered metadata is identical.\r\n// Statics belong in `methods`: decorateMethod targets the prototype and\r\n// would register a static as an instance field.\r\nCjsSchema.define(Tr2MaterialMesh, {\r\n className: \"Tr2MaterialMesh\",\r\n family: \"resources\"\r\n});\r\nCjsSchema.decorateField(Tr2MaterialMesh, \"areas\", io.persist, type.objectRef(\"Tr2MaterialAreaDict\"));\r\n"],"names":["Tr2MaterialMesh","CjsModel","areas","CjsSchema","define","className","family","decorateField","io","persist","type","objectRef"],"mappings":";;;AAAA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,eAAe,SAASC,QAAQ,CAC7C;AAEE;AACAC,EAAAA,KAAK,GAAG,IAAI;AAEd;;AAEA;AACA;AACA;AACA;AACA;AACAC,SAAS,CAACC,MAAM,CAACJ,eAAe,EAAE;AAChCK,EAAAA,SAAS,EAAE,iBAAiB;AAC5BC,EAAAA,MAAM,EAAE;AACV,CAAC,CAAC;AACFH,SAAS,CAACI,aAAa,CAACP,eAAe,EAAE,OAAO,EAAEQ,EAAE,CAACC,OAAO,EAAEC,IAAI,CAACC,SAAS,CAAC,qBAAqB,CAAC,CAAC;;;;"}
|
|
@@ -1,40 +1,35 @@
|
|
|
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/Tr2MaterialRes.json; maintained by runtime-resource.
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Root persisted material record containing its authored name and material
|
|
9
|
-
* mesh dictionary.
|
|
10
|
-
*
|
|
11
|
-
* It owns the serializable material description, not device shaders,
|
|
12
|
-
* descriptor bindings, or pipelines.
|
|
7
|
+
/**
|
|
8
|
+
* Root persisted material record containing its authored name and material
|
|
9
|
+
* mesh dictionary.
|
|
10
|
+
*
|
|
11
|
+
* It owns the serializable material description, not device shaders,
|
|
12
|
+
* descriptor bindings, or pipelines.
|
|
13
13
|
*/
|
|
14
|
-
let _Tr2MaterialRes;
|
|
15
14
|
class Tr2MaterialRes extends CjsModel {
|
|
16
|
-
static {
|
|
17
|
-
({
|
|
18
|
-
e: [_init_meshes, _init_extra_meshes, _init_name, _init_extra_name],
|
|
19
|
-
c: [_Tr2MaterialRes, _initClass]
|
|
20
|
-
} = _applyDecs2311(this, [type.define({
|
|
21
|
-
className: "Tr2MaterialRes",
|
|
22
|
-
family: "resources"
|
|
23
|
-
})], [[[io, io.persist, void 0, type.objectRef("Tr2MaterialMeshDict")], 16, "meshes"], [[io, io.persist, type, type.string], 16, "name"]], 0, void 0, CjsModel));
|
|
24
|
-
}
|
|
25
|
-
constructor(...args) {
|
|
26
|
-
super(...args);
|
|
27
|
-
_init_extra_name(this);
|
|
28
|
-
}
|
|
29
15
|
/** Persisted dictionary of material meshes. */
|
|
30
|
-
meshes =
|
|
16
|
+
meshes = null;
|
|
31
17
|
|
|
32
18
|
/** Authored material name. */
|
|
33
|
-
name =
|
|
34
|
-
static {
|
|
35
|
-
_initClass();
|
|
36
|
-
}
|
|
19
|
+
name = "";
|
|
37
20
|
}
|
|
38
21
|
|
|
39
|
-
|
|
22
|
+
// Declared imperatively rather than with decorators, so this module stays
|
|
23
|
+
// plain ESM that loads from source without a transform. The decorator
|
|
24
|
+
// expressions are reused verbatim, so the registered metadata is identical.
|
|
25
|
+
// Statics belong in `methods`: decorateMethod targets the prototype and
|
|
26
|
+
// would register a static as an instance field.
|
|
27
|
+
CjsSchema.define(Tr2MaterialRes, {
|
|
28
|
+
className: "Tr2MaterialRes",
|
|
29
|
+
family: "resources"
|
|
30
|
+
});
|
|
31
|
+
CjsSchema.decorateField(Tr2MaterialRes, "meshes", io.persist, type.objectRef("Tr2MaterialMeshDict"));
|
|
32
|
+
CjsSchema.decorateField(Tr2MaterialRes, "name", io.persist, type.string);
|
|
33
|
+
|
|
34
|
+
export { Tr2MaterialRes };
|
|
40
35
|
//# sourceMappingURL=Tr2MaterialRes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2MaterialRes.js","sources":["../../../../src/resource/shader/Tr2MaterialRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2MaterialRes.h\r\n// Schema: format-carbon resources/Tr2MaterialRes.json; maintained by runtime-resource.\r\nimport { io, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\n * Root persisted material record containing its authored name and material\n * mesh dictionary.\n *\n * It owns the serializable material description, not device shaders,\n * descriptor bindings, or pipelines.\n */\
|
|
1
|
+
{"version":3,"file":"Tr2MaterialRes.js","sources":["../../../../src/resource/shader/Tr2MaterialRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2MaterialRes.h\r\n// Schema: format-carbon resources/Tr2MaterialRes.json; maintained by runtime-resource.\r\nimport { CjsSchema, io, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\r\n * Root persisted material record containing its authored name and material\r\n * mesh dictionary.\r\n *\r\n * It owns the serializable material description, not device shaders,\r\n * descriptor bindings, or pipelines.\r\n */\r\nexport class Tr2MaterialRes extends CjsModel\r\n{\r\n\r\n /** Persisted dictionary of material meshes. */\r\n meshes = null;\r\n\r\n /** Authored material name. */\r\n name = \"\";\r\n\r\n}\r\n\r\n// Declared imperatively rather than with decorators, so this module stays\r\n// plain ESM that loads from source without a transform. The decorator\r\n// expressions are reused verbatim, so the registered metadata is identical.\r\n// Statics belong in `methods`: decorateMethod targets the prototype and\r\n// would register a static as an instance field.\r\nCjsSchema.define(Tr2MaterialRes, {\r\n className: \"Tr2MaterialRes\",\r\n family: \"resources\"\r\n});\r\nCjsSchema.decorateField(Tr2MaterialRes, \"meshes\", io.persist, type.objectRef(\"Tr2MaterialMeshDict\"));\r\nCjsSchema.decorateField(Tr2MaterialRes, \"name\", io.persist, type.string);\r\n"],"names":["Tr2MaterialRes","CjsModel","meshes","name","CjsSchema","define","className","family","decorateField","io","persist","type","objectRef","string"],"mappings":";;;AAAA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,SAASC,QAAQ,CAC5C;AAEE;AACAC,EAAAA,MAAM,GAAG,IAAI;;AAEb;AACAC,EAAAA,IAAI,GAAG,EAAE;AAEX;;AAEA;AACA;AACA;AACA;AACA;AACAC,SAAS,CAACC,MAAM,CAACL,cAAc,EAAE;AAC/BM,EAAAA,SAAS,EAAE,gBAAgB;AAC3BC,EAAAA,MAAM,EAAE;AACV,CAAC,CAAC;AACFH,SAAS,CAACI,aAAa,CAACR,cAAc,EAAE,QAAQ,EAAES,EAAE,CAACC,OAAO,EAAEC,IAAI,CAACC,SAAS,CAAC,qBAAqB,CAAC,CAAC;AACpGR,SAAS,CAACI,aAAa,CAACR,cAAc,EAAE,MAAM,EAAES,EAAE,CAACC,OAAO,EAAEC,IAAI,CAACE,MAAM,CAAC;;;;"}
|
|
@@ -1,36 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type, carbon, impl } from '@carbonenginejs/runtime-utils/schema';
|
|
1
|
+
import { CjsSchema, type, carbon, impl } from '@carbonenginejs/runtime-utils/schema';
|
|
3
2
|
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
|
-
import {
|
|
5
|
-
import { Tr2EffectDescription
|
|
3
|
+
import { validateEffectBodyReflection, isEffectBodyReflection } from '../../formats/hlsl/core/portableReflection.js';
|
|
4
|
+
import { Tr2EffectDescription } from './reflection/Tr2EffectDescription.js';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
// Source: trinity/trinity/Shader/Tr2Shader.h
|
|
7
|
+
// Source: trinity/trinity/Shader/Tr2Shader.cpp
|
|
8
8
|
|
|
9
9
|
/** GPU-free selected shader and its complete source reflection graph. */
|
|
10
|
-
let _Tr2Shader;
|
|
11
10
|
class Tr2Shader extends CjsModel {
|
|
12
|
-
static {
|
|
13
|
-
({
|
|
14
|
-
e: [_init_sortValue, _init_extra_sortValue, _init_effect, _init_extra_effect, _init_hasVertexBufferAccessInRtShadow, _init_extra_hasVertexBufferAccessInRtShadow, _initProto, _initStatic],
|
|
15
|
-
c: [_Tr2Shader, _initClass]
|
|
16
|
-
} = _applyDecs2311(this, [type.define({
|
|
17
|
-
className: "Tr2Shader",
|
|
18
|
-
family: "shader"
|
|
19
|
-
})], [[[type, type.uint32], 16, "sortValue"], [type.rawStruct("Tr2EffectDescription"), 0, "effect"], [[type, type.boolean], 16, "hasVertexBufferAccessInRtShadow"], [[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Carbon returns success through a bool plus output index; CarbonEngineJS returns the index directly or -1 while preserving exact name lookup.")], 18, "GetTechniqueIndex"], [[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Carbon assumes an already-validated technique index; CarbonEngineJS safely returns zero for an unavailable index.")], 18, "GetPassCount"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetConstant"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetResource"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetParameterAnnotations"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetSortValue"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetEffectDescription"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetEffect"], [[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Carbon assumes an already-validated technique index; CarbonEngineJS safely returns zero for an unavailable index.")], 18, "GetShaderTypeMask"], [[carbon, carbon.method, impl, impl.adapted, void 0, impl.reason("Carbon packs renderer handles assigned while reading; the device-free graph leaves the sort key zero until an engine assigns valid handles.")], 18, "ProcessEffect"], [[carbon, carbon.method, impl, impl.implemented], 18, "HasVertexBufferAccessInRtShadow"], [[impl, impl.custom, void 0, impl.reason("Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the validated browser-safe portable-reflection contract after format parsing.")], 26, "fromPortable"], [[impl, impl.custom, void 0, impl.reason("Carbon has no portable-reflection document API; CarbonEngineJS validates that browser-safe interchange contract before hydration.")], 26, "isPortableReflection"], [[impl, impl.custom, void 0, impl.reason("Carbon performs this traversal inline; CarbonEngineJS exposes a collection-shape-neutral helper for the canonical device-free graph.")], 26, "findStageValue"], [[impl, impl.custom, void 0, impl.reason("Carbon performs pass-stage traversal inline; CarbonEngineJS centralizes the same ordering for device-free reflection lookup.")], 26, "iterateStages"], [[impl, impl.custom, void 0, impl.reason("Carbon collections have fixed native types; CarbonEngineJS accepts canonical maps plus JSON-compatible collection shapes.")], 26, "findNamedCollectionValue"], [[impl, impl.custom, void 0, impl.reason("Carbon uses one native annotation map; CarbonEngineJS accepts the canonical map and JSON-compatible serialized forms.")], 26, "findAnnotationSet"]], 0, void 0, CjsModel));
|
|
20
|
-
_initStatic(this);
|
|
21
|
-
}
|
|
22
|
-
constructor(...args) {
|
|
23
|
-
super(...args);
|
|
24
|
-
_init_extra_hasVertexBufferAccessInRtShadow(this);
|
|
25
|
-
}
|
|
26
11
|
/** m_sortValue (unsigned int) */
|
|
27
|
-
sortValue =
|
|
12
|
+
sortValue = 0;
|
|
28
13
|
|
|
29
14
|
/** m_effect (Tr2EffectDescription) */
|
|
30
|
-
effect =
|
|
15
|
+
effect = new Tr2EffectDescription();
|
|
31
16
|
|
|
32
17
|
/** m_hasVertexBufferAccessInRtShadow (bool) */
|
|
33
|
-
hasVertexBufferAccessInRtShadow =
|
|
18
|
+
hasVertexBufferAccessInRtShadow = false;
|
|
34
19
|
|
|
35
20
|
/**
|
|
36
21
|
* Index of the named technique; 0 for Carbon's empty-string any-technique
|
|
@@ -57,7 +42,7 @@ class Tr2Shader extends CjsModel {
|
|
|
57
42
|
* the description is metadata, not a bound GPU slot.
|
|
58
43
|
*/
|
|
59
44
|
GetConstant(name) {
|
|
60
|
-
return
|
|
45
|
+
return Tr2Shader.findStageValue(this.effect, name, "constants");
|
|
61
46
|
}
|
|
62
47
|
|
|
63
48
|
/**
|
|
@@ -65,12 +50,12 @@ class Tr2Shader extends CjsModel {
|
|
|
65
50
|
* UAVs; null when neither has it.
|
|
66
51
|
*/
|
|
67
52
|
GetResource(name) {
|
|
68
|
-
for (const stage of
|
|
69
|
-
const resource =
|
|
53
|
+
for (const stage of Tr2Shader.iterateStages(this.effect)) {
|
|
54
|
+
const resource = Tr2Shader.findNamedCollectionValue(stage?.resources, name);
|
|
70
55
|
if (resource) {
|
|
71
56
|
return resource;
|
|
72
57
|
}
|
|
73
|
-
const uav =
|
|
58
|
+
const uav = Tr2Shader.findNamedCollectionValue(stage?.uavs, name);
|
|
74
59
|
if (uav) {
|
|
75
60
|
return uav;
|
|
76
61
|
}
|
|
@@ -83,7 +68,7 @@ class Tr2Shader extends CjsModel {
|
|
|
83
68
|
* depends on the reflection source.
|
|
84
69
|
*/
|
|
85
70
|
GetParameterAnnotations(parameterName) {
|
|
86
|
-
return
|
|
71
|
+
return Tr2Shader.findAnnotationSet(this.effect?.annotations, parameterName);
|
|
87
72
|
}
|
|
88
73
|
|
|
89
74
|
/** The packed draw-sort key; 0 until ProcessEffect has run. */
|
|
@@ -143,10 +128,10 @@ class Tr2Shader extends CjsModel {
|
|
|
143
128
|
*/
|
|
144
129
|
static from(values = {}, options = {}) {
|
|
145
130
|
let normalized = values;
|
|
146
|
-
if (values?.effect && !(values.effect instanceof
|
|
131
|
+
if (values?.effect && !(values.effect instanceof Tr2EffectDescription)) {
|
|
147
132
|
normalized = {
|
|
148
133
|
...values,
|
|
149
|
-
effect:
|
|
134
|
+
effect: Tr2EffectDescription.from(values.effect, options)
|
|
150
135
|
};
|
|
151
136
|
}
|
|
152
137
|
const shader = super.from(normalized, options);
|
|
@@ -164,9 +149,9 @@ class Tr2Shader extends CjsModel {
|
|
|
164
149
|
* @returns {Tr2Shader} Canonical selected shader.
|
|
165
150
|
*/
|
|
166
151
|
static fromPortable(portable) {
|
|
167
|
-
|
|
152
|
+
validateEffectBodyReflection(portable);
|
|
168
153
|
const shader = new this();
|
|
169
|
-
shader.effect =
|
|
154
|
+
shader.effect = Tr2EffectDescription.fromPortable(portable.effect);
|
|
170
155
|
shader.ProcessEffect();
|
|
171
156
|
return shader;
|
|
172
157
|
}
|
|
@@ -178,13 +163,13 @@ class Tr2Shader extends CjsModel {
|
|
|
178
163
|
* @returns {boolean} Whether the portable envelope is supported.
|
|
179
164
|
*/
|
|
180
165
|
static isPortableReflection(value) {
|
|
181
|
-
return
|
|
166
|
+
return isEffectBodyReflection(value);
|
|
182
167
|
}
|
|
183
168
|
|
|
184
169
|
/** Find one named reflection entry across every stage. */
|
|
185
170
|
static findStageValue(effect, name, key) {
|
|
186
|
-
for (const stage of
|
|
187
|
-
const found =
|
|
171
|
+
for (const stage of Tr2Shader.iterateStages(effect)) {
|
|
172
|
+
const found = Tr2Shader.findNamedCollectionValue(stage?.[key], name);
|
|
188
173
|
if (found) {
|
|
189
174
|
return found;
|
|
190
175
|
}
|
|
@@ -241,10 +226,31 @@ class Tr2Shader extends CjsModel {
|
|
|
241
226
|
}
|
|
242
227
|
return annotations[parameterName] ?? null;
|
|
243
228
|
}
|
|
244
|
-
static {
|
|
245
|
-
_initClass();
|
|
246
|
-
}
|
|
247
229
|
}
|
|
248
230
|
|
|
249
|
-
|
|
231
|
+
// Declared imperatively rather than with decorators, so this module stays
|
|
232
|
+
// plain ESM that loads from source without a transform. The decorator
|
|
233
|
+
// expressions are reused verbatim, so the registered metadata is identical.
|
|
234
|
+
// Statics belong in `methods`: decorateMethod targets the prototype and
|
|
235
|
+
// would register a static as an instance field.
|
|
236
|
+
CjsSchema.define(Tr2Shader, {
|
|
237
|
+
className: "Tr2Shader",
|
|
238
|
+
family: "shader"
|
|
239
|
+
});
|
|
240
|
+
CjsSchema.decorateField(Tr2Shader, "sortValue", type.uint32);
|
|
241
|
+
CjsSchema.decorateField(Tr2Shader, "effect", type.rawStruct("Tr2EffectDescription"));
|
|
242
|
+
CjsSchema.decorateField(Tr2Shader, "hasVertexBufferAccessInRtShadow", type.boolean);
|
|
243
|
+
CjsSchema.decorateMethod(Tr2Shader, "GetTechniqueIndex", carbon.method, impl.adapted, impl.reason("Carbon returns success through a bool plus output index; CarbonEngineJS returns the index directly or -1 while preserving exact name lookup."));
|
|
244
|
+
CjsSchema.decorateMethod(Tr2Shader, "GetPassCount", carbon.method, impl.adapted, impl.reason("Carbon assumes an already-validated technique index; CarbonEngineJS safely returns zero for an unavailable index."));
|
|
245
|
+
CjsSchema.decorateMethod(Tr2Shader, "GetConstant", carbon.method, impl.implemented);
|
|
246
|
+
CjsSchema.decorateMethod(Tr2Shader, "GetResource", carbon.method, impl.implemented);
|
|
247
|
+
CjsSchema.decorateMethod(Tr2Shader, "GetParameterAnnotations", carbon.method, impl.implemented);
|
|
248
|
+
CjsSchema.decorateMethod(Tr2Shader, "GetSortValue", carbon.method, impl.implemented);
|
|
249
|
+
CjsSchema.decorateMethod(Tr2Shader, "GetEffectDescription", carbon.method, impl.implemented);
|
|
250
|
+
CjsSchema.decorateMethod(Tr2Shader, "GetEffect", carbon.method, impl.implemented);
|
|
251
|
+
CjsSchema.decorateMethod(Tr2Shader, "GetShaderTypeMask", carbon.method, impl.adapted, impl.reason("Carbon assumes an already-validated technique index; CarbonEngineJS safely returns zero for an unavailable index."));
|
|
252
|
+
CjsSchema.decorateMethod(Tr2Shader, "ProcessEffect", carbon.method, impl.adapted, impl.reason("Carbon packs renderer handles assigned while reading; the device-free graph leaves the sort key zero until an engine assigns valid handles."));
|
|
253
|
+
CjsSchema.decorateMethod(Tr2Shader, "HasVertexBufferAccessInRtShadow", carbon.method, impl.implemented);
|
|
254
|
+
|
|
255
|
+
export { Tr2Shader };
|
|
250
256
|
//# sourceMappingURL=Tr2Shader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2Shader.js","sources":["../../../../src/resource/shader/Tr2Shader.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2Shader.h\n// Source: trinity/trinity/Shader/Tr2Shader.cpp\nimport { carbon, impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n isPortableEffectReflection,\n validatePortableEffectReflection\n} from \"./portableValidation.js\";\nimport { Tr2EffectDescription } from \"./reflection/Tr2EffectDescription.js\";\n\n/** GPU-free selected shader and its complete source reflection graph. */\n@type.define({ className: \"Tr2Shader\", family: \"shader\" })\nexport class Tr2Shader extends CjsModel\n{\n\n /** m_sortValue (unsigned int) */\n @type.uint32\n sortValue = 0;\n\n /** m_effect (Tr2EffectDescription) */\n @type.rawStruct(\"Tr2EffectDescription\")\n effect = new Tr2EffectDescription();\n\n /** m_hasVertexBufferAccessInRtShadow (bool) */\n @type.boolean\n hasVertexBufferAccessInRtShadow = false;\n\n /**\n * Index of the named technique; 0 for Carbon's empty-string any-technique\n * sentinel and -1 when the shader has no techniques or the name is unknown.\n */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Carbon returns success through a bool plus output index; CarbonEngineJS returns the index directly or -1 while preserving exact name lookup.\")\n GetTechniqueIndex(name = \"Main\")\n {\n const techniques = this.effect?.techniques ?? [];\n if (!techniques.length)\n {\n return -1;\n }\n if (name === \"\")\n {\n return 0;\n }\n return techniques.findIndex(technique => technique?.name === name);\n }\n\n /** Number of passes in a technique; 0 for an unknown index. */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Carbon assumes an already-validated technique index; CarbonEngineJS safely returns zero for an unavailable index.\")\n GetPassCount(techniqueIndex = 0)\n {\n return this.effect?.techniques?.[techniqueIndex]?.passes?.length ?? 0;\n }\n\n /**\n * The reflected constant of this name from any stage of any pass, or null;\n * the description is metadata, not a bound GPU slot.\n */\n @carbon.method\n @impl.implemented\n GetConstant(name)\n {\n return Tr2Shader.findStageValue(this.effect, name, \"constants\");\n }\n\n /**\n * The reflected resource of this name, searching stage resources before\n * UAVs; null when neither has it.\n */\n @carbon.method\n @impl.implemented\n GetResource(name)\n {\n for (const stage of Tr2Shader.iterateStages(this.effect))\n {\n const resource = Tr2Shader.findNamedCollectionValue(\n stage?.resources,\n name\n );\n if (resource)\n {\n return resource;\n }\n const uav = Tr2Shader.findNamedCollectionValue(stage?.uavs, name);\n if (uav)\n {\n return uav;\n }\n }\n return null;\n }\n\n /**\n * The annotation set authored for a parameter name, or null; the shape\n * depends on the reflection source.\n */\n @carbon.method\n @impl.implemented\n GetParameterAnnotations(parameterName)\n {\n return Tr2Shader.findAnnotationSet(\n this.effect?.annotations,\n parameterName\n );\n }\n\n /** The packed draw-sort key; 0 until ProcessEffect has run. */\n @carbon.method\n @impl.implemented\n GetSortValue()\n {\n return this.sortValue;\n }\n\n /** The reflected effect description, by reference rather than copy. */\n @carbon.method\n @impl.implemented\n GetEffectDescription()\n {\n return this.effect;\n }\n\n /** The same object GetEffectDescription returns. */\n @carbon.method\n @impl.implemented\n GetEffect()\n {\n return this.effect;\n }\n\n /** The technique's bitmask of shader stages, or 0 for an unknown index. */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Carbon assumes an already-validated technique index; CarbonEngineJS safely returns zero for an unavailable index.\")\n GetShaderTypeMask(techniqueIndex = 0)\n {\n return Number(\n this.effect?.techniques?.[techniqueIndex]?.shaderTypeMask ?? 0\n );\n }\n\n /**\n * Pack the first technique/pass's renderer handles into Carbon's sort key.\n * A device-free source graph retains 0 while its handles remain invalid.\n */\n @carbon.method\n @impl.adapted\n @impl.reason(\"Carbon packs renderer handles assigned while reading; the device-free graph leaves the sort key zero until an engine assigns valid handles.\")\n ProcessEffect()\n {\n this.sortValue = 0;\n const pass = this.effect?.techniques?.[0]?.passes?.[0];\n if (!pass)\n {\n return;\n }\n const stages = pass.stageInputs ?? [];\n const pixelHandle = Number(\n stages[1]?.shader ?? stages[1]?.m_shader ?? 0xffffffff\n );\n const vertexHandle = Number(\n stages[0]?.shader ?? stages[0]?.m_shader ?? 0xffffffff\n );\n if (pixelHandle === 0xffffffff || vertexHandle === 0xffffffff)\n {\n return;\n }\n const pixelShader = pixelHandle & 0x3ff;\n const vertexShader = vertexHandle & 0x3ff;\n const renderStates = Number(pass.renderStates ?? 0) & 0x3ff;\n const passCount = Number(\n this.effect?.techniques?.[0]?.passes?.length ?? 0\n ) & 0x3;\n this.sortValue = (\n (passCount << 30)\n | (pixelShader << 20)\n | (vertexShader << 10)\n | renderStates\n ) >>> 0;\n }\n\n /** Whether this shader accesses vertex buffers in RT shadow mode. */\n @carbon.method\n @impl.implemented\n HasVertexBufferAccessInRtShadow()\n {\n return this.hasVertexBufferAccessInRtShadow;\n }\n\n /**\n * Construct a canonical shader graph from JS/JSON model values.\n *\n * @param {object} values Canonical model values.\n * @param {object} options CjsModel import options.\n * @returns {Tr2Shader} Hydrated shader graph.\n */\n static from(values = {}, options = {})\n {\n let normalized = values;\n if (values?.effect\n && !(values.effect instanceof Tr2EffectDescription))\n {\n normalized = {\n ...values,\n effect: Tr2EffectDescription.from(values.effect, options)\n };\n }\n const shader = super.from(normalized, options);\n if (!Object.hasOwn(values ?? {}, \"sortValue\"))\n {\n shader.ProcessEffect();\n }\n return shader;\n }\n\n /**\n * Build one canonical GPU-free shader from complete portable reflection.\n * Each child reflection class owns conversion of its own portable record.\n *\n * @param {object} portable Portable effect-body reflection.\n * @returns {Tr2Shader} Canonical selected shader.\n */\n @impl.custom\n @impl.reason(\"Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the validated browser-safe portable-reflection contract after format parsing.\")\n static fromPortable(portable)\n {\n validatePortableEffectReflection(portable);\n\n const shader = new this();\n shader.effect = Tr2EffectDescription.fromPortable(portable.effect);\n shader.ProcessEffect();\n return shader;\n }\n\n /**\n * Whether a value has the supported complete portable-reflection envelope.\n *\n * @param {*} value Candidate value.\n * @returns {boolean} Whether the portable envelope is supported.\n */\n @impl.custom\n @impl.reason(\"Carbon has no portable-reflection document API; CarbonEngineJS validates that browser-safe interchange contract before hydration.\")\n static isPortableReflection(value)\n {\n return isPortableEffectReflection(value);\n }\n\n /** Find one named reflection entry across every stage. */\n @impl.custom\n @impl.reason(\"Carbon performs this traversal inline; CarbonEngineJS exposes a collection-shape-neutral helper for the canonical device-free graph.\")\n static findStageValue(effect, name, key)\n {\n for (const stage of Tr2Shader.iterateStages(effect))\n {\n const found = Tr2Shader.findNamedCollectionValue(stage?.[key], name);\n if (found)\n {\n return found;\n }\n }\n return null;\n }\n\n /** Flatten pass stage inputs in Carbon lookup order. */\n @impl.custom\n @impl.reason(\"Carbon performs pass-stage traversal inline; CarbonEngineJS centralizes the same ordering for device-free reflection lookup.\")\n static iterateStages(effect)\n {\n const stages = [];\n for (const technique of effect?.techniques ?? [])\n {\n for (const pass of technique?.passes ?? [])\n {\n stages.push(...pass?.stageInputs ?? []);\n }\n }\n return stages;\n }\n\n /** Find a named entry in an array, Map, or plain object collection. */\n @impl.custom\n @impl.reason(\"Carbon collections have fixed native types; CarbonEngineJS accepts canonical maps plus JSON-compatible collection shapes.\")\n static findNamedCollectionValue(values, name)\n {\n if (!values)\n {\n return null;\n }\n if (Array.isArray(values))\n {\n return values.find(\n value => value?.name === name || value?.[1]?.name === name\n ) ?? null;\n }\n if (values instanceof Map)\n {\n for (const value of values.values())\n {\n if (value?.name === name)\n {\n return value;\n }\n }\n return null;\n }\n for (const value of Object.values(values))\n {\n if (value?.name === name)\n {\n return value;\n }\n }\n return null;\n }\n\n /** Resolve a parameter's annotations from a Map, array, or plain object. */\n @impl.custom\n @impl.reason(\"Carbon uses one native annotation map; CarbonEngineJS accepts the canonical map and JSON-compatible serialized forms.\")\n static findAnnotationSet(annotations, parameterName)\n {\n if (!annotations)\n {\n return null;\n }\n if (annotations instanceof Map)\n {\n return annotations.get(parameterName) ?? null;\n }\n if (Array.isArray(annotations))\n {\n const entry = annotations.find(\n item => item?.name === parameterName\n || item?.[0] === parameterName\n );\n return entry?.annotations ?? entry?.value ?? entry?.[1] ?? null;\n }\n return annotations[parameterName] ?? null;\n }\n\n}\n"],"names":["_Tr2Shader","Tr2Shader","CjsModel","e","_init_sortValue","_init_extra_sortValue","_init_effect","_init_extra_effect","_init_hasVertexBufferAccessInRtShadow","_init_extra_hasVertexBufferAccessInRtShadow","_initProto","_initStatic","c","_initClass","_applyDecs","type","define","className","family","uint32","rawStruct","boolean","carbon","method","impl","adapted","reason","implemented","custom","constructor","args","sortValue","effect","Tr2EffectDescription","hasVertexBufferAccessInRtShadow","GetTechniqueIndex","name","techniques","length","findIndex","technique","GetPassCount","techniqueIndex","passes","GetConstant","findStageValue","GetResource","stage","iterateStages","resource","findNamedCollectionValue","resources","uav","uavs","GetParameterAnnotations","parameterName","findAnnotationSet","annotations","GetSortValue","GetEffectDescription","GetEffect","GetShaderTypeMask","Number","shaderTypeMask","ProcessEffect","pass","stages","stageInputs","pixelHandle","shader","m_shader","vertexHandle","pixelShader","vertexShader","renderStates","passCount","HasVertexBufferAccessInRtShadow","from","values","options","normalized","Object","hasOwn","fromPortable","portable","validatePortableEffectReflection","isPortableReflection","value","isPortableEffectReflection","key","found","push","Array","isArray","find","Map","get","entry","item"],"mappings":";;;;;;;;AAUA;AAAA,IAAAA;AACA,MAAAC,SAAA,SAC+BC,QAAQ,CACvC;AAAA,EAAA;AAAA,IAAA,CAAA;AAAAC,MAAAA,CAAA,EAAA,CAAAC,eAAA,EAAAC,qBAAA,EAAAC,YAAA,EAAAC,kBAAA,EAAAC,qCAAA,EAAAC,2CAAA,EAAAC,UAAA,EAAAC,WAAA,CAAA;MAAAC,CAAA,EAAA,CAAAZ,UAAA,EAAAa,UAAA;AAAA,KAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,MAAAA,SAAS,EAAE,WAAW;A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QAAA,IAAIS,KAAK,EAAEnD,IAAI,KAAKA,IAAI,EACxB;AACE,UAAA,OAAOmD,KAAK;AACd,QAAA;AACF,MAAA;AACA,MAAA,OAAO,IAAI;AACb,IAAA;IACA,KAAK,MAAMA,KAAK,IAAIN,MAAM,CAACH,MAAM,CAACA,MAAM,CAAC,EACzC;AACE,MAAA,IAAIS,KAAK,EAAEnD,IAAI,KAAKA,IAAI,EACxB;AACE,QAAA,OAAOmD,KAAK;AACd,MAAA;AACF,IAAA;AACA,IAAA,OAAO,IAAI;AACb,EAAA;;AAEA;AACA,EAAA,OAEO/B,iBAAiBA,CAACC,WAAW,EAAEF,aAAa,EACnD;IACE,IAAI,CAACE,WAAW,EAChB;AACE,MAAA,OAAO,IAAI;AACb,IAAA;IACA,IAAIA,WAAW,YAAYsC,GAAG,EAC9B;AACE,MAAA,OAAOtC,WAAW,CAACuC,GAAG,CAACzC,aAAa,CAAC,IAAI,IAAI;AAC/C,IAAA;AACA,IAAA,IAAIqC,KAAK,CAACC,OAAO,CAACpC,WAAW,CAAC,EAC9B;MACE,MAAMwC,KAAK,GAAGxC,WAAW,CAACqC,IAAI,CAC5BI,IAAI,IAAIA,IAAI,EAAE9D,IAAI,KAAKmB,aAAa,IAC/B2C,IAAI,GAAG,CAAC,CAAC,KAAK3C,aACrB,CAAC;AACD,MAAA,OAAO0C,KAAK,EAAExC,WAAW,IAAIwC,KAAK,EAAEV,KAAK,IAAIU,KAAK,GAAG,CAAC,CAAC,IAAI,IAAI;AACjE,IAAA;AACA,IAAA,OAAOxC,WAAW,CAACF,aAAa,CAAC,IAAI,IAAI;AAC3C,EAAA;AAAC,EAAA;IAAA1C,UAAA,EAAA;AAAA;AAEH;;;;"}
|
|
1
|
+
{"version":3,"file":"Tr2Shader.js","sources":["../../../../src/resource/shader/Tr2Shader.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2Shader.h\n// Source: trinity/trinity/Shader/Tr2Shader.cpp\nimport { CjsSchema, carbon, impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n isEffectBodyReflection,\n validateEffectBodyReflection\n} from \"../../formats/hlsl/portable.js\";\nimport { Tr2EffectDescription } from \"./reflection/Tr2EffectDescription.js\";\n\n/** GPU-free selected shader and its complete source reflection graph. */\nexport class Tr2Shader extends CjsModel\n{\n\n /** m_sortValue (unsigned int) */\n sortValue = 0;\n\n /** m_effect (Tr2EffectDescription) */\n effect = new Tr2EffectDescription();\n\n /** m_hasVertexBufferAccessInRtShadow (bool) */\n hasVertexBufferAccessInRtShadow = false;\n\n /**\n * Index of the named technique; 0 for Carbon's empty-string any-technique\n * sentinel and -1 when the shader has no techniques or the name is unknown.\n */\n GetTechniqueIndex(name = \"Main\")\n {\n const techniques = this.effect?.techniques ?? [];\n if (!techniques.length)\n {\n return -1;\n }\n if (name === \"\")\n {\n return 0;\n }\n return techniques.findIndex(technique => technique?.name === name);\n }\n\n /** Number of passes in a technique; 0 for an unknown index. */\n GetPassCount(techniqueIndex = 0)\n {\n return this.effect?.techniques?.[techniqueIndex]?.passes?.length ?? 0;\n }\n\n /**\n * The reflected constant of this name from any stage of any pass, or null;\n * the description is metadata, not a bound GPU slot.\n */\n GetConstant(name)\n {\n return Tr2Shader.findStageValue(this.effect, name, \"constants\");\n }\n\n /**\n * The reflected resource of this name, searching stage resources before\n * UAVs; null when neither has it.\n */\n GetResource(name)\n {\n for (const stage of Tr2Shader.iterateStages(this.effect))\n {\n const resource = Tr2Shader.findNamedCollectionValue(\n stage?.resources,\n name\n );\n if (resource)\n {\n return resource;\n }\n const uav = Tr2Shader.findNamedCollectionValue(stage?.uavs, name);\n if (uav)\n {\n return uav;\n }\n }\n return null;\n }\n\n /**\n * The annotation set authored for a parameter name, or null; the shape\n * depends on the reflection source.\n */\n GetParameterAnnotations(parameterName)\n {\n return Tr2Shader.findAnnotationSet(\n this.effect?.annotations,\n parameterName\n );\n }\n\n /** The packed draw-sort key; 0 until ProcessEffect has run. */\n GetSortValue()\n {\n return this.sortValue;\n }\n\n /** The reflected effect description, by reference rather than copy. */\n GetEffectDescription()\n {\n return this.effect;\n }\n\n /** The same object GetEffectDescription returns. */\n GetEffect()\n {\n return this.effect;\n }\n\n /** The technique's bitmask of shader stages, or 0 for an unknown index. */\n GetShaderTypeMask(techniqueIndex = 0)\n {\n return Number(\n this.effect?.techniques?.[techniqueIndex]?.shaderTypeMask ?? 0\n );\n }\n\n /**\n * Pack the first technique/pass's renderer handles into Carbon's sort key.\n * A device-free source graph retains 0 while its handles remain invalid.\n */\n ProcessEffect()\n {\n this.sortValue = 0;\n const pass = this.effect?.techniques?.[0]?.passes?.[0];\n if (!pass)\n {\n return;\n }\n const stages = pass.stageInputs ?? [];\n const pixelHandle = Number(\n stages[1]?.shader ?? stages[1]?.m_shader ?? 0xffffffff\n );\n const vertexHandle = Number(\n stages[0]?.shader ?? stages[0]?.m_shader ?? 0xffffffff\n );\n if (pixelHandle === 0xffffffff || vertexHandle === 0xffffffff)\n {\n return;\n }\n const pixelShader = pixelHandle & 0x3ff;\n const vertexShader = vertexHandle & 0x3ff;\n const renderStates = Number(pass.renderStates ?? 0) & 0x3ff;\n const passCount = Number(\n this.effect?.techniques?.[0]?.passes?.length ?? 0\n ) & 0x3;\n this.sortValue = (\n (passCount << 30)\n | (pixelShader << 20)\n | (vertexShader << 10)\n | renderStates\n ) >>> 0;\n }\n\n /** Whether this shader accesses vertex buffers in RT shadow mode. */\n HasVertexBufferAccessInRtShadow()\n {\n return this.hasVertexBufferAccessInRtShadow;\n }\n\n /**\n * Construct a canonical shader graph from JS/JSON model values.\n *\n * @param {object} values Canonical model values.\n * @param {object} options CjsModel import options.\n * @returns {Tr2Shader} Hydrated shader graph.\n */\n static from(values = {}, options = {})\n {\n let normalized = values;\n if (values?.effect\n && !(values.effect instanceof Tr2EffectDescription))\n {\n normalized = {\n ...values,\n effect: Tr2EffectDescription.from(values.effect, options)\n };\n }\n const shader = super.from(normalized, options);\n if (!Object.hasOwn(values ?? {}, \"sortValue\"))\n {\n shader.ProcessEffect();\n }\n return shader;\n }\n\n /**\n * Build one canonical GPU-free shader from complete portable reflection.\n * Each child reflection class owns conversion of its own portable record.\n *\n * @param {object} portable Portable effect-body reflection.\n * @returns {Tr2Shader} Canonical selected shader.\n */\n static fromPortable(portable)\n {\n validateEffectBodyReflection(portable);\n\n const shader = new this();\n shader.effect = Tr2EffectDescription.fromPortable(portable.effect);\n shader.ProcessEffect();\n return shader;\n }\n\n /**\n * Whether a value has the supported complete portable-reflection envelope.\n *\n * @param {*} value Candidate value.\n * @returns {boolean} Whether the portable envelope is supported.\n */\n static isPortableReflection(value)\n {\n return isEffectBodyReflection(value);\n }\n\n /** Find one named reflection entry across every stage. */\n static findStageValue(effect, name, key)\n {\n for (const stage of Tr2Shader.iterateStages(effect))\n {\n const found = Tr2Shader.findNamedCollectionValue(stage?.[key], name);\n if (found)\n {\n return found;\n }\n }\n return null;\n }\n\n /** Flatten pass stage inputs in Carbon lookup order. */\n static iterateStages(effect)\n {\n const stages = [];\n for (const technique of effect?.techniques ?? [])\n {\n for (const pass of technique?.passes ?? [])\n {\n stages.push(...pass?.stageInputs ?? []);\n }\n }\n return stages;\n }\n\n /** Find a named entry in an array, Map, or plain object collection. */\n static findNamedCollectionValue(values, name)\n {\n if (!values)\n {\n return null;\n }\n if (Array.isArray(values))\n {\n return values.find(\n value => value?.name === name || value?.[1]?.name === name\n ) ?? null;\n }\n if (values instanceof Map)\n {\n for (const value of values.values())\n {\n if (value?.name === name)\n {\n return value;\n }\n }\n return null;\n }\n for (const value of Object.values(values))\n {\n if (value?.name === name)\n {\n return value;\n }\n }\n return null;\n }\n\n /** Resolve a parameter's annotations from a Map, array, or plain object. */\n static findAnnotationSet(annotations, parameterName)\n {\n if (!annotations)\n {\n return null;\n }\n if (annotations instanceof Map)\n {\n return annotations.get(parameterName) ?? null;\n }\n if (Array.isArray(annotations))\n {\n const entry = annotations.find(\n item => item?.name === parameterName\n || item?.[0] === parameterName\n );\n return entry?.annotations ?? entry?.value ?? entry?.[1] ?? null;\n }\n return annotations[parameterName] ?? null;\n }\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(Tr2Shader, {\n className: \"Tr2Shader\",\n family: \"shader\"\n});\nCjsSchema.decorateField(Tr2Shader, \"sortValue\", type.uint32);\nCjsSchema.decorateField(Tr2Shader, \"effect\", type.rawStruct(\"Tr2EffectDescription\"));\nCjsSchema.decorateField(Tr2Shader, \"hasVertexBufferAccessInRtShadow\", type.boolean);\nCjsSchema.decorateMethod(Tr2Shader, \"GetTechniqueIndex\", carbon.method, impl.adapted, impl.reason(\"Carbon returns success through a bool plus output index; CarbonEngineJS returns the index directly or -1 while preserving exact name lookup.\"));\nCjsSchema.decorateMethod(Tr2Shader, \"GetPassCount\", carbon.method, impl.adapted, impl.reason(\"Carbon assumes an already-validated technique index; CarbonEngineJS safely returns zero for an unavailable index.\"));\nCjsSchema.decorateMethod(Tr2Shader, \"GetConstant\", carbon.method, impl.implemented);\nCjsSchema.decorateMethod(Tr2Shader, \"GetResource\", carbon.method, impl.implemented);\nCjsSchema.decorateMethod(Tr2Shader, \"GetParameterAnnotations\", carbon.method, impl.implemented);\nCjsSchema.decorateMethod(Tr2Shader, \"GetSortValue\", carbon.method, impl.implemented);\nCjsSchema.decorateMethod(Tr2Shader, \"GetEffectDescription\", carbon.method, impl.implemented);\nCjsSchema.decorateMethod(Tr2Shader, \"GetEffect\", carbon.method, impl.implemented);\nCjsSchema.decorateMethod(Tr2Shader, \"GetShaderTypeMask\", carbon.method, impl.adapted, impl.reason(\"Carbon assumes an already-validated technique index; CarbonEngineJS safely returns zero for an unavailable index.\"));\nCjsSchema.decorateMethod(Tr2Shader, \"ProcessEffect\", carbon.method, impl.adapted, impl.reason(\"Carbon packs renderer handles assigned while reading; the device-free graph leaves the sort key zero until an engine assigns valid handles.\"));\nCjsSchema.decorateMethod(Tr2Shader, \"HasVertexBufferAccessInRtShadow\", carbon.method, impl.implemented);\n"],"names":["Tr2Shader","CjsModel","sortValue","effect","Tr2EffectDescription","hasVertexBufferAccessInRtShadow","GetTechniqueIndex","name","techniques","length","findIndex","technique","GetPassCount","techniqueIndex","passes","GetConstant","findStageValue","GetResource","stage","iterateStages","resource","findNamedCollectionValue","resources","uav","uavs","GetParameterAnnotations","parameterName","findAnnotationSet","annotations","GetSortValue","GetEffectDescription","GetEffect","GetShaderTypeMask","Number","shaderTypeMask","ProcessEffect","pass","stages","stageInputs","pixelHandle","shader","m_shader","vertexHandle","pixelShader","vertexShader","renderStates","passCount","HasVertexBufferAccessInRtShadow","from","values","options","normalized","Object","hasOwn","fromPortable","portable","validateEffectBodyReflection","isPortableReflection","value","isEffectBodyReflection","key","found","push","Array","isArray","find","Map","get","entry","item","CjsSchema","define","className","family","decorateField","type","uint32","rawStruct","boolean","decorateMethod","carbon","method","impl","adapted","reason","implemented"],"mappings":";;;;;AAAA;AACA;;AASA;AACO,MAAMA,SAAS,SAASC,QAAQ,CACvC;AAEE;AACAC,EAAAA,SAAS,GAAG,CAAC;;AAEb;AACAC,EAAAA,MAAM,GAAG,IAAIC,oBAAoB,EAAE;;AAEnC;AACAC,EAAAA,+BAA+B,GAAG,KAAK;;AAEvC;AACF;AACA;AACA;AACEC,EAAAA,iBAAiBA,CAACC,IAAI,GAAG,MAAM,EAC/B;IACE,MAAMC,UAAU,GAAG,IAAI,CAACL,MAAM,EAAEK,UAAU,IAAI,EAAE;AAChD,IAAA,IAAI,CAACA,UAAU,CAACC,MAAM,EACtB;AACE,MAAA,OAAO,EAAE;AACX,IAAA;IACA,IAAIF,IAAI,KAAK,EAAE,EACf;AACE,MAAA,OAAO,CAAC;AACV,IAAA;IACA,OAAOC,UAAU,CAACE,SAAS,CAACC,SAAS,IAAIA,SAAS,EAAEJ,IA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,EAAEC,IAAI,CAACG,WAAW,CAAC;AACjFf,SAAS,CAACS,cAAc,CAAC/E,SAAS,EAAE,mBAAmB,EAAEgF,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,mHAAmH,CAAC,CAAC;AACvNd,SAAS,CAACS,cAAc,CAAC/E,SAAS,EAAE,eAAe,EAAEgF,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,6IAA6I,CAAC,CAAC;AAC7Od,SAAS,CAACS,cAAc,CAAC/E,SAAS,EAAE,iCAAiC,EAAEgF,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACG,WAAW,CAAC;;;;"}
|
|
@@ -1,49 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type } from '@carbonenginejs/runtime-utils/schema';
|
|
1
|
+
import { CjsSchema, type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
2
|
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
// Source: trinity/trinity/Resources/Tr2EffectRes.h
|
|
5
|
+
// Schema: format-carbon resources/Tr2ShaderPermutation.json; maintained by runtime-resource.
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Describes one authored effect permutation and the option values a shader
|
|
9
|
-
* resolver may select.
|
|
10
|
-
*
|
|
11
|
-
* This is resource metadata only. Backend shader compilation and pipeline
|
|
12
|
-
* realization remain engine responsibilities.
|
|
7
|
+
/**
|
|
8
|
+
* Describes one authored effect permutation and the option values a shader
|
|
9
|
+
* resolver may select.
|
|
10
|
+
*
|
|
11
|
+
* This is resource metadata only. Backend shader compilation and pipeline
|
|
12
|
+
* realization remain engine responsibilities.
|
|
13
13
|
*/
|
|
14
|
-
let _Tr2ShaderPermutation;
|
|
15
14
|
class Tr2ShaderPermutation extends CjsModel {
|
|
16
|
-
static {
|
|
17
|
-
({
|
|
18
|
-
e: [_init_name, _init_extra_name, _init_options, _init_extra_options, _init_defaultOption, _init_extra_defaultOption, _init_description, _init_extra_description, _init_type, _init_extra_type],
|
|
19
|
-
c: [_Tr2ShaderPermutation, _initClass]
|
|
20
|
-
} = _applyDecs2311(this, [type.define({
|
|
21
|
-
className: "Tr2ShaderPermutation",
|
|
22
|
-
family: "resources"
|
|
23
|
-
})], [[[type, type.string], 16, "name"], [type.list("BlueSharedString"), 0, "options"], [[type, type.uint64], 16, "defaultOption"], [[type, type.string], 16, "description"], [[type, type.uint8], 16, "type"]], 0, void 0, CjsModel));
|
|
24
|
-
}
|
|
25
|
-
constructor(...args) {
|
|
26
|
-
super(...args);
|
|
27
|
-
_init_extra_type(this);
|
|
28
|
-
}
|
|
29
15
|
/** Authored permutation name. */
|
|
30
|
-
name =
|
|
16
|
+
name = "";
|
|
31
17
|
|
|
32
18
|
/** Ordered option names accepted by the permutation. */
|
|
33
|
-
options =
|
|
19
|
+
options = [];
|
|
34
20
|
|
|
35
21
|
/** Index of the option selected when a caller supplies no override. */
|
|
36
|
-
defaultOption =
|
|
22
|
+
defaultOption = 0;
|
|
37
23
|
|
|
38
24
|
/** Human-readable description retained from the effect resource. */
|
|
39
|
-
description =
|
|
25
|
+
description = "";
|
|
40
26
|
|
|
41
27
|
/** Carbon permutation category value. */
|
|
42
|
-
type =
|
|
43
|
-
static {
|
|
44
|
-
_initClass();
|
|
45
|
-
}
|
|
28
|
+
type = 0;
|
|
46
29
|
}
|
|
47
30
|
|
|
48
|
-
|
|
31
|
+
// Declared imperatively rather than with decorators, so this module stays
|
|
32
|
+
// plain ESM that loads from source without a transform. The decorator
|
|
33
|
+
// expressions are reused verbatim, so the registered metadata is identical.
|
|
34
|
+
// Statics belong in `methods`: decorateMethod targets the prototype and
|
|
35
|
+
// would register a static as an instance field.
|
|
36
|
+
CjsSchema.define(Tr2ShaderPermutation, {
|
|
37
|
+
className: "Tr2ShaderPermutation",
|
|
38
|
+
family: "resources"
|
|
39
|
+
});
|
|
40
|
+
CjsSchema.decorateField(Tr2ShaderPermutation, "name", type.string);
|
|
41
|
+
CjsSchema.decorateField(Tr2ShaderPermutation, "options", type.list("BlueSharedString"));
|
|
42
|
+
CjsSchema.decorateField(Tr2ShaderPermutation, "defaultOption", type.uint64);
|
|
43
|
+
CjsSchema.decorateField(Tr2ShaderPermutation, "description", type.string);
|
|
44
|
+
CjsSchema.decorateField(Tr2ShaderPermutation, "type", type.uint8);
|
|
45
|
+
|
|
46
|
+
export { Tr2ShaderPermutation };
|
|
49
47
|
//# sourceMappingURL=Tr2ShaderPermutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2ShaderPermutation.js","sources":["../../../../src/resource/shader/Tr2ShaderPermutation.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2EffectRes.h\r\n// Schema: format-carbon resources/Tr2ShaderPermutation.json; maintained by runtime-resource.\r\nimport { type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\n * Describes one authored effect permutation and the option values a shader\n * resolver may select.\n *\n * This is resource metadata only. Backend shader compilation and pipeline\n * realization remain engine responsibilities.\n */\
|
|
1
|
+
{"version":3,"file":"Tr2ShaderPermutation.js","sources":["../../../../src/resource/shader/Tr2ShaderPermutation.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2EffectRes.h\r\n// Schema: format-carbon resources/Tr2ShaderPermutation.json; maintained by runtime-resource.\r\nimport { CjsSchema, type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\n\r\n/**\r\n * Describes one authored effect permutation and the option values a shader\r\n * resolver may select.\r\n *\r\n * This is resource metadata only. Backend shader compilation and pipeline\r\n * realization remain engine responsibilities.\r\n */\r\nexport class Tr2ShaderPermutation extends CjsModel\r\n{\r\n\r\n /** Authored permutation name. */\r\n name = \"\";\r\n\r\n /** Ordered option names accepted by the permutation. */\r\n options = [];\r\n\r\n /** Index of the option selected when a caller supplies no override. */\r\n defaultOption = 0;\r\n\r\n /** Human-readable description retained from the effect resource. */\r\n description = \"\";\r\n\r\n /** Carbon permutation category value. */\r\n type = 0;\r\n\r\n}\r\n\r\n// Declared imperatively rather than with decorators, so this module stays\r\n// plain ESM that loads from source without a transform. The decorator\r\n// expressions are reused verbatim, so the registered metadata is identical.\r\n// Statics belong in `methods`: decorateMethod targets the prototype and\r\n// would register a static as an instance field.\r\nCjsSchema.define(Tr2ShaderPermutation, {\r\n className: \"Tr2ShaderPermutation\",\r\n family: \"resources\"\r\n});\r\nCjsSchema.decorateField(Tr2ShaderPermutation, \"name\", type.string);\r\nCjsSchema.decorateField(Tr2ShaderPermutation, \"options\", type.list(\"BlueSharedString\"));\r\nCjsSchema.decorateField(Tr2ShaderPermutation, \"defaultOption\", type.uint64);\r\nCjsSchema.decorateField(Tr2ShaderPermutation, \"description\", type.string);\r\nCjsSchema.decorateField(Tr2ShaderPermutation, \"type\", type.uint8);\r\n"],"names":["Tr2ShaderPermutation","CjsModel","name","options","defaultOption","description","type","CjsSchema","define","className","family","decorateField","string","list","uint64","uint8"],"mappings":";;;AAAA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,oBAAoB,SAASC,QAAQ,CAClD;AAEE;AACAC,EAAAA,IAAI,GAAG,EAAE;;AAET;AACAC,EAAAA,OAAO,GAAG,EAAE;;AAEZ;AACAC,EAAAA,aAAa,GAAG,CAAC;;AAEjB;AACAC,EAAAA,WAAW,GAAG,EAAE;;AAEhB;AACAC,EAAAA,IAAI,GAAG,CAAC;AAEV;;AAEA;AACA;AACA;AACA;AACA;AACAC,SAAS,CAACC,MAAM,CAACR,oBAAoB,EAAE;AACrCS,EAAAA,SAAS,EAAE,sBAAsB;AACjCC,EAAAA,MAAM,EAAE;AACV,CAAC,CAAC;AACFH,SAAS,CAACI,aAAa,CAACX,oBAAoB,EAAE,MAAM,EAAEM,IAAI,CAACM,MAAM,CAAC;AAClEL,SAAS,CAACI,aAAa,CAACX,oBAAoB,EAAE,SAAS,EAAEM,IAAI,CAACO,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACvFN,SAAS,CAACI,aAAa,CAACX,oBAAoB,EAAE,eAAe,EAAEM,IAAI,CAACQ,MAAM,CAAC;AAC3EP,SAAS,CAACI,aAAa,CAACX,oBAAoB,EAAE,aAAa,EAAEM,IAAI,CAACM,MAAM,CAAC;AACzEL,SAAS,CAACI,aAAa,CAACX,oBAAoB,EAAE,MAAM,EAAEM,IAAI,CAACS,KAAK,CAAC;;;;"}
|