win32: the window is kept across a video driver restart by default

2cb7874f7 left the window up across a restart only when
RETROARCH_WINDOW_KEEP=1 asked for it, because it had been run under
Wine with GDI and nowhere with Vulkan.

It has now been run on Windows 11 with Vulkan on an NVIDIA card,
threaded video, HDR and a hardware-rendered core: loading content
left the window up, the driver that came next took it, made its
surface and swapchain on it and presented; the swapchain was rebuilt
on it four times after that - fullscreen toggles, by the look of the
log - and the quit went as it does. The input driver, kept across the
same restart, was started once in the session.

So it is the default. RETROARCH_WINDOW_KEEP=0 destroys the window
with the driver as before; =2 still leaves it up without taking it,
for the tests.

It is still the Vulkan and GDI families only. Direct3D and OpenGL
windows are destroyed and made again as before, which is why the
foreground workaround of cd6b6b5ad stays: it is theirs now.

Not run on Windows: closing content with the window kept, Vulkan with
threaded video off, and cards other than NVIDIA's.

samples/input/windows_wine_smoke: every scenario now expects the
window left up and taken back at both restarts; one more turns it off
and expects neither. All seven pass with retroarch.exe built from
this.
This commit is contained in:
LibretroAdmin authored and libretroadmin committed 2026-10-03 10:27:39 +02:00
1 parent dbcc033ca6
commit 184d80a48c
3 files changed
+22 -21

No files matched your search

+3 -3
View File
@@ -15,9 +15,9 @@ name: CI Windows raw input under Wine
# (the default); restarted with the video driver
# (RETROARCH_INPUT_KEEP=0); threaded video off; the raw driver as it
# was before any of this (RETROARCH_RAWINPUT_POLL=0); and DirectInput.
# Three more are about the window: left up across both restarts and
# taken back, with threaded video and without
# (RETROARCH_WINDOW_KEEP=1), and left up and then not taken (=2).
# In all of those the window is left up across both restarts and
# taken back; two more destroy it with the driver as before
# (RETROARCH_WINDOW_KEEP=0) and leave it up without taking it (=2).
# See samples/input/windows_wine_smoke/run.sh.
#
# Wine is not Windows: what this holds is that the frontend, the pump,
+8 -9
View File
@@ -1685,9 +1685,8 @@ void win32_window_proc_setup(enum win32_window_family family)
*
* For the Vulkan and the GDI families, for now - the ones whose
* window sets up nothing a second driver of the same family cannot
* set up again on the same window - and only with
* RETROARCH_WINDOW_KEEP=1 in the environment until it has been run on
* Windows. Never when the program is shutting down. */
* set up again on the same window. Never when the program is shutting
* down. RETROARCH_WINDOW_KEEP=0 in the environment turns it off. */
static bool win32_window_family_keeps(void)
{
return win32_wnd_family == WIN32_WINDOW_VULKAN
@@ -1706,16 +1705,16 @@ static void win32_window_destroy_kept(HWND hwnd)
win32_retiring_hwnd = NULL;
}
/* RETROARCH_WINDOW_KEEP: 1 leaves the window up and takes it back; 2
* leaves it up and then does not take it, so that the way out for a
* window nothing takes can be run (the tests do); anything else, or
* nothing, destroys it with the driver as before. */
/* 1, the default: the window is left up and taken back. With
* RETROARCH_WINDOW_KEEP=0 it is destroyed with the driver, as it used
* to be; with =2 it is left up and then not taken, so that the way
* out for a window nothing takes can be run (the tests do). */
static int win32_window_keep_mode(void)
{
const char *env = getenv("RETROARCH_WINDOW_KEEP");
if (env && (env[0] == '1' || env[0] == '2'))
if (env && (env[0] == '0' || env[0] == '2'))
return env[0] - '0';
return 0;
return 1;
}
/* the hook of video_thread_host_hold(): the video thread is ending
+11 -9
View File
@@ -43,11 +43,14 @@
# can get, with its joypad driver:
# started by the same code, restarted
# with the video driver, works.
# RETROARCH_WINDOW_KEEP=1 the window is left up across both
# restarts and taken back by the driver
# that comes next, with threaded video
# (where the video thread is held for
# it) and without.
#
# And the window. In every scenario above it is left up across both
# restarts and taken back by the driver that comes next - with
# threaded video, where the video thread is held for it, and without.
# Two more:
#
# RETROARCH_WINDOW_KEEP=0 the window is destroyed with the driver
# and a new one made, as it used to be.
# RETROARCH_WINDOW_KEEP=2 the window is left up and then not
# taken: it is destroyed, a new one is
# made, and RetroArch does not take the
@@ -199,7 +202,7 @@ scenario() {
# the old path measures the wait the new one removes; the new
# one has nothing to measure
win="$(count "$log" 'window is left up') $(count "$log" 'Took the window left up') $(count "$log" 'not one this driver takes')"
[ "$win" = "${WANT_WINDOW:-0 0 0}" ] || ok=no
[ "$win" = "${WANT_WINDOW:-2 2 0}" ] || ok=no
stale=$(count "$log" "Taken by the window's thread: at the poll")
if [ "$name" = "RETROARCH_RAWINPUT_POLL=0" ]; then
[ "$stale" = 3 ] || ok=no
@@ -218,7 +221,7 @@ scenario() {
"video driver started $video (want 3), input driver by the poll $bulk (want $want_bulk)," \
"joypad driver started $joy (want $want_joy);" \
"lines on how old the state was at the poll: $stale;" \
"window left up, taken, not taken: $win (want ${WANT_WINDOW:-0 0 0});" \
"window left up, taken, not taken: $win (want ${WANT_WINDOW:-2 2 0});" \
"the core saw B pressed $b_down and released $b_up (want 2 and 2), J: ${j_seq:-nothing}(want down up down up)" \
"$([ "$nomsg" = nomsg ] && echo ", driver instances with reports taken as messages: $msg (want 0)")"
sed 's/\x1b\[[0-9;]*m//g' "$log" | tr -d '\r' | grep -av "ALSA lib\|Playlist\]" | tail -25
@@ -231,8 +234,7 @@ RETROARCH_INPUT_KEEP=0 scenario "RETROARCH_INPUT_KEEP=0" true 3 3 nomsg
scenario "video not threaded" false 1 1 any
RETROARCH_RAWINPUT_POLL=0 scenario "RETROARCH_RAWINPUT_POLL=0" true 0 3 any
scenario "DirectInput" true 0 3 any dinput dinput
WANT_WINDOW="2 2 0" RETROARCH_WINDOW_KEEP=1 scenario "window kept" true 1 1 nomsg
WANT_WINDOW="2 2 0" RETROARCH_WINDOW_KEEP=1 scenario "window kept, video not threaded" false 1 1 any
WANT_WINDOW="0 0 0" RETROARCH_WINDOW_KEEP=0 scenario "RETROARCH_WINDOW_KEEP=0" true 1 1 nomsg
WANT_WINDOW="2 0 2" RETROARCH_WINDOW_KEEP=2 scenario "window left up and not taken" true 1 1 nomsg
if [ "$failures" != 0 ]; then