A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(native): a WebGPU error reaches the log instead of vanishing
esengine35f06b891ebe
diff --git a/native/host/Host.cpp b/native/host/Host.cppindex c76910c4c..a72aa9e1d 100644--- a/native/host/Host.cpp+++ b/native/host/Host.cpp@@ -96,6 +96,14 @@ bool createDevice(HostState& h) {WGPUDeviceDescriptor dd = {};dd.requiredFeatureCount = compCount;dd.requiredFeatures = compCount ? compFeats : nullptr;+ // Without this, a validation failure is silent: WebGPU does not throw, the+ // offending call is dropped, and all that reaches anyone is a black frame.+ dd.uncapturedErrorCallbackInfo.callback =+ [](WGPUDevice const*, WGPUErrorType, WGPUStringView message, void*, void*) {+ ESHOST_LOGE("WebGPU: %.*s", (int)(message.length == WGPU_STRLEN+ ? strlen(message.data) : message.length),+ message.data ? message.data : "");+ };WGPURequestDeviceCallbackInfo dci = {};dci.mode = WGPUCallbackMode_WaitAnyOnly; dci.callback = onDevice; dci.userdata1 = &h.device;WGPUFutureWaitInfo df = {wgpuAdapterRequestDevice(h.adapter, &dd, dci), 0};