@onerjs/core 8.31.6 → 8.31.7

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 (52) hide show
  1. package/Animations/animation.d.ts +2 -1
  2. package/Animations/animation.js +3 -2
  3. package/Animations/animation.js.map +1 -1
  4. package/Behaviors/Cameras/interpolatingBehavior.d.ts +2 -1
  5. package/Behaviors/Cameras/interpolatingBehavior.js +2 -2
  6. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
  7. package/Cameras/geospatialCamera.d.ts +12 -3
  8. package/Cameras/geospatialCamera.js +91 -36
  9. package/Cameras/geospatialCamera.js.map +1 -1
  10. package/Cameras/geospatialCameraMovement.d.ts +6 -2
  11. package/Cameras/geospatialCameraMovement.js +10 -10
  12. package/Cameras/geospatialCameraMovement.js.map +1 -1
  13. package/Engines/abstractEngine.js +2 -2
  14. package/Engines/abstractEngine.js.map +1 -1
  15. package/Engines/thinEngine.js +1 -1
  16. package/Engines/thinEngine.js.map +1 -1
  17. package/FrameGraph/Node/nodeRenderGraph.d.ts +22 -5
  18. package/FrameGraph/Node/nodeRenderGraph.js +39 -18
  19. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  20. package/FrameGraph/Passes/pass.d.ts +2 -0
  21. package/FrameGraph/Passes/pass.js +2 -0
  22. package/FrameGraph/Passes/pass.js.map +1 -1
  23. package/FrameGraph/Passes/renderPass.d.ts +2 -0
  24. package/FrameGraph/Passes/renderPass.js +4 -0
  25. package/FrameGraph/Passes/renderPass.js.map +1 -1
  26. package/FrameGraph/frameGraph.d.ts +13 -4
  27. package/FrameGraph/frameGraph.js +45 -5
  28. package/FrameGraph/frameGraph.js.map +1 -1
  29. package/FrameGraph/frameGraphRenderTarget.d.ts +1 -0
  30. package/FrameGraph/frameGraphRenderTarget.js +3 -0
  31. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  32. package/FrameGraph/frameGraphTask.d.ts +6 -0
  33. package/FrameGraph/frameGraphTask.js +15 -0
  34. package/FrameGraph/frameGraphTask.js.map +1 -1
  35. package/FrameGraph/frameGraphTypes.d.ts +2 -0
  36. package/FrameGraph/frameGraphTypes.js.map +1 -1
  37. package/Materials/Node/nodeMaterial.js +3 -0
  38. package/Materials/Node/nodeMaterial.js.map +1 -1
  39. package/Materials/materialHelper.functions.d.ts +29 -7
  40. package/Materials/materialHelper.functions.js +59 -24
  41. package/Materials/materialHelper.functions.js.map +1 -1
  42. package/Materials/shaderMaterial.d.ts +1 -0
  43. package/Materials/shaderMaterial.js +6 -17
  44. package/Materials/shaderMaterial.js.map +1 -1
  45. package/Meshes/mesh.js +1 -1
  46. package/Meshes/mesh.js.map +1 -1
  47. package/Misc/screenshotTools.js +2 -8
  48. package/Misc/screenshotTools.js.map +1 -1
  49. package/ShadersWGSL/iblVoxelGrid.vertex.d.ts +1 -0
  50. package/ShadersWGSL/iblVoxelGrid.vertex.js +53 -64
  51. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  52. package/package.json +1 -1
