diff options
| author | Tony Barbour <tony@LunarG.com> | 2016-09-12 14:02:43 -0600 |
|---|---|---|
| committer | Tony Barbour <tony@LunarG.com> | 2016-09-13 10:34:41 -0600 |
| commit | 602ca4f897121d79efb320201a52c2b194de0fa5 (patch) | |
| tree | 50c2439b286418395ee426f4012c34e9cd981c46 | |
| parent | d75effecdfce7deda2829ba474383e31dd2d1afd (diff) | |
| download | usermoji-602ca4f897121d79efb320201a52c2b194de0fa5.tar.xz | |
demos: Fix issue of making Vulkan calls from callback
Change-Id: I6fcb41cbcd13e8ce5ace6f857d7dd54bad48aa55
| -rw-r--r-- | demos/cube.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/demos/cube.c b/demos/cube.c index 6017444f..161771ee 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -66,6 +66,7 @@ #endif #ifdef _WIN32 +bool in_callback = false; #define ERR_EXIT(err_msg, err_class) \ do { \ if (!demo->suppress_popups) \ @@ -434,9 +435,11 @@ dbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, } #ifdef _WIN32 + in_callback = true; struct demo *demo = (struct demo*) pUserData; if (!demo->suppress_popups) MessageBox(NULL, message, "Alert", MB_OK); + in_callback = false; #else printf("%s\n", message); fflush(stdout); @@ -1993,7 +1996,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { PostQuitMessage(validation_error); break; case WM_PAINT: - demo_run(&demo); + // The validation callback calls MessageBox which can generate paint + // events - don't make more Vulkan calls if we got here from the + // callback + if (!in_callback) { + demo_run(&demo); + } break; case WM_GETMINMAXINFO: // set window's minimum size ((MINMAXINFO*)lParam)->ptMinTrackSize = demo.minsize; |
