@onerjs/smart-filters 8.31.6 → 8.31.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/blockFoundation/customShaderBlock.d.ts +16 -2
  2. package/dist/blockFoundation/customShaderBlock.d.ts.map +1 -1
  3. package/dist/blockFoundation/customShaderBlock.js +69 -5
  4. package/dist/blockFoundation/customShaderBlock.js.map +1 -1
  5. package/dist/blockFoundation/customShaderBlock.serializer.d.ts +22 -0
  6. package/dist/blockFoundation/customShaderBlock.serializer.d.ts.map +1 -0
  7. package/dist/blockFoundation/customShaderBlock.serializer.js +32 -0
  8. package/dist/blockFoundation/customShaderBlock.serializer.js.map +1 -0
  9. package/dist/blockFoundation/disableableShaderBlock.d.ts +5 -0
  10. package/dist/blockFoundation/disableableShaderBlock.d.ts.map +1 -1
  11. package/dist/blockFoundation/disableableShaderBlock.js +18 -11
  12. package/dist/blockFoundation/disableableShaderBlock.js.map +1 -1
  13. package/dist/editorUtils/editableInPropertyPage.d.ts +5 -0
  14. package/dist/editorUtils/editableInPropertyPage.d.ts.map +1 -1
  15. package/dist/editorUtils/editableInPropertyPage.js +11 -2
  16. package/dist/editorUtils/editableInPropertyPage.js.map +1 -1
  17. package/dist/optimization/smartFilterOptimizer.d.ts +11 -0
  18. package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -1
  19. package/dist/optimization/smartFilterOptimizer.js +28 -14
  20. package/dist/optimization/smartFilterOptimizer.js.map +1 -1
  21. package/dist/serialization/importCustomBlockDefinition.js +1 -0
  22. package/dist/serialization/importCustomBlockDefinition.js.map +1 -1
  23. package/dist/serialization/smartFilterSerializer.d.ts.map +1 -1
  24. package/dist/serialization/smartFilterSerializer.js +6 -3
  25. package/dist/serialization/smartFilterSerializer.js.map +1 -1
  26. package/dist/serialization/v1/shaderBlockSerialization.types.d.ts +37 -0
  27. package/dist/serialization/v1/shaderBlockSerialization.types.d.ts.map +1 -1
  28. package/dist/utils/buildTools/shaderCode.types.d.ts +5 -0
  29. package/dist/utils/buildTools/shaderCode.types.d.ts.map +1 -1
  30. package/dist/utils/buildTools/shaderConverter.d.ts +10 -4
  31. package/dist/utils/buildTools/shaderConverter.d.ts.map +1 -1
  32. package/dist/utils/buildTools/shaderConverter.js +58 -2
  33. package/dist/utils/buildTools/shaderConverter.js.map +1 -1
  34. package/dist/utils/index.d.ts +1 -1
  35. package/dist/utils/index.d.ts.map +1 -1
  36. package/dist/utils/index.js +1 -0
  37. package/dist/utils/index.js.map +1 -1
  38. package/dist/utils/shaderCodeUtils.d.ts +6 -0
  39. package/dist/utils/shaderCodeUtils.d.ts.map +1 -1
  40. package/dist/utils/shaderCodeUtils.js +14 -1
  41. package/dist/utils/shaderCodeUtils.js.map +1 -1
  42. package/dist/version.d.ts +1 -1
  43. package/dist/version.js +1 -1
  44. package/package.json +1 -1
  45. package/src/blockFoundation/customShaderBlock.serializer.ts +51 -0
  46. package/src/blockFoundation/customShaderBlock.ts +80 -6
  47. package/src/blockFoundation/disableableShaderBlock.ts +18 -9
  48. package/src/editorUtils/editableInPropertyPage.ts +16 -2
  49. package/src/optimization/smartFilterOptimizer.ts +30 -16
  50. package/src/serialization/importCustomBlockDefinition.ts +1 -0
  51. package/src/serialization/smartFilterSerializer.ts +6 -3
  52. package/src/serialization/v1/shaderBlockSerialization.types.ts +42 -0
  53. package/src/utils/buildTools/shaderCode.types.ts +65 -59
  54. package/src/utils/buildTools/shaderConverter.ts +96 -6
  55. package/src/utils/index.ts +1 -1
  56. package/src/utils/shaderCodeUtils.ts +16 -1
  57. package/src/version.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  import { ShaderBinding } from "../runtime/shaderRuntime.js";
2
2
  import type { SerializedShaderBlockDefinition } from "../serialization/serializedShaderBlockDefinition.js";
3
3
  import type { SmartFilter } from "../smartFilter.js";
4
- import type { ShaderProgram } from "../utils/shaderCodeUtils.js";
4
+ import { type ShaderProgram } from "../utils/shaderCodeUtils.js";
5
5
  import { ShaderBlock } from "./shaderBlock.js";
6
6
  import type { Nullable } from "@onerjs/core/types.js";