@@ -22,6 +22,7 @@ export declare class FrameGraph implements IDisposable {
22
22
  private readonly _tasks;
23
23
  private readonly _passContext;
24
24
  private readonly _renderContext;
25
+ private readonly _initAsyncPromises;
25
26
  private _currentProcessedTask;
26
27
  private _whenReadyAsyncCancel;
27
28
  /**
@@ -112,11 +113,19 @@ export declare class FrameGraph implements IDisposable {
112
113
  */
113
114
  addObjectListPass(name: string, whenTaskDisabled?: boolean): FrameGraphObjectListPass;
114
115
  private _addPass;
116
+ /** @internal */
117
+ _whenAsynchronousInitializationDoneAsync(): Promise<void>;
118
+ /**
119
+ * @deprecated Use buildAsync instead
120
+ */
121
+ build(): void;
122
+ private _built;
115
123
  /**
116
124
  * Builds the frame graph.
117
125
  * This method should be called after all tasks have been added to the frame graph (FrameGraph.addTask) and before the graph is executed (FrameGraph.execute).
126
+ * @param waitForReadiness If true, the method will wait for the frame graph to be ready before returning (default is true)
118
127
  */
119
- build(): void;
128
+ buildAsync(waitForReadiness?: boolean): Promise<void>;
120
129
  /**
121
130
  * Checks if the frame graph is ready to be executed.
122
131
  * Note that you can use the whenReadyAsync method to wait for the frame graph to be ready.
@@ -124,10 +133,10 @@ export declare class FrameGraph implements IDisposable {
124
133
  */
125
134
  isReady(): boolean;
126
135
  /**
127
- * Returns a promise that resolves when the frame graph is ready to be executed
128
- * This method must be called after the graph has been built (FrameGraph.build called)!
136
+ * Returns a promise that resolves when the frame graph is ready to be executed.
137
+ * In general, calling “await buildAsync()” should suffice, as this function also waits for readiness by default.
129
138
  * @param timeStep Time step in ms between retries (default is 16)
130
- * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 5000)
139
+ * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 10000)
131
140
  * @returns The promise that resolves when the graph is ready
132
141
  */
133
142
  whenReadyAsync(timeStep?: number, maxTimeout?: number): Promise<void>;
@@ -55,6 +55,7 @@ export class FrameGraph {
55
55
  constructor(scene, debugTextures = false, _linkedNodeRenderGraph = null) {
56
56
  this._linkedNodeRenderGraph = _linkedNodeRenderGraph;
57
57
  this._tasks = [];
58
+ this._initAsyncPromises = [];
58
59
  this._currentProcessedTask = null;
59
60
  this._whenReadyAsyncCancel = null;
60
61
  /**
@@ -77,6 +78,7 @@ export class FrameGraph {
77
78
  * Indicates whether the execution of the frame graph is paused (default is false)
78
79
  */
79
80
  this.pausedExecution = false;
81
+ this._built = false; // TODO: to be removed when build() is removed
80
82
  this._scene = scene;
81
83
  this._engine = scene.getEngine();
82
84
  this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);
@@ -116,6 +118,7 @@ export class FrameGraph {
116
118
  throw new Error(`FrameGraph.addTask: Can't add the task "${task.name}" while another task is currently building (task: ${this._currentProcessedTask.name}).`);
117
119
  }
118
120
  this._tasks.push(task);
121
+ this._initAsyncPromises.push(task.initAsync());
119
122
  }
120
123
  /**
121
124
  * Adds a pass to a task. This method can only be called during a Task.record execution.
@@ -163,13 +166,30 @@ export class FrameGraph {
163
166
  this._currentProcessedTask._addPass(pass, whenTaskDisabled);
164
167
  return pass;
165
168
  }
169
+ /** @internal */
170
+ async _whenAsynchronousInitializationDoneAsync() {
171
+ if (this._initAsyncPromises.length > 0) {
172
+ await Promise.all(this._initAsyncPromises);
173
+ this._initAsyncPromises.length = 0;
174
+ }
175
+ }
176
+ /**
177
+ * @deprecated Use buildAsync instead
178
+ */
179
+ build() {
180
+ void this.buildAsync(false);
181
+ }
166
182
  /**
167
183
  * Builds the frame graph.
168
184
  * This method should be called after all tasks have been added to the frame graph (FrameGraph.addTask) and before the graph is executed (FrameGraph.execute).
185
+ * @param waitForReadiness If true, the method will wait for the frame graph to be ready before returning (default is true)
169
186
  */
170
- build() {
187
+ async buildAsync(waitForReadiness = true) {
171
188
  this.textureManager._releaseTextures(false);
189
+ this.pausedExecution = true;
190
+ this._built = false;
172
191
  try {
192
+ await this._whenAsynchronousInitializationDoneAsync();
173
193
  for (const task of this._tasks) {
174
194
  task._reset();
175
195
  this._currentProcessedTask = task;
@@ -185,7 +205,11 @@ export class FrameGraph {
185
205
  for (const task of this._tasks) {
186
206
  task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);
187
207
  }
208
+ this._built = true;
188
209
  this.onBuildObservable.notifyObservers(this);
210
+ if (waitForReadiness) {
211
+ await this.whenReadyAsync();
212
+ }
189
213
  }
190
214
  catch (e) {
191
215
  this._tasks.length = 0;
@@ -193,6 +217,10 @@ export class FrameGraph {
193
217
  this.textureManager._isRecordingTask = false;
194
218
  throw e;
195
219
  }
220
+ finally {
221
+ this.pausedExecution = false;
222
+ this._built = true;
223
+ }
196
224
  }
197
225
  /**
198
226
  * Checks if the frame graph is ready to be executed.
@@ -207,14 +235,26 @@ export class FrameGraph {
207
235
  return ready;
208
236
  }
209
237
  /**
210
- * Returns a promise that resolves when the frame graph is ready to be executed
211
- * This method must be called after the graph has been built (FrameGraph.build called)!
238
+ * Returns a promise that resolves when the frame graph is ready to be executed.
239
+ * In general, calling “await buildAsync()” should suffice, as this function also waits for readiness by default.
212
240
  * @param timeStep Time step in ms between retries (default is 16)
213
- * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 5000)
241
+ * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 10000)
214
242
  * @returns The promise that resolves when the graph is ready
215
243
  */
216
- async whenReadyAsync(timeStep = 16, maxTimeout = 5000) {
244
+ async whenReadyAsync(timeStep = 16, maxTimeout = 10000) {
217
245
  let firstNotReadyTask = null;
246
+ // TODO: to be removed when build() is removed
247
+ await new Promise((resolve) => {
248
+ const checkBuilt = () => {
249
+ if (this._built) {
250
+ resolve(void 0);
251
+ return;
252
+ }
253
+ setTimeout(checkBuilt, 16);
254
+ };
255
+ checkBuilt();
256
+ });
257
+ // END TODO
218
258
  return await new Promise((resolve, reject) => {
219
259
  this._whenReadyAsyncCancel = _RetryWithInterval(() => {
220
260
  let ready = this._renderContext._isReady();
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,kBAAkB,EAAE,+BAA8B;AAC3D,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,iBAAiB,EAAE,qCAAoC;AAEhE,qDAAoD;AACpD,4DAA2D;AAE3D,IAAK,kBAIJ;AAJD,WAAK,kBAAkB;IACnB,+DAAU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ACb,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAE/B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene, AbstractEngine, FrameGraphTask, Nullable, NodeRenderGraph, IDisposable } from \"core/index\";\r\nimport { FrameGraphPass } from \"./Passes/pass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { FrameGraphObjectListPass } from \"./Passes/objectListPass\";\r\nimport { FrameGraphRenderContext } from \"./frameGraphRenderContext\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\nimport { FrameGraphTextureManager } from \"./frameGraphTextureManager\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { _RetryWithInterval } from \"core/Misc/timingTools\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { UniqueIdGenerator } from \"core/Misc/uniqueIdGenerator\";\r\n\r\nimport \"core/Engines/Extensions/engine.multiRender\";\r\nimport \"core/Engines/WebGPU/Extensions/engine.multiRender\";\r\n\r\nenum FrameGraphPassType {\r\n Normal = 0,\r\n Render = 1,\r\n ObjectList = 2,\r\n}\r\n\r\n/**\r\n * Class used to implement a frame graph\r\n * @experimental\r\n */\r\nexport class FrameGraph implements IDisposable {\r\n /**\r\n * Gets the texture manager used by the frame graph\r\n */\r\n public readonly textureManager: FrameGraphTextureManager;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _tasks: FrameGraphTask[] = [];\r\n private readonly _passContext: FrameGraphContext;\r\n private readonly _renderContext: FrameGraphRenderContext;\r\n private _currentProcessedTask: FrameGraphTask | null = null;\r\n private _whenReadyAsyncCancel: Nullable<() => void> = null;\r\n\r\n /**\r\n * Name of the frame graph\r\n */\r\n public name = \"Frame Graph\";\r\n\r\n /**\r\n * Gets the unique id of the frame graph\r\n */\r\n public readonly uniqueId = UniqueIdGenerator.UniqueId;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)\r\n */\r\n public optimizeTextureAllocation = true;\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<FrameGraph>();\r\n\r\n /**\r\n * Gets the engine used by the frame graph\r\n */\r\n public get engine() {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the scene used by the frame graph\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the list of tasks in the frame graph\r\n */\r\n public get tasks() {\r\n return this._tasks;\r\n }\r\n\r\n /**\r\n * Indicates whether the execution of the frame graph is paused (default is false)\r\n */\r\n public pausedExecution = false;\r\n\r\n /**\r\n * Gets the node render graph linked to the frame graph (if any)\r\n * @returns the linked node render graph or null if none\r\n */\r\n public getLinkedNodeRenderGraph(): Nullable<NodeRenderGraph> {\r\n return this._linkedNodeRenderGraph;\r\n }\r\n\r\n /**\r\n * Constructs the frame graph\r\n * @param scene defines the scene the frame graph is associated with\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)\r\n * @param _linkedNodeRenderGraph defines the linked node render graph (if any)\r\n */\r\n constructor(\r\n scene: Scene,\r\n debugTextures = false,\r\n private readonly _linkedNodeRenderGraph: Nullable<NodeRenderGraph> = null\r\n ) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext(this._engine, this.textureManager, scene);\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);\r\n\r\n this._scene.addFrameGraph(this);\r\n }\r\n\r\n /**\r\n * Gets the class name of the frame graph\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FrameGraph\";\r\n }\r\n\r\n /**\r\n * Gets a task by name\r\n * @param name Name of the task to get\r\n * @returns The task or undefined if not found\r\n */\r\n public getTaskByName<T extends FrameGraphTask>(name: string): T | undefined {\r\n return this._tasks.find((t) => t.name === name) as T;\r\n }\r\n\r\n /**\r\n * Gets all tasks of a specific type\r\n * @param taskType Type of the task(s) to get\r\n * @returns The list of tasks of the specified type\r\n */\r\n public getTasksByType<T extends FrameGraphTask>(taskType: new (...args: any[]) => T): T[] {\r\n return this._tasks.filter((t) => t instanceof taskType) as T[];\r\n }\r\n\r\n /**\r\n * Adds a task to the frame graph\r\n * @param task Task to add\r\n */\r\n public addTask(task: FrameGraphTask): void {\r\n if (this._currentProcessedTask !== null) {\r\n throw new Error(`FrameGraph.addTask: Can't add the task \"${task.name}\" while another task is currently building (task: ${this._currentProcessedTask.name}).`);\r\n }\r\n\r\n this._tasks.push(task);\r\n }\r\n\r\n /**\r\n * Adds a pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addPass(name: string, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> {\r\n return this._addPass(name, FrameGraphPassType.Normal, whenTaskDisabled) as FrameGraphPass<FrameGraphContext>;\r\n }\r\n\r\n /**\r\n * Adds a render pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addRenderPass(name: string, whenTaskDisabled = false): FrameGraphRenderPass {\r\n return this._addPass(name, FrameGraphPassType.Render, whenTaskDisabled) as FrameGraphRenderPass;\r\n }\r\n\r\n /**\r\n * Adds an object list pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The object list pass created\r\n */\r\n public addObjectListPass(name: string, whenTaskDisabled = false): FrameGraphObjectListPass {\r\n return this._addPass(name, FrameGraphPassType.ObjectList, whenTaskDisabled) as FrameGraphObjectListPass;\r\n }\r\n\r\n private _addPass(name: string, passType: FrameGraphPassType, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass {\r\n if (!this._currentProcessedTask) {\r\n throw new Error(\"FrameGraph: A pass must be created during a Task.record execution only.\");\r\n }\r\n\r\n let pass: FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass;\r\n\r\n switch (passType) {\r\n case FrameGraphPassType.Render:\r\n pass = new FrameGraphRenderPass(name, this._currentProcessedTask, this._renderContext, this._engine);\r\n break;\r\n case FrameGraphPassType.ObjectList:\r\n pass = new FrameGraphObjectListPass(name, this._currentProcessedTask, this._passContext, this._engine);\r\n break;\r\n default:\r\n pass = new FrameGraphPass(name, this._currentProcessedTask, this._passContext);\r\n break;\r\n }\r\n\r\n this._currentProcessedTask._addPass(pass, whenTaskDisabled);\r\n\r\n return pass;\r\n }\r\n\r\n /**\r\n * Builds the frame graph.\r\n * This method should be called after all tasks have been added to the frame graph (FrameGraph.addTask) and before the graph is executed (FrameGraph.execute).\r\n */\r\n public build(): void {\r\n this.textureManager._releaseTextures(false);\r\n\r\n try {\r\n for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n this.textureManager._isRecordingTask = true;\r\n\r\n task.record();\r\n\r\n this.textureManager._isRecordingTask = false;\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this.textureManager._allocateTextures(this.optimizeTextureAllocation ? this._tasks : undefined);\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n for (const task of this._tasks) {\r\n task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n } catch (e) {\r\n this._tasks.length = 0;\r\n this._currentProcessedTask = null;\r\n this.textureManager._isRecordingTask = false;\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n * Checks if the frame graph is ready to be executed.\r\n * Note that you can use the whenReadyAsync method to wait for the frame graph to be ready.\r\n * @returns True if the frame graph is ready to be executed, else false\r\n */\r\n public isReady(): boolean {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n ready &&= task.isReady();\r\n }\r\n return ready;\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the frame graph is ready to be executed\r\n * This method must be called after the graph has been built (FrameGraph.build called)!\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 5000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public async whenReadyAsync(timeStep = 16, maxTimeout = 5000): Promise<void> {\r\n let firstNotReadyTask: FrameGraphTask | null = null;\r\n return await new Promise((resolve, reject) => {\r\n this._whenReadyAsyncCancel = _RetryWithInterval(\r\n () => {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n const taskIsReady = task.isReady();\r\n if (!taskIsReady && !firstNotReadyTask) {\r\n firstNotReadyTask = task;\r\n }\r\n ready &&= taskIsReady;\r\n }\r\n return ready;\r\n },\r\n () => {\r\n this._whenReadyAsyncCancel = null;\r\n resolve();\r\n },\r\n (err, isTimeout) => {\r\n this._whenReadyAsyncCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"FrameGraph: An unexpected error occurred while waiting for the frame graph to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(\r\n `FrameGraph: Timeout while waiting for the frame graph to be ready.${firstNotReadyTask ? ` First task not ready: ${firstNotReadyTask.name}` : \"\"}`\r\n );\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n reject(new Error(err));\r\n },\r\n timeStep,\r\n maxTimeout\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Executes the frame graph.\r\n */\r\n public execute(): void {\r\n if (this.pausedExecution) {\r\n return;\r\n }\r\n\r\n this._renderContext.bindRenderTarget();\r\n\r\n this.textureManager._updateHistoryTextures();\r\n\r\n for (const task of this._tasks) {\r\n task._execute();\r\n }\r\n\r\n this._renderContext.bindRenderTarget(undefined, undefined, true); // restore default framebuffer\r\n }\r\n\r\n /**\r\n * Clears the frame graph (remove the tasks and release the textures).\r\n * The frame graph can be built again after this method is called.\r\n */\r\n public clear(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n }\r\n\r\n this._tasks.length = 0;\r\n this.textureManager._releaseTextures();\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n /**\r\n * Disposes the frame graph\r\n */\r\n public dispose(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n this.clear();\r\n this.textureManager._dispose();\r\n this._renderContext._dispose();\r\n\r\n this._scene.removeFrameGraph(this);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,kBAAkB,EAAE,+BAA8B;AAC3D,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,iBAAiB,EAAE,qCAAoC;AAEhE,qDAAoD;AACpD,4DAA2D;AAE3D,IAAK,kBAIJ;AAJD,WAAK,kBAAkB;IACnB,+DAAU,CA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I,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAE/B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene, AbstractEngine, FrameGraphTask, Nullable, NodeRenderGraph, IDisposable } from \"core/index\";\r\nimport { FrameGraphPass } from \"./Passes/pass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { FrameGraphObjectListPass } from \"./Passes/objectListPass\";\r\nimport { FrameGraphRenderContext } from \"./frameGraphRenderContext\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\nimport { FrameGraphTextureManager } from \"./frameGraphTextureManager\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { _RetryWithInterval } from \"core/Misc/timingTools\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { UniqueIdGenerator } from \"core/Misc/uniqueIdGenerator\";\r\n\r\nimport \"core/Engines/Extensions/engine.multiRender\";\r\nimport \"core/Engines/WebGPU/Extensions/engine.multiRender\";\r\n\r\nenum FrameGraphPassType {\r\n Normal = 0,\r\n Render = 1,\r\n ObjectList = 2,\r\n}\r\n\r\n/**\r\n * Class used to implement a frame graph\r\n * @experimental\r\n */\r\nexport class FrameGraph implements IDisposable {\r\n /**\r\n * Gets the texture manager used by the frame graph\r\n */\r\n public readonly textureManager: FrameGraphTextureManager;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _tasks: FrameGraphTask[] = [];\r\n private readonly _passContext: FrameGraphContext;\r\n private readonly _renderContext: FrameGraphRenderContext;\r\n private readonly _initAsyncPromises: Promise<void>[] = [];\r\n private _currentProcessedTask: FrameGraphTask | null = null;\r\n private _whenReadyAsyncCancel: Nullable<() => void> = null;\r\n\r\n /**\r\n * Name of the frame graph\r\n */\r\n public name = \"Frame Graph\";\r\n\r\n /**\r\n * Gets the unique id of the frame graph\r\n */\r\n public readonly uniqueId = UniqueIdGenerator.UniqueId;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)\r\n */\r\n public optimizeTextureAllocation = true;\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<FrameGraph>();\r\n\r\n /**\r\n * Gets the engine used by the frame graph\r\n */\r\n public get engine() {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the scene used by the frame graph\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the list of tasks in the frame graph\r\n */\r\n public get tasks() {\r\n return this._tasks;\r\n }\r\n\r\n /**\r\n * Indicates whether the execution of the frame graph is paused (default is false)\r\n */\r\n public pausedExecution = false;\r\n\r\n /**\r\n * Gets the node render graph linked to the frame graph (if any)\r\n * @returns the linked node render graph or null if none\r\n */\r\n public getLinkedNodeRenderGraph(): Nullable<NodeRenderGraph> {\r\n return this._linkedNodeRenderGraph;\r\n }\r\n\r\n /**\r\n * Constructs the frame graph\r\n * @param scene defines the scene the frame graph is associated with\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)\r\n * @param _linkedNodeRenderGraph defines the linked node render graph (if any)\r\n */\r\n constructor(\r\n scene: Scene,\r\n debugTextures = false,\r\n private readonly _linkedNodeRenderGraph: Nullable<NodeRenderGraph> = null\r\n ) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext(this._engine, this.textureManager, scene);\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);\r\n\r\n this._scene.addFrameGraph(this);\r\n }\r\n\r\n /**\r\n * Gets the class name of the frame graph\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FrameGraph\";\r\n }\r\n\r\n /**\r\n * Gets a task by name\r\n * @param name Name of the task to get\r\n * @returns The task or undefined if not found\r\n */\r\n public getTaskByName<T extends FrameGraphTask>(name: string): T | undefined {\r\n return this._tasks.find((t) => t.name === name) as T;\r\n }\r\n\r\n /**\r\n * Gets all tasks of a specific type\r\n * @param taskType Type of the task(s) to get\r\n * @returns The list of tasks of the specified type\r\n */\r\n public getTasksByType<T extends FrameGraphTask>(taskType: new (...args: any[]) => T): T[] {\r\n return this._tasks.filter((t) => t instanceof taskType) as T[];\r\n }\r\n\r\n /**\r\n * Adds a task to the frame graph\r\n * @param task Task to add\r\n */\r\n public addTask(task: FrameGraphTask): void {\r\n if (this._currentProcessedTask !== null) {\r\n throw new Error(`FrameGraph.addTask: Can't add the task \"${task.name}\" while another task is currently building (task: ${this._currentProcessedTask.name}).`);\r\n }\r\n\r\n this._tasks.push(task);\r\n this._initAsyncPromises.push(task.initAsync());\r\n }\r\n\r\n /**\r\n * Adds a pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addPass(name: string, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> {\r\n return this._addPass(name, FrameGraphPassType.Normal, whenTaskDisabled) as FrameGraphPass<FrameGraphContext>;\r\n }\r\n\r\n /**\r\n * Adds a render pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addRenderPass(name: string, whenTaskDisabled = false): FrameGraphRenderPass {\r\n return this._addPass(name, FrameGraphPassType.Render, whenTaskDisabled) as FrameGraphRenderPass;\r\n }\r\n\r\n /**\r\n * Adds an object list pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The object list pass created\r\n */\r\n public addObjectListPass(name: string, whenTaskDisabled = false): FrameGraphObjectListPass {\r\n return this._addPass(name, FrameGraphPassType.ObjectList, whenTaskDisabled) as FrameGraphObjectListPass;\r\n }\r\n\r\n private _addPass(name: string, passType: FrameGraphPassType, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass {\r\n if (!this._currentProcessedTask) {\r\n throw new Error(\"FrameGraph: A pass must be created during a Task.record execution only.\");\r\n }\r\n\r\n let pass: FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass;\r\n\r\n switch (passType) {\r\n case FrameGraphPassType.Render:\r\n pass = new FrameGraphRenderPass(name, this._currentProcessedTask, this._renderContext, this._engine);\r\n break;\r\n case FrameGraphPassType.ObjectList:\r\n pass = new FrameGraphObjectListPass(name, this._currentProcessedTask, this._passContext, this._engine);\r\n break;\r\n default:\r\n pass = new FrameGraphPass(name, this._currentProcessedTask, this._passContext);\r\n break;\r\n }\r\n\r\n this._currentProcessedTask._addPass(pass, whenTaskDisabled);\r\n\r\n return pass;\r\n }\r\n\r\n /** @internal */\r\n public async _whenAsynchronousInitializationDoneAsync(): Promise<void> {\r\n if (this._initAsyncPromises.length > 0) {\r\n await Promise.all(this._initAsyncPromises);\r\n this._initAsyncPromises.length = 0;\r\n }\r\n }\r\n\r\n /**\r\n * @deprecated Use buildAsync instead\r\n */\r\n public build(): void {\r\n void this.buildAsync(false);\r\n }\r\n\r\n private _built = false; // TODO: to be removed when build() is removed\r\n\r\n /**\r\n * Builds the frame graph.\r\n * This method should be called after all tasks have been added to the frame graph (FrameGraph.addTask) and before the graph is executed (FrameGraph.execute).\r\n * @param waitForReadiness If true, the method will wait for the frame graph to be ready before returning (default is true)\r\n */\r\n public async buildAsync(waitForReadiness = true): Promise<void> {\r\n this.textureManager._releaseTextures(false);\r\n\r\n this.pausedExecution = true;\r\n this._built = false;\r\n\r\n try {\r\n await this._whenAsynchronousInitializationDoneAsync();\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n this.textureManager._isRecordingTask = true;\r\n\r\n task.record();\r\n\r\n this.textureManager._isRecordingTask = false;\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this.textureManager._allocateTextures(this.optimizeTextureAllocation ? this._tasks : undefined);\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n for (const task of this._tasks) {\r\n task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);\r\n }\r\n\r\n this._built = true;\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n if (waitForReadiness) {\r\n await this.whenReadyAsync();\r\n }\r\n } catch (e) {\r\n this._tasks.length = 0;\r\n this._currentProcessedTask = null;\r\n this.textureManager._isRecordingTask = false;\r\n throw e;\r\n } finally {\r\n this.pausedExecution = false;\r\n this._built = true;\r\n }\r\n }\r\n\r\n /**\r\n * Checks if the frame graph is ready to be executed.\r\n * Note that you can use the whenReadyAsync method to wait for the frame graph to be ready.\r\n * @returns True if the frame graph is ready to be executed, else false\r\n */\r\n public isReady(): boolean {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n ready &&= task.isReady();\r\n }\r\n return ready;\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the frame graph is ready to be executed.\r\n * In general, calling “await buildAsync()” should suffice, as this function also waits for readiness by default.\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 10000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public async whenReadyAsync(timeStep = 16, maxTimeout = 10000): Promise<void> {\r\n let firstNotReadyTask: FrameGraphTask | null = null;\r\n\r\n // TODO: to be removed when build() is removed\r\n await new Promise((resolve) => {\r\n const checkBuilt = () => {\r\n if (this._built) {\r\n resolve(void 0);\r\n return;\r\n }\r\n setTimeout(checkBuilt, 16);\r\n };\r\n checkBuilt();\r\n });\r\n // END TODO\r\n\r\n return await new Promise((resolve, reject) => {\r\n this._whenReadyAsyncCancel = _RetryWithInterval(\r\n () => {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n const taskIsReady = task.isReady();\r\n if (!taskIsReady && !firstNotReadyTask) {\r\n firstNotReadyTask = task;\r\n }\r\n ready &&= taskIsReady;\r\n }\r\n return ready;\r\n },\r\n () => {\r\n this._whenReadyAsyncCancel = null;\r\n resolve();\r\n },\r\n (err, isTimeout) => {\r\n this._whenReadyAsyncCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"FrameGraph: An unexpected error occurred while waiting for the frame graph to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(\r\n `FrameGraph: Timeout while waiting for the frame graph to be ready.${firstNotReadyTask ? ` First task not ready: ${firstNotReadyTask.name}` : \"\"}`\r\n );\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n reject(new Error(err));\r\n },\r\n timeStep,\r\n maxTimeout\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Executes the frame graph.\r\n */\r\n public execute(): void {\r\n if (this.pausedExecution) {\r\n return;\r\n }\r\n\r\n this._renderContext.bindRenderTarget();\r\n\r\n this.textureManager._updateHistoryTextures();\r\n\r\n for (const task of this._tasks) {\r\n task._execute();\r\n }\r\n\r\n this._renderContext.bindRenderTarget(undefined, undefined, true); // restore default framebuffer\r\n }\r\n\r\n /**\r\n * Clears the frame graph (remove the tasks and release the textures).\r\n * The frame graph can be built again after this method is called.\r\n */\r\n public clear(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n }\r\n\r\n this._tasks.length = 0;\r\n this.textureManager._releaseTextures();\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n /**\r\n * Disposes the frame graph\r\n */\r\n public dispose(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n this.clear();\r\n this.textureManager._dispose();\r\n this._renderContext._dispose();\r\n\r\n this._scene.removeFrameGraph(this);\r\n }\r\n}\r\n"]}
@@ -13,4 +13,5 @@ export declare class FrameGraphRenderTarget {
13
13
  constructor(name: string, textureManager: FrameGraphTextureManager, renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[], renderTargetDepth?: FrameGraphTextureHandle);
14
14
  get renderTargetWrapper(): RenderTargetWrapper | undefined;
15
15
  equals(other: FrameGraphRenderTarget): boolean;
16
+ dispose(): void;
16
17
  }
@@ -63,5 +63,8 @@ export class FrameGraphRenderTarget {
63
63
  }
64
64
  return this._renderTargetDepth === other._renderTargetDepth;
65
65
  }
66
+ dispose() {
67
+ this._renderTargetWrapper?.dispose();
68
+ }
66
69
  }
67
70
  //# sourceMappingURL=frameGraphRenderTarget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphRenderTarget.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphRenderTarget.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAS/B,YACI,IAAY,EACZ,cAAwC,EACxC,aAAmE,EACnE,iBAA2C;QARrC,kBAAa,GAAG,KAAK,CAAC;QAU5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,cAAc,GAAG,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QAC/H,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;IAChD,CAAC;IAED,IAAW,mBAAmB;QAC1B,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,OAAO,SAAS,CAAC;QACrB,C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IAAI,CAAC,kBAAkB,KAAK,KAAK,CAAC,kBAAkB,CAAC;IAChE,CAAC;CACJ","sourcesContent":["import type { FrameGraphTextureHandle, FrameGraphTextureManager, IMultiRenderTargetOptions, RenderTargetWrapper } from \"core/index\";\r\n\r\n/**\r\n * @internal\r\n * @experimental\r\n */\r\nexport class FrameGraphRenderTarget {\r\n protected readonly _textureManager: FrameGraphTextureManager;\r\n protected readonly _renderTargets: FrameGraphTextureHandle[] | undefined;\r\n protected readonly _renderTargetDepth: FrameGraphTextureHandle | undefined;\r\n protected _renderTargetWrapper: RenderTargetWrapper | undefined;\r\n protected _isBackBuffer = false;\r\n\r\n public readonly name: string;\r\n\r\n constructor(\r\n name: string,\r\n textureManager: FrameGraphTextureManager,\r\n renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[],\r\n renderTargetDepth?: FrameGraphTextureHandle\r\n ) {\r\n this.name = name;\r\n this._textureManager = textureManager;\r\n this._renderTargets = renderTargets === undefined ? undefined : Array.isArray(renderTargets) ? renderTargets : [renderTargets];\r\n this._renderTargetDepth = renderTargetDepth;\r\n }\r\n\r\n public get renderTargetWrapper() {\r\n if (this._isBackBuffer) {\r\n return undefined;\r\n }\r\n\r\n if (!this._renderTargetWrapper) {\r\n const engine = this._textureManager.engine;\r\n\r\n // _renderTargets and _renderTargetDepth cannot both be undefined\r\n const textureHandle = this._renderTargets === undefined || this._renderTargets.length === 0 ? this._renderTargetDepth! : this._renderTargets[0];\r\n\r\n if (this._textureManager.isBackbuffer(textureHandle)) {\r\n this._isBackBuffer = true;\r\n return undefined;\r\n }\r\n\r\n const textureDescription = this._textureManager.getTextureDescription(textureHandle);\r\n\r\n const creationOptionsForTexture: IMultiRenderTargetOptions = {\r\n textureCount: this._renderTargets?.length ?? 0,\r\n generateDepthBuffer: false,\r\n label: this.name,\r\n samples: textureDescription.options.samples ?? 1,\r\n dontCreateTextures: true,\r\n };\r\n\r\n this._renderTargetWrapper = engine.createMultipleRenderTarget(textureDescription.size, creationOptionsForTexture, true);\r\n\r\n for (let i = 0; i < creationOptionsForTexture.textureCount!; i++) {\r\n const handle = this._renderTargets![i];\r\n const texture = this._textureManager.getTextureFromHandle(handle);\r\n\r\n if (!texture) {\r\n throw new Error(\r\n `FrameGraphRenderTarget.renderTargetWrapper: Failed to get texture from handle. handle: ${handle}, name: ${this.name}, index: ${i}, renderTargets: ${this._renderTargets}`\r\n );\r\n }\r\n\r\n this._renderTargetWrapper.setTexture(texture, i, false);\r\n }\r\n\r\n if (this._renderTargetDepth !== undefined) {\r\n this._renderTargetWrapper.setDepthStencilTexture(this._textureManager.getTextureFromHandle(this._renderTargetDepth), false);\r\n }\r\n }\r\n\r\n return this._renderTargetWrapper;\r\n }\r\n\r\n public equals(other: FrameGraphRenderTarget): boolean {\r\n const src = this._renderTargets;\r\n const dst = other._renderTargets;\r\n\r\n if (src !== undefined && dst !== undefined) {\r\n if (src.length !== dst.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < src.length; i++) {\r\n if (src[i] !== dst[i]) {\r\n return false;\r\n }\r\n }\r\n } else if ((src === undefined && dst !== undefined) || (src !== undefined && dst === undefined)) {\r\n return false;\r\n }\r\n\r\n return this._renderTargetDepth === other._renderTargetDepth;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphRenderTarget.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphRenderTarget.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAS/B,YACI,IAAY,EACZ,cAAwC,EACxC,aAAmE,EACnE,iBAA2C;QARrC,kBAAa,GAAG,KAAK,CAAC;QAU5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,cAAc,GAAG,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAA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B,CAAC;YACL,CAAC;QACL,CAAC;aAAM,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,CAAC,EAAE,CAAC;YAC9F,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC,kBAAkB,KAAK,KAAK,CAAC,kBAAkB,CAAC;IAChE,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { FrameGraphTextureHandle, FrameGraphTextureManager, IMultiRenderTargetOptions, RenderTargetWrapper } from \"core/index\";\r\n\r\n/**\r\n * @internal\r\n * @experimental\r\n */\r\nexport class FrameGraphRenderTarget {\r\n protected readonly _textureManager: FrameGraphTextureManager;\r\n protected readonly _renderTargets: FrameGraphTextureHandle[] | undefined;\r\n protected readonly _renderTargetDepth: FrameGraphTextureHandle | undefined;\r\n protected _renderTargetWrapper: RenderTargetWrapper | undefined;\r\n protected _isBackBuffer = false;\r\n\r\n public readonly name: string;\r\n\r\n constructor(\r\n name: string,\r\n textureManager: FrameGraphTextureManager,\r\n renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[],\r\n renderTargetDepth?: FrameGraphTextureHandle\r\n ) {\r\n this.name = name;\r\n this._textureManager = textureManager;\r\n this._renderTargets = renderTargets === undefined ? undefined : Array.isArray(renderTargets) ? renderTargets : [renderTargets];\r\n this._renderTargetDepth = renderTargetDepth;\r\n }\r\n\r\n public get renderTargetWrapper() {\r\n if (this._isBackBuffer) {\r\n return undefined;\r\n }\r\n\r\n if (!this._renderTargetWrapper) {\r\n const engine = this._textureManager.engine;\r\n\r\n // _renderTargets and _renderTargetDepth cannot both be undefined\r\n const textureHandle = this._renderTargets === undefined || this._renderTargets.length === 0 ? this._renderTargetDepth! : this._renderTargets[0];\r\n\r\n if (this._textureManager.isBackbuffer(textureHandle)) {\r\n this._isBackBuffer = true;\r\n return undefined;\r\n }\r\n\r\n const textureDescription = this._textureManager.getTextureDescription(textureHandle);\r\n\r\n const creationOptionsForTexture: IMultiRenderTargetOptions = {\r\n textureCount: this._renderTargets?.length ?? 0,\r\n generateDepthBuffer: false,\r\n label: this.name,\r\n samples: textureDescription.options.samples ?? 1,\r\n dontCreateTextures: true,\r\n };\r\n\r\n this._renderTargetWrapper = engine.createMultipleRenderTarget(textureDescription.size, creationOptionsForTexture, true);\r\n\r\n for (let i = 0; i < creationOptionsForTexture.textureCount!; i++) {\r\n const handle = this._renderTargets![i];\r\n const texture = this._textureManager.getTextureFromHandle(handle);\r\n\r\n if (!texture) {\r\n throw new Error(\r\n `FrameGraphRenderTarget.renderTargetWrapper: Failed to get texture from handle. handle: ${handle}, name: ${this.name}, index: ${i}, renderTargets: ${this._renderTargets}`\r\n );\r\n }\r\n\r\n this._renderTargetWrapper.setTexture(texture, i, false);\r\n }\r\n\r\n if (this._renderTargetDepth !== undefined) {\r\n this._renderTargetWrapper.setDepthStencilTexture(this._textureManager.getTextureFromHandle(this._renderTargetDepth), false);\r\n }\r\n }\r\n\r\n return this._renderTargetWrapper;\r\n }\r\n\r\n public equals(other: FrameGraphRenderTarget): boolean {\r\n const src = this._renderTargets;\r\n const dst = other._renderTargets;\r\n\r\n if (src !== undefined && dst !== undefined) {\r\n if (src.length !== dst.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < src.length; i++) {\r\n if (src[i] !== dst[i]) {\r\n return false;\r\n }\r\n }\r\n } else if ((src === undefined && dst !== undefined) || (src !== undefined && dst === undefined)) {\r\n return false;\r\n }\r\n\r\n return this._renderTargetDepth === other._renderTargetDepth;\r\n }\r\n\r\n public dispose() {\r\n this._renderTargetWrapper?.dispose();\r\n }\r\n}\r\n"]}
@@ -37,6 +37,12 @@ export declare abstract class FrameGraphTask {
37
37
  * @param skipCreationOfDisabledPasses If true, the disabled passe(s) won't be created.
38
38
  */
39
39
  abstract record(skipCreationOfDisabledPasses?: boolean): void;
40
+ /**
41
+ * This function is called once after the task has been added to the frame graph and before the frame graph is built for the first time.
42
+ * This allows you to initialize asynchronous resources, which is not possible in the constructor.
43
+ * @returns A promise that resolves when the initialization is complete.
44
+ */
45
+ initAsync(): Promise<void>;
40
46
  /**
41
47
  * An observable that is triggered after the textures have been allocated.
42
48
  */
@@ -36,6 +36,15 @@ export class FrameGraphTask {
36
36
  get passesDisabled() {
37
37
  return this._passesDisabled;
38
38
  }
39
+ /**
40
+ * This function is called once after the task has been added to the frame graph and before the frame graph is built for the first time.
41
+ * This allows you to initialize asynchronous resources, which is not possible in the constructor.
42
+ * @returns A promise that resolves when the initialization is complete.
43
+ */
44
+ // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax
45
+ initAsync() {
46
+ return Promise.resolve();
47
+ }
39
48
  /**
40
49
  * Checks if the task is ready to be executed.
41
50
  * @returns True if the task is ready to be executed, else false.
@@ -79,6 +88,12 @@ export class FrameGraphTask {
79
88
  }
80
89
  /** @internal */
81
90
  _reset() {
91
+ for (const pass of this._passes) {
92
+ pass._dispose();
93
+ }
94
+ for (const pass of this._passesDisabled) {
95
+ pass._dispose();
96
+ }
82
97
  this._passes.length = 0;
83
98
  this._passesDisabled.length = 0;
84
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphTask.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAElD;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAUhC;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAW,IAAI,CAAC,KAAa;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CA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OAAO,CAAC;QAEvG,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAE/C,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IAEO,sBAAsB,CAAC,GAA0C,EAAE,GAA0C;QACjH,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YAC/B,OAAO,GAAG,KAAK,GAAG,CAAC;QACvB,CAAC;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpB,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphObjectList, IFrameGraphPass, Nullable, FrameGraphTextureHandle, InternalTexture, FrameGraphRenderContext } from \"core/index\";\r\nimport { FrameGraphObjectListPass } from \"./Passes/objectListPass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\n/**\r\n * Represents a task in a frame graph.\r\n * @experimental\r\n */\r\nexport abstract class FrameGraphTask {\r\n protected readonly _frameGraph: FrameGraph;\r\n\r\n private readonly _passes: IFrameGraphPass[] = [];\r\n private readonly _passesDisabled: IFrameGraphPass[] = [];\r\n\r\n // Note: must be a getter/setter even if there's no specific processing, otherwise inherited classes can't make it a getter/setter!\r\n // Same thing for the disabled property\r\n protected _name: string;\r\n\r\n /**\r\n * The name of the task.\r\n */\r\n public get name() {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n protected _disabled = false;\r\n\r\n /**\r\n * Whether the task is disabled.\r\n */\r\n public get disabled() {\r\n return this._disabled;\r\n }\r\n\r\n public set disabled(value: boolean) {\r\n this._disabled = value;\r\n }\r\n\r\n /**\r\n * Gets the render passes of the task.\r\n */\r\n public get passes() {\r\n return this._passes;\r\n }\r\n\r\n /**\r\n * Gets the disabled render passes of the task.\r\n */\r\n public get passesDisabled() {\r\n return this._passesDisabled;\r\n }\r\n\r\n /**\r\n * The (texture) dependencies of the task (optional).\r\n */\r\n public dependencies?: Set<FrameGraphTextureHandle>;\r\n\r\n /**\r\n * Records the task in the frame graph. Use this function to add content (render passes, ...) to the task.\r\n * @param skipCreationOfDisabledPasses If true, the disabled passe(s) won't be created.\r\n */\r\n public abstract record(skipCreationOfDisabledPasses?: boolean): void;\r\n\r\n /**\r\n * An observable that is triggered after the textures have been allocated.\r\n */\r\n public onTexturesAllocatedObservable: Observable<FrameGraphRenderContext> = new Observable();\r\n\r\n /**\r\n * An observable that is triggered before the task is executed.\r\n */\r\n public onBeforeTaskExecute: Observable<FrameGraphTask> = new Observable();\r\n\r\n /**\r\n * An observable that is triggered after the task is executed.\r\n */\r\n public onAfterTaskExecute: Observable<FrameGraphTask> = new Observable();\r\n\r\n /**\r\n * Checks if the task is ready to be executed.\r\n * @returns True if the task is ready to be executed, else false.\r\n */\r\n public isReady(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Disposes of the task.\r\n */\r\n public dispose() {\r\n this._reset();\r\n this.onTexturesAllocatedObservable.clear();\r\n this.onBeforeTaskExecute.clear();\r\n this.onAfterTaskExecute.clear();\r\n }\r\n\r\n /**\r\n * Constructs a new frame graph task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n this.name = name;\r\n this._frameGraph = frameGraph;\r\n this._reset();\r\n }\r\n\r\n /** @internal */\r\n public _reset() {\r\n this._passes.length = 0;\r\n this._passesDisabled.length = 0;\r\n }\r\n\r\n /** @internal */\r\n public _addPass(pass: IFrameGraphPass, disabled: boolean) {\r\n if (disabled) {\r\n this._passesDisabled.push(pass);\r\n } else {\r\n this._passes.push(pass);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _checkTask() {\r\n let outputTexture: Nullable<Nullable<InternalTexture>[]> = null;\r\n let outputDepthTexture: Nullable<InternalTexture> = null;\r\n let outputObjectList: FrameGraphObjectList | undefined;\r\n\r\n for (const pass of this._passes) {\r\n const errMsg = pass._isValid();\r\n if (errMsg) {\r\n throw new Error(`Pass \"${pass.name}\" is not valid. ${errMsg}`);\r\n }\r\n if (FrameGraphRenderPass.IsRenderPass(pass)) {\r\n const handles = Array.isArray(pass.renderTarget) ? pass.renderTarget : [pass.renderTarget];\r\n outputTexture = [];\r\n for (const handle of handles) {\r\n if (handle !== undefined) {\r\n outputTexture.push(this._frameGraph.textureManager.getTextureFromHandle(handle));\r\n }\r\n }\r\n outputDepthTexture = pass.renderTargetDepth !== undefined ? this._frameGraph.textureManager.getTextureFromHandle(pass.renderTargetDepth) : null;\r\n } else if (FrameGraphObjectListPass.IsObjectListPass(pass)) {\r\n outputObjectList = pass.objectList;\r\n }\r\n }\r\n\r\n let disabledOutputTexture: Nullable<Nullable<InternalTexture>[]> = null;\r\n let disabledOutputTextureHandle: (FrameGraphTextureHandle | undefined)[] = [];\r\n let disabledOutputDepthTexture: Nullable<InternalTexture> = null;\r\n let disabledOutputObjectList: FrameGraphObjectList | undefined;\r\n\r\n for (const pass of this._passesDisabled) {\r\n const errMsg = pass._isValid();\r\n if (errMsg) {\r\n throw new Error(`Pass \"${pass.name}\" is not valid. ${errMsg}`);\r\n }\r\n if (FrameGraphRenderPass.IsRenderPass(pass)) {\r\n const handles = Array.isArray(pass.renderTarget) ? pass.renderTarget : [pass.renderTarget];\r\n disabledOutputTexture = [];\r\n for (const handle of handles) {\r\n if (handle !== undefined) {\r\n disabledOutputTexture.push(this._frameGraph.textureManager.getTextureFromHandle(handle));\r\n }\r\n }\r\n disabledOutputTextureHandle = handles;\r\n disabledOutputDepthTexture = pass.renderTargetDepth !== undefined ? this._frameGraph.textureManager.getTextureFromHandle(pass.renderTargetDepth) : null;\r\n } else if (FrameGraphObjectListPass.IsObjectListPass(pass)) {\r\n disabledOutputObjectList = pass.objectList;\r\n }\r\n }\r\n\r\n if (this._passesDisabled.length > 0) {\r\n if (!this._checkSameRenderTarget(outputTexture, disabledOutputTexture)) {\r\n let ok = true;\r\n for (const handle of disabledOutputTextureHandle) {\r\n if (handle !== undefined && !this._frameGraph.textureManager.isHistoryTexture(handle)) {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n if (!ok) {\r\n throw new Error(`The output texture of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n }\r\n if (outputDepthTexture !== disabledOutputDepthTexture) {\r\n throw new Error(`The output depth texture of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n if (outputObjectList !== disabledOutputObjectList) {\r\n throw new Error(`The output object list of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _execute() {\r\n const passes = this._disabled && this._passesDisabled.length > 0 ? this._passesDisabled : this._passes;\r\n\r\n this.onBeforeTaskExecute.notifyObservers(this);\r\n\r\n for (const pass of passes) {\r\n pass._execute();\r\n }\r\n\r\n this.onAfterTaskExecute.notifyObservers(this);\r\n }\r\n\r\n private _checkSameRenderTarget(src: Nullable<Nullable<InternalTexture>[]>, dst: Nullable<Nullable<InternalTexture>[]>) {\r\n if (src === null || dst === null) {\r\n return src === dst;\r\n }\r\n\r\n if (src.length !== dst.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < src.length; i++) {\r\n if (src[i] !== dst[i]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphTask.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAElD;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAUhC;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAW,IAAI,CAAC,KAAa;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAID;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAaD;;;;OAIG;IACH,2FAA2F;IACpF,SAAS;QACZ,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAiBD;;;OAGG;IACI,OAAO;QACV,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,6BAA6B,CAAC,KAAK,EAAE,CAAC;QAC3C,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,YAAY,IAAY,EAAE,UAAsB;QAxG/B,YAAO,GAAs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,CAAC;YAC5B,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpB,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphObjectList, IFrameGraphPass, Nullable, FrameGraphTextureHandle, InternalTexture, FrameGraphRenderContext } from \"core/index\";\r\nimport { FrameGraphObjectListPass } from \"./Passes/objectListPass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\n/**\r\n * Represents a task in a frame graph.\r\n * @experimental\r\n */\r\nexport abstract class FrameGraphTask {\r\n protected readonly _frameGraph: FrameGraph;\r\n\r\n private readonly _passes: IFrameGraphPass[] = [];\r\n private readonly _passesDisabled: IFrameGraphPass[] = [];\r\n\r\n // Note: must be a getter/setter even if there's no specific processing, otherwise inherited classes can't make it a getter/setter!\r\n // Same thing for the disabled property\r\n protected _name: string;\r\n\r\n /**\r\n * The name of the task.\r\n */\r\n public get name() {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n protected _disabled = false;\r\n\r\n /**\r\n * Whether the task is disabled.\r\n */\r\n public get disabled() {\r\n return this._disabled;\r\n }\r\n\r\n public set disabled(value: boolean) {\r\n this._disabled = value;\r\n }\r\n\r\n /**\r\n * Gets the render passes of the task.\r\n */\r\n public get passes() {\r\n return this._passes;\r\n }\r\n\r\n /**\r\n * Gets the disabled render passes of the task.\r\n */\r\n public get passesDisabled() {\r\n return this._passesDisabled;\r\n }\r\n\r\n /**\r\n * The (texture) dependencies of the task (optional).\r\n */\r\n public dependencies?: Set<FrameGraphTextureHandle>;\r\n\r\n /**\r\n * Records the task in the frame graph. Use this function to add content (render passes, ...) to the task.\r\n * @param skipCreationOfDisabledPasses If true, the disabled passe(s) won't be created.\r\n */\r\n public abstract record(skipCreationOfDisabledPasses?: boolean): void;\r\n\r\n /**\r\n * This function is called once after the task has been added to the frame graph and before the frame graph is built for the first time.\r\n * This allows you to initialize asynchronous resources, which is not possible in the constructor.\r\n * @returns A promise that resolves when the initialization is complete.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public initAsync(): Promise<void> {\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * An observable that is triggered after the textures have been allocated.\r\n */\r\n public onTexturesAllocatedObservable: Observable<FrameGraphRenderContext> = new Observable();\r\n\r\n /**\r\n * An observable that is triggered before the task is executed.\r\n */\r\n public onBeforeTaskExecute: Observable<FrameGraphTask> = new Observable();\r\n\r\n /**\r\n * An observable that is triggered after the task is executed.\r\n */\r\n public onAfterTaskExecute: Observable<FrameGraphTask> = new Observable();\r\n\r\n /**\r\n * Checks if the task is ready to be executed.\r\n * @returns True if the task is ready to be executed, else false.\r\n */\r\n public isReady(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Disposes of the task.\r\n */\r\n public dispose() {\r\n this._reset();\r\n this.onTexturesAllocatedObservable.clear();\r\n this.onBeforeTaskExecute.clear();\r\n this.onAfterTaskExecute.clear();\r\n }\r\n\r\n /**\r\n * Constructs a new frame graph task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n this.name = name;\r\n this._frameGraph = frameGraph;\r\n this._reset();\r\n }\r\n\r\n /** @internal */\r\n public _reset() {\r\n for (const pass of this._passes) {\r\n pass._dispose();\r\n }\r\n for (const pass of this._passesDisabled) {\r\n pass._dispose();\r\n }\r\n this._passes.length = 0;\r\n this._passesDisabled.length = 0;\r\n }\r\n\r\n /** @internal */\r\n public _addPass(pass: IFrameGraphPass, disabled: boolean) {\r\n if (disabled) {\r\n this._passesDisabled.push(pass);\r\n } else {\r\n this._passes.push(pass);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _checkTask() {\r\n let outputTexture: Nullable<Nullable<InternalTexture>[]> = null;\r\n let outputDepthTexture: Nullable<InternalTexture> = null;\r\n let outputObjectList: FrameGraphObjectList | undefined;\r\n\r\n for (const pass of this._passes) {\r\n const errMsg = pass._isValid();\r\n if (errMsg) {\r\n throw new Error(`Pass \"${pass.name}\" is not valid. ${errMsg}`);\r\n }\r\n if (FrameGraphRenderPass.IsRenderPass(pass)) {\r\n const handles = Array.isArray(pass.renderTarget) ? pass.renderTarget : [pass.renderTarget];\r\n outputTexture = [];\r\n for (const handle of handles) {\r\n if (handle !== undefined) {\r\n outputTexture.push(this._frameGraph.textureManager.getTextureFromHandle(handle));\r\n }\r\n }\r\n outputDepthTexture = pass.renderTargetDepth !== undefined ? this._frameGraph.textureManager.getTextureFromHandle(pass.renderTargetDepth) : null;\r\n } else if (FrameGraphObjectListPass.IsObjectListPass(pass)) {\r\n outputObjectList = pass.objectList;\r\n }\r\n }\r\n\r\n let disabledOutputTexture: Nullable<Nullable<InternalTexture>[]> = null;\r\n let disabledOutputTextureHandle: (FrameGraphTextureHandle | undefined)[] = [];\r\n let disabledOutputDepthTexture: Nullable<InternalTexture> = null;\r\n let disabledOutputObjectList: FrameGraphObjectList | undefined;\r\n\r\n for (const pass of this._passesDisabled) {\r\n const errMsg = pass._isValid();\r\n if (errMsg) {\r\n throw new Error(`Pass \"${pass.name}\" is not valid. ${errMsg}`);\r\n }\r\n if (FrameGraphRenderPass.IsRenderPass(pass)) {\r\n const handles = Array.isArray(pass.renderTarget) ? pass.renderTarget : [pass.renderTarget];\r\n disabledOutputTexture = [];\r\n for (const handle of handles) {\r\n if (handle !== undefined) {\r\n disabledOutputTexture.push(this._frameGraph.textureManager.getTextureFromHandle(handle));\r\n }\r\n }\r\n disabledOutputTextureHandle = handles;\r\n disabledOutputDepthTexture = pass.renderTargetDepth !== undefined ? this._frameGraph.textureManager.getTextureFromHandle(pass.renderTargetDepth) : null;\r\n } else if (FrameGraphObjectListPass.IsObjectListPass(pass)) {\r\n disabledOutputObjectList = pass.objectList;\r\n }\r\n }\r\n\r\n if (this._passesDisabled.length > 0) {\r\n if (!this._checkSameRenderTarget(outputTexture, disabledOutputTexture)) {\r\n let ok = true;\r\n for (const handle of disabledOutputTextureHandle) {\r\n if (handle !== undefined && !this._frameGraph.textureManager.isHistoryTexture(handle)) {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n if (!ok) {\r\n throw new Error(`The output texture of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n }\r\n if (outputDepthTexture !== disabledOutputDepthTexture) {\r\n throw new Error(`The output depth texture of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n if (outputObjectList !== disabledOutputObjectList) {\r\n throw new Error(`The output object list of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _execute() {\r\n const passes = this._disabled && this._passesDisabled.length > 0 ? this._passesDisabled : this._passes;\r\n\r\n this.onBeforeTaskExecute.notifyObservers(this);\r\n\r\n for (const pass of passes) {\r\n pass._execute();\r\n }\r\n\r\n this.onAfterTaskExecute.notifyObservers(this);\r\n }\r\n\r\n private _checkSameRenderTarget(src: Nullable<Nullable<InternalTexture>[]>, dst: Nullable<Nullable<InternalTexture>[]>) {\r\n if (src === null || dst === null) {\r\n return src === dst;\r\n }\r\n\r\n if (src.length !== dst.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < src.length; i++) {\r\n if (src[i] !== dst[i]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n"]}
@@ -77,4 +77,6 @@ export interface IFrameGraphPass {
77
77
  _execute(): void;
78
78
  /** @internal */
79
79
  _isValid(): Nullable<string>;
80
+ /** @internal */
81
+ _dispose(): void;
80
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTypes.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,4BAA4B,GAA4B,CAAC,CAAC;AAEvE;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mCAAmC,GAA4B,CAAC,CAAC","sourcesContent":["import type { Nullable, TextureSize, FrameGraphContext } from \"core/index\";\r\n\r\n/**\r\n * Represents a texture handle in the frame graph.\r\n */\r\nexport type FrameGraphTextureHandle = number;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer color texture.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const backbufferColorTextureHandle: FrameGraphTextureHandle = 0;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer depth/stencil texture.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const backbufferDepthStencilTextureHandle: FrameGraphTextureHandle = 1;\r\n\r\n/**\r\n * Options used to describe a texture to be created in the frame graph.\r\n */\r\nexport type FrameGraphTextureOptions = {\r\n /** Specifies if mipmaps must be created for the textures (default: false) */\r\n createMipMaps?: boolean;\r\n\r\n /** Defines sample count (default: 1) */\r\n samples?: number;\r\n\r\n /** Defines the types of the textures */\r\n types?: number[];\r\n\r\n /** Defines the format of the textures (RED, RG, RGB, RGBA, ALPHA...) */\r\n formats?: number[];\r\n\r\n /** Defines if sRGB format should be used for each of texture */\r\n useSRGBBuffers?: boolean[];\r\n\r\n /** Defines the creation flags of the textures (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg) */\r\n creationFlags?: number[];\r\n\r\n /** Defines the names of the textures (used for debugging purpose) */\r\n labels?: string[];\r\n};\r\n\r\n/**\r\n * Options used to create a texture / list of textures in the frame graph.\r\n */\r\nexport type FrameGraphTextureCreationOptions = {\r\n /** Size of the textures. If sizeIsPercentage is true, these are percentages relative to the screen size (100 = 100%) */\r\n size: TextureSize;\r\n\r\n /** Options used to create the textures */\r\n options: FrameGraphTextureOptions;\r\n\r\n /** If true, indicates that \"size\" is percentages relative to the screen size */\r\n sizeIsPercentage: boolean;\r\n\r\n /** Indicates that the texture is a history texture (default: false) */\r\n isHistoryTexture?: boolean;\r\n};\r\n\r\n/**\r\n * Represents a texture description in the frame graph.\r\n * This is basically the same thing than FrameGraphTextureCreationOptions, but the size is never in percentage and always in pixels.\r\n */\r\nexport type FrameGraphTextureDescription = {\r\n /** Size of the texture */\r\n size: { width: number; height: number };\r\n\r\n /** Options used to create the texture */\r\n options: FrameGraphTextureOptions;\r\n};\r\n\r\n/**\r\n * Defines a pass in the frame graph.\r\n */\r\nexport interface IFrameGraphPass {\r\n /**\r\n * The name of the pass.\r\n */\r\n name: string;\r\n\r\n /**\r\n * Whether the pass is disabled.\r\n */\r\n disabled: boolean;\r\n\r\n /**\r\n * Sets the function to execute when the pass is executed\r\n * @param func The function to execute when the pass is executed\r\n */\r\n setExecuteFunc(func: (context: FrameGraphContext) => void): void;\r\n\r\n /** @internal */\r\n _execute(): void;\r\n\r\n /** @internal */\r\n _isValid(): Nullable<string>;\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTypes.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,4BAA4B,GAA4B,CAAC,CAAC;AAEvE;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mCAAmC,GAA4B,CAAC,CAAC","sourcesContent":["import type { Nullable, TextureSize, FrameGraphContext } from \"core/index\";\r\n\r\n/**\r\n * Represents a texture handle in the frame graph.\r\n */\r\nexport type FrameGraphTextureHandle = number;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer color texture.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const backbufferColorTextureHandle: FrameGraphTextureHandle = 0;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer depth/stencil texture.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const backbufferDepthStencilTextureHandle: FrameGraphTextureHandle = 1;\r\n\r\n/**\r\n * Options used to describe a texture to be created in the frame graph.\r\n */\r\nexport type FrameGraphTextureOptions = {\r\n /** Specifies if mipmaps must be created for the textures (default: false) */\r\n createMipMaps?: boolean;\r\n\r\n /** Defines sample count (default: 1) */\r\n samples?: number;\r\n\r\n /** Defines the types of the textures */\r\n types?: number[];\r\n\r\n /** Defines the format of the textures (RED, RG, RGB, RGBA, ALPHA...) */\r\n formats?: number[];\r\n\r\n /** Defines if sRGB format should be used for each of texture */\r\n useSRGBBuffers?: boolean[];\r\n\r\n /** Defines the creation flags of the textures (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg) */\r\n creationFlags?: number[];\r\n\r\n /** Defines the names of the textures (used for debugging purpose) */\r\n labels?: string[];\r\n};\r\n\r\n/**\r\n * Options used to create a texture / list of textures in the frame graph.\r\n */\r\nexport type FrameGraphTextureCreationOptions = {\r\n /** Size of the textures. If sizeIsPercentage is true, these are percentages relative to the screen size (100 = 100%) */\r\n size: TextureSize;\r\n\r\n /** Options used to create the textures */\r\n options: FrameGraphTextureOptions;\r\n\r\n /** If true, indicates that \"size\" is percentages relative to the screen size */\r\n sizeIsPercentage: boolean;\r\n\r\n /** Indicates that the texture is a history texture (default: false) */\r\n isHistoryTexture?: boolean;\r\n};\r\n\r\n/**\r\n * Represents a texture description in the frame graph.\r\n * This is basically the same thing than FrameGraphTextureCreationOptions, but the size is never in percentage and always in pixels.\r\n */\r\nexport type FrameGraphTextureDescription = {\r\n /** Size of the texture */\r\n size: { width: number; height: number };\r\n\r\n /** Options used to create the texture */\r\n options: FrameGraphTextureOptions;\r\n};\r\n\r\n/**\r\n * Defines a pass in the frame graph.\r\n */\r\nexport interface IFrameGraphPass {\r\n /**\r\n * The name of the pass.\r\n */\r\n name: string;\r\n\r\n /**\r\n * Whether the pass is disabled.\r\n */\r\n disabled: boolean;\r\n\r\n /**\r\n * Sets the function to execute when the pass is executed\r\n * @param func The function to execute when the pass is executed\r\n */\r\n setExecuteFunc(func: (context: FrameGraphContext) => void): void;\r\n\r\n /** @internal */\r\n _execute(): void;\r\n\r\n /** @internal */\r\n _isValid(): Nullable<string>;\r\n\r\n /** @internal */\r\n _dispose(): void;\r\n}\r\n"]}
@@ -1813,6 +1813,9 @@ export class NodeMaterial extends NodeMaterialBase {
1813
1813
  }
1814
1814
  this.editorData.map = blockMap;
1815
1815
  }
1816
+ if (source.forceAlphaBlending) {
1817
+ this.forceAlphaBlending = true;
1818
+ }
1816
1819
  Material.ParseAlphaMode(source, this);
1817
1820
  if (!merge) {
1818
1821
  this._mode = source.mode ?? NodeMaterialModes.Material;