@babylonjs/smart-filters 0.1.0-alpha
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/blocks/aggregateBlock.d.ts +50 -0
- package/dist/blocks/aggregateBlock.d.ts.map +1 -0
- package/dist/blocks/aggregateBlock.js +103 -0
- package/dist/blocks/aggregateBlock.js.map +1 -0
- package/dist/blocks/baseBlock.d.ts +160 -0
- package/dist/blocks/baseBlock.d.ts.map +1 -0
- package/dist/blocks/baseBlock.js +256 -0
- package/dist/blocks/baseBlock.js.map +1 -0
- package/dist/blocks/copyBlock.d.ts +59 -0
- package/dist/blocks/copyBlock.d.ts.map +1 -0
- package/dist/blocks/copyBlock.js +84 -0
- package/dist/blocks/copyBlock.js.map +1 -0
- package/dist/blocks/disableableBlock.d.ts +30 -0
- package/dist/blocks/disableableBlock.d.ts.map +1 -0
- package/dist/blocks/disableableBlock.js +22 -0
- package/dist/blocks/disableableBlock.js.map +1 -0
- package/dist/blocks/inputBlock.d.ts +64 -0
- package/dist/blocks/inputBlock.d.ts.map +1 -0
- package/dist/blocks/inputBlock.js +74 -0
- package/dist/blocks/inputBlock.js.map +1 -0
- package/dist/blocks/outputBlock.d.ts +42 -0
- package/dist/blocks/outputBlock.d.ts.map +1 -0
- package/dist/blocks/outputBlock.js +74 -0
- package/dist/blocks/outputBlock.js.map +1 -0
- package/dist/blocks/shaderBlock.d.ts +68 -0
- package/dist/blocks/shaderBlock.d.ts.map +1 -0
- package/dist/blocks/shaderBlock.js +101 -0
- package/dist/blocks/shaderBlock.js.map +1 -0
- package/dist/command/command.d.ts +49 -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 +12 -0
- package/dist/command/commandBufferDebugger.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 +153 -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 +22 -0
- package/dist/connection/connectionPointType.d.ts.map +1 -0
- package/dist/connection/connectionPointType.js +17 -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/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -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 +77 -0
- package/dist/optimization/dependencyGraph.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 +72 -0
- package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -0
- package/dist/optimization/smartFilterOptimizer.js +482 -0
- package/dist/optimization/smartFilterOptimizer.js.map +1 -0
- package/dist/runtime/renderTargetGenerator.d.ts +35 -0
- package/dist/runtime/renderTargetGenerator.d.ts.map +1 -0
- package/dist/runtime/renderTargetGenerator.js +153 -0
- package/dist/runtime/renderTargetGenerator.js.map +1 -0
- package/dist/runtime/shaderRuntime.d.ts +95 -0
- package/dist/runtime/shaderRuntime.d.ts.map +1 -0
- package/dist/runtime/shaderRuntime.js +120 -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 +57 -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/smartFilter.d.ts +100 -0
- package/dist/smartFilter.d.ts.map +1 -0
- package/dist/smartFilter.js +154 -0
- package/dist/smartFilter.js.map +1 -0
- package/dist/utils/shaderCodeUtils.d.ts +131 -0
- package/dist/utils/shaderCodeUtils.d.ts.map +1 -0
- package/dist/utils/shaderCodeUtils.js +115 -0
- package/dist/utils/shaderCodeUtils.js.map +1 -0
- package/dist/utils/textureLoaders.d.ts +14 -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/license.md +21 -0
- package/package.json +47 -0
- package/readme.md +165 -0
- package/src/IDisposable.ts +9 -0
- package/src/blocks/aggregateBlock.ts +121 -0
- package/src/blocks/baseBlock.ts +341 -0
- package/src/blocks/copyBlock.ts +103 -0
- package/src/blocks/disableableBlock.ts +40 -0
- package/src/blocks/inputBlock.ts +114 -0
- package/src/blocks/outputBlock.ts +97 -0
- package/src/blocks/shaderBlock.ts +145 -0
- package/src/command/command.ts +60 -0
- package/src/command/commandBuffer.ts +71 -0
- package/src/command/commandBufferDebugger.ts +13 -0
- package/src/connection/connectionPoint.ts +212 -0
- package/src/connection/connectionPointCompatibilityState.ts +31 -0
- package/src/connection/connectionPointDirection.ts +9 -0
- package/src/connection/connectionPointType.ts +30 -0
- package/src/connection/connectionPointWithDefault.ts +35 -0
- package/src/index.ts +36 -0
- package/src/optimization/dependencyGraph.ts +94 -0
- package/src/optimization/optimizedShaderBlock.ts +133 -0
- package/src/optimization/smartFilterOptimizer.ts +706 -0
- package/src/runtime/renderTargetGenerator.ts +204 -0
- package/src/runtime/shaderRuntime.ts +155 -0
- package/src/runtime/smartFilterRuntime.ts +104 -0
- package/src/runtime/strongRef.ts +18 -0
- package/src/smartFilter.ts +227 -0
- package/src/utils/shaderCodeUtils.ts +242 -0
- package/src/utils/textureLoaders.ts +28 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionPointDirection.d.ts","sourceRoot":"","sources":["../../src/connection/connectionPointDirection.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,wBAAwB;IAChC,YAAY;IACZ,KAAK,IAAI;IACT,aAAa;IACb,MAAM,IAAI;CACb"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the direction of a connection point.
|
|
3
|
+
*/
|
|
4
|
+
export var ConnectionPointDirection;
|
|
5
|
+
(function (ConnectionPointDirection) {
|
|
6
|
+
/** Input */
|
|
7
|
+
ConnectionPointDirection[ConnectionPointDirection["Input"] = 0] = "Input";
|
|
8
|
+
/** Output */
|
|
9
|
+
ConnectionPointDirection[ConnectionPointDirection["Output"] = 1] = "Output";
|
|
10
|
+
})(ConnectionPointDirection || (ConnectionPointDirection = {}));
|
|
11
|
+
//# sourceMappingURL=connectionPointDirection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionPointDirection.js","sourceRoot":"","sources":["../../src/connection/connectionPointDirection.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAChC,YAAY;IACZ,yEAAS,CAAA;IACT,aAAa;IACb,2EAAU,CAAA;AACd,CAAC,EALW,wBAAwB,KAAxB,wBAAwB,QAKnC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ThinTexture } from "@babylonjs/core/Materials/Textures/thinTexture";
|
|
2
|
+
import type { IColor3Like, IColor4Like } from "@babylonjs/core/Maths/math.like";
|
|
3
|
+
/**
|
|
4
|
+
* Defines the type of a connection point.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ConnectionPointType {
|
|
7
|
+
/** Float */
|
|
8
|
+
Float = 1,
|
|
9
|
+
/** Texture */
|
|
10
|
+
Texture = 2,
|
|
11
|
+
/** Color3 */
|
|
12
|
+
Color3 = 3,
|
|
13
|
+
/** Color4 */
|
|
14
|
+
Color4 = 4,
|
|
15
|
+
/** Boolean */
|
|
16
|
+
Boolean = 5
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the type of the value from the Connection point type.
|
|
20
|
+
*/
|
|
21
|
+
export type ConnectionPointValue<T extends ConnectionPointType = ConnectionPointType> = T extends ConnectionPointType.Float ? number : T extends ConnectionPointType.Texture ? ThinTexture : T extends ConnectionPointType.Color3 ? IColor3Like : T extends ConnectionPointType.Color4 ? IColor4Like : T extends ConnectionPointType.Boolean ? boolean : never;
|
|
22
|
+
//# sourceMappingURL=connectionPointType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionPointType.d.ts","sourceRoot":"","sources":["../../src/connection/connectionPointType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEhF;;GAEG;AACH,oBAAY,mBAAmB;IAC3B,YAAY;IACZ,KAAK,IAAI;IACT,cAAc;IACd,OAAO,IAAI;IACX,aAAa;IACb,MAAM,IAAI;IACV,aAAa;IACb,MAAM,IAAI;IACV,cAAc;IACd,OAAO,IAAI;CACd;AAED;;GAEG;AAEH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB,IAChF,CAAC,SAAS,mBAAmB,CAAC,KAAK,GAAG,MAAM,GAC5C,CAAC,SAAS,mBAAmB,CAAC,OAAO,GAAG,WAAW,GACnD,CAAC,SAAS,mBAAmB,CAAC,MAAM,GAAG,WAAW,GAClD,CAAC,SAAS,mBAAmB,CAAC,MAAM,GAAG,WAAW,GAClD,CAAC,SAAS,mBAAmB,CAAC,OAAO,GAAG,OAAO,GAC/C,KAAK,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the type of a connection point.
|
|
3
|
+
*/
|
|
4
|
+
export var ConnectionPointType;
|
|
5
|
+
(function (ConnectionPointType) {
|
|
6
|
+
/** Float */
|
|
7
|
+
ConnectionPointType[ConnectionPointType["Float"] = 1] = "Float";
|
|
8
|
+
/** Texture */
|
|
9
|
+
ConnectionPointType[ConnectionPointType["Texture"] = 2] = "Texture";
|
|
10
|
+
/** Color3 */
|
|
11
|
+
ConnectionPointType[ConnectionPointType["Color3"] = 3] = "Color3";
|
|
12
|
+
/** Color4 */
|
|
13
|
+
ConnectionPointType[ConnectionPointType["Color4"] = 4] = "Color4";
|
|
14
|
+
/** Boolean */
|
|
15
|
+
ConnectionPointType[ConnectionPointType["Boolean"] = 5] = "Boolean";
|
|
16
|
+
})(ConnectionPointType || (ConnectionPointType = {}));
|
|
17
|
+
//# sourceMappingURL=connectionPointType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionPointType.js","sourceRoot":"","sources":["../../src/connection/connectionPointType.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAWX;AAXD,WAAY,mBAAmB;IAC3B,YAAY;IACZ,+DAAS,CAAA;IACT,cAAc;IACd,mEAAW,CAAA;IACX,aAAa;IACb,iEAAU,CAAA;IACV,aAAa;IACb,iEAAU,CAAA;IACV,cAAc;IACd,mEAAW,CAAA;AACf,CAAC,EAXW,mBAAmB,KAAnB,mBAAmB,QAW9B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseBlock } from "../blocks/baseBlock";
|
|
2
|
+
import { ConnectionPoint, type RuntimeData } from "./connectionPoint.js";
|
|
3
|
+
import type { ConnectionPointDirection } from "./connectionPointDirection";
|
|
4
|
+
import type { ConnectionPointType } from "./connectionPointType";
|
|
5
|
+
/**
|
|
6
|
+
* A ConnectionPoint whose runtimeData is never null - if not hooked up to a connection, it will use a default value.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ConnectionPointWithDefault<U extends ConnectionPointType = ConnectionPointType> extends ConnectionPoint<U> {
|
|
9
|
+
/**
|
|
10
|
+
* The runtime data for this ConnectionPoint - it will never be null - if not hooked up to a connection, it will use the default value.
|
|
11
|
+
*/
|
|
12
|
+
runtimeData: RuntimeData<U>;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new ConnectionPointWithDefault
|
|
15
|
+
* @param name - The name the connection point has in the block
|
|
16
|
+
* @param ownerBlock - The block the connection point belongs to
|
|
17
|
+
* @param type - The type of the connection point
|
|
18
|
+
* @param direction - The direction of the connection point
|
|
19
|
+
* @param runtimeData - The runtimeData to use for this connection point if no connection is made
|
|
20
|
+
*/
|
|
21
|
+
constructor(name: string, ownerBlock: BaseBlock, type: U, direction: ConnectionPointDirection, runtimeData: RuntimeData<U>);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=connectionPointWithDefault.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionPointWithDefault.d.ts","sourceRoot":"","sources":["../../src/connection/connectionPointWithDefault.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;GAEG;AACH,qBAAa,0BAA0B,CACnC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB,CACrD,SAAQ,eAAe,CAAC,CAAC,CAAC;IACxB;;OAEG;IACa,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAE5C;;;;;;;OAOG;gBAEC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,EACrB,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,wBAAwB,EACnC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;CAKlC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConnectionPoint } from "./connectionPoint.js";
|
|
2
|
+
/**
|
|
3
|
+
* A ConnectionPoint whose runtimeData is never null - if not hooked up to a connection, it will use a default value.
|
|
4
|
+
*/
|
|
5
|
+
export class ConnectionPointWithDefault extends ConnectionPoint {
|
|
6
|
+
/**
|
|
7
|
+
* Create a new ConnectionPointWithDefault
|
|
8
|
+
* @param name - The name the connection point has in the block
|
|
9
|
+
* @param ownerBlock - The block the connection point belongs to
|
|
10
|
+
* @param type - The type of the connection point
|
|
11
|
+
* @param direction - The direction of the connection point
|
|
12
|
+
* @param runtimeData - The runtimeData to use for this connection point if no connection is made
|
|
13
|
+
*/
|
|
14
|
+
constructor(name, ownerBlock, type, direction, runtimeData) {
|
|
15
|
+
super(name, ownerBlock, type, direction, runtimeData);
|
|
16
|
+
this.runtimeData = runtimeData;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=connectionPointWithDefault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionPointWithDefault.js","sourceRoot":"","sources":["../../src/connection/connectionPointWithDefault.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAoB,MAAM,sBAAsB,CAAC;AAIzE;;GAEG;AACH,MAAM,OAAO,0BAEX,SAAQ,eAAkB;IAMxB;;;;;;;OAOG;IACH,YACI,IAAY,EACZ,UAAqB,EACrB,IAAO,EACP,SAAmC,EACnC,WAA2B;QAE3B,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;QACtD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export { type IDisposable } from "./IDisposable.js";
|
|
2
|
+
export { type StrongRef } from "./runtime/strongRef.js";
|
|
3
|
+
export { createStrongRef } from "./runtime/strongRef.js";
|
|
4
|
+
export * from "./command/command.js";
|
|
5
|
+
export * from "./command/commandBuffer.js";
|
|
6
|
+
export { logCommands } from "./command/commandBufferDebugger.js";
|
|
7
|
+
export { ConnectionPointDirection } from "./connection/connectionPointDirection.js";
|
|
8
|
+
export { ConnectionPointType } from "./connection/connectionPointType.js";
|
|
9
|
+
export { type ConnectionPointValue } from "./connection/connectionPointType.js";
|
|
10
|
+
export { ConnectionPointCompatibilityState, getCompatibilityIssueMessage, } from "./connection/connectionPointCompatibilityState.js";
|
|
11
|
+
export { ConnectionPoint } from "./connection/connectionPoint.js";
|
|
12
|
+
export { type RuntimeData } from "./connection/connectionPoint.js";
|
|
13
|
+
export { BaseBlock } from "./blocks/baseBlock.js";
|
|
14
|
+
export { InputBlock } from "./blocks/inputBlock.js";
|
|
15
|
+
export { type AnyInputBlock } from "./blocks/inputBlock.js";
|
|
16
|
+
export { ShaderBlock } from "./blocks/shaderBlock.js";
|
|
17
|
+
export { AggregateBlock } from "./blocks/aggregateBlock.js";
|
|
18
|
+
export { CopyBlock } from "./blocks/copyBlock.js";
|
|
19
|
+
export { ShaderBinding, ShaderRuntime } from "./runtime/shaderRuntime.js";
|
|
20
|
+
export { type ShaderProgram, injectDisableUniform } from "./utils/shaderCodeUtils.js";
|
|
21
|
+
export { type IDisableableBlock } from "./blocks/disableableBlock.js";
|
|
22
|
+
export { type SmartFilterRuntime } from "./runtime/smartFilterRuntime.js";
|
|
23
|
+
export { InternalSmartFilterRuntime } from "./runtime/smartFilterRuntime.js";
|
|
24
|
+
export { RenderTargetGenerator } from "./runtime/renderTargetGenerator.js";
|
|
25
|
+
export { SmartFilter } from "./smartFilter.js";
|
|
26
|
+
export { SmartFilterOptimizer } from "./optimization/smartFilterOptimizer.js";
|
|
27
|
+
export * from "./utils/textureLoaders.js";
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EACH,iCAAiC,EACjC,4BAA4B,GAC/B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,cAAc,2BAA2B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export {} from "./IDisposable.js";
|
|
2
|
+
export {} from "./runtime/strongRef.js";
|
|
3
|
+
export { createStrongRef } from "./runtime/strongRef.js";
|
|
4
|
+
export * from "./command/command.js";
|
|
5
|
+
export * from "./command/commandBuffer.js";
|
|
6
|
+
export { logCommands } from "./command/commandBufferDebugger.js";
|
|
7
|
+
export { ConnectionPointDirection } from "./connection/connectionPointDirection.js";
|
|
8
|
+
export { ConnectionPointType } from "./connection/connectionPointType.js";
|
|
9
|
+
export {} from "./connection/connectionPointType.js";
|
|
10
|
+
export { ConnectionPointCompatibilityState, getCompatibilityIssueMessage, } from "./connection/connectionPointCompatibilityState.js";
|
|
11
|
+
export { ConnectionPoint } from "./connection/connectionPoint.js";
|
|
12
|
+
export {} from "./connection/connectionPoint.js";
|
|
13
|
+
export { BaseBlock } from "./blocks/baseBlock.js";
|
|
14
|
+
export { InputBlock } from "./blocks/inputBlock.js";
|
|
15
|
+
export {} from "./blocks/inputBlock.js";
|
|
16
|
+
export { ShaderBlock } from "./blocks/shaderBlock.js";
|
|
17
|
+
export { AggregateBlock } from "./blocks/aggregateBlock.js";
|
|
18
|
+
export { CopyBlock } from "./blocks/copyBlock.js";
|
|
19
|
+
export { ShaderBinding, ShaderRuntime } from "./runtime/shaderRuntime.js";
|
|
20
|
+
export { injectDisableUniform } from "./utils/shaderCodeUtils.js";
|
|
21
|
+
export {} from "./blocks/disableableBlock.js";
|
|
22
|
+
export {} from "./runtime/smartFilterRuntime.js";
|
|
23
|
+
export { InternalSmartFilterRuntime } from "./runtime/smartFilterRuntime.js";
|
|
24
|
+
export { RenderTargetGenerator } from "./runtime/renderTargetGenerator.js";
|
|
25
|
+
export { SmartFilter } from "./smartFilter.js";
|
|
26
|
+
export { SmartFilterOptimizer } from "./optimization/smartFilterOptimizer.js";
|
|
27
|
+
export * from "./utils/textureLoaders.js";
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,O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
|
|
9
|
+
* Creates a new instance of a dependency graph.
|
|
10
|
+
*/
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Adds an element to the graph.
|
|
14
|
+
* @param element - The element to add to the graph.
|
|
15
|
+
*/
|
|
16
|
+
addElement(element: T): void;
|
|
17
|
+
/**
|
|
18
|
+
* Adds a dependency between two elements.
|
|
19
|
+
* @param element - The element that depends on another element.
|
|
20
|
+
* @param dependency - The element that is required by the element passed as the first parameter.
|
|
21
|
+
*/
|
|
22
|
+
addDependency(element: T, dependency: T): void;
|
|
23
|
+
/**
|
|
24
|
+
* Walks through the graph and calls the callback for each element.
|
|
25
|
+
* The elements that depend on other elements will be traversed after the elements they depend on.
|
|
26
|
+
* Note: the graph will be modified during the walk, so don't call walk twice on the same graph!
|
|
27
|
+
* @param callback - The callback to call for each element.
|
|
28
|
+
*/
|
|
29
|
+
walk(callback: (element: T) => void): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=dependencyGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencyGraph.d.ts","sourceRoot":"","sources":["../../src/optimization/dependencyGraph.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,eAAe,CAAC,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,WAAW,CAAiB;IAEpC;;OAEG;;IAOH;;;OAGG;IACI,UAAU,CAAC,OAAO,EAAE,CAAC;IAQ5B;;;;OAIG;IACI,aAAa,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC;IAa9C;;;;;OAKG;IACI,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI;CAwC7C"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implementation of a dependency graph.
|
|
3
|
+
*/
|
|
4
|
+
export class DependencyGraph {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new instance of a dependency graph.
|
|
7
|
+
*/
|
|
8
|
+
constructor() {
|
|
9
|
+
this._list = new Set();
|
|
10
|
+
this._dependOn = new Map();
|
|
11
|
+
this._requiredBy = new Map();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Adds an element to the graph.
|
|
15
|
+
* @param element - The element to add to the graph.
|
|
16
|
+
*/
|
|
17
|
+
addElement(element) {
|
|
18
|
+
if (this._list.has(element)) {
|
|
19
|
+
throw new Error(`Element "${element}" already added to the graph!`);
|
|
20
|
+
}
|
|
21
|
+
this._list.add(element);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Adds a dependency between two elements.
|
|
25
|
+
* @param element - The element that depends on another element.
|
|
26
|
+
* @param dependency - The element that is required by the element passed as the first parameter.
|
|
27
|
+
*/
|
|
28
|
+
addDependency(element, dependency) {
|
|
29
|
+
if (!this._dependOn.has(element)) {
|
|
30
|
+
this._dependOn.set(element, new Set());
|
|
31
|
+
}
|
|
32
|
+
if (!this._requiredBy.has(dependency)) {
|
|
33
|
+
this._requiredBy.set(dependency, new Set());
|
|
34
|
+
}
|
|
35
|
+
this._dependOn.get(element).add(dependency);
|
|
36
|
+
this._requiredBy.get(dependency).add(element);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Walks through the graph and calls the callback for each element.
|
|
40
|
+
* The elements that depend on other elements will be traversed after the elements they depend on.
|
|
41
|
+
* Note: the graph will be modified during the walk, so don't call walk twice on the same graph!
|
|
42
|
+
* @param callback - The callback to call for each element.
|
|
43
|
+
*/
|
|
44
|
+
walk(callback) {
|
|
45
|
+
const toVisit = [];
|
|
46
|
+
// Collect all elements that have no dependency
|
|
47
|
+
for (const element of this._list) {
|
|
48
|
+
if (!this._dependOn.get(element)) {
|
|
49
|
+
toVisit.push(element);
|
|
50
|
+
this._list.delete(element);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Loop over all elements that have no dependency
|
|
54
|
+
while (toVisit.length > 0) {
|
|
55
|
+
const element = toVisit.shift();
|
|
56
|
+
callback(element);
|
|
57
|
+
this._list.delete(element);
|
|
58
|
+
const requiredBy = this._requiredBy.get(element);
|
|
59
|
+
if (requiredBy) {
|
|
60
|
+
for (const dependingElement of requiredBy) {
|
|
61
|
+
const dependencies = this._dependOn.get(dependingElement);
|
|
62
|
+
if (dependencies) {
|
|
63
|
+
dependencies.delete(element);
|
|
64
|
+
if (dependencies.size === 0) {
|
|
65
|
+
toVisit.push(dependingElement);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (this._list.size > 0) {
|
|
72
|
+
console.error(this._list);
|
|
73
|
+
throw new Error("Circular dependency detected!");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=dependencyGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencyGraph.js","sourceRoot":"","sources":["../../src/optimization/dependencyGraph.ts"],"names":[],"mappings":"AAAA;;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,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,OAAU,EAAE,UAAa;QAC1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AAC;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,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Effect } from "@babylonjs/core/Materials/effect";
|
|
2
|
+
import type { ThinTexture } from "@babylonjs/core/Materials/Textures/thinTexture";
|
|
3
|
+
import type { SmartFilter } from "../smartFilter";
|
|
4
|
+
import type { ShaderProgram } from "../utils/shaderCodeUtils";
|
|
5
|
+
import type { StrongRef } from "../runtime/strongRef";
|
|
6
|
+
import { ShaderBlock } from "../blocks/shaderBlock.js";
|
|
7
|
+
import { Binding } from "../runtime/shaderRuntime.js";
|
|
8
|
+
/**
|
|
9
|
+
* The shader bindings for the OptimizedShader block.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare class OptimizedShaderBinding extends Binding {
|
|
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: Binding[], inputTextures: {
|
|
21
|
+
[name: string]: StrongRef<ThinTexture>;
|
|
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: Binding[]): 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(): Binding;
|
|
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,MAAM,kCAAkC,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAElF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGtD;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,OAAO;IAC/C,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,cAAc,CAA6C;IAEnE;;;;OAIG;gBACS,cAAc,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,WAAW,CAAC,CAAA;KAAE;IAOhG;;;;;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,CAAsB;IAC7C,OAAO,CAAC,cAAc,CAAkD;IACxE,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,OAAO,EAAE,GAAG,IAAI;IAIzD;;;OAGG;IACI,gBAAgB,IAAI,OAAO;CAmBrC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ShaderBlock } from "../blocks/shaderBlock.js";
|
|
2
|
+
import { Binding } 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 Binding {
|
|
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":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,OAAO;IAI/C;;;;OAIG;IACH,YAAY,cAAyB,EAAE,aAAyD;QAC5F,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,cAAc,GAAG,aAAa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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,72 @@
|
|
|
1
|
+
import type { Nullable } from "@babylonjs/core/types";
|
|
2
|
+
import type { ConnectionPoint } from "../connection/connectionPoint";
|
|
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 _textureRatio;
|
|
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 _processHelperFunctions;
|
|
64
|
+
private _processVariables;
|
|
65
|
+
private _processSampleTexture;
|
|
66
|
+
private _canBeOptimized;
|
|
67
|
+
private _optimizeBlock;
|
|
68
|
+
private _saveBlockStackState;
|
|
69
|
+
private _restoreBlockStackState;
|
|
70
|
+
private _processBlock;
|
|
71
|
+
}
|
|
72
|
+
//# 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,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIrE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA8ChD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACpB;;OAEG;IACH,iBAAiB,EAAE,eAAe,EAAE,CAAC;IAErC;;OAEG;IACH,qBAAqB,EAAE,eAAe,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,4BAA4B;IACzC;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC7B,OAAO,CAAC,kBAAkB,CAAc;IACxC,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,WAAW,CAAmB;IACtC,OAAO,CAAC,iBAAiB,CAAwC;IACjE,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,sBAAsB,CAAwC;IAEtE,OAAO,CAAC,kBAAkB,CAAkC;IAC5D,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,wBAAwB,CAAqC;IACrE,OAAO,CAAC,uBAAuB,CAAkC;IACjE,OAAO,CAAC,gBAAgB,CAA0D;IAClF,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,iBAAiB,CAAkB;IAE3C;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,4BAA4B;IAQ5E;;;OAGG;IACI,QAAQ,IAAI,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