fix(gl): gate fallible constructors on a complete loader table

- loader: add available(), true only after load() has resolved every
  required entry point (false at the start of load()). Program::from_source
  and the other fallible constructors return ErrorCode::Unsupported while it
  is false, so a failed load() with a partially populated table can no longer
  fault on an unresolved entry point.
- caps: GL_CONTEXT_PROFILE_MASK only exists from 3.2, so query it only on
  3.2+ contexts. A 3.0/3.1 query latches GL_INVALID_ENUM in the context, which
  the next unrelated glGetError() (e.g. read_pixel) then reports as failure.
- tests: gate the dlsym/libGL.so.1 fallback assertions on libGL being
  resolvable, so the GL suite also passes on a GLES-only host.
This commit is contained in:
Martino Ferrari committed 2026-09-27 21:15:57 +02:00
1 parent 258caa38a7
commit 6866457155
4 files changed
+59 -12

No files matched your search

+7
View File
@@ -25,4 +25,11 @@ using ProcLoader = void* (*)(const char*);
/// context.
bool load(ProcLoader loader = nullptr) noexcept;
/// True once a `load()` has resolved every required entry point of the global
/// table. This is the gate superseding per-pointer null checks: while it is
/// false the table may be only partially populated (see load()), so no `gl*`
/// entry point may be called. The fallible handle constructors report
/// `ErrorCode::Unsupported` until it becomes true.
bool available() noexcept;
} // namespace plot::gl