@carbonenginejs/runtime-resource 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CjsResMan.js +4 -4
- package/dist/CjsResMan.js.map +1 -1
- package/dist/_virtual/_rollupPluginBabelHelpers.js +1 -4
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/dist/format/CjsByteReader.js +310 -0
- package/dist/format/CjsByteReader.js.map +1 -0
- package/dist/format/CjsByteWriter.js +242 -0
- package/dist/format/CjsByteWriter.js.map +1 -0
- package/dist/format/CjsFormatError.js +41 -0
- package/dist/format/CjsFormatError.js.map +1 -0
- package/dist/format/CjsStringTable.js +268 -0
- package/dist/format/CjsStringTable.js.map +1 -0
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js +361 -0
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -0
- package/dist/format/carbonEffect/CjsCarbonEffectWriter.js +373 -0
- package/dist/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -0
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js +372 -0
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js.map +1 -0
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js +427 -0
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -0
- package/dist/format/carbonEffect/carbonEffectRecords.js +955 -0
- package/dist/format/carbonEffect/carbonEffectRecords.js.map +1 -0
- package/dist/format/compareUtf8.js +36 -0
- package/dist/format/compareUtf8.js.map +1 -0
- package/dist/format/index.js +11 -0
- package/dist/format/index.js.map +1 -0
- package/dist/formats/bnk/CjsBnkFormat.js +10 -4
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/eventAction.js +305 -0
- package/dist/formats/bnk/core/eventAction.js.map +1 -0
- package/dist/formats/bnk/core/helpers.js +11 -2
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/nodeBase.js +532 -0
- package/dist/formats/bnk/core/nodeBase.js.map +1 -0
- package/dist/formats/bnk/core/sfxNodes.js +252 -152
- package/dist/formats/bnk/core/sfxNodes.js.map +1 -1
- package/dist/formats/hlsl/core/HlslReader.js +7 -257
- package/dist/formats/hlsl/core/HlslReader.js.map +1 -1
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +781 -0
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +21 -1
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -1
- package/dist/formats/index.js +1 -1
- package/dist/formats/webgl/core/cewg/CewgPackage.js +2 -1
- package/dist/formats/webgl/core/cewg/CewgPackage.js.map +1 -1
- package/dist/formats/webgl/core/cewg/binary.js +11 -93
- package/dist/formats/webgl/core/cewg/binary.js.map +1 -1
- package/dist/formats/webgl/core/effectPackage.js +1 -1
- package/dist/formats/webgpu/CjsWebgpuFormat.js +4 -23
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +197 -0
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js +368 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/containerViews.js +355 -0
- package/dist/formats/webgpu/core/cewgpu/containerViews.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/validateContainer.js +90 -0
- package/dist/formats/webgpu/core/cewgpu/validateContainer.js.map +1 -0
- package/dist/formats/webgpu/core/effectBackendBodySet.js +21 -20
- package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
- package/dist/formats/webgpu/core/helpers.js +87 -92
- package/dist/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js +14 -13
- package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js.map +1 -1
- package/dist/formats/webgpu/core/ir/inferValueTypes.js +10 -8
- package/dist/formats/webgpu/core/ir/inferValueTypes.js.map +1 -1
- package/dist/formats/webgpu/core/packageEffect.js +94 -9
- package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
- package/dist/formats/webgpu/core/packageMetadata.js +10 -1
- package/dist/formats/webgpu/core/packageMetadata.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +17 -15
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js +13 -12
- package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +9 -8
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js +23 -22
- package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/selectionPlans.js +46 -44
- package/dist/formats/webgpu/core/wgsl/selectionPlans.js.map +1 -1
- package/dist/resource/CjsResource.js +700 -684
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/Tr2LightProfileRes.js +18 -27
- package/dist/resource/Tr2LightProfileRes.js.map +1 -1
- package/dist/resource/audio/CjsAudioBufferRes.js +2 -2
- package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -1
- package/dist/resource/audio/CjsAudioRes.js +2 -2
- package/dist/resource/audio/CjsAudioRes.js.map +1 -1
- package/dist/resource/geometry/TriGeometryRes.js +605 -586
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +21 -30
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
- package/dist/resource/geometry/granny/TriGrannyRes.js +21 -30
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
- package/dist/resource/shader/Tr2EffectRes.js +9 -7
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialArea.js +5 -3
- package/dist/resource/shader/Tr2MaterialArea.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialMesh.js +4 -2
- package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -1
- package/dist/resource/shader/Tr2MaterialRes.js +5 -3
- package/dist/resource/shader/Tr2MaterialRes.js.map +1 -1
- package/dist/resource/shader/Tr2Shader.js +26 -21
- package/dist/resource/shader/Tr2Shader.js.map +1 -1
- package/dist/resource/shader/Tr2ShaderPermutation.js +8 -6
- package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDefine.js +5 -3
- package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +5 -3
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +17 -15
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +11 -9
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +8 -6
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +15 -13
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +7 -5
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +11 -9
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +8 -6
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +400 -411
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
- package/dist/resource/texture/Tr2ImageRes.js +99 -95
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
- package/dist/resource/texture/TriTextureRes.js +312 -273
- package/dist/resource/texture/TriTextureRes.js.map +1 -1
- package/docs/README.md +13 -1
- package/docs/architecture.md +3 -3
- package/docs/concepts/resource-lifecycle.md +9 -2
- package/docs/concepts/shader-resource-model.md +114 -0
- package/docs/concepts/writing-an-engine-adapter.md +115 -0
- package/docs/formats/README.md +24 -1
- package/docs/formats/carbon-effect-container.md +452 -0
- package/docs/formats/dxbc/reference/classes/README.md +5 -72
- package/docs/formats/hlsl/reference/api.md +5 -4
- package/docs/formats/hlsl/reference/classes/README.md +6 -11
- package/docs/formats/provenance.md +23 -13
- package/docs/formats/webgl/reference/classes/README.md +5 -92
- package/docs/formats/webgpu/README.md +19 -16
- package/docs/formats/webgpu/architecture.md +15 -12
- package/docs/formats/webgpu/formats/cewgpu.md +175 -438
- package/docs/formats/webgpu/guides/effect-packaging.md +132 -140
- package/docs/formats/webgpu/reference/api.md +131 -131
- package/docs/formats/webgpu/reference/classes/README.md +5 -62
- package/docs/formats/webgpu/reference/wgsl-compatibility.md +146 -45
- package/docs/formats/wwise.md +34 -8
- package/docs/reference/classes/core.md +80 -0
- package/docs/reference/classes/formats.md +18 -28
- package/docs/reference/events.md +25 -0
- package/docs/reference/motherlode-cache.md +22 -8
- package/docs/reference/workers.md +5 -5
- package/docs/roadmap.md +61 -41
- package/package.json +2 -1
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js +0 -415
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js +0 -100
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/binary.js +0 -93
- package/dist/formats/webgpu/core/cewgpu/binary.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/tags.js +0 -17
- package/dist/formats/webgpu/core/cewgpu/tags.js.map +0 -1
- package/dist/formats/webgpu/core/effectPackageValidation.js +0 -1078
- package/dist/formats/webgpu/core/effectPackageValidation.js.map +0 -1
- package/docs/formats/hlsl/reference/classes/carbon-compatibility.md +0 -66
- package/docs/formats/hlsl/reference/classes/public-api.md +0 -26
- package/docs/formats/hlsl/reference/classes/tr2-effect-model.md +0 -150
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type } from '@carbonenginejs/runtime-utils/schema';
|
|
1
|
+
import { CjsSchema } from '@carbonenginejs/runtime-utils/schema';
|
|
3
2
|
import { normalizeResourcePath } from '@carbonenginejs/runtime-utils/path';
|
|
4
|
-
import { CjsResource
|
|
3
|
+
import { CjsResource } from '../CjsResource.js';
|
|
5
4
|
import { CjsTextureArrayResParameterProxy } from './CjsTextureArrayResParameterProxy.js';
|
|
6
5
|
|
|
7
|
-
let _initClass;
|
|
8
|
-
|
|
9
6
|
/**
|
|
10
7
|
* Mutable runtime aggregate for an ordered texture-array request.
|
|
11
8
|
*
|
|
@@ -13,471 +10,463 @@ let _initClass;
|
|
|
13
10
|
* manager or engine scheduler consumes the coalesced update on a later frame
|
|
14
11
|
* and prepares the corresponding immutable/cached texture-array payload.
|
|
15
12
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
super(resourceValues);
|
|
51
|
-
if (options.updateScheduler) this.SetUpdateScheduler(options.updateScheduler);
|
|
52
|
-
if (options.updateHandler) this.SetUpdateHandler(options.updateHandler);
|
|
53
|
-
const paths = options.layers || options.paths;
|
|
54
|
-
if (paths !== undefined) {
|
|
55
|
-
this.SetLayerResourcePaths(paths, options.layerNames);
|
|
56
|
-
} else if (options.layerCount !== undefined) {
|
|
57
|
-
this.SetLayerCount(options.layerCount, options.layerNames);
|
|
58
|
-
}
|
|
13
|
+
class CjsTextureArrayRes extends CjsResource {
|
|
14
|
+
#layers = [];
|
|
15
|
+
#dirtyLayers = new Set();
|
|
16
|
+
#requestedRevision = 0;
|
|
17
|
+
#preparedRevision = 0;
|
|
18
|
+
#updateScheduled = false;
|
|
19
|
+
#topologyChanged = false;
|
|
20
|
+
#inFlightRequests = new Map();
|
|
21
|
+
#readyWaiters = [];
|
|
22
|
+
#failedRevision = 0;
|
|
23
|
+
#failedError = null;
|
|
24
|
+
#updateScheduler = null;
|
|
25
|
+
#updateHandler = null;
|
|
26
|
+
|
|
27
|
+
/** Creates a CjsTextureArrayRes with caller-provided initial state. */
|
|
28
|
+
constructor(values = null) {
|
|
29
|
+
const options = values && typeof values === "object" && !Array.isArray(values) ? values : {};
|
|
30
|
+
const resourceValues = {
|
|
31
|
+
...options
|
|
32
|
+
};
|
|
33
|
+
delete resourceValues.layers;
|
|
34
|
+
delete resourceValues.paths;
|
|
35
|
+
delete resourceValues.layerCount;
|
|
36
|
+
delete resourceValues.layerNames;
|
|
37
|
+
delete resourceValues.updateScheduler;
|
|
38
|
+
delete resourceValues.updateHandler;
|
|
39
|
+
super(resourceValues);
|
|
40
|
+
if (options.updateScheduler) this.SetUpdateScheduler(options.updateScheduler);
|
|
41
|
+
if (options.updateHandler) this.SetUpdateHandler(options.updateHandler);
|
|
42
|
+
const paths = options.layers || options.paths;
|
|
43
|
+
if (paths !== undefined) {
|
|
44
|
+
this.SetLayerResourcePaths(paths, options.layerNames);
|
|
45
|
+
} else if (options.layerCount !== undefined) {
|
|
46
|
+
this.SetLayerCount(options.layerCount, options.layerNames);
|
|
59
47
|
}
|
|
48
|
+
}
|
|
60
49
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
/** Returns layer count from the current texture-array resource. */
|
|
51
|
+
GetLayerCount() {
|
|
52
|
+
return this.#layers.length;
|
|
53
|
+
}
|
|
65
54
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.#SetLayerNames(names);
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
const previousCount = this.#layers.length;
|
|
77
|
-
if (count < previousCount) {
|
|
78
|
-
this.#layers.length = count;
|
|
79
|
-
} else {
|
|
80
|
-
for (let layer = previousCount; layer < count; layer++) {
|
|
81
|
-
this.#layers.push(this.#CreateLayer(layer, names?.[layer]));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
55
|
+
/** Updates layer count in the current texture-array resource. */
|
|
56
|
+
SetLayerCount(value, names = null) {
|
|
57
|
+
const count = Number(value);
|
|
58
|
+
if (!Number.isInteger(count) || count < 1) {
|
|
59
|
+
throw new RangeError("CjsTextureArrayRes layer count must be a positive integer.");
|
|
60
|
+
}
|
|
61
|
+
if (count === this.#layers.length) {
|
|
84
62
|
this.#SetLayerNames(names);
|
|
85
|
-
|
|
86
|
-
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const previousCount = this.#layers.length;
|
|
66
|
+
if (count < previousCount) {
|
|
67
|
+
this.#layers.length = count;
|
|
68
|
+
} else {
|
|
69
|
+
for (let layer = previousCount; layer < count; layer++) {
|
|
70
|
+
this.#layers.push(this.#CreateLayer(layer, names?.[layer]));
|
|
71
|
+
}
|
|
87
72
|
}
|
|
73
|
+
this.#SetLayerNames(names);
|
|
74
|
+
this.#InvalidateRange(count, true);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
88
77
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
/** Returns layer parameter from the current texture-array resource. */
|
|
79
|
+
GetLayerParameter(layer) {
|
|
80
|
+
return this.#GetLayer(layer).proxy;
|
|
81
|
+
}
|
|
93
82
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
83
|
+
/** Returns layer parameters from the current texture-array resource. */
|
|
84
|
+
GetLayerParameters(out = []) {
|
|
85
|
+
for (const layer of this.#layers) out.push(layer.proxy);
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
99
88
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
89
|
+
/** Returns layer resource path from the current texture-array resource. */
|
|
90
|
+
GetLayerResourcePath(layer) {
|
|
91
|
+
return this.#GetLayer(layer).path;
|
|
92
|
+
}
|
|
104
93
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
94
|
+
/** Returns layer resource paths from the current texture-array resource. */
|
|
95
|
+
GetLayerResourcePaths(out = []) {
|
|
96
|
+
for (const layer of this.#layers) out.push(layer.path);
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
110
99
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
100
|
+
/** Updates layer resource path in the current texture-array resource. */
|
|
101
|
+
SetLayerResourcePath(layer, value) {
|
|
102
|
+
const record = this.#GetLayer(layer);
|
|
103
|
+
const path = normalizeResourcePath(value);
|
|
104
|
+
if (path === record.path) return false;
|
|
105
|
+
record.path = path;
|
|
106
|
+
record.resource = null;
|
|
107
|
+
this.#InvalidateLayer(layer);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
121
110
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
if (current.proxy.SetParameterName(name)) namesChanged = true;
|
|
146
|
-
next.push(current);
|
|
111
|
+
/** Updates layer resource paths in the current texture-array resource. */
|
|
112
|
+
SetLayerResourcePaths(values, names = null) {
|
|
113
|
+
if (!Array.isArray(values) || values.length === 0) {
|
|
114
|
+
throw new TypeError("CjsTextureArrayRes layers must be a non-empty array of resource paths.");
|
|
115
|
+
}
|
|
116
|
+
const paths = values.map(value => normalizeResourcePath(value && typeof value === "object" ? value.resourcePath ?? value.path ?? value.GetPath?.() ?? "" : value));
|
|
117
|
+
const topologyChanged = paths.length !== this.#layers.length;
|
|
118
|
+
let contentChanged = topologyChanged;
|
|
119
|
+
let namesChanged = false;
|
|
120
|
+
const changedLayers = new Set();
|
|
121
|
+
const next = [];
|
|
122
|
+
for (let layer = 0; layer < paths.length; layer++) {
|
|
123
|
+
const current = this.#layers[layer];
|
|
124
|
+
const name = names?.[layer] ?? current?.proxy?.GetParameterName?.() ?? "";
|
|
125
|
+
if (!current) {
|
|
126
|
+
next.push(this.#CreateLayer(layer, name, paths[layer]));
|
|
127
|
+
} else {
|
|
128
|
+
if (current.path !== paths[layer]) {
|
|
129
|
+
current.path = paths[layer];
|
|
130
|
+
current.resource = null;
|
|
131
|
+
contentChanged = true;
|
|
132
|
+
changedLayers.add(layer);
|
|
147
133
|
}
|
|
134
|
+
if (current.proxy.SetParameterName(name)) namesChanged = true;
|
|
135
|
+
next.push(current);
|
|
148
136
|
}
|
|
149
|
-
this.#layers = next;
|
|
150
|
-
if (topologyChanged) {
|
|
151
|
-
this.#InvalidateRange(paths.length, true);
|
|
152
|
-
} else if (contentChanged) {
|
|
153
|
-
this.#InvalidateLayers(changedLayers);
|
|
154
|
-
}
|
|
155
|
-
return contentChanged || namesChanged;
|
|
156
137
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
138
|
+
this.#layers = next;
|
|
139
|
+
if (topologyChanged) {
|
|
140
|
+
this.#InvalidateRange(paths.length, true);
|
|
141
|
+
} else if (contentChanged) {
|
|
142
|
+
this.#InvalidateLayers(changedLayers);
|
|
161
143
|
}
|
|
144
|
+
return contentChanged || namesChanged;
|
|
145
|
+
}
|
|
162
146
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (record.resource === next) return false;
|
|
168
|
-
record.resource = next;
|
|
169
|
-
this.#InvalidateLayer(layer);
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
147
|
+
/** Returns layer resource from the current texture-array resource. */
|
|
148
|
+
GetLayerResource(layer) {
|
|
149
|
+
return this.#GetLayer(layer).resource;
|
|
150
|
+
}
|
|
172
151
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
152
|
+
/** Updates layer resource in the current texture-array resource. */
|
|
153
|
+
SetLayerResource(layer, resource) {
|
|
154
|
+
const record = this.#GetLayer(layer);
|
|
155
|
+
const next = resource ?? null;
|
|
156
|
+
if (record.resource === next) return false;
|
|
157
|
+
record.resource = next;
|
|
158
|
+
this.#InvalidateLayer(layer);
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
179
161
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
162
|
+
/** Invalidate a layer whose resolved resource changed without changing identity. */
|
|
163
|
+
TouchLayer(layer) {
|
|
164
|
+
this.#GetLayer(layer);
|
|
165
|
+
this.#InvalidateLayer(layer);
|
|
166
|
+
return this;
|
|
167
|
+
}
|
|
185
168
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
169
|
+
/** Invalidate every current layer, for example after an adapter generation loss. */
|
|
170
|
+
TouchAllLayers(options = {}) {
|
|
171
|
+
this.#InvalidateRange(this.#layers.length, !!options.topologyChanged);
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
190
174
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
175
|
+
/** Returns requested revision from the current texture-array resource. */
|
|
176
|
+
GetRequestedRevision() {
|
|
177
|
+
return this.#requestedRevision;
|
|
178
|
+
}
|
|
195
179
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
180
|
+
/** Returns prepared revision from the current texture-array resource. */
|
|
181
|
+
GetPreparedRevision() {
|
|
182
|
+
return this.#preparedRevision;
|
|
183
|
+
}
|
|
200
184
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
185
|
+
/** Reports whether update is required by the current texture-array resource. */
|
|
186
|
+
NeedsUpdate() {
|
|
187
|
+
return this.#updateScheduled || this.#dirtyLayers.size > 0 || this.#preparedRevision < this.#requestedRevision;
|
|
188
|
+
}
|
|
205
189
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
GetInFlightRevisions(out = []) {
|
|
211
|
-
for (const revision of this.#inFlightRequests.keys()) out.push(revision);
|
|
212
|
-
return out.sort((a, b) => a - b);
|
|
213
|
-
}
|
|
190
|
+
/** Returns dirty layers from the current texture-array resource. */
|
|
191
|
+
GetDirtyLayers() {
|
|
192
|
+
return new Set(this.#dirtyLayers);
|
|
193
|
+
}
|
|
214
194
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Returns revisions currently being prepared by the update handler for the
|
|
197
|
+
* texture-array resource.
|
|
198
|
+
*/
|
|
199
|
+
GetInFlightRevisions(out = []) {
|
|
200
|
+
for (const revision of this.#inFlightRequests.keys()) out.push(revision);
|
|
201
|
+
return out.sort((a, b) => a - b);
|
|
202
|
+
}
|
|
222
203
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
return this;
|
|
231
|
-
}
|
|
204
|
+
/**
|
|
205
|
+
* Reports whether a requested revision is currently being prepared for the
|
|
206
|
+
* texture-array resource.
|
|
207
|
+
*/
|
|
208
|
+
IsRevisionInFlight(revision) {
|
|
209
|
+
return this.#inFlightRequests.has(revision);
|
|
210
|
+
}
|
|
232
211
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
this.#updateHandler = handler;
|
|
239
|
-
return this;
|
|
212
|
+
/** Updates update scheduler in the current texture-array resource. */
|
|
213
|
+
SetUpdateScheduler(schedule = null) {
|
|
214
|
+
if (schedule !== null && typeof schedule !== "function") {
|
|
215
|
+
throw new TypeError("CjsTextureArrayRes update scheduler must be a function or null.");
|
|
240
216
|
}
|
|
217
|
+
this.#updateScheduler = schedule;
|
|
218
|
+
if (schedule && this.#updateScheduled) schedule(this);
|
|
219
|
+
return this;
|
|
220
|
+
}
|
|
241
221
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
ConsumeUpdateRequest() {
|
|
247
|
-
if (!this.#updateScheduled && this.#dirtyLayers.size === 0) return null;
|
|
248
|
-
const request = Object.freeze({
|
|
249
|
-
revision: this.#requestedRevision,
|
|
250
|
-
paths: Object.freeze(this.GetLayerResourcePaths()),
|
|
251
|
-
resources: Object.freeze(this.#layers.map(layer => layer.resource)),
|
|
252
|
-
dirtyLayers: Object.freeze([...this.#dirtyLayers].sort((a, b) => a - b)),
|
|
253
|
-
topologyChanged: this.#topologyChanged
|
|
254
|
-
});
|
|
255
|
-
this.#dirtyLayers.clear();
|
|
256
|
-
this.#topologyChanged = false;
|
|
257
|
-
this.#updateScheduled = false;
|
|
258
|
-
this.#inFlightRequests.set(request.revision, request);
|
|
259
|
-
return request;
|
|
222
|
+
/** Updates update handler in the current texture-array resource. */
|
|
223
|
+
SetUpdateHandler(handler = null) {
|
|
224
|
+
if (handler !== null && typeof handler !== "function") {
|
|
225
|
+
throw new TypeError("CjsTextureArrayRes update handler must be a function or null.");
|
|
260
226
|
}
|
|
227
|
+
this.#updateHandler = handler;
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
261
230
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
231
|
+
/**
|
|
232
|
+
* Consume all proxy changes as one immutable request snapshot.
|
|
233
|
+
* A frame scheduler should call this at most once per parent per frame.
|
|
234
|
+
*/
|
|
235
|
+
ConsumeUpdateRequest() {
|
|
236
|
+
if (!this.#updateScheduled && this.#dirtyLayers.size === 0) return null;
|
|
237
|
+
const request = Object.freeze({
|
|
238
|
+
revision: this.#requestedRevision,
|
|
239
|
+
paths: Object.freeze(this.GetLayerResourcePaths()),
|
|
240
|
+
resources: Object.freeze(this.#layers.map(layer => layer.resource)),
|
|
241
|
+
dirtyLayers: Object.freeze([...this.#dirtyLayers].sort((a, b) => a - b)),
|
|
242
|
+
topologyChanged: this.#topologyChanged
|
|
243
|
+
});
|
|
244
|
+
this.#dirtyLayers.clear();
|
|
245
|
+
this.#topologyChanged = false;
|
|
246
|
+
this.#updateScheduled = false;
|
|
247
|
+
this.#inFlightRequests.set(request.revision, request);
|
|
248
|
+
return request;
|
|
249
|
+
}
|
|
280
250
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this.#failedRevision =
|
|
289
|
-
this.#failedError =
|
|
290
|
-
if (this.#preparedRevision === 0) this.SetError(failure);
|
|
291
|
-
this.EmitEvent("revisionfailed", this, revision, failure);
|
|
292
|
-
this.#RejectReadyWaiters(revision, failure);
|
|
293
|
-
return true;
|
|
251
|
+
/** Requeue a consumed current request after cancellation, loss, or retryable failure. */
|
|
252
|
+
RetryUpdateRequest(revision = this.#requestedRevision) {
|
|
253
|
+
const request = this.#inFlightRequests.get(revision);
|
|
254
|
+
if (!request) return false;
|
|
255
|
+
this.#inFlightRequests.delete(revision);
|
|
256
|
+
if (revision !== this.#requestedRevision) return false;
|
|
257
|
+
if (this.#failedRevision === revision) {
|
|
258
|
+
this.#failedRevision = 0;
|
|
259
|
+
this.#failedError = null;
|
|
294
260
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
Update(context = {}) {
|
|
298
|
-
const request = this.ConsumeUpdateRequest();
|
|
299
|
-
if (!request) return null;
|
|
300
|
-
this.EmitEvent("update", this, request, context);
|
|
301
|
-
return this.#updateHandler ? this.#updateHandler(this, request, context) : request;
|
|
261
|
+
for (const layer of request.dirtyLayers) {
|
|
262
|
+
if (layer < this.#layers.length) this.#dirtyLayers.add(layer);
|
|
302
263
|
}
|
|
264
|
+
this.#topologyChanged ||= request.topologyChanged;
|
|
265
|
+
this.#ScheduleUpdate();
|
|
266
|
+
this.EmitEvent("revisionretry", this, revision);
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
303
269
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
270
|
+
/** Complete a consumed request as failed, optionally making it retryable. */
|
|
271
|
+
FailUpdateRequest(revision, error, options = {}) {
|
|
272
|
+
if (options.retry) return this.RetryUpdateRequest(revision);
|
|
273
|
+
if (!this.#inFlightRequests.has(revision)) return false;
|
|
274
|
+
this.#inFlightRequests.delete(revision);
|
|
275
|
+
if (revision !== this.#requestedRevision) return false;
|
|
276
|
+
const failure = error instanceof Error ? error : new Error(String(error ?? "Texture array preparation failed."));
|
|
277
|
+
this.#failedRevision = revision;
|
|
278
|
+
this.#failedError = failure;
|
|
279
|
+
if (this.#preparedRevision === 0) this.SetError(failure);
|
|
280
|
+
this.EmitEvent("revisionfailed", this, revision, failure);
|
|
281
|
+
this.#RejectReadyWaiters(revision, failure);
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** Run the registered update handler for the current coalesced frame request. */
|
|
286
|
+
Update(context = {}) {
|
|
287
|
+
const request = this.ConsumeUpdateRequest();
|
|
288
|
+
if (!request) return null;
|
|
289
|
+
this.EmitEvent("update", this, request, context);
|
|
290
|
+
return this.#updateHandler ? this.#updateHandler(this, request, context) : request;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Atomically publish an opaque adapter allocation with its prepared revision.
|
|
295
|
+
* The caller owns disposal of a successfully displaced allocation.
|
|
296
|
+
*/
|
|
297
|
+
CommitPreparedAdapterRevision(revision, adapterKey, candidate, options = {}) {
|
|
298
|
+
if (!adapterKey) throw new TypeError("CjsTextureArrayRes adapter publication requires a key.");
|
|
299
|
+
if (candidate === null || candidate === undefined) {
|
|
300
|
+
throw new TypeError("CjsTextureArrayRes adapter publication requires a candidate allocation.");
|
|
301
|
+
}
|
|
302
|
+
const inFlight = this.#inFlightRequests.has(revision);
|
|
303
|
+
if (!inFlight || revision !== this.#requestedRevision) {
|
|
304
|
+
if (inFlight) this.#inFlightRequests.delete(revision);
|
|
305
|
+
if (options.destroyRejected !== false) destroyAdapterValue(candidate);
|
|
335
306
|
return Object.freeze({
|
|
336
|
-
published:
|
|
307
|
+
published: false,
|
|
337
308
|
revision,
|
|
338
|
-
displaced:
|
|
309
|
+
displaced: null
|
|
339
310
|
});
|
|
340
311
|
}
|
|
312
|
+
const displaced = this.GetAdapterResource(adapterKey);
|
|
313
|
+
this.SetAdapterResource(adapterKey, candidate);
|
|
314
|
+
this.#preparedRevision = revision;
|
|
315
|
+
this.#failedRevision = 0;
|
|
316
|
+
this.#failedError = null;
|
|
317
|
+
this.#inFlightRequests.delete(revision);
|
|
318
|
+
for (const pendingRevision of this.#inFlightRequests.keys()) {
|
|
319
|
+
if (pendingRevision < revision) this.#inFlightRequests.delete(pendingRevision);
|
|
320
|
+
}
|
|
321
|
+
this.MarkPrepared();
|
|
322
|
+
this.EmitEvent("revisionprepared", this, revision, adapterKey, candidate);
|
|
323
|
+
this.#ResolveReadyWaiters(revision);
|
|
324
|
+
return Object.freeze({
|
|
325
|
+
published: true,
|
|
326
|
+
revision,
|
|
327
|
+
displaced: displaced === candidate ? null : displaced
|
|
328
|
+
});
|
|
329
|
+
}
|
|
341
330
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
331
|
+
/** Destroy an unusable adapter allocation and request a complete rebuild. */
|
|
332
|
+
HandleAdapterLoss(adapterKey, options = {}) {
|
|
333
|
+
if (!adapterKey) throw new TypeError("CjsTextureArrayRes adapter loss requires a key.");
|
|
334
|
+
const lost = this.GetAdapterResource(adapterKey);
|
|
335
|
+
if (this.HasAdapterResource(adapterKey)) this.DestroyAdapterResource(adapterKey, options);
|
|
336
|
+
this.#preparedRevision = 0;
|
|
337
|
+
if (this.#layers.length) this.#InvalidateRange(this.#layers.length, true);
|
|
338
|
+
if (this.state === CjsResource.State.PREPARED) this.MarkPreparing();
|
|
339
|
+
this.EmitEvent("adapterlost", this, adapterKey, lost);
|
|
340
|
+
return lost;
|
|
341
|
+
}
|
|
353
342
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
});
|
|
343
|
+
/** Resolve when the generation requested at call time has been prepared. */
|
|
344
|
+
Ready() {
|
|
345
|
+
if (this.#requestedRevision === 0) {
|
|
346
|
+
const error = new Error("Texture array resource has no configured layers.");
|
|
347
|
+
error.code = "CJS_TEXTURE_ARRAY_UNCONFIGURED";
|
|
348
|
+
return Promise.reject(error);
|
|
349
|
+
}
|
|
350
|
+
const revision = this.#requestedRevision;
|
|
351
|
+
if (this.#preparedRevision >= revision && this.IsPrepared()) return Promise.resolve(this);
|
|
352
|
+
if (this.#failedRevision === revision) return Promise.reject(this.#failedError);
|
|
353
|
+
return new Promise((resolve, reject) => {
|
|
354
|
+
this.#readyWaiters.push({
|
|
355
|
+
revision,
|
|
356
|
+
resolve,
|
|
357
|
+
reject
|
|
370
358
|
});
|
|
371
|
-
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
372
361
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
362
|
+
/** Creates one texture-array layer record for the texture-array resource. */
|
|
363
|
+
#CreateLayer(layer, name = "", path = "") {
|
|
364
|
+
return {
|
|
365
|
+
path: normalizeResourcePath(path),
|
|
366
|
+
resource: null,
|
|
367
|
+
proxy: new CjsTextureArrayResParameterProxy(this, layer, {
|
|
368
|
+
name
|
|
369
|
+
})
|
|
370
|
+
};
|
|
371
|
+
}
|
|
383
372
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
return this.#layers[layer];
|
|
373
|
+
/**
|
|
374
|
+
* Returns a validated texture-array layer record for the texture-array
|
|
375
|
+
* resource.
|
|
376
|
+
*/
|
|
377
|
+
#GetLayer(layer) {
|
|
378
|
+
if (!Number.isInteger(layer) || layer < 0 || layer >= this.#layers.length) {
|
|
379
|
+
throw new RangeError(`CjsTextureArrayRes layer ${layer} is out of range.`);
|
|
393
380
|
}
|
|
381
|
+
return this.#layers[layer];
|
|
382
|
+
}
|
|
394
383
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
384
|
+
/** Updates layer names in the current texture-array resource. */
|
|
385
|
+
#SetLayerNames(names) {
|
|
386
|
+
if (!names) return;
|
|
387
|
+
for (let layer = 0; layer < Math.min(names.length, this.#layers.length); layer++) {
|
|
388
|
+
this.#layers[layer].proxy.SetParameterName(names[layer]);
|
|
401
389
|
}
|
|
390
|
+
}
|
|
402
391
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
392
|
+
/** Invalidates one texture-array layer for the texture-array resource. */
|
|
393
|
+
#InvalidateLayer(layer) {
|
|
394
|
+
this.#InvalidateLayers([layer]);
|
|
395
|
+
}
|
|
407
396
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
397
|
+
/**
|
|
398
|
+
* Invalidates the requested texture-array layer range for the texture-array
|
|
399
|
+
* resource.
|
|
400
|
+
*/
|
|
401
|
+
#InvalidateRange(count, topologyChanged = false) {
|
|
402
|
+
const layers = [];
|
|
403
|
+
for (let layer = 0; layer < count; layer++) layers.push(layer);
|
|
404
|
+
this.#InvalidateLayers(layers, topologyChanged);
|
|
405
|
+
}
|
|
417
406
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
407
|
+
/**
|
|
408
|
+
* Invalidates the supplied texture-array layers for the texture-array
|
|
409
|
+
* resource.
|
|
410
|
+
*/
|
|
411
|
+
#InvalidateLayers(layers, topologyChanged = false) {
|
|
412
|
+
const changed = [];
|
|
413
|
+
for (const layer of layers) {
|
|
414
|
+
if (!Number.isInteger(layer) || layer < 0 || layer >= this.#layers.length) continue;
|
|
415
|
+
this.#dirtyLayers.add(layer);
|
|
416
|
+
changed.push(layer);
|
|
417
|
+
}
|
|
418
|
+
if (!changed.length && !topologyChanged) return;
|
|
419
|
+
this.#topologyChanged ||= topologyChanged;
|
|
420
|
+
this.#failedRevision = 0;
|
|
421
|
+
this.#failedError = null;
|
|
422
|
+
this.#requestedRevision += 1;
|
|
423
|
+
this.#ScheduleUpdate();
|
|
424
|
+
this.EmitEvent("invalidated", this, Object.freeze(changed), this.#requestedRevision, Object.freeze({
|
|
425
|
+
topologyChanged: this.#topologyChanged
|
|
426
|
+
}));
|
|
427
|
+
}
|
|
439
428
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
429
|
+
/** Schedules the coalesced texture-array update for the texture-array resource. */
|
|
430
|
+
#ScheduleUpdate() {
|
|
431
|
+
if (this.#updateScheduled) return;
|
|
432
|
+
this.#updateScheduled = true;
|
|
433
|
+
this.#updateScheduler?.(this);
|
|
434
|
+
}
|
|
446
435
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
this.#readyWaiters = pending;
|
|
436
|
+
/**
|
|
437
|
+
* Resolves waiters satisfied by the prepared revision for the texture-array
|
|
438
|
+
* resource.
|
|
439
|
+
*/
|
|
440
|
+
#ResolveReadyWaiters(revision) {
|
|
441
|
+
const pending = [];
|
|
442
|
+
for (const waiter of this.#readyWaiters) {
|
|
443
|
+
if (waiter.revision <= revision) waiter.resolve(this);else pending.push(waiter);
|
|
457
444
|
}
|
|
445
|
+
this.#readyWaiters = pending;
|
|
446
|
+
}
|
|
458
447
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}
|
|
468
|
-
this.#readyWaiters = pending;
|
|
448
|
+
/**
|
|
449
|
+
* Rejects waiters affected by a failed revision for the texture-array
|
|
450
|
+
* resource.
|
|
451
|
+
*/
|
|
452
|
+
#RejectReadyWaiters(revision, error) {
|
|
453
|
+
const pending = [];
|
|
454
|
+
for (const waiter of this.#readyWaiters) {
|
|
455
|
+
if (waiter.revision <= revision) waiter.reject(error);else pending.push(waiter);
|
|
469
456
|
}
|
|
470
|
-
|
|
471
|
-
payload = "texture-array";
|
|
472
|
-
constructor() {
|
|
473
|
-
super(_CjsTextureArrayRes), _initClass();
|
|
457
|
+
this.#readyWaiters = pending;
|
|
474
458
|
}
|
|
475
|
-
|
|
459
|
+
static payload = "texture-array";
|
|
460
|
+
}
|
|
476
461
|
function destroyAdapterValue(value) {
|
|
477
462
|
if (!value || typeof value !== "object" && typeof value !== "function") return;
|
|
478
463
|
const destroy = value.Destroy || value.Dispose || value.destroy || value.dispose;
|
|
479
464
|
if (typeof destroy === "function") destroy.call(value);
|
|
480
465
|
}
|
|
466
|
+
CjsSchema.define(CjsTextureArrayRes, {
|
|
467
|
+
className: "CjsTextureArrayRes",
|
|
468
|
+
family: "resource"
|
|
469
|
+
});
|
|
481
470
|
|
|
482
|
-
export {
|
|
471
|
+
export { CjsTextureArrayRes };
|
|
483
472
|
//# sourceMappingURL=CjsTextureArrayRes.js.map
|