@carbonenginejs/runtime-resource 0.11.1 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/dist/CjsResMan.js +4 -4
  2. package/dist/CjsResMan.js.map +1 -1
  3. package/dist/_virtual/_rollupPluginBabelHelpers.js +1 -4
  4. package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  5. package/dist/format/CjsByteReader.js +310 -0
  6. package/dist/format/CjsByteReader.js.map +1 -0
  7. package/dist/format/CjsByteWriter.js +242 -0
  8. package/dist/format/CjsByteWriter.js.map +1 -0
  9. package/dist/format/CjsFormatError.js +41 -0
  10. package/dist/format/CjsFormatError.js.map +1 -0
  11. package/dist/format/CjsStringTable.js +268 -0
  12. package/dist/format/CjsStringTable.js.map +1 -0
  13. package/dist/format/carbonEffect/CjsCarbonEffectReader.js +361 -0
  14. package/dist/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -0
  15. package/dist/format/carbonEffect/CjsCarbonEffectWriter.js +373 -0
  16. package/dist/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -0
  17. package/dist/format/carbonEffect/carbonDescriptionFromPortable.js +372 -0
  18. package/dist/format/carbonEffect/carbonDescriptionFromPortable.js.map +1 -0
  19. package/dist/format/carbonEffect/carbonEffectBackendBlock.js +427 -0
  20. package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -0
  21. package/dist/format/carbonEffect/carbonEffectRecords.js +955 -0
  22. package/dist/format/carbonEffect/carbonEffectRecords.js.map +1 -0
  23. package/dist/format/compareUtf8.js +36 -0
  24. package/dist/format/compareUtf8.js.map +1 -0
  25. package/dist/format/index.js +11 -0
  26. package/dist/format/index.js.map +1 -0
  27. package/dist/formats/bnk/CjsBnkFormat.js +18 -2
  28. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
  29. package/dist/formats/bnk/core/eventAction.js +305 -0
  30. package/dist/formats/bnk/core/eventAction.js.map +1 -0
  31. package/dist/formats/bnk/core/graph.js +3 -6
  32. package/dist/formats/bnk/core/graph.js.map +1 -1
  33. package/dist/formats/bnk/core/helpers.js +62 -11
  34. package/dist/formats/bnk/core/helpers.js.map +1 -1
  35. package/dist/formats/bnk/core/nodeBase.js +532 -0
  36. package/dist/formats/bnk/core/nodeBase.js.map +1 -0
  37. package/dist/formats/bnk/core/sfxNodes.js +632 -0
  38. package/dist/formats/bnk/core/sfxNodes.js.map +1 -0
  39. package/dist/formats/bnk/core/soundbanksInfo.js +59 -51
  40. package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
  41. package/dist/formats/gr2/CjsGr2Format.js +256 -13
  42. package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
  43. package/dist/formats/gr2/core/helpers.js +15 -15
  44. package/dist/formats/gr2/core/helpers.js.map +1 -1
  45. package/dist/formats/gr2/core/json.js +1 -1
  46. package/dist/formats/gr2/core/json.js.map +1 -1
  47. package/dist/formats/gr2/core/targets.js +1 -1
  48. package/dist/formats/gr2/core/targets.js.map +1 -1
  49. package/dist/formats/gr2/index.js +0 -1
  50. package/dist/formats/gr2/index.js.map +1 -1
  51. package/dist/formats/hlsl/core/HlslReader.js +7 -257
  52. package/dist/formats/hlsl/core/HlslReader.js.map +1 -1
  53. package/dist/formats/hlsl/core/analysis.js +1 -1
  54. package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +781 -0
  55. package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -0
  56. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +21 -1
  57. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -1
  58. package/dist/formats/hlsl/index.js +1 -0
  59. package/dist/formats/hlsl/index.js.map +1 -1
  60. package/dist/formats/index.js +3 -6
  61. package/dist/formats/index.js.map +1 -1
  62. package/dist/formats/webgl/core/cewg/CewgPackage.js +2 -1
  63. package/dist/formats/webgl/core/cewg/CewgPackage.js.map +1 -1
  64. package/dist/formats/webgl/core/cewg/binary.js +11 -93
  65. package/dist/formats/webgl/core/cewg/binary.js.map +1 -1
  66. package/dist/formats/webgl/core/effectPackage.js +4 -1
  67. package/dist/formats/webgl/core/effectPackage.js.map +1 -1
  68. package/dist/formats/webgl/core/errors.js +3 -3
  69. package/dist/formats/webgl/core/errors.js.map +1 -1
  70. package/dist/formats/webgpu/CjsWebgpuFormat.js +4 -23
  71. package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  72. package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +197 -0
  73. package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -0
  74. package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js +368 -0
  75. package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js.map +1 -0
  76. package/dist/formats/webgpu/core/cewgpu/containerViews.js +355 -0
  77. package/dist/formats/webgpu/core/cewgpu/containerViews.js.map +1 -0
  78. package/dist/formats/webgpu/core/cewgpu/validateContainer.js +90 -0
  79. package/dist/formats/webgpu/core/cewgpu/validateContainer.js.map +1 -0
  80. package/dist/formats/webgpu/core/effectBackendBodySet.js +21 -20
  81. package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
  82. package/dist/formats/webgpu/core/helpers.js +87 -92
  83. package/dist/formats/webgpu/core/helpers.js.map +1 -1
  84. package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js +14 -13
  85. package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js.map +1 -1
  86. package/dist/formats/webgpu/core/ir/inferValueTypes.js +10 -8
  87. package/dist/formats/webgpu/core/ir/inferValueTypes.js.map +1 -1
  88. package/dist/formats/webgpu/core/packageEffect.js +94 -9
  89. package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
  90. package/dist/formats/webgpu/core/packageMetadata.js +10 -1
  91. package/dist/formats/webgpu/core/packageMetadata.js.map +1 -1
  92. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +17 -15
  93. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
  94. package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js +13 -12
  95. package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js.map +1 -1
  96. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +9 -8
  97. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
  98. package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js +23 -22
  99. package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js.map +1 -1
  100. package/dist/formats/webgpu/core/wgsl/selectionPlans.js +46 -44
  101. package/dist/formats/webgpu/core/wgsl/selectionPlans.js.map +1 -1
  102. package/dist/resource/CjsResource.js +700 -684
  103. package/dist/resource/CjsResource.js.map +1 -1
  104. package/dist/resource/Tr2LightProfileRes.js +18 -27
  105. package/dist/resource/Tr2LightProfileRes.js.map +1 -1
  106. package/dist/resource/audio/CjsAudioBufferRes.js +2 -2
  107. package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -1
  108. package/dist/resource/audio/CjsAudioRes.js +2 -2
  109. package/dist/resource/audio/CjsAudioRes.js.map +1 -1
  110. package/dist/resource/geometry/TriGeometryRes.js +605 -586
  111. package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
  112. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +21 -30
  113. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
  114. package/dist/resource/geometry/granny/TriGrannyRes.js +21 -30
  115. package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
  116. package/dist/resource/shader/Tr2EffectRes.js +9 -7
  117. package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
  118. package/dist/resource/shader/Tr2MaterialArea.js +5 -3
  119. package/dist/resource/shader/Tr2MaterialArea.js.map +1 -1
  120. package/dist/resource/shader/Tr2MaterialMesh.js +4 -2
  121. package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -1
  122. package/dist/resource/shader/Tr2MaterialRes.js +5 -3
  123. package/dist/resource/shader/Tr2MaterialRes.js.map +1 -1
  124. package/dist/resource/shader/Tr2Shader.js +26 -21
  125. package/dist/resource/shader/Tr2Shader.js.map +1 -1
  126. package/dist/resource/shader/Tr2ShaderPermutation.js +8 -6
  127. package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -1
  128. package/dist/resource/shader/reflection/Tr2EffectDefine.js +5 -3
  129. package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -1
  130. package/dist/resource/shader/reflection/Tr2EffectDescription.js +5 -3
  131. package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
  132. package/dist/resource/shader/reflection/Tr2EffectLibrary.js +17 -15
  133. package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
  134. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +11 -9
  135. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
  136. package/dist/resource/shader/reflection/Tr2EffectResource.js +8 -6
  137. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
  138. package/dist/resource/shader/reflection/Tr2EffectStageInput.js +15 -13
  139. package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
  140. package/dist/resource/shader/reflection/Tr2EffectTechnique.js +7 -5
  141. package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
  142. package/dist/resource/shader/reflection/Tr2Pass.js +11 -9
  143. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
  144. package/dist/resource/shader/sampler/Tr2SamplerSetup.js +8 -6
  145. package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
  146. package/dist/resource/texture/CjsTextureArrayRes.js +400 -411
  147. package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
  148. package/dist/resource/texture/Tr2ImageRes.js +99 -95
  149. package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
  150. package/dist/resource/texture/TriTextureRes.js +312 -273
  151. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  152. package/docs/README.md +13 -1
  153. package/docs/architecture.md +3 -3
  154. package/docs/concepts/resource-lifecycle.md +9 -2
  155. package/docs/concepts/shader-resource-model.md +114 -0
  156. package/docs/concepts/writing-an-engine-adapter.md +115 -0
  157. package/docs/formats/README.md +24 -1
  158. package/docs/formats/carbon-effect-container.md +452 -0
  159. package/docs/formats/dxbc/README.md +68 -0
  160. package/docs/formats/dxbc/architecture.md +80 -0
  161. package/docs/formats/dxbc/reference/api.md +77 -0
  162. package/docs/formats/dxbc/reference/classes/README.md +9 -0
  163. package/docs/formats/dxbc/reference/decoded-output.md +122 -0
  164. package/docs/formats/gr2.md +3 -4
  165. package/docs/formats/hlsl/README.md +54 -0
  166. package/docs/formats/hlsl/architecture.md +67 -0
  167. package/docs/formats/hlsl/guides/hydrating-json-output.md +62 -0
  168. package/docs/formats/hlsl/guides/reading-effects.md +64 -0
  169. package/docs/formats/hlsl/reference/advanced-analysis.md +66 -0
  170. package/docs/formats/hlsl/reference/api.md +98 -0
  171. package/docs/formats/hlsl/reference/classes/README.md +11 -0
  172. package/docs/formats/hlsl/reference/json-graph.md +100 -0
  173. package/docs/formats/hlsl/reference/portable-reflection.md +141 -0
  174. package/docs/formats/provenance.md +32 -17
  175. package/docs/formats/webgl/README.md +57 -0
  176. package/docs/formats/webgl/architecture.md +70 -0
  177. package/docs/formats/webgl/carbon-constant-layouts.md +326 -0
  178. package/docs/formats/webgl/decl-io.md +1234 -0
  179. package/docs/formats/webgl/effect-reflection.md +127 -0
  180. package/docs/formats/webgl/memory-structured.md +871 -0
  181. package/docs/formats/webgl/reference/classes/README.md +9 -0
  182. package/docs/formats/webgl/texture-sample.md +964 -0
  183. package/docs/formats/webgpu/README.md +84 -0
  184. package/docs/formats/webgpu/architecture.md +96 -0
  185. package/docs/formats/webgpu/formats/cewgpu.md +216 -0
  186. package/docs/formats/webgpu/guides/effect-packaging.md +191 -0
  187. package/docs/formats/webgpu/reference/api.md +197 -0
  188. package/docs/formats/webgpu/reference/classes/README.md +9 -0
  189. package/docs/formats/webgpu/reference/wgsl-compatibility.md +1543 -0
  190. package/docs/formats/wwise.md +45 -4
  191. package/docs/reference/classes/core.md +80 -0
  192. package/docs/reference/classes/formats.md +24 -34
  193. package/docs/reference/events.md +25 -0
  194. package/docs/reference/motherlode-cache.md +22 -8
  195. package/docs/reference/workers.md +5 -5
  196. package/docs/roadmap.md +61 -41
  197. package/format-notices/bnk/NOTICE +5 -4
  198. package/format-notices/webgl/NOTICE +1 -1
  199. package/package.json +2 -1
  200. package/dist/formats/gr2/core/CjsFormatGr2.js +0 -273
  201. package/dist/formats/gr2/core/CjsFormatGr2.js.map +0 -1
  202. package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js +0 -415
  203. package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js.map +0 -1
  204. package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js +0 -100
  205. package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js.map +0 -1
  206. package/dist/formats/webgpu/core/cewgpu/binary.js +0 -93
  207. package/dist/formats/webgpu/core/cewgpu/binary.js.map +0 -1
  208. package/dist/formats/webgpu/core/cewgpu/tags.js +0 -17
  209. package/dist/formats/webgpu/core/cewgpu/tags.js.map +0 -1
  210. package/dist/formats/webgpu/core/effectPackageValidation.js +0 -1078
  211. package/dist/formats/webgpu/core/effectPackageValidation.js.map +0 -1
