Files
parallel-gx2/tools/check_no_wsi.sh
T
libretroadmin c81b43ba0c Vulkan through the frontend alone: no surfaces, swapchain or instance setup
Under libretro the Vulkan instance, device, surface and swapchain are the
frontend's: the core is handed a device and queue (the shared-device
constructor) and draws into the image the frontend gives it. Everything
the standalone emulator used to make its own was still compiled in and
never ran: the default constructor with its instance creation and device
selection, GetDevices, the X11, XCB, Wayland, Win32 and Metal surface
creation (CocoaSurface.mm), SwapchainInfoVk, swapchain acquire, recreate
and present, the swapchain blit pipeline and descriptor layout, and the
Breath of the Wild workaround that forked a child process to probe
RADV before creating an instance. All of it is removed (SwapchainInfoVk
and CocoaSurface are listed in .upstream-excluded).

What touched the swapchain on the way keeps its libretro behaviour:
BeginFrame reports no frame, ClearColorbuffer and ImguiInit do nothing,
ImguiBegin returns false after the base class's setup, IsPadWindowActive
follows the DRC layout, and a screenshot is always a single one.

With no VK_USE_PLATFORM_* defined, vulkan.h includes no window-system
header, and Common/platform.h no longer includes Xlib, Xrender or Xutil:
the Linux build needs no headers beyond the compiler's, so the CI jobs
and the README install none. tools/check_no_wsi.sh, run in both CIs,
fails on an X11, XCB, Wayland, GL or EGL include, a VK_USE_PLATFORM_*
define or a platform surface or context entry point in the core.
2026-11-07 12:58:23 +01:00

26 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# Fails if the core's own sources or build files bring in a window system: an
# X11, XCB, Wayland, GL or EGL header, a VK_USE_PLATFORM_* define (which makes
# vulkan.h pull those headers in), or a platform surface entry point. The GL
# context and the Vulkan surface and swapchain are the frontend's under
# libretro; a core that includes these needs headers to build that nothing
# else needs, and has code that can never run.
cd "$(dirname "$0")/.." || exit 2
pattern='#[[:space:]]*include[[:space:]]*[<"](X11/|xcb/|wayland-|GL/|EGL/|GLES[0-9]*/|KHR/)|VK_USE_PLATFORM_|vkCreate(Xlib|Xcb|Wayland|Win32|Android|Metal|MacOS)Surface|(wgl|glX|egl)(CreateContext|MakeCurrent|SwapBuffers|GetProcAddress)'
found=$(grep -rnE "$pattern" src Makefile Makefile.common \
--include='*.c' --include='*.cpp' --include='*.h' --include='*.hpp' --include='*.mm' \
--include='Makefile' --include='Makefile.common' 2>/dev/null \
| grep -v -e '^src/Cafe/HW/Latte/Renderer/Metal/' \
-e '^src/imgui/imgui_impl_opengl3.cpp:' \
-e '^[^:]*:[0-9]*:[[:space:]]*\(\*\|//\|# \)')
# Metal: Apple's renderer, which has no window-system headers of its own to
# leave out. imgui's GL backend: its loader includes are alternatives behind
# IMGUI_IMPL_OPENGL_LOADER_*, and the core selects the custom one (GLInclude).
# Comment lines are not code.
if [ -n "$found" ]; then
echo "window-system code or headers in the core (the frontend owns these):"
printf '%s\n' "$found"
exit 1
fi
echo "no window-system headers, defines or surface entry points"