Scaffold experimental wgpu viewer backend

Adds src/ifcviewer-wgpu/ and src/ifcviewer-wgpu-minimal/ behind a new
BUILD_BONSAIVIEWER_WGPU option (default OFF), gated independently of
BUILD_BONSAIVIEWER. Stage 1 brings up a Qt window with a wgpu-native
v29 surface (X11) and clears to the background colour — no rendering
beyond that yet. Mirrors the lifecycle of the GL ViewportWindow so
subsequent stages (vertex-pulling renderer, pick, cull, HiZ, overlay)
slot in without restructuring the host.

wgpu-native is fetched as a pre-built binary release via FetchContent;
its .so SONAME is patched in at configure time so dependents get a
clean DT_NEEDED. The X11 native handle is obtained via the public
QNativeInterface::QX11Application API; Wayland and macOS/Windows
surface creation are stubbed with explicit "not wired yet" warnings.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-27 12:23:23 +10:00
parent dd902bf0f8
commit 19a39a0413
6 changed files with 702 additions and 0 deletions
+11
View File
@@ -73,6 +73,7 @@ option(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." OFF)
option(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer" OFF) # QtViewer requires Qt6
option(BUILD_BONSAIVIEWER "Build Bonsai Viewer" OFF) # Requires Qt6 + OpenGL 4.5
option(BUILD_BONSAIVIEWER_TESTS "Build unit tests for Bonsai Viewer core (fetches Catch2 v3)" OFF)
option(BUILD_BONSAIVIEWER_WGPU "Build the experimental wgpu backend (fetches wgpu-native binary release)" OFF)
option(BUILD_PACKAGE "" OFF)
option(
@@ -690,6 +691,16 @@ if(BUILD_BONSAIVIEWER)
add_subdirectory(../src/bonsaiviewer bonsaiviewer)
endif()
# The wgpu backend is gated independently of BUILD_BONSAIVIEWER: it shares
# Qt but does not depend on the GL viewer's static lib, so a developer can
# build it on its own to iterate on the port without compiling IfcGeom etc.
# However most stages of the port will reference Federation/SceneLoader
# headers from src/ifcviewer, so in practice it ships alongside.
if(BUILD_BONSAIVIEWER_WGPU)
add_subdirectory(../src/ifcviewer-wgpu ifcviewer-wgpu)
add_subdirectory(../src/ifcviewer-wgpu-minimal ifcviewer-wgpu-minimal)
endif()
# Cmake uninstall target
if(NOT TARGET uninstall)
configure_file(