// SpeedBreaker tests. GPL-3.0-or-later (see COPYING). // // video::SwapchainUse (runtime/video/swapchain_use.h): the present waiter's // thread uses a swapchain (its present waits, the driver's reports) only // while it is the current one, and the main thread never destroys one under // such a use. v0.1.4 and v0.1.5 read the driver's reports // (vkGetPastPresentationTimingGOOGLE) after the wait's lock, so a fullscreen // toggle on a 120 Hz Mac could destroy the swapchain under the read: an abort, // "mutex lock failed". Fake swapchains carry a lifetime canary: a use that // reaches a destroyed one, or another one than its present's, is counted. // The optional argument is runtime/video/presenter.cpp: every waiter call that // takes a swapchain must be inside a use, and the swapchain retired before it // is destroyed (checked, then planted mutations of it that must fail). // // Build by hand: c++ -std=c++20 -O2 -I runtime tests/swapchain_use_test.cpp -o build/swapchain_use_test #include