ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
offscreen_gl.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
7// Can this machine create an offscreen OpenGL context? (#313)
8//
9// VTK's headless path ends in vtkEGLRenderWindow, and on a machine where EGL
10// has nothing to render on — a GitHub-hosted CI runner, a nix build sandbox —
11// that render window crashes on its first Render() instead of reporting the
12// failure. Everything downstream of it (the SupportsOpenGL() guard in
13// render_view(), the "blank frame" check, the caller's try/catch) is therefore
14// unreachable, and STANDARDS §5 is served by a segfault.
15//
16// This header answers the question *before* any VTK object is touched, and it
17// answers it by asking EGL rather than by looking at the filesystem. That
18// distinction is the whole point: the obvious probe — "is there a
19// /dev/dri/renderD* node?" — reports failure on two configurations that render
20// perfectly well.
21//
22// - A software rasteriser (Mesa llvmpipe) has no DRM node at all. It still
23// exposes an EGL device, and EGL still initialises on it.
24// - A remote or containerised GPU can be reachable through a vendor EGL
25// driver with no local render node bind-mounted.
26//
27// Asking EGL to enumerate its devices and initialise one covers both, and
28// fails only when there is genuinely nothing to render on.
29
30#include <string>
31
33
48
58
87
95bool display_configured() noexcept;
96
97} // namespace reusex::visualize
OffscreenGlProbe probe_offscreen_gl() noexcept
Ask EGL whether an offscreen context is possible here.
bool display_configured() noexcept
True when a window-system display is configured (DISPLAY or WAYLAND_DISPLAY).
OffscreenGlStatus
What the probe could establish about offscreen OpenGL on this machine.
@ unusable
EGL is present and was asked, and reports nothing it can render on.
@ usable
EGL enumerated a device and initialised a display on it.
@ unknown
The probe could not reach a verdict — libEGL is absent, its entry points are missing,...
The outcome of one probe, with enough detail to put in an error message.
int devices
EGL devices enumerated, or -1 when enumeration was not available.
std::string detail
Human-readable explanation, always non-empty: which device initialised, or which step failed and with...