@@ -1,10 +1,11 @@
1
- import { identity as _identity, applyDecs2311 as _applyDecs2311 } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { io, type, carbon, impl } from '@carbonenginejs/runtime-utils/schema';
3
- import { CjsResource as _CjsResource } from '../CjsResource.js';
1
+ import { CjsSchema, carbon, impl, type, io } from '@carbonenginejs/runtime-utils/schema';
2
+ import { CjsResource } from '../CjsResource.js';
4
3
  import { validateVideoPayload, validateTexturePayload, validateRgbaPayload, ResourcePayloadType } from '../../format/payloadContract.js';
5
4
  import { resourcePayloadError, validateResourcePayload, resourceBoundaryError } from '../resourceBoundary.js';
6
5
 
7
- let _initProto, _initClass, _init_format, _init_extra_format, _init_type, _init_extra_type, _init_averageColor, _init_extra_averageColor, _init_depth, _init_extra_depth, _init_cutoutHeight, _init_extra_cutoutHeight, _init_height, _init_extra_height, _init_lodEnabled, _init_extra_lodEnabled, _init_hadLodRequests, _init_extra_hadLodRequests, _init_cpuMip, _init_extra_cpuMip, _init_gpuMip, _init_extra_gpuMip, _init_wrappedRenderTarget, _init_extra_wrappedRenderTarget, _init_originalResolution, _init_extra_originalResolution, _init_originalMemoryUsage, _init_extra_originalMemoryUsage, _init_name, _init_extra_name, _init_arraySize, _init_extra_arraySize, _init_cutoutWidth, _init_extra_cutoutWidth, _init_width, _init_extra_width, _init_cutoutX, _init_extra_cutoutX, _init_cutoutY, _init_extra_cutoutY;
6
+ // Source: trinity/trinity/Resources/TriTextureRes.h
7
+ // Source: trinity/trinity/Resources/TriTextureRes.cpp
8
+ // Source: trinity/trinity/Resources/TriTextureRes_Blue.cpp
8
9
 
