@onerjs/smart-filters 8.25.1 → 8.25.3
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/IDisposable.d.ts +10 -0
- package/dist/IDisposable.d.ts.map +1 -0
- package/dist/IDisposable.js +2 -0
- package/dist/IDisposable.js.map +1 -0
- package/dist/blockFoundation/aggregateBlock.d.ts +56 -0
- package/dist/blockFoundation/aggregateBlock.d.ts.map +1 -0
- package/dist/blockFoundation/aggregateBlock.js +130 -0
- package/dist/blockFoundation/aggregateBlock.js.map +1 -0
- package/dist/blockFoundation/baseBlock.d.ts +176 -0
- package/dist/blockFoundation/baseBlock.d.ts.map +1 -0
- package/dist/blockFoundation/baseBlock.js +276 -0
- package/dist/blockFoundation/baseBlock.js.map +1 -0
- package/dist/blockFoundation/customAggregateBlock.d.ts +38 -0
- package/dist/blockFoundation/customAggregateBlock.d.ts.map +1 -0
- package/dist/blockFoundation/customAggregateBlock.js +63 -0
- package/dist/blockFoundation/customAggregateBlock.js.map +1 -0
- package/dist/blockFoundation/customShaderBlock.d.ts +73 -0
- package/dist/blockFoundation/customShaderBlock.d.ts.map +1 -0
- package/dist/blockFoundation/customShaderBlock.js +232 -0
- package/dist/blockFoundation/customShaderBlock.js.map +1 -0
- package/dist/blockFoundation/disableableShaderBlock.d.ts +56 -0
- package/dist/blockFoundation/disableableShaderBlock.d.ts.map +1 -0
- package/dist/blockFoundation/disableableShaderBlock.js +68 -0
- package/dist/blockFoundation/disableableShaderBlock.js.map +1 -0
- package/dist/blockFoundation/index.d.ts +10 -0
- package/dist/blockFoundation/index.d.ts.map +1 -0
- package/dist/blockFoundation/index.js +8 -0
- package/dist/blockFoundation/index.js.map +1 -0
- package/dist/blockFoundation/inputBlock.d.ts +127 -0
- package/dist/blockFoundation/inputBlock.d.ts.map +1 -0
- package/dist/blockFoundation/inputBlock.deserializer.d.ts +12 -0
- package/dist/blockFoundation/inputBlock.deserializer.d.ts.map +1 -0
- package/dist/blockFoundation/inputBlock.deserializer.js +65 -0
- package/dist/blockFoundation/inputBlock.deserializer.js.map +1 -0
- package/dist/blockFoundation/inputBlock.js +89 -0
- package/dist/blockFoundation/inputBlock.js.map +1 -0
- package/dist/blockFoundation/inputBlock.serialization.types.d.ts +105 -0
- package/dist/blockFoundation/inputBlock.serialization.types.d.ts.map +1 -0
- package/dist/blockFoundation/inputBlock.serialization.types.js +2 -0
- package/dist/blockFoundation/inputBlock.serialization.types.js.map +1 -0
- package/dist/blockFoundation/inputBlock.serializer.d.ts +6 -0
- package/dist/blockFoundation/inputBlock.serializer.d.ts.map +1 -0
- package/dist/blockFoundation/inputBlock.serializer.js +130 -0
- package/dist/blockFoundation/inputBlock.serializer.js.map +1 -0
- package/dist/blockFoundation/outputBlock.d.ts +47 -0
- package/dist/blockFoundation/outputBlock.d.ts.map +1 -0
- package/dist/blockFoundation/outputBlock.js +123 -0
- package/dist/blockFoundation/outputBlock.js.map +1 -0
- package/dist/blockFoundation/shaderBlock.d.ts +64 -0
- package/dist/blockFoundation/shaderBlock.d.ts.map +1 -0
- package/dist/blockFoundation/shaderBlock.js +125 -0
- package/dist/blockFoundation/shaderBlock.js.map +1 -0
- package/dist/blockFoundation/textureOptions.d.ts +47 -0
- package/dist/blockFoundation/textureOptions.d.ts.map +1 -0
- package/dist/blockFoundation/textureOptions.js +37 -0
- package/dist/blockFoundation/textureOptions.js.map +1 -0
- package/dist/command/command.d.ts +48 -0
- package/dist/command/command.d.ts.map +1 -0
- package/dist/command/command.js +15 -0
- package/dist/command/command.js.map +1 -0
- package/dist/command/commandBuffer.d.ts +40 -0
- package/dist/command/commandBuffer.d.ts.map +1 -0
- package/dist/command/commandBuffer.js +58 -0
- package/dist/command/commandBuffer.js.map +1 -0
- package/dist/command/commandBufferDebugger.d.ts +7 -0
- package/dist/command/commandBufferDebugger.d.ts.map +1 -0
- package/dist/command/commandBufferDebugger.js +13 -0
- package/dist/command/commandBufferDebugger.js.map +1 -0
- package/dist/command/index.d.ts +6 -0
- package/dist/command/index.d.ts.map +1 -0
- package/dist/command/index.js +8 -0
- package/dist/command/index.js.map +1 -0
- package/dist/connection/connectionPoint.d.ts +110 -0
- package/dist/connection/connectionPoint.d.ts.map +1 -0
- package/dist/connection/connectionPoint.js +154 -0
- package/dist/connection/connectionPoint.js.map +1 -0
- package/dist/connection/connectionPointCompatibilityState.d.ts +20 -0
- package/dist/connection/connectionPointCompatibilityState.d.ts.map +1 -0
- package/dist/connection/connectionPointCompatibilityState.js +32 -0
- package/dist/connection/connectionPointCompatibilityState.js.map +1 -0
- package/dist/connection/connectionPointDirection.d.ts +10 -0
- package/dist/connection/connectionPointDirection.d.ts.map +1 -0
- package/dist/connection/connectionPointDirection.js +11 -0
- package/dist/connection/connectionPointDirection.js.map +1 -0
- package/dist/connection/connectionPointType.d.ts +29 -0
- package/dist/connection/connectionPointType.d.ts.map +1 -0
- package/dist/connection/connectionPointType.js +19 -0
- package/dist/connection/connectionPointType.js.map +1 -0
- package/dist/connection/connectionPointWithDefault.d.ts +23 -0
- package/dist/connection/connectionPointWithDefault.d.ts.map +1 -0
- package/dist/connection/connectionPointWithDefault.js +19 -0
- package/dist/connection/connectionPointWithDefault.js.map +1 -0
- package/dist/connection/index.d.ts +8 -0
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/index.js +7 -0
- package/dist/connection/index.js.map +1 -0
- package/dist/editorUtils/editableInPropertyPage.d.ts +80 -0
- package/dist/editorUtils/editableInPropertyPage.d.ts.map +1 -0
- package/dist/editorUtils/editableInPropertyPage.js +42 -0
- package/dist/editorUtils/editableInPropertyPage.js.map +1 -0
- package/dist/editorUtils/index.d.ts +3 -0
- package/dist/editorUtils/index.d.ts.map +1 -0
- package/dist/editorUtils/index.js +4 -0
- package/dist/editorUtils/index.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/optimization/dependencyGraph.d.ts +31 -0
- package/dist/optimization/dependencyGraph.d.ts.map +1 -0
- package/dist/optimization/dependencyGraph.js +78 -0
- package/dist/optimization/dependencyGraph.js.map +1 -0
- package/dist/optimization/index.d.ts +2 -0
- package/dist/optimization/index.d.ts.map +1 -0
- package/dist/optimization/index.js +2 -0
- package/dist/optimization/index.js.map +1 -0
- package/dist/optimization/optimizedShaderBlock.d.ts +75 -0
- package/dist/optimization/optimizedShaderBlock.d.ts.map +1 -0
- package/dist/optimization/optimizedShaderBlock.js +105 -0
- package/dist/optimization/optimizedShaderBlock.js.map +1 -0
- package/dist/optimization/smartFilterOptimizer.d.ts +126 -0
- package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -0
- package/dist/optimization/smartFilterOptimizer.js +666 -0
- package/dist/optimization/smartFilterOptimizer.js.map +1 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +7 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/renderTargetGenerator.d.ts +43 -0
- package/dist/runtime/renderTargetGenerator.d.ts.map +1 -0
- package/dist/runtime/renderTargetGenerator.js +169 -0
- package/dist/runtime/renderTargetGenerator.js.map +1 -0
- package/dist/runtime/shaderRuntime.d.ts +103 -0
- package/dist/runtime/shaderRuntime.d.ts.map +1 -0
- package/dist/runtime/shaderRuntime.js +132 -0
- package/dist/runtime/shaderRuntime.js.map +1 -0
- package/dist/runtime/smartFilterRuntime.d.ts +69 -0
- package/dist/runtime/smartFilterRuntime.d.ts.map +1 -0
- package/dist/runtime/smartFilterRuntime.js +63 -0
- package/dist/runtime/smartFilterRuntime.js.map +1 -0
- package/dist/runtime/strongRef.d.ts +16 -0
- package/dist/runtime/strongRef.d.ts.map +1 -0
- package/dist/runtime/strongRef.js +9 -0
- package/dist/runtime/strongRef.js.map +1 -0
- package/dist/serialization/importCustomBlockDefinition.d.ts +15 -0
- package/dist/serialization/importCustomBlockDefinition.d.ts.map +1 -0
- package/dist/serialization/importCustomBlockDefinition.js +76 -0
- package/dist/serialization/importCustomBlockDefinition.js.map +1 -0
- package/dist/serialization/index.d.ts +9 -0
- package/dist/serialization/index.d.ts.map +1 -0
- package/dist/serialization/index.js +11 -0
- package/dist/serialization/index.js.map +1 -0
- package/dist/serialization/serializedBlockDefinition.d.ts +12 -0
- package/dist/serialization/serializedBlockDefinition.d.ts.map +1 -0
- package/dist/serialization/serializedBlockDefinition.js +2 -0
- package/dist/serialization/serializedBlockDefinition.js.map +1 -0
- package/dist/serialization/serializedShaderBlockDefinition.d.ts +7 -0
- package/dist/serialization/serializedShaderBlockDefinition.d.ts.map +1 -0
- package/dist/serialization/serializedShaderBlockDefinition.js +2 -0
- package/dist/serialization/serializedShaderBlockDefinition.js.map +1 -0
- package/dist/serialization/serializedSmartFilter.d.ts +6 -0
- package/dist/serialization/serializedSmartFilter.d.ts.map +1 -0
- package/dist/serialization/serializedSmartFilter.js +2 -0
- package/dist/serialization/serializedSmartFilter.js.map +1 -0
- package/dist/serialization/smartFilterDeserializer.d.ts +34 -0
- package/dist/serialization/smartFilterDeserializer.d.ts.map +1 -0
- package/dist/serialization/smartFilterDeserializer.js +141 -0
- package/dist/serialization/smartFilterDeserializer.js.map +1 -0
- package/dist/serialization/smartFilterSerializer.d.ts +23 -0
- package/dist/serialization/smartFilterSerializer.d.ts.map +1 -0
- package/dist/serialization/smartFilterSerializer.js +95 -0
- package/dist/serialization/smartFilterSerializer.js.map +1 -0
- package/dist/serialization/v1/defaultBlockSerializer.d.ts +9 -0
- package/dist/serialization/v1/defaultBlockSerializer.d.ts.map +1 -0
- package/dist/serialization/v1/defaultBlockSerializer.js +19 -0
- package/dist/serialization/v1/defaultBlockSerializer.js.map +1 -0
- package/dist/serialization/v1/index.d.ts +4 -0
- package/dist/serialization/v1/index.d.ts.map +1 -0
- package/dist/serialization/v1/index.js +5 -0
- package/dist/serialization/v1/index.js.map +1 -0
- package/dist/serialization/v1/shaderBlockSerialization.types.d.ts +73 -0
- package/dist/serialization/v1/shaderBlockSerialization.types.d.ts.map +1 -0
- package/dist/serialization/v1/shaderBlockSerialization.types.js +7 -0
- package/dist/serialization/v1/shaderBlockSerialization.types.js.map +1 -0
- package/dist/serialization/v1/smartFilterSerialization.types.d.ts +98 -0
- package/dist/serialization/v1/smartFilterSerialization.types.d.ts.map +1 -0
- package/dist/serialization/v1/smartFilterSerialization.types.js +2 -0
- package/dist/serialization/v1/smartFilterSerialization.types.js.map +1 -0
- package/dist/smartFilter.d.ts +118 -0
- package/dist/smartFilter.d.ts.map +1 -0
- package/dist/smartFilter.js +169 -0
- package/dist/smartFilter.js.map +1 -0
- package/dist/utils/buildTools/buildShaders.d.ts +9 -0
- package/dist/utils/buildTools/buildShaders.d.ts.map +1 -0
- package/dist/utils/buildTools/buildShaders.js +13 -0
- package/dist/utils/buildTools/buildShaders.js.map +1 -0
- package/dist/utils/buildTools/convertGlslIntoBlock.d.ts +9 -0
- package/dist/utils/buildTools/convertGlslIntoBlock.d.ts.map +1 -0
- package/dist/utils/buildTools/convertGlslIntoBlock.js +346 -0
- package/dist/utils/buildTools/convertGlslIntoBlock.js.map +1 -0
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts +26 -0
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts.map +1 -0
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.js +141 -0
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.js.map +1 -0
- package/dist/utils/buildTools/convertShaders.d.ts +16 -0
- package/dist/utils/buildTools/convertShaders.d.ts.map +1 -0
- package/dist/utils/buildTools/convertShaders.js +62 -0
- package/dist/utils/buildTools/convertShaders.js.map +1 -0
- package/dist/utils/buildTools/shaderCode.types.d.ts +51 -0
- package/dist/utils/buildTools/shaderCode.types.d.ts.map +1 -0
- package/dist/utils/buildTools/shaderCode.types.js +2 -0
- package/dist/utils/buildTools/shaderCode.types.js.map +1 -0
- package/dist/utils/buildTools/shaderConverter.d.ts +77 -0
- package/dist/utils/buildTools/shaderConverter.d.ts.map +1 -0
- package/dist/utils/buildTools/shaderConverter.js +297 -0
- package/dist/utils/buildTools/shaderConverter.js.map +1 -0
- package/dist/utils/buildTools/watchShaders.d.ts +9 -0
- package/dist/utils/buildTools/watchShaders.d.ts.map +1 -0
- package/dist/utils/buildTools/watchShaders.js +39 -0
- package/dist/utils/buildTools/watchShaders.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/renderTargetUtils.d.ts +14 -0
- package/dist/utils/renderTargetUtils.d.ts.map +1 -0
- package/dist/utils/renderTargetUtils.js +23 -0
- package/dist/utils/renderTargetUtils.js.map +1 -0
- package/dist/utils/shaderCodeUtils.d.ts +91 -0
- package/dist/utils/shaderCodeUtils.d.ts.map +1 -0
- package/dist/utils/shaderCodeUtils.js +111 -0
- package/dist/utils/shaderCodeUtils.js.map +1 -0
- package/dist/utils/textureLoaders.d.ts +16 -0
- package/dist/utils/textureLoaders.d.ts.map +1 -0
- package/dist/utils/textureLoaders.js +22 -0
- package/dist/utils/textureLoaders.js.map +1 -0
- package/dist/utils/textureUtils.d.ts +13 -0
- package/dist/utils/textureUtils.d.ts.map +1 -0
- package/dist/utils/textureUtils.js +25 -0
- package/dist/utils/textureUtils.js.map +1 -0
- package/dist/utils/uniqueIdGenerator.d.ts +19 -0
- package/dist/utils/uniqueIdGenerator.d.ts.map +1 -0
- package/dist/utils/uniqueIdGenerator.js +27 -0
- package/dist/utils/uniqueIdGenerator.js.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +1 -1
- package/src/optimization/smartFilterOptimizer.ts +305 -158
- package/src/version.ts +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Logger } from "@onerjs/core/Misc/logger.js";
|
|
2
|
+
/**
|
|
3
|
+
* Implementation of a dependency graph.
|
|
4
|
+
*/
|
|
5
|
+
export class DependencyGraph {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new instance of a dependency graph.
|
|
8
|
+
*/
|
|
9
|
+
constructor() {
|
|
10
|
+
this._list = new Set();
|
|
11
|
+
this._dependOn = new Map();
|
|
12
|
+
this._requiredBy = new Map();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Adds an element to the graph.
|
|
16
|
+
* @param element - The element to add to the graph.
|
|
17
|
+
*/
|
|
18
|
+
addElement(element) {
|
|
19
|
+
if (this._list.has(element)) {
|
|
20
|
+
throw new Error(`Element "${element}" already added to the graph!`);
|
|
21
|
+
}
|
|
22
|
+
this._list.add(element);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Adds a dependency between two elements.
|
|
26
|
+
* @param element - The element that depends on another element.
|
|
27
|
+
* @param dependency - The element that is required by the element passed as the first parameter.
|
|
28
|
+
*/
|
|
29
|
+
addDependency(element, dependency) {
|
|
30
|
+
if (!this._dependOn.has(element)) {
|
|
31
|
+
this._dependOn.set(element, new Set());
|
|
32
|
+
}
|
|
33
|
+
if (!this._requiredBy.has(dependency)) {
|
|
34
|
+
this._requiredBy.set(dependency, new Set());
|
|
35
|
+
}
|
|
36
|
+
this._dependOn.get(element).add(dependency);
|
|
37
|
+
this._requiredBy.get(dependency).add(element);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Walks through the graph and calls the callback for each element.
|
|
41
|
+
* The elements that depend on other elements will be traversed after the elements they depend on.
|
|
42
|
+
* Note: the graph will be modified during the walk, so don't call walk twice on the same graph!
|
|
43
|
+
* @param callback - The callback to call for each element.
|
|
44
|
+
*/
|
|
45
|
+
walk(callback) {
|
|
46
|
+
const toVisit = [];
|
|
47
|
+
// Collect all elements that have no dependency
|
|
48
|
+
for (const element of this._list) {
|
|
49
|
+
if (!this._dependOn.get(element)) {
|
|
50
|
+
toVisit.push(element);
|
|
51
|
+
this._list.delete(element);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Loop over all elements that have no dependency
|
|
55
|
+
while (toVisit.length > 0) {
|
|
56
|
+
const element = toVisit.shift();
|
|
57
|
+
callback(element);
|
|
58
|
+
this._list.delete(element);
|
|
59
|
+
const requiredBy = this._requiredBy.get(element);
|
|
60
|
+
if (requiredBy) {
|
|
61
|
+
for (const dependingElement of requiredBy) {
|
|
62
|
+
const dependencies = this._dependOn.get(dependingElement);
|
|
63
|
+
if (dependencies) {
|
|
64
|
+
dependencies.delete(element);
|
|
65
|
+
if (dependencies.size === 0) {
|
|
66
|
+
toVisit.push(dependingElement);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (this._list.size > 0) {
|
|
73
|
+
Logger.Error(JSON.stringify(this._list));
|
|
74
|
+
throw new Error("Circular dependency detected!");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=dependencyGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencyGraph.js","sourceRoot":"","sources":["../../src/optimization/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,oCAA4B;AAE7C;;GAEG;AACH,MAAM,OAAO,eAAe;IAKxB;;OAEG;IACH;QACI,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;IACjC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,OAAU;QACxB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,+BAA+B,CAAC,CAAC;QACxE,CAAC;QAED,IAAI,C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AC,CAAC;YAE3B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACjD,IAAI,UAAU,EAAE,CAAC;gBACb,KAAK,MAAM,gBAAgB,IAAI,UAAU,EAAE,CAAC;oBACxC,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;oBAE1D,IAAI,YAAY,EAAE,CAAC;wBACf,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;wBAE7B,IAAI,YAAY,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;4BAC1B,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACnC,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/optimization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/optimization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Effect } from "@onerjs/core/Materials/effect.js";
|
|
2
|
+
import type { SmartFilter } from "../smartFilter.js";
|
|
3
|
+
import type { ShaderProgram } from "../utils/shaderCodeUtils.js";
|
|
4
|
+
import type { RuntimeData } from "../connection/connectionPoint.js";
|
|
5
|
+
import { ShaderBlock } from "../blockFoundation/shaderBlock.js";
|
|
6
|
+
import { ShaderBinding } from "../runtime/shaderRuntime.js";
|
|
7
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
8
|
+
/**
|
|
9
|
+
* The shader bindings for the OptimizedShader block.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare class OptimizedShaderBinding extends ShaderBinding {
|
|
13
|
+
private _shaderBindings;
|
|
14
|
+
private _inputTextures;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new shader binding instance for the OptimizedShader block.
|
|
17
|
+
* @param shaderBindings - The list of shader bindings to process
|
|
18
|
+
* @param inputTextures - The list of input textures to bind
|
|
19
|
+
*/
|
|
20
|
+
constructor(shaderBindings: ShaderBinding[], inputTextures: {
|
|
21
|
+
[name: string]: RuntimeData<ConnectionPointType.Texture>;
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Binds all the required data to the shader when rendering.
|
|
25
|
+
* @param effect - defines the effect to bind the data to
|
|
26
|
+
* @param width - defines the width of the output
|
|
27
|
+
* @param height - defines the height of the output
|
|
28
|
+
*/
|
|
29
|
+
bind(effect: Effect, width: number, height: number): void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A block used by the smart filter optimizer to group shader blocks together.
|
|
33
|
+
* Should be for internal use only.
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare class OptimizedShaderBlock extends ShaderBlock {
|
|
37
|
+
private _shaderBindings;
|
|
38
|
+
private _inputTextures;
|
|
39
|
+
private _shaderProgram;
|
|
40
|
+
/**
|
|
41
|
+
* The class name of the block.
|
|
42
|
+
*/
|
|
43
|
+
static ClassName: string;
|
|
44
|
+
/**
|
|
45
|
+
* Returns if the block is an input block.
|
|
46
|
+
*/
|
|
47
|
+
get isInput(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new OptimizedShaderBlock.
|
|
50
|
+
* @param smartFilter - The smart filter to add the block to
|
|
51
|
+
* @param name - The name of the block
|
|
52
|
+
*/
|
|
53
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
54
|
+
/**
|
|
55
|
+
* Gets the shader program to use to render the block.
|
|
56
|
+
* @returns The shader program to use to render the block
|
|
57
|
+
*/
|
|
58
|
+
getShaderProgram(): ShaderProgram;
|
|
59
|
+
/**
|
|
60
|
+
* Sets the shader program to use to render the block.
|
|
61
|
+
* @param shaderProgram - The shader program to use to render the block
|
|
62
|
+
*/
|
|
63
|
+
setShaderProgram(shaderProgram: ShaderProgram): void;
|
|
64
|
+
/**
|
|
65
|
+
* Sets the list of shader bindings to use to render the block.
|
|
66
|
+
* @param shaderBindings - The list of shader bindings to use to render the block
|
|
67
|
+
*/
|
|
68
|
+
setShaderBindings(shaderBindings: ShaderBinding[]): void;
|
|
69
|
+
/**
|
|
70
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
71
|
+
* @returns The class instance that binds the data to the effect
|
|
72
|
+
*/
|
|
73
|
+
getShaderBinding(): ShaderBinding;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=optimizedShaderBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimizedShaderBlock.d.ts","sourceRoot":"","sources":["../../src/optimization/optimizedShaderBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,yCAAiC;AAGvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,aAAa;IACrD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,cAAc,CAA+D;IAErF;;;;OAIG;gBACS,cAAc,EAAE,aAAa,EAAE,EAAE,aAAa,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAA;KAAE;IAOxH;;;;;OAKG;IACa,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAW5E;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;IACjD,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,cAAc,CAAoE;IAC1F,OAAO,CAAC,cAAc,CAAgB;IAEtC;;OAEG;IACH,OAAuB,SAAS,SAA0B;IAE1D;;OAEG;IACH,IAAoB,OAAO,IAAI,OAAO,CAErC;IAED;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAOlD;;;OAGG;IACa,gBAAgB,IAAI,aAAa;IAIjD;;;OAGG;IACI,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;IAI3D;;;OAGG;IACI,iBAAiB,CAAC,cAAc,EAAE,aAAa,EAAE,GAAG,IAAI;IAI/D;;;OAGG;IACI,gBAAgB,IAAI,aAAa;CAmB3C"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ShaderBlock } from "../blockFoundation/shaderBlock.js";
|
|
2
|
+
import { ShaderBinding } from "../runtime/shaderRuntime.js";
|
|
3
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
4
|
+
/**
|
|
5
|
+
* The shader bindings for the OptimizedShader block.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export class OptimizedShaderBinding extends ShaderBinding {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new shader binding instance for the OptimizedShader block.
|
|
11
|
+
* @param shaderBindings - The list of shader bindings to process
|
|
12
|
+
* @param inputTextures - The list of input textures to bind
|
|
13
|
+
*/
|
|
14
|
+
constructor(shaderBindings, inputTextures) {
|
|
15
|
+
super();
|
|
16
|
+
this._shaderBindings = shaderBindings;
|
|
17
|
+
this._inputTextures = inputTextures;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Binds all the required data to the shader when rendering.
|
|
21
|
+
* @param effect - defines the effect to bind the data to
|
|
22
|
+
* @param width - defines the width of the output
|
|
23
|
+
* @param height - defines the height of the output
|
|
24
|
+
*/
|
|
25
|
+
bind(effect, width, height) {
|
|
26
|
+
for (const shaderBinding of this._shaderBindings) {
|
|
27
|
+
shaderBinding.bind(effect, width, height);
|
|
28
|
+
}
|
|
29
|
+
for (const name in this._inputTextures) {
|
|
30
|
+
const texture = this._inputTextures[name];
|
|
31
|
+
// texture can't be undefined, so let's add "!" to make Typescript happy
|
|
32
|
+
effect.setTexture(this.getRemappedName(name), texture.value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A block used by the smart filter optimizer to group shader blocks together.
|
|
38
|
+
* Should be for internal use only.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export class OptimizedShaderBlock extends ShaderBlock {
|
|
42
|
+
/**
|
|
43
|
+
* Returns if the block is an input block.
|
|
44
|
+
*/
|
|
45
|
+
get isInput() {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new OptimizedShaderBlock.
|
|
50
|
+
* @param smartFilter - The smart filter to add the block to
|
|
51
|
+
* @param name - The name of the block
|
|
52
|
+
*/
|
|
53
|
+
constructor(smartFilter, name) {
|
|
54
|
+
super(smartFilter, name, true);
|
|
55
|
+
this._inputTextures = {};
|
|
56
|
+
this._shaderBindings = null;
|
|
57
|
+
this._shaderProgram = undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets the shader program to use to render the block.
|
|
61
|
+
* @returns The shader program to use to render the block
|
|
62
|
+
*/
|
|
63
|
+
getShaderProgram() {
|
|
64
|
+
return this._shaderProgram;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Sets the shader program to use to render the block.
|
|
68
|
+
* @param shaderProgram - The shader program to use to render the block
|
|
69
|
+
*/
|
|
70
|
+
setShaderProgram(shaderProgram) {
|
|
71
|
+
this._shaderProgram = shaderProgram;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Sets the list of shader bindings to use to render the block.
|
|
75
|
+
* @param shaderBindings - The list of shader bindings to use to render the block
|
|
76
|
+
*/
|
|
77
|
+
setShaderBindings(shaderBindings) {
|
|
78
|
+
this._shaderBindings = shaderBindings;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
82
|
+
* @returns The class instance that binds the data to the effect
|
|
83
|
+
*/
|
|
84
|
+
getShaderBinding() {
|
|
85
|
+
if (this._shaderBindings === null) {
|
|
86
|
+
throw new Error("Shader bindings not set!");
|
|
87
|
+
}
|
|
88
|
+
for (const input of this.inputs) {
|
|
89
|
+
const name = input.name;
|
|
90
|
+
if (input.type === ConnectionPointType.Texture) {
|
|
91
|
+
/**
|
|
92
|
+
* These are the inputs created by the OptimizedShaderBlock
|
|
93
|
+
* We pass them to OptimizedShaderBinding so that their value can be set appropriately at runtime (in the bind method)
|
|
94
|
+
*/
|
|
95
|
+
this._inputTextures[name] = input.runtimeData;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return new OptimizedShaderBinding(this._shaderBindings, this._inputTextures);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The class name of the block.
|
|
103
|
+
*/
|
|
104
|
+
OptimizedShaderBlock.ClassName = "OptimizedShaderBlock";
|
|
105
|
+
//# sourceMappingURL=optimizedShaderBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimizedShaderBlock.js","sourceRoot":"","sources":["../../src/optimization/optimizedShaderBlock.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,aAAa;IAIrD;;;;OAIG;IACH,YAAY,cAA+B,EAAE,aAA2E;QACpH,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACa,IAAI,CAAC,MAAc,EAAE,KAAa,EAAE,MAAc;QAC9D,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC/C,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC9C,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACrC,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC1C,wEAAwE;YACxE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,OAAQ,CAAC,KAAK,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IAUjD;;OAEG;IACH,IAAoB,OAAO;QACvB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,YAAY,WAAwB,EAAE,IAAY;QAC9C,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QArB3B,mBAAc,GAAiE,EAAE,CAAC;QAuBtF,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,cAAc,GAAG,SAAgB,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACa,gBAAgB;QAC5B,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,gBAAgB,CAAC,aAA4B;QAChD,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,iBAAiB,CAAC,cAA+B;QACpD,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACnB,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAChD,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YAExB,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,CAAC,OAAO,EAAE,CAAC;gBAC7C;;;mBAGG;gBACH,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,WAAuD,CAAC;YAC9F,CAAC;QACL,CAAC;QAED,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACjF,CAAC;;AAtED;;GAEG;AACoB,8BAAS,GAAG,sBAAsB,AAAzB,CAA0B"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Nullable } from "@onerjs/core/types.js";
|
|
2
|
+
import type { ConnectionPoint } from "../connection/connectionPoint.js";
|
|
3
|
+
import { SmartFilter } from "../smartFilter.js";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export type StackItem = {
|
|
8
|
+
/**
|
|
9
|
+
* The connection points to which to connect the output of the optimized block, once the optimized block has been created.
|
|
10
|
+
*/
|
|
11
|
+
inputsToConnectTo: ConnectionPoint[];
|
|
12
|
+
/**
|
|
13
|
+
* The connection point to process.
|
|
14
|
+
*/
|
|
15
|
+
outputConnectionPoint: ConnectionPoint;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Options for the smart filter optimizer.
|
|
19
|
+
*/
|
|
20
|
+
export interface ISmartFilterOptimizerOptions {
|
|
21
|
+
/**
|
|
22
|
+
* The maximum number of samplers allowed in the fragment shader. Default: 8
|
|
23
|
+
*/
|
|
24
|
+
maxSamplersInFragmentShader?: number;
|
|
25
|
+
/**
|
|
26
|
+
* If true, the optimizer will remove the disabled blocks from the optimized smart filter. Default: false
|
|
27
|
+
* It allows more aggressive optimizations, but removed blocks will no longer be available in the optimized smart filter.
|
|
28
|
+
*/
|
|
29
|
+
removeDisabledBlocks?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Optimizes a smart filter by aggregating blocks whenever possible, to reduce the number of draw calls.
|
|
33
|
+
*/
|
|
34
|
+
export declare class SmartFilterOptimizer {
|
|
35
|
+
private _sourceSmartFilter;
|
|
36
|
+
private _options;
|
|
37
|
+
private _blockStack;
|
|
38
|
+
private _blockToStackItem;
|
|
39
|
+
private _savedBlockStack;
|
|
40
|
+
private _savedBlockToStackItem;
|
|
41
|
+
private _symbolOccurrences;
|
|
42
|
+
private _remappedSymbols;
|
|
43
|
+
private _blockToMainFunctionName;
|
|
44
|
+
private _mainFunctionNameToCode;
|
|
45
|
+
private _dependencyGraph;
|
|
46
|
+
private _vertexShaderCode;
|
|
47
|
+
private _currentOutputTextureOptions;
|
|
48
|
+
private _forceUnoptimized;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new smart filter optimizer
|
|
51
|
+
* @param smartFilter - The smart filter to optimize
|
|
52
|
+
* @param options - Options for the optimizer
|
|
53
|
+
*/
|
|
54
|
+
constructor(smartFilter: SmartFilter, options?: ISmartFilterOptimizerOptions);
|
|
55
|
+
/**
|
|
56
|
+
* Optimizes the smart filter by aggregating blocks whenever possible, to lower the number of rendering passes
|
|
57
|
+
* @returns The optimized smart filter, or null if the optimization failed
|
|
58
|
+
*/
|
|
59
|
+
optimize(): Nullable<SmartFilter>;
|
|
60
|
+
private _disconnectDisabledBlocks;
|
|
61
|
+
private _initialize;
|
|
62
|
+
private _makeSymbolUnique;
|
|
63
|
+
private _processDefines;
|
|
64
|
+
/**
|
|
65
|
+
* Processes each helper function (any function that's not the main function), adding those to emit in the final
|
|
66
|
+
* block to _remappedSymbols and noting any necessary renames in renameWork. If a helper does not access any
|
|
67
|
+
* uniforms, it only needs to be emitted once regardless of how many instances of the block that define it are
|
|
68
|
+
* folded into the final optimized block.
|
|
69
|
+
* NOTE: so this function can know about the uniforms to test for them, it must be called after _processVariables.
|
|
70
|
+
* @param block - The block we are processing
|
|
71
|
+
* @param renameWork - The list of rename work to add to as needed
|
|
72
|
+
* @param samplerList - The list of sampler names
|
|
73
|
+
*/
|
|
74
|
+
private _processHelperFunctions;
|
|
75
|
+
private _processVariables;
|
|
76
|
+
private _processSampleTexture;
|
|
77
|
+
private _canBeOptimized;
|
|
78
|
+
private _optimizeBlock;
|
|
79
|
+
/**
|
|
80
|
+
* Replaces calls to __sampleTexture(foo, uv); with calls to a function bar(uv); for chaining optimized blocks together
|
|
81
|
+
* @param code - The code to process
|
|
82
|
+
* @param samplerName - The old name of the sampler
|
|
83
|
+
* @param functionName - The name of the function to call instead
|
|
84
|
+
* @returns The updated code
|
|
85
|
+
*/
|
|
86
|
+
private _replaceSampleTextureWithFunctionCall;
|
|
87
|
+
private _replaceSampleTextureWithTexture2DCall;
|
|
88
|
+
/**
|
|
89
|
+
* Processes all the functions, both main and helper functions, applying the renames and changes which have been collected
|
|
90
|
+
* @param block - The original block we are optimizing
|
|
91
|
+
* @param shaderProgram - The shader of the block we are optimizing
|
|
92
|
+
* @param renameWork - The rename work to apply
|
|
93
|
+
* @param newMainFunctionName - The new name for the main function
|
|
94
|
+
*/
|
|
95
|
+
private _processAllFunctions;
|
|
96
|
+
/**
|
|
97
|
+
* Applies all required changes specific to just the main function
|
|
98
|
+
* @param code - The code of the main function
|
|
99
|
+
* @param shaderProgram - The shader program containing the main function
|
|
100
|
+
* @param newMainFunctionName - The new name for the main function
|
|
101
|
+
* @returns The updated main function code
|
|
102
|
+
*/
|
|
103
|
+
private _processMainFunction;
|
|
104
|
+
/**
|
|
105
|
+
* Applies all required changes to a function (main or helper)
|
|
106
|
+
* @param block - The original block we are optimizing
|
|
107
|
+
* @param code - The code of the function
|
|
108
|
+
* @param renameWork - The rename work to apply
|
|
109
|
+
* @returns The updated function code
|
|
110
|
+
*/
|
|
111
|
+
private _processFunction;
|
|
112
|
+
private _saveBlockStackState;
|
|
113
|
+
private _restoreBlockStackState;
|
|
114
|
+
private _processBlock;
|
|
115
|
+
/**
|
|
116
|
+
* If this block used DisableStrategy.AutoSample, find all the __sampleTexture calls which just pass the vUV,
|
|
117
|
+
* skip the first one, and for all others replace with the local variable created by the DisableStrategy.AutoSample
|
|
118
|
+
*
|
|
119
|
+
* @param code - The shader code to process
|
|
120
|
+
* @param sampler - The name of the sampler
|
|
121
|
+
*
|
|
122
|
+
* @returns The processed code
|
|
123
|
+
*/
|
|
124
|
+
private _applyAutoSampleStrategy;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=smartFilterOptimizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smartFilterOptimizer.d.ts","sourceRoot":"","sources":["../../src/optimization/smartFilterOptimizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,8BAAsB;AAG9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAIxE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAiEhD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;I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