Closed 1danielcoelho closed 11 months ago
Ah, I've been looking into this and apparently we need to call wgpuDeviceTick
: https://github.com/webgpu-native/webgpu-headers/issues/117
I've tested on my own code and it does work: I get the error callback as soon as Tick is called. It doesn't seem to block any GPU work on either webgpu-native or Dawn, so I guess it should be safe to use, at least for development/debug modes?
Yes wgpuDeviceTick
is needed to flush callbacks in Dawn. Problem is that this is not standard, and wgpu-native has its own wgpuPoll
to do something similar.
This issue is being discussed here because it would be better to have callbacks be called immediately when debugging. This is how we got the DAWN_DEBUG_BREAK_ON_ERROR
although imperfect. Did you make sure you set it to =1
and that you run your program with a debugger (IDE or gdb, in a Debug build)?
Hello!
I'm playing around with basic C++ native WebGPU apps using Dawn (and Vulkan backend) following your guide, and I've set the error callbacks like this:
With a callback that looks like this:
So basically exactly like it says here: https://eliemichel.github.io/LearnWebGPU/getting-started/the-device.html
From the text, I get the impression that these callbacks should fire as soon as there's any form of error, and I should be able to see them on the console while my app runs.
Unfortunately only when I close the app that it seems that these error messages are flushed and
on_device_error
called, which makes it very annoying. I'd like to see the errors streaming on the console while they happen and my app continues to run.This happens even if I launch with a debugger and put a breakpoint within
on_device_error
, so it is likely something related to Dawn itself because other regularstd::cout
calls work fine and output as my app runs.I've tried setting the
DAWN_DEBUG_BREAK_ON_ERROR
environment variable, but it doesn't seem to have any effect (and I can't even find that env var mentioned on Dawn source?)I've had a look at the callstack when
on_device_error
is called (after my app exits) and it looks like this:But I'm not sure if this is meant to be right or not.
Any ideas? It is supposed to be calling
on_device_error
in real time, right?Another thing that could be related: On the following step the guide has us setup the
wgpuQueueOnSubmittedWorkDone
callback. I get an analogous issue there: I got the feeling I was supposed to be seeing the WorkDone callback called every frame or something like that, but I also only get its callback called exactly once, when the app finishes. And it's always called with the "DeviceLost"WGPUQueueWorkDoneStatus
(because I closed the app, I imagine). That is pretty useless overall, so I wonder if I'm doing something wrong?Thanks!