Update samples to process events.

This CL updates the `dawn/sample` programs to call the
`dawn::native::InstanceProcessEvents` which allows things like shader
validation errors to be emitted.

Without this change the errors are never displayed.

Change-Id: I054bb4f7177c5d0c110e97409852143b2bef1e02
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2023-04-12 13:19:35 +00:00 committed by Dawn LUCI CQ
parent b04e622eea
commit 0b3fc055d3
7 changed files with 10 additions and 0 deletions

View File

@ -186,6 +186,7 @@ int main(int argc, const char* argv[]) {
timer->Start();
while (!ShouldQuit()) {
utils::ScopedAutoreleasePool pool;
ProcessEvents();
frameCount++;
frame();
if (frameCount % 60 == 0) {

View File

@ -143,6 +143,7 @@ int main(int argc, const char* argv[]) {
while (!ShouldQuit()) {
utils::ScopedAutoreleasePool pool;
ProcessEvents();
frame();
utils::USleep(16000);
}

View File

@ -323,6 +323,7 @@ int main(int argc, const char* argv[]) {
while (!ShouldQuit()) {
utils::ScopedAutoreleasePool pool;
ProcessEvents();
frame();
utils::USleep(16000);
}

View File

@ -176,6 +176,7 @@ int main(int argc, const char* argv[]) {
while (!ShouldQuit()) {
utils::ScopedAutoreleasePool pool;
ProcessEvents();
frame();
utils::USleep(16000);
}

View File

@ -339,6 +339,7 @@ int main(int argc, const char* argv[]) {
while (windows.size() != 0) {
utils::ScopedAutoreleasePool pool;
glfwPollEvents();
wgpuInstanceProcessEvents(instance->Get());
for (auto it = windows.begin(); it != windows.end();) {
GLFWwindow* window = it->first;

View File

@ -391,3 +391,7 @@ bool ShouldQuit() {
GLFWwindow* GetGLFWWindow() {
return window;
}
void ProcessEvents() {
dawn::native::InstanceProcessEvents(instance->Get());
}

View File

@ -28,5 +28,6 @@ wgpu::Device CreateCppDawnDevice();
wgpu::TextureFormat GetPreferredSwapChainTextureFormat();
wgpu::SwapChain GetSwapChain();
wgpu::TextureView CreateDefaultDepthStencilView(const wgpu::Device& device);
void ProcessEvents();
#endif // SRC_DAWN_SAMPLES_SAMPLEUTILS_H_