From 3ef2bead1449bdb763100d8cd2f8a8a936dbddfa Mon Sep 17 00:00:00 2001 From: bluseliu50 <265648257+bluseliu50@users.noreply.github.com> Date: Wed, 28 Oct 2026 20:13:16 +0800 Subject: [PATCH] feat(metal): show the head and tail of a client failure The board row holds 63 characters: drop the common prefix and keep what was refused and why. Shader priming does not report problems. --- NativeAdrenoMetalPlugin.mm | 9 ++++++++- PrimeShaders.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NativeAdrenoMetalPlugin.mm b/NativeAdrenoMetalPlugin.mm index 2bf0222..6c74534 100644 --- a/NativeAdrenoMetalPlugin.mm +++ b/NativeAdrenoMetalPlugin.mm @@ -150,8 +150,15 @@ static void reportDisplayState(Gpu &gpu) { static unsigned gClientPort; static void clientFailure(unsigned port, const char *step, const char *detail) { if (Gpu *gpu = makeGpu(port)) { + // The row holds 63 characters: the common prefix goes, and a long reason keeps its start (what was refused) and its end (why). + if (!detail) detail = ""; + if (!strncmp(detail, "native-metal: ", 14)) detail += 14; + char shown[48]; + const size_t length = strlen(detail); + if (length <= 46) strlcpy(shown, detail, sizeof shown); + else snprintf(shown, sizeof shown, "%.18s~%s", detail, detail + length - 27); char text[64]; - snprintf(text, sizeof text, "%.14s %.46s", step, detail ? detail : ""); + snprintf(text, sizeof text, "%.14s %s", step, shown); streamText(*gpu, text); } } diff --git a/PrimeShaders.h b/PrimeShaders.h index b8d453e..530e0ed 100644 --- a/PrimeShaders.h +++ b/PrimeShaders.h @@ -36,6 +36,7 @@ extern "C" unsigned native_bridge_metal_recent_commits(uint64_t windowUs); // saw in 250 ms. extern "C" {volatile uint32_t native_prime_compiling, native_prime_libraries_done, native_prime_libraries_total, native_prime_made, native_prime_rate;} +extern "C" void native_bridge_metal_quiet_problems(bool); namespace prime { static const char *const kRoots[] = {"/System/Library", "/Applications", "/System/Cryptexes/OS/System/Library"}; @@ -291,6 +292,7 @@ static std::string library(id device, const std::string &path, const // The thread: waits for the desktop to settle, then works through the libraries not finished yet. static void run(id device, std::string root, unsigned delaySeconds, const std::string &listPath) { pthread_set_qos_class_self_np(QOS_CLASS_BACKGROUND, 0); + native_bridge_metal_quiet_problems(true); while (root.size() > 1 && root.back() == '/') root.pop_back(); const std::string donePath = root + "/prime-done", badPath = root + "/prime-bad", current = root + "/prime-current", logPath = root + "/prime.log";