ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
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
32
namespace
reusex::visualize
{
33
35
enum class
OffscreenGlStatus
{
38
usable
,
41
unusable
,
46
unknown
,
47
};
48
50
struct
OffscreenGlProbe
{
51
OffscreenGlStatus
status
=
OffscreenGlStatus::unknown
;
54
std::string
detail
;
56
int
devices
= -1;
57
};
58
86
OffscreenGlProbe
probe_offscreen_gl
() noexcept;
87
95
bool
display_configured
() noexcept;
96
97
}
// namespace reusex::visualize
reusex::visualize
Definition
offscreen_gl.hpp:32
reusex::visualize::probe_offscreen_gl
OffscreenGlProbe probe_offscreen_gl() noexcept
Ask EGL whether an offscreen context is possible here.
reusex::visualize::display_configured
bool display_configured() noexcept
True when a window-system display is configured (DISPLAY or WAYLAND_DISPLAY).
reusex::visualize::OffscreenGlStatus
OffscreenGlStatus
What the probe could establish about offscreen OpenGL on this machine.
Definition
offscreen_gl.hpp:35
reusex::visualize::OffscreenGlStatus::unusable
@ unusable
EGL is present and was asked, and reports nothing it can render on.
Definition
offscreen_gl.hpp:41
reusex::visualize::OffscreenGlStatus::usable
@ usable
EGL enumerated a device and initialised a display on it.
Definition
offscreen_gl.hpp:38
reusex::visualize::OffscreenGlStatus::unknown
@ unknown
The probe could not reach a verdict — libEGL is absent, its entry points are missing,...
Definition
offscreen_gl.hpp:46
reusex::visualize::OffscreenGlProbe
The outcome of one probe, with enough detail to put in an error message.
Definition
offscreen_gl.hpp:50
reusex::visualize::OffscreenGlProbe::status
OffscreenGlStatus status
Definition
offscreen_gl.hpp:51
reusex::visualize::OffscreenGlProbe::devices
int devices
EGL devices enumerated, or -1 when enumeration was not available.
Definition
offscreen_gl.hpp:56
reusex::visualize::OffscreenGlProbe::detail
std::string detail
Human-readable explanation, always non-empty: which device initialised, or which step failed and with...
Definition
offscreen_gl.hpp:54
libs
reusex
include
visualize
offscreen_gl.hpp
Generated by
1.17.0