Просмотр исходного кода

TSL: Fix `debug()` changes the compiled code (#30944)

* fix `build()` return value

* add `webgpu_postprocessing_fxaa` unknown problem

* update description
sunag 1 год назад
Родитель
Сommit
bc7aedd026
3 измененных файлов с 10 добавлено и 5 удалено
  1. 8 4
      src/nodes/core/Node.js
  2. 1 1
      src/nodes/gpgpu/ComputeNode.js
  3. 1 0
      test/e2e/puppeteer.js

+ 8 - 4
src/nodes/core/Node.js

@@ -586,12 +586,14 @@ class Node extends EventDispatcher {
 	}
 
 	/**
-	 * This method performs the build of a node. The behavior of this method as well as its return value depend
-	 * on the current build stage (setup, analyze or generate).
+	 * This method performs the build of a node. The behavior and return value depend on the current build stage:
+	 * - **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant.
+	 * - **analyze**: Analyzes the node hierarchy for optimizations in the code generation stage. Returns `null`.
+	 * - **generate**: Generates the shader code for the node. Returns the generated shader string.
 	 *
 	 * @param {NodeBuilder} builder - The current node builder.
-	 * @param {?string} output - Can be used to define the output type.
-	 * @return {?string} When this method is executed in the setup or analyze stage, `null` is returned. In the generate stage, the generated shader string.
+	 * @param {?string} [output=null] - Can be used to define the output type.
+	 * @return {Node|string|null} The result of the build process, depending on the build stage.
 	 */
 	build( builder, output = null ) {
 
@@ -657,6 +659,8 @@ class Node extends EventDispatcher {
 
 			}
 
+			result = properties.outputNode || null;
+
 		} else if ( buildStage === 'analyze' ) {
 
 			this.analyze( builder );

+ 1 - 1
src/nodes/gpgpu/ComputeNode.js

@@ -165,7 +165,7 @@ class ComputeNode extends Node {
 
 	setup( builder ) {
 
-		const result = this.computeNode.setup( builder );
+		const result = this.computeNode.build( builder );
 
 		if ( result ) {
 

+ 1 - 0
test/e2e/puppeteer.js

@@ -168,6 +168,7 @@ const exceptionList = [
 	'webgpu_materials_envmaps_bpcem',
 	'webgpu_postprocessing_sobel',
 	'webgpu_postprocessing_3dlut',
+	'webgpu_postprocessing_fxaa',
 	'webgpu_postprocessing_afterimage',
 	'webgpu_xr_native_layers',
 

粤ICP备19079148号