From fb57fd8509dcf1a5acbaa4cf3c6ac8a02547cd34 Mon Sep 17 00:00:00 2001 From: Samson <16504129+sagudev@users.noreply.github.com> Date: Thu, 18 Jul 2024 08:08:15 +0200 Subject: [PATCH] Catch and fail GPUPipelineError (#3866) Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Co-authored-by: Brandon Jones --- src/webgpu/shader/execution/expression/expression.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/webgpu/shader/execution/expression/expression.ts b/src/webgpu/shader/execution/expression/expression.ts index f486723baf56..e50767601750 100644 --- a/src/webgpu/shader/execution/expression/expression.ts +++ b/src/webgpu/shader/execution/expression/expression.ts @@ -430,7 +430,17 @@ export async function run( } batchesInFlight += 1; - pendingBatches.push(processBatch(batchCases).finally(batchFinishedCallback)); + pendingBatches.push( + processBatch(batchCases) + .catch(err => { + if (err instanceof GPUPipelineError) { + t.fail(`Pipeline Creation Error, ${err.reason}: ${err.message}`); + } else { + throw err; + } + }) + .finally(batchFinishedCallback) + ); } await Promise.all(pendingBatches);