7
7
  /**
@@ -13,9 +13,10 @@ export declare class CustomShaderBlock extends ShaderBlock {
13
13
  * @param smartFilter - The smart filter this block belongs to
14
14
  * @param name - Defines the name of the block
15
15
  * @param blockDefinition - The serialized block definition
16
+ * @param data - The data property from the serialized block, if applicable
16
17
  * @returns The deserialized CustomShaderBlock instance
17
18
  */
18
- static Create(smartFilter: SmartFilter, name: string, blockDefinition: SerializedShaderBlockDefinition): CustomShaderBlock;
19
+ static Create(smartFilter: SmartFilter, name: string, blockDefinition: SerializedShaderBlockDefinition, data?: any): CustomShaderBlock;
19
20
  /**
20
21
  * The class name of the block.
21
22
  */
@@ -23,7 +24,14 @@ export declare class CustomShaderBlock extends ShaderBlock {
23
24
  private readonly _shaderProgram;
24
25
  private readonly _blockType;
25
26
  private readonly _namespace;
27
+ private readonly _fragmentConstProperties;
26
28
  private _autoBoundInputs;
29
+ /**
30
+ * A list of the names of the properties added to this instance of the block, for example,
31
+ * fragment const properties.
32
+ *
33
+ */
34
+ readonly dynamicPropertyNames: string[];
27
35
  /**
28
36
  * The type of the block - used when serializing / deserializing the block, and in the editor.
29
37
  */
@@ -41,6 +49,7 @@ export declare class CustomShaderBlock extends ShaderBlock {
41
49
  * @param blockType - The type of the block
42
50
  * @param namespace - The namespace of the block
43
51
  * @param inputConnectionPoints - The input connection points of the
52
+ * @param fragmentConstProperties - The define properties for the block
44
53
  * @param shaderProgram - The shader program for the block
45
54
  */
46
55
  private constructor();
@@ -49,6 +58,11 @@ export declare class CustomShaderBlock extends ShaderBlock {
49
58
  * @returns The shader program to use to render the block
50
59
  */
51
60
  getShaderProgram(): ShaderProgram;
61
+ /**
62
+ * Creates a dynamic property for the supplied const property with EditableInPropertyPage decorator.
63
+ * @param constProperty - The const property metadata
64
+ */
65
+ private _createConstProperty;
52
66
  /**
53
67
  * Checks a specific input connection point type to see if it has a default value, and registers the input
54
68
  * connection point accordingly.
@@ -1 +1 @@
1
- {"version":3,"file":"customShaderBlock.d.ts","sourceRoot":"","sources":["../../src/blockFoundation/customShaderBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AAE3G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,QAAQ,EAAE,8BAAsB;AA6E9C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAC9C;;;;;;OAMG;WACW,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,+BAA+B,GAAG,iBAAiB;IAcjI;;OAEG;IACH,OAAuB,SAAS,SAAuB;IAEvD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAC/C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAC9C,OAAO,CAAC,gBAAgB,CAAsD;IAE9E;;OAEG;IACH,IAAoB,SAAS,IAAI,MAAM,CAEtC;IAED;;;OAGG;IACH,IAAoB,SAAS,IAAI,QAAQ,CAAC,MAAM,CAAC,CAEhD;IAED;;;;;;;;;OASG;IACH,OAAO;IAoBP;;;OAGG;IACa,gBAAgB;IAIhC;;;;OAIG;IACH,OAAO,CAAC,yCAAyC;IAkBjD;;;OAGG;IACa,gBAAgB,IAAI,aAAa;IAgCjD;;;;;;;OAOG;IACH,OAAO,CAAC,qBAAqB;CAuChC"}
1
+ {"version":3,"file":"customShaderBlock.d.ts","sourceRoot":"","sources":["../../src/blockFoundation/customShaderBlock.ts"],"names":[],"mappings":"AAGA,OAA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js/core/Misc/logger.js";
2
2
  import { ConnectionPointType } from "../connection/connectionPointType.js";
3
3
  import { ShaderBinding } from "../runtime/shaderRuntime.js";
4
4
  import { CreateStrongRef } from "../runtime/strongRef.js";
5
+ import { CloneShaderProgram } from "../utils/shaderCodeUtils.js";
5
6
  import { ShaderBlock } from "./shaderBlock.js";
7
+ import { EditableInPropertyPage, PropertyTypeForEdition } from "../editorUtils/editableInPropertyPage.js";
6
8
  /**
7
9
  * The binding for a CustomShaderBlock
8
10
  */
@@ -83,11 +85,21 @@ export class CustomShaderBlock extends ShaderBlock {
83
85
  * @param smartFilter - The smart filter this block belongs to
84
86
  * @param name - Defines the name of the block
85
87
  * @param blockDefinition - The serialized block definition
88
+ * @param data - The data property from the serialized block, if applicable
86
89
  * @returns The deserialized CustomShaderBlock instance
87
90
  */
88
- static Create(smartFilter, name, blockDefinition) {
91
+ static Create(smartFilter, name, blockDefinition, data) {
89
92
  // When a new version of SerializedBlockDefinition is created, this function should be updated to handle the new properties.
90
- return new CustomShaderBlock(smartFilter, name, blockDefinition.disableOptimization, blockDefinition.blockType, blockDefinition.namespace, blockDefinition.inputConnectionPoints, blockDefinition.shaderProgram);
93
+ const newBlock = new CustomShaderBlock(smartFilter, name, blockDefinition.disableOptimization, blockDefinition.blockType, blockDefinition.namespace, blockDefinition.inputConnectionPoints, blockDefinition.fragmentConstProperties || [], blockDefinition.shaderProgram);
94
+ if (data && data.customProperties) {
95
+ const customProperties = data.customProperties;
96
+ for (const customProperty of customProperties) {
97
+ if (newBlock.dynamicPropertyNames.indexOf(customProperty.name) !== -1) {
98
+ newBlock[customProperty.name] = customProperty.value;
99
+ }
100
+ }
101
+ }
102
+ return newBlock;
91
103
  }
92
104
  /**
93
105
  * The type of the block - used when serializing / deserializing the block, and in the editor.
@@ -110,24 +122,76 @@ export class CustomShaderBlock extends ShaderBlock {
110
122
  * @param blockType - The type of the block
111
123
  * @param namespace - The namespace of the block
112
124
  * @param inputConnectionPoints - The input connection points of the
125
+ * @param fragmentConstProperties - The define properties for the block
113
126
  * @param shaderProgram - The shader program for the block
114
127
  */
115
- constructor(smartFilter, name, disableOptimization, blockType, namespace, inputConnectionPoints, shaderProgram) {
128
+ constructor(smartFilter, name, disableOptimization, blockType, namespace, inputConnectionPoints, fragmentConstProperties, shaderProgram) {
116
129
  super(smartFilter, name, disableOptimization);
117
130
  this._autoBoundInputs = null;
131
+ /**
132
+ * A list of the names of the properties added to this instance of the block, for example,
133
+ * fragment const properties.
134
+ *
135
+ */
136
+ this.dynamicPropertyNames = [];
118
137
  this._blockType = blockType;
119
138
  this._namespace = namespace;
139
+ this._shaderProgram = shaderProgram;
140
+ this._fragmentConstProperties = fragmentConstProperties;
120
141
  for (const input of inputConnectionPoints) {
121
142
  this._registerSerializedInputConnectionPointV1(input);
122
143
  }
123
- this._shaderProgram = shaderProgram;
144
+ for (const constProperty of fragmentConstProperties) {
145
+ this._createConstProperty(constProperty);
146
+ }
124
147
  }
125
148
  /**
126
149
  * Gets the shader program to use to render the block.
127
150
  * @returns The shader program to use to render the block
128
151
  */
129
152
  getShaderProgram() {
130
- return this._shaderProgram;
153
+ if (this._fragmentConstProperties.length === 0) {
154
+ return this._shaderProgram;
155
+ }
156
+ else {
157
+ // Make a copy of the shader program and append const properties to the fragment shader consts
158
+ const shaderProgramForThisInstance = CloneShaderProgram(this._shaderProgram);
159
+ shaderProgramForThisInstance.fragment.constPerInstance =
160
+ this._fragmentConstProperties
161
+ .map((property) => {
162
+ switch (property.type) {
163
+ case "float": {
164
+ const value = this[property.friendlyName];
165
+ const valueStr = Number.isInteger(value) ? value.toString() + "." : value.toString();
166
+ return `const float ${property.name} = ${valueStr};`;
167
+ }
168
+ }
169
+ })
170
+ .join("\n") + "\n";
171
+ return shaderProgramForThisInstance;
172
+ }
173
+ }
174
+ /**
175
+ * Creates a dynamic property for the supplied const property with EditableInPropertyPage decorator.
176
+ * @param constProperty - The const property metadata
177
+ */
178
+ _createConstProperty(constProperty) {
179
+ // Create the property and assign the default value
180
+ this[constProperty.friendlyName] = constProperty.defaultValue;
181
+ this.dynamicPropertyNames.push(constProperty.friendlyName);
182
+ // Use the EditableInPropertyPage decorator to make the property editable in the Smart Filters Editor
183
+ const editablePropertyOptions = {
184
+ notifiers: { rebuild: true },
185
+ blockType: this._blockType,
186
+ };
187
+ if (constProperty.options) {
188
+ editablePropertyOptions.options = Object.keys(constProperty.options).map((key) => {
189
+ return { label: key, value: constProperty.options[key] };
190
+ });
191
+ }
192
+ const propertyType = constProperty.options ? PropertyTypeForEdition.List : PropertyTypeForEdition.Float;
193
+ const decoratorApplier = EditableInPropertyPage(constProperty.friendlyName, propertyType, "PROPERTIES", editablePropertyOptions);
194
+ decoratorApplier(this, constProperty.friendlyName);
131
195
  }
132
196
  /**
133
197
  * Checks a specific input connection point type to see if it has a default value, and registers the input
@@ -1 +1 @@
1
- {"version":3,"file":"customShaderBlock.js","sourceRoot":"","sources":["../../src/blockFoundation/customShaderBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,oCAA4B;AAE7C,OAAO,EAAE,mBAAmB,EAA6B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;GAEG;AACH,MAAM,wBAAyB,SAAQ,aAAa;IAGhD;;;OAGG;IACH,YAAmB,qBAAgD;QAC/D,KAAK,EAAE,CAAC;QAPK,eAAU,GAAgE,EAAE,CAAC;QAS1F,KAAK,MAAM,KAAK,IAAI,qBAAqB,EAAE,CAAC;YACxC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;gBACjB,KAAK,mBAAmB,CAAC,KAAK;oBAC1B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;wBAC5B,MAAM,CAAC,QAAQ,CAAC,I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AAI,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC1I,MAAM;YACV,KAAK,mBAAmB,CAAC,MAAM;gBAC3B,WAAW,GAAG,OAAO,YAAY,KAAK,QAAQ,IAAI,GAAG,IAAI,YAAY,IAAI,GAAG,IAAI,YAAY,IAAI,GAAG,IAAI,YAAY,IAAI,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;gBACjK,MAAM;YACV,KAAK,mBAAmB,CAAC,OAAO;gBAC5B,WAAW,GAAG,OAAO,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;gBACtE,MAAM;YACV,KAAK,mBAAmB,CAAC,OAAO;gBAC5B,WAAW,GAAG,OAAO,YAAY,KAAK,QAAQ,IAAI,GAAG,IAAI,YAAY,IAAI,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;gBACnH,MAAM;YACV,OAAO,CAAC,CAAC,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,yDAAyD,IAAI,CAAC,SAAS,wBAAwB,mBAAmB,GAAG,CAAC,CAAC;gBACnI,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QAED,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,uCAAuC,IAAI,CAAC,SAAS,wBAAwB,mBAAmB,GAAG,CAAC,CAAC;QACrH,CAAC;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;;AAnOD;;GAEG;AACoB,2BAAS,GAAG,mBAAmB,AAAtB,CAAuB"}
@@ -0,0 +1,22 @@
1
+ import type { SerializeBlockV1 } from "../serialization/v1/smartFilterSerialization.types.js";
2
+ /**
3
+ * Data for a dynamic property on a CustomShaderBlock
4
+ */
5
+ export type CustomShaderBlockData = {
6
+ /**
7
+ * The custom properties of the CustomShaderBlock
8
+ */
9
+ customProperties: CustomPropertyData[];
10
+ };
11
+ type CustomPropertyData = {
12
+ name: string;
13
+ value: any;
14
+ };
15
+ /**
16
+ * Serializes a CustomShaderBlock to V1 serialized data.
17
+ * @param block - The block to serialize
18
+ * @returns The serialized block
19
+ */
20
+ export declare const CustomShaderBlockSerializer: SerializeBlockV1;
21
+ export {};
22
+ //# sourceMappingURL=customShaderBlock.serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customShaderBlock.serializer.d.ts","sourceRoot":"","sources":["../../src/blockFoundation/customShaderBlock.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,uDAAuD,CAAC;AAIlH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAChC;;OAEG;IACH,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;CAC1C,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,gBA0BzC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { CustomShaderBlock } from "./customShaderBlock.js";
2
+ /**
3
+ * Serializes a CustomShaderBlock to V1 serialized data.
4
+ * @param block - The block to serialize
5
+ * @returns The serialized block
6
+ */
7
+ export const CustomShaderBlockSerializer = (block) => {
8
+ if (block.getClassName() !== CustomShaderBlock.ClassName) {
9
+ throw new Error("Was asked to serialize an unrecognized block type");
10
+ }
11
+ const customShaderBlock = block;
12
+ let data;
13
+ const dynamicPropertyNames = customShaderBlock.dynamicPropertyNames;
14
+ if (dynamicPropertyNames.length > 0) {
15
+ data = {
16
+ customProperties: dynamicPropertyNames.map((propertyName) => ({
17
+ name: propertyName,
18
+ value: customShaderBlock[propertyName],
19
+ })),
20
+ };
21
+ }
22
+ return {
23
+ name: customShaderBlock.name,
24
+ uniqueId: customShaderBlock.uniqueId,
25
+ blockType: customShaderBlock.blockType,
26
+ namespace: customShaderBlock.namespace,
27
+ comments: customShaderBlock.comments,
28
+ data,
29
+ outputTextureOptions: customShaderBlock.outputTextureOptions,
30
+ };
31
+ };
32
+ //# sourceMappingURL=customShaderBlock.serializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customShaderBlock.serializer.js","sourceRoot":"","sources":["../../src/blockFoundation/customShaderBlock.serializer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAiB3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAqB,CAAC,KAAgB,EAAsB,EAAE;IAClG,IAAI,KAAK,CAAC,YAAY,EAAE,KAAK,iBAAiB,CAAC,SAAS,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,iBAAiB,GAAG,KAA0B,CAAC;IAErD,IAAI,IAAuC,CAAC;IAC5C,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC;IACpE,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,IAAI,GAAG;YACH,gBAAgB,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;gBAC1D,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAG,iBAAyB,CAAC,YAAY,CAAC;aAClD,CAAC,CAAC;SACN,CAAC;IACN,CAAC;IAED,OAAO;QACH,IAAI,EAAE,iBAAiB,CAAC,IAAI;QAC5B,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;QACpC,SAAS,EAAE,iBAAiB,CAAC,SAAS;QACtC,SAAS,EAAE,iBAAiB,CAAC,SAAS;QACtC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;QACpC,IAAI;QACJ,oBAAoB,EAAE,iBAAiB,CAAC,oBAAoB;KAC/D,CAAC;AACN,CAAC,CAAC"}
@@ -44,6 +44,11 @@ export declare abstract class DisableableShaderBlock extends ShaderBlock impleme
44
44
  private static _HasModifiedShaderCode;
45
45
  private get _hasModifiedShaderCode();
46
46
  private set _hasModifiedShaderCode(value);
47
+ /**
48
+ * Gets the shader program to use to render the block.
49
+ * @returns The shader program to use to render the block
50
+ */
51
+ getShaderProgram(): import("../utils/shaderCodeUtils.js").ShaderProgram;
47
52
  /**
48
53
  * Instantiates a new block.
49
54
  * @param smartFilter - Defines the smart filter the block belongs to
@@ -1 +1 @@
1
- {"version":3,"file":"disableableShaderBlock.d.ts","sourceRoot":"","sources":["../../src/blockFoundation/disableableShaderBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;CAC1D;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC5B;;;OAGG;IACH,MAAM,IAAI;IAEV;;;;OAIG;IACH,UAAU,IAAI;CACjB;AAED;;;;GAIG;AACH,8BAAsB,sBAAuB,SAAQ,WAAY,YAAW,iBAAiB;IACzF;;OAEG;IACH,SAAgB,QAAQ,gHAAgG;IAExH;;OAEG;IACH,SAAgB,oBAAoB,EAAE,oBAAoB,CAAC;IAQ3D,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAS;IAC9C,OAAO,KAAK,sBAAsB,GAEjC;IACD,OAAO,KAAK,sBAAsB,QAEjC;IAED;;;;;;OAMG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,UAAQ,EAAE,eAAe,uBAAkC;CAiBrI"}
1
+ {"version":3,"file":"disableableShaderBlock.d.ts","sourceRoot":"","sources":["../../src/blockFoundation/disableableShaderBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;CAC1D;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC5B;;;OAGG;IACH,MAAM,IAAI;IAEV;;;;OAIG;IACH,UAAU,IAAI;CACjB;AAED;;;;GAIG;AACH,8BAAsB,sBAAuB,SAAQ,WAAY,YAAW,iBAAiB;IACzF;;OAEG;IACH,SAAgB,QAAQ,gHAAgG;IAExH;;OAEG;IACH,SAAgB,oBAAoB,EAAE,oBAAoB,CAAC;IAQ3D,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAS;IAC9C,OAAO,KAAK,sBAAsB,GAEjC;IACD,OAAO,KAAK,sBAAsB,QAEjC;IAED;;;OAGG;IACa,gBAAgB;IAkBhC;;;;;;OAMG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,UAAQ,EAAE,eAAe,uBAAkC;CAIrI"}
@@ -31,6 +31,24 @@ export class DisableableShaderBlock extends ShaderBlock {
31
31
  set _hasModifiedShaderCode(value) {
32
32
  this.constructor._HasModifiedShaderCode = value;
33
33
  }
34
+ /**
35
+ * Gets the shader program to use to render the block.
36
+ * @returns The shader program to use to render the block
37
+ */
38
+ getShaderProgram() {
39
+ const shaderProgram = super.getShaderProgram();
40
+ // If we haven't already modified the shader code for this block type, do so now
41
+ if (!this._hasModifiedShaderCode) {
42
+ this._hasModifiedShaderCode = true;
43
+ // Apply the disable strategy
44
+ switch (this.blockDisableStrategy) {
45
+ case BlockDisableStrategy.AutoSample:
46
+ InjectAutoSampleDisableCode(shaderProgram);
47
+ break;
48
+ }
49
+ }
50
+ return shaderProgram;
51
+ }
34
52
  /**
35
53
  * Instantiates a new block.
36
54
  * @param smartFilter - Defines the smart filter the block belongs to
@@ -45,17 +63,6 @@ export class DisableableShaderBlock extends ShaderBlock {
45
63
  */
46
64
  this.disabled = this._registerOptionalInput("disabled", ConnectionPointType.Boolean, CreateStrongRef(false));
47
65
  this.blockDisableStrategy = disableStrategy;
48
- // If we haven't already modified the shader code for this block type, do so now
49
- if (!this._hasModifiedShaderCode) {
50
- this._hasModifiedShaderCode = true;
51
- // Apply the disable strategy
52
- const shaderProgram = this.getShaderProgram();
53
- switch (this.blockDisableStrategy) {
54
- case BlockDisableStrategy.AutoSample:
55
- InjectAutoSampleDisableCode(shaderProgram);
56
- break;
57
- }
58
- }
59
66
  }
60
67
  }
61
68
  // The shader code is a static per block type. When an instance of a block is created, we may need to alter
@@ -1 +1 @@
1
- {"version":3,"file":"disableableShaderBlock.js","sourceRoot":"","sources":["../../src/blockFoundation/disableableShaderBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAY1E;;GAEG;AACH,MAAM,CAAN,IAAY,oBAaX;AAbD,WAAY,oBAAoB;IAC5B;;;OAGG;IACH,mEAAU,CAAA;IAEV;;;;OAIG;IACH,2EAAc,CAAA;AAClB,CAAC,EAbW,oBAAoB,KAApB,oBAAoB,QAa/B;AAED;;;;GAIG;AACH,MAAM,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,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAoDpH,IAAI,CAAC,oBAAoB,GAAG,eAAe,CAAC;IAChD,CAAC;;AA9CD,2GAA2G;AAC3G,4GAA4G;AAC5G,4GAA4G;AAC5G,uGAAuG;AACvG,iHAAiH;AACjH,2BAA2B;AACZ,6CAAsB,GAAG,KAAK,AAAR,CAAS"}
@@ -50,6 +50,11 @@ export interface IEditablePropertyOption {
50
50
  valuesAreStrings?: boolean;
51
51
  /** If supplied, the sub property to read/write */
52
52
  subPropertyName?: string;
53
+ /**
54
+ * If supplied, scope this to a specific block type - useful for the
55
+ * CustomShaderBlock where multiple block types are implemented with the same class
56
+ */
57
+ blockType?: string;
53
58
  }
54
59
  /**
55
60
  * Interface that describes an editable property
@@ -1 +1 @@
1
- {"version":3,"file":"editableInPropertyPage.d.ts","sourceRoot":"","sources":["../../src/editorUtils/editableInPropertyPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,wCAAgC;AAE1D;;GAEG;AACH,oBAAY,sBAAsB;IAC9B,4BAA4B;IAC5B,OAAO,IAAA;IACP,0BAA0B;IAC1B,KAAK,IAAA;IACL,wBAAwB;IACxB,GAAG,IAAA;IACH,4BAA4B;IAC5B,OAAO,IAAA;IACP,mCAAmC;IACnC,IAAI,IAAA;CACP;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,gBAAgB;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,SAAS,CAAC,EAAE;QACR,mCAAmC;QACnC,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,oCAAoC;QACpC,MAAM,CAAC,EAAE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S,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,OAAO,EAAE,uBAAuB,CAAC;IACjC,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAClC,WAAW,EAAE,MAAM,EACnB,YAAY,GAAE,sBAAuD,EACrE,SAAS,GAAE,MAAqB,EAChC,OAAO,CAAC,EAAE,uBAAuB,YAEjB,GAAG,eAAe,MAAM,UAyB3C"}
@@ -29,14 +29,23 @@ export function EditableInPropertyPage(displayName, propertyType = PropertyTypeF
29
29
  propStore = [];
30
30
  target._propStore = propStore;
31
31
  }
32
- propStore.push({
32
+ const propToAdd = {
33
33
  propertyName: propertyKey,
34
34
  displayName: displayName,
35
35
  type: propertyType,
36
36
  groupName: groupName,
37
37
  options: options ?? {},
38
38
  className: target.constructor.name,
39
- });
39
+ };
40
+ // If the property already exists, overwrite it, otherwise add it
41
+ // Note: It may have been redefined since the application started
42
+ const existingIndex = propStore.findIndex((p) => p.propertyName === propertyKey && p.className === target.constructor.name && options?.blockType === p.options?.blockType);
43
+ if (existingIndex !== -1) {
44
+ propStore[existingIndex] = propToAdd;
45
+ }
46
+ else {
47
+ propStore.push(propToAdd);
48
+ }
40
49
  };
41
50
  }
42
51
  //# sourceMappingURL=editableInPropertyPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editableInPropertyPage.js","sourceRoot":"","sources":["../../src/editorUtils/editableInPropertyPage.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,sBAWX;AAXD,WAAY,sBAAsB;IAC9B,4BAA4B;IAC5B,yEAAO,CAAA;IACP,0BAA0B;IAC1B,qEAAK,CAAA;IACL,wBAAwB;IACxB,iEAAG,CAAA;IACH,4BAA4B;IAC5B,yEAAO,CAAA;IACP,mCAAmC;IACnC,mEAAI,CAAA;AACR,CAAC,EAXW,sBAAsB,KAAtB,sBAAsB,QAWjC;AA2DD;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAClC,WAAmB,EACnB,eAAuC,sBAAsB,CAAC,OAAO,EACrE,YAAoB,YAAY,EAChC,OAAiC;IAEjC,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QACxC,IAAI,SAAS,GAAqC,MAAM,CAAC,UAAU,CAAC;QACpE,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,SAAS,GAAG,EAAE,CAAC;YACf,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;QAClC,CAAC;QAED,SAAS,CAAC,IAAI,CAAC;YACX,YAAY,EAAE,WAAW;YACzB,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,YAAY;YAClB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,OAAO,IAAI,EAAE;YACtB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI;SACrC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"editableInPropertyPage.js","sourceRoot":"","sources":["../../src/editorUtils/editableInPropertyPage.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,sBAWX;AAXD,WAAY,sBAAsB;IAC9B,4BAA4B;IAC5B,yEAAO,CAAA;IACP,0BAA0B;IAC1B,qEAAK,CAAA;IACL,wBAAwB;IACxB,iEAAG,CAAA;IACH,4BAA4B;IAC5B,yEAAO,CAAA;IACP,mCAAmC;IACnC,mEAAI,CAAA;AACR,CAAC,EAXW,sBAAsB,KAAtB,sBAAsB,QAWjC;AAgED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAClC,WAAmB,EACnB,eAAuC,sBAAsB,CAAC,OAAO,EACrE,YAAoB,YAAY,EAChC,OAAiC;IAEjC,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QACxC,IAAI,SAAS,GAAqC,MAAM,CAAC,UAAU,CAAC;QACpE,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,SAAS,GAAG,EAAE,CAAC;YACf,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;QAClC,CAAC;QAED,MAAM,SAAS,GAAmC;YAC9C,YAAY,EAAE,WAAW;YACzB,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,YAAY;YAClB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,OAAO,IAAI,EAAE;YACtB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI;SACrC,CAAC;QAEF,iEAAiE;QACjE,iEAAiE;QACjE,MAAM,aAAa,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,WAAW,IAAI,CAAC,CAAC,SAAS,KAAK,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,OAAO,EAAE,SAAS,KAAK,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC3K,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;YACvB,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC;IACL,CAAC,CAAC;AACN,CAAC"}
@@ -68,10 +68,21 @@ export declare class SmartFilterOptimizer {
68
68
  * folded into the final optimized block.
69
69
  * NOTE: so this function can know about the uniforms to test for them, it must be called after _processVariables.
70
70
  * @param block - The block we are processing
71
+ * @param shaderProgram - The shader program associated with the block
71
72
  * @param renameWork - The list of rename work to add to as needed
72
73
  * @param samplerList - The list of sampler names
73
74
  */
74
75
  private _processHelperFunctions;
76
+ /**
77
+ * Processes either consts or uniforms. Handles capturing the rename work needed, updating the sampler list, and
78
+ * accounting for single instance situations (where a const or uniform is shared across all instances of this block).
79
+ * @param block - The block to work on
80
+ * @param renameWork - The RenameWork list to update
81
+ * @param varDecl - Which type of variable we're working with
82
+ * @param declarations - The declarations of those variables from the shader
83
+ * @param sharedByAllInstances - If this should be treated as a shared value across all instances of this shader block
84
+ * @returns The list of samplers
85
+ */
75
86
  private _processVariables;
76
87
  private _processSampleTexture;
77
88
  private _canBeOptimized;
@@ -1 +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;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,4BAA4B,CAAmC;IACvE,OAAO,CAAC,iBAAiB,CAAkB;IAE3C;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,4BAA4B;IAQ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O,CAAC,wBAAwB;CAWnC"}
@@ -125,8 +125,8 @@ export class SmartFilterOptimizer {
125
125
  }
126
126
  return newVarName;
127
127
  }
128
- _processDefines(block, renameWork) {
129
- const defines = block.getShaderProgram().fragment.defines;
128
+ _processDefines(block, shaderProgram, renameWork) {
129
+ const defines = shaderProgram.fragment.defines;
130
130
  if (!defines) {
131
131
  return;
132
132
  }
@@ -168,18 +168,19 @@ export class SmartFilterOptimizer {
168
168
  * folded into the final optimized block.
169
169
  * NOTE: so this function can know about the uniforms to test for them, it must be called after _processVariables.
170
170
  * @param block - The block we are processing
171
+ * @param shaderProgram - The shader program associated with the block
171
172
  * @param renameWork - The list of rename work to add to as needed
172
173
  * @param samplerList - The list of sampler names
173
174
  */
174
- _processHelperFunctions(block, renameWork, samplerList) {
175
- const functions = block.getShaderProgram().fragment.functions;
175
+ _processHelperFunctions(block, shaderProgram, renameWork, samplerList) {
176
+ const functions = shaderProgram.fragment.functions;
176
177
  if (functions.length === 1) {
177
178
  // There's only the main function, so we don't need to do anything
178
179
  return;
179
180
  }
180
181
  for (const func of functions) {
181
182
  let funcName = func.name;
182
- if (funcName === block.getShaderProgram().fragment.mainFunctionName) {
183
+ if (funcName === shaderProgram.fragment.mainFunctionName) {
183
184
  continue;
184
185
  }
185
186
  funcName = UndecorateSymbol(funcName);
@@ -239,11 +240,22 @@ export class SmartFilterOptimizer {
239
240
  }
240
241
  }
241
242
  }
242
- _processVariables(block, renameWork, varDecl, declarations, hasValue = false, forceSingleInstance = false) {
243
+ /**
244
+ * Processes either consts or uniforms. Handles capturing the rename work needed, updating the sampler list, and
245
+ * accounting for single instance situations (where a const or uniform is shared across all instances of this block).
246
+ * @param block - The block to work on
247
+ * @param renameWork - The RenameWork list to update
248
+ * @param varDecl - Which type of variable we're working with
249
+ * @param declarations - The declarations of those variables from the shader
250
+ * @param sharedByAllInstances - If this should be treated as a shared value across all instances of this shader block
251
+ * @returns The list of samplers
252
+ */
253
+ _processVariables(block, renameWork, varDecl, declarations, sharedByAllInstances) {
243
254
  if (!declarations) {
244
255
  return [];
245
256
  }
246
257
  let rex = `${varDecl}\\s+(\\S+)\\s+${DecorateChar}(\\w+)${DecorateChar}\\s*`;
258
+ const hasValue = varDecl !== "uniform";
247
259
  if (hasValue) {
248
260
  rex += "=\\s*(.+);";
249
261
  }
@@ -254,7 +266,6 @@ export class SmartFilterOptimizer {
254
266
  const rx = new RegExp(rex, "g");
255
267
  let match = rx.exec(declarations);
256
268
  while (match !== null) {
257
- const singleInstance = forceSingleInstance || varDecl === "const";
258
269
  const varType = match[1];
259
270
  const varName = match[2];
260
271
  const varValue = hasValue ? match[3] : null;
@@ -264,7 +275,7 @@ export class SmartFilterOptimizer {
264
275
  }
265
276
  else {
266
277
  const existingRemapped = this._remappedSymbols.find((s) => s.type === varDecl && s.name === varName && s.owners[0] && s.owners[0].blockType === block.blockType);
267
- if (existingRemapped && singleInstance) {
278
+ if (existingRemapped && sharedByAllInstances) {
268
279
  newVarName = existingRemapped.remappedName;
269
280
  if (varDecl === "uniform") {
270
281
  existingRemapped.owners.push(block);
@@ -319,12 +330,12 @@ export class SmartFilterOptimizer {
319
330
  });
320
331
  return UndecorateSymbol(newSamplerName);
321
332
  }
322
- _canBeOptimized(block) {
333
+ _canBeOptimized(block, shaderProgram) {
323
334
  if (block.disableOptimization) {
324
335
  return false;
325
336
  }
326
337
  if (block instanceof ShaderBlock) {
327
- if (block.getShaderProgram().vertex !== this._vertexShaderCode) {
338
+ if (shaderProgram.vertex !== this._vertexShaderCode) {
328
339
  return false;
329
340
  }
330
341
  if (!TextureOptionsMatch(block.outputTextureOptions, this._currentOutputTextureOptions)) {
@@ -343,6 +354,7 @@ export class SmartFilterOptimizer {
343
354
  if (this._currentOutputTextureOptions === undefined) {
344
355
  this._currentOutputTextureOptions = block.outputTextureOptions;
345
356
  }
357
+ // Sometimes getShaderProgram() does work, so only grab it once for efficiency
346
358
  const shaderProgram = block.getShaderProgram();
347
359
  if (!shaderProgram) {
348
360
  throw new Error(`Shader program not found for block "${block.name}"!`);
@@ -365,17 +377,19 @@ export class SmartFilterOptimizer {
365
377
  this._dependencyGraph.addElement(newShaderFuncName);
366
378
  }
367
379
  // Processes the defines to make them unique
368
- this._processDefines(block, renameWork);
380
+ this._processDefines(block, shaderProgram, renameWork);
369
381
  // Processes the constants to make them unique
370
382
  this._processVariables(block, renameWork, "const", shaderProgram.fragment.const, true);
383
+ // Processes the per-instance constants
384
+ this._processVariables(block, renameWork, "const", shaderProgram.fragment.constPerInstance, false);
371
385
  // Processes the uniform inputs to make them unique. Also extract the list of samplers
372
386
  let samplerList = [];
373
387
  samplerList = this._processVariables(block, renameWork, "uniform", shaderProgram.fragment.uniform, false);
374
388
  let additionalSamplers = [];
375
- additionalSamplers = this._processVariables(block, renameWork, "uniform", shaderProgram.fragment.uniformSingle, false, true);
389
+ additionalSamplers = this._processVariables(block, renameWork, "uniform", shaderProgram.fragment.uniformSingle, true);
376
390
  samplerList.push(...additionalSamplers);
377
391
  // Processes the functions other than the main function - must be done after _processVariables()
378
- this._processHelperFunctions(block, renameWork, samplerList);
392
+ this._processHelperFunctions(block, shaderProgram, renameWork, samplerList);
379
393
  // Processes the texture inputs
380
394
  for (const sampler of samplerList) {
381
395
  const samplerName = UndecorateSymbol(sampler);
@@ -398,7 +412,7 @@ export class SmartFilterOptimizer {
398
412
  // input is connected to an InputBlock of type "Texture": we must directly sample a texture
399
413
  this._processSampleTexture(block, renameWork, samplerName, samplers, parentBlock);
400
414
  }
401
- else if (this._forceUnoptimized || !this._canBeOptimized(parentBlock)) {
415
+ else if (this._forceUnoptimized || !this._canBeOptimized(parentBlock, shaderProgram)) {
402
416
  // the block connected to this input cannot be optimized: we must directly sample its output texture
403
417
  const uniqueSamplerName = this._processSampleTexture(block, renameWork, samplerName, samplers);
404
418
  let stackItem = this._blockToStackItem.get(parentBlock);