Prechádzať zdrojové kódy

WebGPUPipelineUtils: reset shared render-pipeline descriptor before suspending in the async path (#33794)

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
Harshal Sheth 6 dní pred
rodič
commit
b6e7df7ee1

+ 18 - 3
src/renderers/webgpu/utils/WebGPUPipelineUtils.js

@@ -314,10 +314,11 @@ class WebGPUPipelineUtils {
 				try {
 
 					let asyncError = null;
+					let pipelinePromise = null;
 
 					try {
 
-						pipelineData.pipeline = await device.createRenderPipelineAsync( _renderPipelineDescriptor );
+						pipelinePromise = device.createRenderPipelineAsync( _renderPipelineDescriptor );
 
 					} catch ( err ) {
 
@@ -325,6 +326,22 @@ class WebGPUPipelineUtils {
 
 					}
 
+					_renderPipelineDescriptor.reset();
+
+					if ( pipelinePromise !== null ) {
+
+						try {
+
+							pipelineData.pipeline = await pipelinePromise;
+
+						} catch ( err ) {
+
+							asyncError = err;
+
+						}
+
+					}
+
 					const errorScope = await device.popErrorScope();
 
 					if ( errorScope !== null || asyncError !== null ) {
@@ -340,8 +357,6 @@ class WebGPUPipelineUtils {
 
 				} finally {
 
-					_renderPipelineDescriptor.reset();
-
 					// Guarantee resolution so `compileAsync`'s Promise.all cannot hang on an
 					// unexpected throw from any await above.
 					resolve();

粤ICP备19079148号