9
10
  /**
10
11
  * Resource record that owns Carbon-style texture identity and validated
@@ -13,301 +14,286 @@ let _initProto, _initClass, _init_format, _init_extra_format, _init_type, _init_
13
14
  *
14
15
  * The resource never creates or retains a backend texture.
15
16
  */
16
- let _TriTextureRes;
17
- new class extends _identity {
18
- static [class TriTextureRes extends _CjsResource {
19
- static {
20
- ({
21
- e: [_init_format, _init_extra_format, _init_type, _init_extra_type, _init_averageColor, _init_extra_averageColor, _init_depth, _init_extra_depth, _init_cutoutHeight, _init_extra_cutoutHeight, _init_height, _init_extra_height, _init_lodEnabled, _init_extra_lodEnabled, _init_hadLodRequests, _init_extra_hadLodRequests, _init_cpuMip, _init_extra_cpuMip, _init_gpuMip, _init_extra_gpuMip, _init_wrappedRenderTarget, _init_extra_wrappedRenderTarget, _init_originalResolution, _init_extra_originalResolution, _init_originalMemoryUsage, _init_extra_originalMemoryUsage, _init_name, _init_extra_name, _init_arraySize, _init_extra_arraySize, _init_cutoutWidth, _init_extra_cutoutWidth, _init_width, _init_extra_width, _init_cutoutX, _init_extra_cutoutX, _init_cutoutY, _init_extra_cutoutY, _initProto],
22
- c: [_TriTextureRes, _initClass]
23
- } = _applyDecs2311(this, [type.define({
24
- className: "TriTextureRes",
25
- family: "resources"
26
- })], [[[io, io.read, type, type.unknown], 16, "format"], [[io, io.persist, type, type.unknown], 16, "type"], [[io, io.read, type, type.color], 16, "averageColor"], [[io, io.read, type, type.uint32], 16, "depth"], [[io, io.readwrite, type, type.float32], 16, "cutoutHeight"], [[io, io.read, type, type.uint32], 16, "height"], [[io, io.read, type, type.boolean], 16, "lodEnabled"], [[io, io.read, type, type.boolean], 16, "hadLodRequests"], [[io, io.read, type, type.uint32], 16, "cpuMip"], [[io, io.read, type, type.uint32], 16, "gpuMip"], [[io, io.read, type, type.unknown], 16, "wrappedRenderTarget"], [[io, io.read, type, type.uint32], 16, "originalResolution"], [[io, io.read, type, type.uint64], 16, "originalMemoryUsage"], [[io, io.readwrite, type, type.string], 16, "name"], [[io, io.read, type, type.uint32], 16, "arraySize"], [[io, io.readwrite, type, type.float32], 16, "cutoutWidth"], [[io, io.read, type, type.uint32], 16, "width"], [[io, io.readwrite, type, type.float32], 16, "cutoutX"], [[io, io.readwrite, type, type.float32], 16, "cutoutY"], [[carbon, carbon.method, impl, impl.adapted], 18, "GetMipCount"], [[carbon, carbon.method, impl, impl.adapted], 18, "GetMsaaType"], [[carbon, carbon.method, impl, impl.adapted], 18, "GetMsaaQuality"], [[carbon, carbon.method, impl, impl.adapted], 18, "HadLodRequests"], [[carbon, carbon.method, impl, impl.notSupported], 18, "GetSrvIndexInHeap"], [[carbon, carbon.method, impl, impl.notSupported], 18, "SaveAsync"], [[carbon, carbon.method, impl, impl.notSupported], 18, "Save"], [[carbon, carbon.method, impl, impl.noop], 18, "IsSaving"], [[carbon, carbon.method, impl, impl.noop], 18, "IsSaveCompleted"], [[carbon, carbon.method, impl, impl.noop], 18, "IsSaveSucceeded"], [[carbon, carbon.method, impl, impl.noop], 18, "WaitForSave"], [[carbon, carbon.method, impl, impl.notSupported], 18, "CreateEmptyTexture"], [[carbon, carbon.method, impl, impl.notSupported], 18, "SetFromRenderTarget"], [[carbon, carbon.method, impl, impl.notSupported], 18, "CreateAndCopyFromRenderTarget"], [[carbon, carbon.method, impl, impl.notSupported], 18, "CreateFromHostBitmap"], [[carbon, carbon.method, impl, impl.notSupported], 18, "CreateFromTexture"], [[carbon, carbon.method, impl, impl.adapted], 18, "HasALObject"], [[carbon, carbon.method, impl, impl.adapted], 18, "GetPipeline"], [[carbon, carbon.method, impl, impl.adapted], 18, "GetOriginalMemoryUsage"], [[carbon, carbon.method, impl, impl.adapted], 18, "SetAverageColor"], [[carbon, carbon.method, impl, impl.notSupported], 18, "UpdateSubresource"], [[carbon, carbon.method, impl, impl.adapted], 18, "PrepareResources"]], 0, void 0, _CjsResource));
27
- }
28
- format = (_initProto(this), _init_format(this, null));
29
- type = (_init_extra_format(this), _init_type(this, null));
30
- averageColor = (_init_extra_type(this), _init_averageColor(this, [0, 0, 0, 0]));
31
- depth = (_init_extra_averageColor(this), _init_depth(this, 0));
32
- cutoutHeight = (_init_extra_depth(this), _init_cutoutHeight(this, 1));
33
- height = (_init_extra_cutoutHeight(this), _init_height(this, 0));
34
- lodEnabled = (_init_extra_height(this), _init_lodEnabled(this, false));
35
- hadLodRequests = (_init_extra_lodEnabled(this), _init_hadLodRequests(this, false));
36
- cpuMip = (_init_extra_hadLodRequests(this), _init_cpuMip(this, 0));
37
- gpuMip = (_init_extra_cpuMip(this), _init_gpuMip(this, 0));
38
- wrappedRenderTarget = (_init_extra_gpuMip(this), _init_wrappedRenderTarget(this, null));
39
- originalResolution = (_init_extra_wrappedRenderTarget(this), _init_originalResolution(this, 0));
40
- originalMemoryUsage = (_init_extra_originalResolution(this), _init_originalMemoryUsage(this, 0));
41
- name = (_init_extra_originalMemoryUsage(this), _init_name(this, ""));
42
- arraySize = (_init_extra_name(this), _init_arraySize(this, 0));
43
- cutoutWidth = (_init_extra_arraySize(this), _init_cutoutWidth(this, 1));
44
- width = (_init_extra_cutoutWidth(this), _init_width(this, 0));
45
- cutoutX = (_init_extra_width(this), _init_cutoutX(this, 0));
46
- cutoutY = (_init_extra_cutoutX(this), _init_cutoutY(this, 0));
17
+ class TriTextureRes extends CjsResource {
18
+ format = null;
19
+ type = null;
20
+ averageColor = [0, 0, 0, 0];
21
+ depth = 0;
22
+ cutoutHeight = 1;
23
+ height = 0;
24
+ lodEnabled = false;
25
+ hadLodRequests = false;
26
+ cpuMip = 0;
27
+ gpuMip = 0;
28
+ wrappedRenderTarget = null;
29
+ originalResolution = 0;
30
+ originalMemoryUsage = 0;
31
+ name = "";
32
+ arraySize = 0;
33
+ cutoutWidth = 1;
34
+ width = 0;
35
+ cutoutX = 0;
36
+ cutoutY = 0;
47
37
 
48
- /** Creates a TriTextureRes with caller-provided initial state. */
49
- constructor(values = null) {
50
- super(), _init_extra_cutoutY(this);
51
- this.SetValues(values || {}, {
52
- markDirty: false,
53
- skipUpdate: true,
54
- skipEvents: true
55
- });
56
- }
38
+ /** Creates a TriTextureRes with caller-provided initial state. */
39
+ constructor(values = null) {
40
+ super();
41
+ this.SetValues(values || {}, {
42
+ markDirty: false,
43
+ skipUpdate: true,
44
+ skipEvents: true
45
+ });
46
+ }
57
47
 
58
- /**
59
- * Attach a plain texture, RGBA, or video payload and mirror Carbon-exposed
60
- * metadata. Invalid payloads are rejected before replacing the current one.
61
- *
62
- * @param {object|null} payload
63
- * @param {object|null} options
64
- * @returns {TriTextureRes}
65
- */
66
- SetPayload(payload = null, options = null) {
67
- if (payload === null) {
68
- super.SetPayload(null);
69
- return this;
70
- }
71
- const validator = {
72
- [ResourcePayloadType.RGBA]: validateRgbaPayload,
73
- [ResourcePayloadType.TEXTURE]: validateTexturePayload,
74
- [ResourcePayloadType.VIDEO]: validateVideoPayload
75
- }[payload?.payloadType];
76
- if (!validator) {
77
- throw resourcePayloadError("TriTextureRes", 'Expected payloadType "rgba", "texture", or "video".', "payloadType");
78
- }
79
- validateResourcePayload("TriTextureRes", payload, validator);
80
- const values = {
81
- ...(options || {})
82
- };
83
- if (payload.pixelFormat !== undefined || payload.format !== undefined) values.format = payload.pixelFormat || payload.format;
84
- if (payload.width !== undefined) values.width = payload.width;
85
- if (payload.height !== undefined) values.height = payload.height;
86
- if (payload.depth !== undefined) values.depth = payload.depth;
87
- if (payload.arraySize !== undefined) values.arraySize = payload.arraySize;else if (Array.isArray(payload.faces)) values.arraySize = payload.faces.length;
88
- if (payload.mipCount !== undefined) values.cpuMip = payload.mipCount;else if (payload.payloadType === ResourcePayloadType.RGBA) values.cpuMip = 1;
89
- if (payload.hadLodRequests !== undefined) values.hadLodRequests = !!payload.hadLodRequests;
90
- values.originalMemoryUsage = getPayloadMemoryUsage(payload);
91
- values.originalResolution = Math.max(payload.width || 0, payload.height || 0, this.originalResolution || 0);
92
- super.SetPayload(payload);
93
- this.SetValues(values);
48
+ /**
49
+ * Attach a plain texture, RGBA, or video payload and mirror Carbon-exposed
50
+ * metadata. Invalid payloads are rejected before replacing the current one.
51
+ *
52
+ * @param {object|null} payload
53
+ * @param {object|null} options
54
+ * @returns {TriTextureRes}
55
+ */
56
+ SetPayload(payload = null, options = null) {
57
+ if (payload === null) {
58
+ super.SetPayload(null);
94
59
  return this;
95
60
  }
96
-
97
- /**
98
- * Return the number of mip levels known to this texture resource.
99
- *
100
- * @returns {number}
101
- */
102
- GetMipCount() {
103
- return this.GetPayload()?.mipCount || this.cpuMip || 0;
61
+ const validator = {
62
+ [ResourcePayloadType.RGBA]: validateRgbaPayload,
63
+ [ResourcePayloadType.TEXTURE]: validateTexturePayload,
64
+ [ResourcePayloadType.VIDEO]: validateVideoPayload
65
+ }[payload?.payloadType];
66
+ if (!validator) {
67
+ throw resourcePayloadError("TriTextureRes", 'Expected payloadType "rgba", "texture", or "video".', "payloadType");
104
68
  }
69
+ validateResourcePayload("TriTextureRes", payload, validator);
70
+ const values = {
71
+ ...(options || {})
72
+ };
73
+ if (payload.pixelFormat !== undefined || payload.format !== undefined) values.format = payload.pixelFormat || payload.format;
74
+ if (payload.width !== undefined) values.width = payload.width;
75
+ if (payload.height !== undefined) values.height = payload.height;
76
+ if (payload.depth !== undefined) values.depth = payload.depth;
77
+ if (payload.arraySize !== undefined) values.arraySize = payload.arraySize;else if (Array.isArray(payload.faces)) values.arraySize = payload.faces.length;
78
+ if (payload.mipCount !== undefined) values.cpuMip = payload.mipCount;else if (payload.payloadType === ResourcePayloadType.RGBA) values.cpuMip = 1;
79
+ if (payload.hadLodRequests !== undefined) values.hadLodRequests = !!payload.hadLodRequests;
80
+ values.originalMemoryUsage = getPayloadMemoryUsage(payload);
81
+ values.originalResolution = Math.max(payload.width || 0, payload.height || 0, this.originalResolution || 0);
82
+ super.SetPayload(payload);
83
+ this.SetValues(values);
84
+ return this;
85
+ }
105
86
 
106
- /**
107
- * Return the multisample type for this texture.
108
- *
109
- * @returns {number}
110
- */
111
- GetMsaaType() {
112
- const payload = this.GetPayload();
113
- return payload?.multiSampleType ?? payload?.msaaType ?? payload?.samples ?? 1;
114
- }
87
+ /**
88
+ * Return the number of mip levels known to this texture resource.
89
+ *
90
+ * @returns {number}
91
+ */
92
+ GetMipCount() {
93
+ return this.GetPayload()?.mipCount || this.cpuMip || 0;
94
+ }
115
95
 
116
- /**
117
- * Return the multisample quality for this texture.
118
- *
119
- * @returns {number}
120
- */
121
- GetMsaaQuality() {
122
- const payload = this.GetPayload();
123
- return payload?.multiSampleQuality ?? payload?.msaaQuality ?? 0;
124
- }
96
+ /**
97
+ * Return the multisample type for this texture.
98
+ *
99
+ * @returns {number}
100
+ */
101
+ GetMsaaType() {
102
+ const payload = this.GetPayload();
103
+ return payload?.multiSampleType ?? payload?.msaaType ?? payload?.samples ?? 1;
104
+ }
125
105
 
126
- /**
127
- * Return true if this texture has received LOD requests.
128
- *
129
- * @returns {boolean}
130
- */
131
- HadLodRequests() {
132
- return this.hadLodRequests;
133
- }
106
+ /**
107
+ * Return the multisample quality for this texture.
108
+ *
109
+ * @returns {number}
110
+ */
111
+ GetMsaaQuality() {
112
+ const payload = this.GetPayload();
113
+ return payload?.multiSampleQuality ?? payload?.msaaQuality ?? 0;
114
+ }
134
115
 
135
- /**
136
- * Return the shader-resource-view heap index when a backend owns one.
137
- *
138
- * @returns {number}
139
- */
140
- GetSrvIndexInHeap() {
141
- throw resourceBoundaryError("TriTextureRes", "GetSrvIndexInHeap", "Runtime-resource does not own descriptor heaps.");
142
- }
116
+ /**
117
+ * Return true if this texture has received LOD requests.
118
+ *
119
+ * @returns {boolean}
120
+ */
121
+ HadLodRequests() {
122
+ return this.hadLodRequests;
123
+ }
143
124
 
144
- /**
145
- * Save this texture asynchronously.
146
- *
147
- * @param {string} path
148
- * @returns {boolean}
149
- */
150
- SaveAsync(path = "") {
151
- throw resourceBoundaryError("TriTextureRes", "SaveAsync", `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : ""}.`);
152
- }
125
+ /**
126
+ * Return the shader-resource-view heap index when a backend owns one.
127
+ *
128
+ * @returns {number}
129
+ */
130
+ GetSrvIndexInHeap() {
131
+ throw resourceBoundaryError("TriTextureRes", "GetSrvIndexInHeap", "Runtime-resource does not own descriptor heaps.");
132
+ }
153
133
 
154
- /**
155
- * Save this texture synchronously.
156
- *
157
- * @param {string} path
158
- * @returns {boolean}
159
- */
160
- Save(path = "") {
161
- throw resourceBoundaryError("TriTextureRes", "Save", `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : ""}.`);
162
- }
134
+ /**
135
+ * Save this texture asynchronously.
136
+ *
137
+ * @param {string} path
138
+ * @returns {boolean}
139
+ */
140
+ SaveAsync(path = "") {
141
+ throw resourceBoundaryError("TriTextureRes", "SaveAsync", `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : ""}.`);
142
+ }
163
143
 
164
- /**
165
- * Return true if an asynchronous save is active.
166
- *
167
- * @returns {boolean}
168
- */
169
- IsSaving() {
170
- return false;
171
- }
144
+ /**
145
+ * Save this texture synchronously.
146
+ *
147
+ * @param {string} path
148
+ * @returns {boolean}
149
+ */
150
+ Save(path = "") {
151
+ throw resourceBoundaryError("TriTextureRes", "Save", `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : ""}.`);
152
+ }
172
153
 
173
- /**
174
- * Return true if the asynchronous save operation has completed.
175
- *
176
- * @returns {boolean}
177
- */
178
- IsSaveCompleted() {
179
- return true;
180
- }
154
+ /**
155
+ * Return true if an asynchronous save is active.
156
+ *
157
+ * @returns {boolean}
158
+ */
159
+ IsSaving() {
160
+ return false;
161
+ }
181
162
 
182
- /**
183
- * Return true if the asynchronous save operation succeeded.
184
- *
185
- * @returns {boolean}
186
- */
187
- IsSaveSucceeded() {
188
- return false;
189
- }
163
+ /**
164
+ * Return true if the asynchronous save operation has completed.
165
+ *
166
+ * @returns {boolean}
167
+ */
168
+ IsSaveCompleted() {
169
+ return true;
170
+ }
190
171
 
191
- /**
192
- * Wait for an asynchronous save operation.
193
- *
194
- * @returns {boolean}
195
- */
196
- WaitForSave() {
197
- return this.IsSaveCompleted();
198
- }
172
+ /**
173
+ * Return true if the asynchronous save operation succeeded.
174
+ *
175
+ * @returns {boolean}
176
+ */
177
+ IsSaveSucceeded() {
178
+ return false;
179
+ }
199
180
 
200
- /**
201
- * Device texture allocation belongs to engine-gpu.
202
- *
203
- * @throws {Error}
204
- */
205
- CreateEmptyTexture() {
206
- throw resourceBoundaryError("TriTextureRes", "CreateEmptyTexture", "Use engine-gpu to allocate device textures.");
207
- }
181
+ /**
182
+ * Wait for an asynchronous save operation.
183
+ *
184
+ * @returns {boolean}
185
+ */
186
+ WaitForSave() {
187
+ return this.IsSaveCompleted();
188
+ }
208
189
 
209
- /**
210
- * Render-target wrapping belongs to engine-gpu.
211
- *
212
- * @throws {Error}
213
- */
214
- SetFromRenderTarget() {
215
- throw resourceBoundaryError("TriTextureRes", "SetFromRenderTarget", "Runtime-resource does not own render targets.");
216
- }
190
+ /**
191
+ * Device texture allocation belongs to engine-gpu.
192
+ *
193
+ * @throws {Error}
194
+ */
195
+ CreateEmptyTexture() {
196
+ throw resourceBoundaryError("TriTextureRes", "CreateEmptyTexture", "Use engine-gpu to allocate device textures.");
197
+ }
217
198
 
218
- /**
219
- * Create a texture copy from a render target.
220
- *
221
- * @throws {Error}
222
- */
223
- CreateAndCopyFromRenderTarget() {
224
- throw resourceBoundaryError("TriTextureRes", "CreateAndCopyFromRenderTarget", "Runtime-resource does not own render targets.");
225
- }
199
+ /**
200
+ * Render-target wrapping belongs to engine-gpu.
201
+ *
202
+ * @throws {Error}
203
+ */
204
+ SetFromRenderTarget() {
205
+ throw resourceBoundaryError("TriTextureRes", "SetFromRenderTarget", "Runtime-resource does not own render targets.");
206
+ }
226
207
 
227
- /**
228
- * Create a device texture from a host bitmap.
229
- *
230
- * @throws {Error}
231
- */
232
- CreateFromHostBitmap() {
233
- throw resourceBoundaryError("TriTextureRes", "CreateFromHostBitmap", "Use engine-gpu to allocate and upload texture data.");
234
- }
208
+ /**
209
+ * Create a texture copy from a render target.
210
+ *
211
+ * @throws {Error}
212
+ */
213
+ CreateAndCopyFromRenderTarget() {
214
+ throw resourceBoundaryError("TriTextureRes", "CreateAndCopyFromRenderTarget", "Runtime-resource does not own render targets.");
215
+ }
235
216
 
236
- /**
237
- * Create this texture from another texture resource.
238
- *
239
- * @throws {Error}
240
- */
241
- CreateFromTexture() {
242
- throw resourceBoundaryError("TriTextureRes", "CreateFromTexture", "Use engine-gpu to copy device textures.");
243
- }
217
+ /**
218
+ * Create a device texture from a host bitmap.
219
+ *
220
+ * @throws {Error}
221
+ */
222
+ CreateFromHostBitmap() {
223
+ throw resourceBoundaryError("TriTextureRes", "CreateFromHostBitmap", "Use engine-gpu to allocate and upload texture data.");
224
+ }
244
225
 
245
- /**
246
- * Return true if this texture owns a backend allocation object.
247
- *
248
- * @param {string|number} type
249
- * @param {string|number} object
250
- * @returns {boolean}
251
- */
252
- HasALObject(type, object) {
253
- return this.HasAdapterResource(`${type}:${object}`);
254
- }
226
+ /**
227
+ * Create this texture from another texture resource.
228
+ *
229
+ * @throws {Error}
230
+ */
231
+ CreateFromTexture() {
232
+ throw resourceBoundaryError("TriTextureRes", "CreateFromTexture", "Use engine-gpu to copy device textures.");
233
+ }
255
234
 
256
- /**
257
- * Return an engine-owned texture pipeline object when attached.
258
- *
259
- * @returns {*}
260
- */
261
- GetPipeline() {
262
- return this.GetAdapterResource("pipeline");
263
- }
235
+ /**
236
+ * Return true if this texture owns a backend allocation object.
237
+ *
238
+ * @param {string|number} type
239
+ * @param {string|number} object
240
+ * @returns {boolean}
241
+ */
242
+ HasALObject(type, object) {
243
+ return this.HasAdapterResource(`${type}:${object}`);
244
+ }
264
245
 
265
- /**
266
- * Return memory size for the original non-LODed texture.
267
- *
268
- * @returns {number}
269
- */
270
- GetOriginalMemoryUsage() {
271
- return this.originalMemoryUsage || getPayloadMemoryUsage(this.GetPayload());
272
- }
246
+ /**
247
+ * Return an engine-owned texture pipeline object when attached.
248
+ *
249
+ * @returns {*}
250
+ */
251
+ GetPipeline() {
252
+ return this.GetAdapterResource("pipeline");
253
+ }
273
254
 
274
- /**
275
- * Store the average color reported by decoded texture data.
276
- *
277
- * @param {number} red
278
- * @param {number} green
279
- * @param {number} blue
280
- * @param {number} alpha
281
- * @returns {TriTextureRes}
282
- */
283
- SetAverageColor(red = 0, green = 0, blue = 0, alpha = 0) {
284
- this.averageColor = [red, green, blue, alpha];
285
- return this;
286
- }
255
+ /**
256
+ * Return memory size for the original non-LODed texture.
257
+ *
258
+ * @returns {number}
259
+ */
260
+ GetOriginalMemoryUsage() {
261
+ return this.originalMemoryUsage || getPayloadMemoryUsage(this.GetPayload());
262
+ }
287
263
 
288
- /**
289
- * Update a texture subresource.
290
- *
291
- * @throws {Error}
292
- */
293
- UpdateSubresource() {
294
- throw resourceBoundaryError("TriTextureRes", "UpdateSubresource", "Use engine-gpu to upload texture bytes.");
295
- }
264
+ /**
265
+ * Store the average color reported by decoded texture data.
266
+ *
267
+ * @param {number} red
268
+ * @param {number} green
269
+ * @param {number} blue
270
+ * @param {number} alpha
271
+ * @returns {TriTextureRes}
272
+ */
273
+ SetAverageColor(red = 0, green = 0, blue = 0, alpha = 0) {
274
+ this.averageColor = [red, green, blue, alpha];
275
+ return this;
276
+ }
296
277
 
297
- /**
298
- * Resource preparation does not decide device upload policy.
299
- *
300
- * @returns {boolean}
301
- */
302
- PrepareResources() {
303
- return this.IsPrepared();
304
- }
305
- }];
306
- payload = "texture";
307
- constructor() {
308
- super(_TriTextureRes), _initClass();
278
+ /**
279
+ * Update a texture subresource.
280
+ *
281
+ * @throws {Error}
282
+ */
283
+ UpdateSubresource() {
284
+ throw resourceBoundaryError("TriTextureRes", "UpdateSubresource", "Use engine-gpu to upload texture bytes.");
285
+ }
286
+
287
+ /**
288
+ * Resource preparation does not decide device upload policy.
289
+ *
290
+ * @returns {boolean}
291
+ */
292
+ PrepareResources() {
293
+ return this.IsPrepared();
309
294
  }
310
- }();
295
+ static payload = "texture";
296
+ }
311
297
  function getPayloadMemoryUsage(payload) {
312
298
  if (!payload || typeof payload !== "object") return 0;
313
299
  if (Number.isSafeInteger(payload.originalMemoryUsage) && payload.originalMemoryUsage >= 0) {
@@ -316,5 +302,58 @@ function getPayloadMemoryUsage(payload) {
316
302
  return ArrayBuffer.isView(payload.data) || payload.data instanceof ArrayBuffer ? payload.data.byteLength : 0;
317
303
  }
318
304
 
319
- export { _TriTextureRes as TriTextureRes };
305
+ // Declared as data rather than with decorators, so the resource tree loads from
306
+ // source without a transform. Field order is key order, and GetValues() exports
307
+ // in that order.
308
+ CjsSchema.define(TriTextureRes, {
309
+ className: "TriTextureRes",
310
+ family: "resources",
311
+ fields: {
312
+ format: [type.unknown, io.read],
313
+ type: [type.unknown, io.persist],
314
+ averageColor: [type.color, io.read],
315
+ depth: [type.uint32, io.read],
316
+ cutoutHeight: [type.float32, io.readwrite],
317
+ height: [type.uint32, io.read],
318
+ lodEnabled: [type.boolean, io.read],
319
+ hadLodRequests: [type.boolean, io.read],
320
+ cpuMip: [type.uint32, io.read],
321
+ gpuMip: [type.uint32, io.read],
322
+ wrappedRenderTarget: [type.unknown, io.read],
323
+ originalResolution: [type.uint32, io.read],
324
+ originalMemoryUsage: [type.uint64, io.read],
325
+ name: [type.string, io.readwrite],
326
+ arraySize: [type.uint32, io.read],
327
+ cutoutWidth: [type.float32, io.readwrite],
328
+ width: [type.uint32, io.read],
329
+ cutoutX: [type.float32, io.readwrite],
330
+ cutoutY: [type.float32, io.readwrite]
331
+ },
332
+ methods: {
333
+ GetMipCount: [carbon.method, impl.adapted],
334
+ GetMsaaType: [carbon.method, impl.adapted],
335
+ GetMsaaQuality: [carbon.method, impl.adapted],
336
+ HadLodRequests: [carbon.method, impl.adapted],
337
+ GetSrvIndexInHeap: [carbon.method, impl.notSupported],
338
+ SaveAsync: [carbon.method, impl.notSupported],
339
+ Save: [carbon.method, impl.notSupported],
340
+ IsSaving: [carbon.method, impl.noop],
341
+ IsSaveCompleted: [carbon.method, impl.noop],
342
+ IsSaveSucceeded: [carbon.method, impl.noop],
343
+ WaitForSave: [carbon.method, impl.noop],
344
+ CreateEmptyTexture: [carbon.method, impl.notSupported],
345
+ SetFromRenderTarget: [carbon.method, impl.notSupported],
346
+ CreateAndCopyFromRenderTarget: [carbon.method, impl.notSupported],
347
+ CreateFromHostBitmap: [carbon.method, impl.notSupported],
348
+ CreateFromTexture: [carbon.method, impl.notSupported],
349
+ HasALObject: [carbon.method, impl.adapted],
350
+ GetPipeline: [carbon.method, impl.adapted],
351
+ GetOriginalMemoryUsage: [carbon.method, impl.adapted],
352
+ SetAverageColor: [carbon.method, impl.adapted],
353
+ UpdateSubresource: [carbon.method, impl.notSupported],
354
+ PrepareResources: [carbon.method, impl.adapted]
355
+ }
356
+ });
357
+
358
+ export { TriTextureRes };
320
359
  //# sourceMappingURL=TriTextureRes.js.map