From b70d610bae692a872e0d449aef00496e68a3c22c Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 3 Jan 2023 21:45:05 +0000 Subject: [PATCH] dawn/native: Hook tint ICE up to Dawn assertions Scream and shout if we ICE in a debug build. Fixed: tint:597 Change-Id: Ie349d314a2ddf518f54df81469e4e14aa16cacda Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114540 Kokoro: Kokoro Reviewed-by: Corentin Wallez Commit-Queue: Ben Clayton --- src/dawn/native/TintUtils.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dawn/native/TintUtils.cpp b/src/dawn/native/TintUtils.cpp index 74f377e31b..f2e08a66a4 100644 --- a/src/dawn/native/TintUtils.cpp +++ b/src/dawn/native/TintUtils.cpp @@ -31,6 +31,15 @@ thread_local DeviceBase* tlDevice = nullptr; void TintICEReporter(const tint::diag::List& diagnostics) { if (tlDevice) { tlDevice->HandleError(InternalErrorType::Internal, diagnostics.str().c_str()); +#if DAWN_ENABLE_ASSERTS + for (const tint::diag::Diagnostic& diag : diagnostics) { + if (diag.severity >= tint::diag::Severity::InternalCompilerError) { + HandleAssertionFailure( + diag.source.file ? diag.source.file->path.c_str() : "", "", + diag.source.range.begin.line, diag.message.c_str()); + } + } +#endif } }