feat(gl): dependency-free GL loader, RAII handles, caps probe, headless EGL harness

This commit is contained in:
Martino Ferrari committed 2026-09-27 21:07:36 +02:00
1 parent ed71719df7
commit 258caa38a7
11 files changed
+1458 -1

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
#pragma once
#include <plot/gl/api.hpp>
namespace plot::gl {
/// What the current context can do. Only OpenGL 3.3 core is required; every
/// field above that baseline is false when the driver does not offer it.
struct Caps {
int major = 0;
int minor = 0;
/// GL_VERSION / GL_RENDERER / GL_VENDOR strings. They are owned by the
/// context: valid until it is destroyed, and empty ("") when nothing has
/// been probed yet.
const char* renderer = "";
const char* vendor = "";
bool compute = false; ///< GL 4.3+ (compute shaders)
bool buffer_storage = false; ///< GL 4.4+ or ARB_buffer_storage
bool persistent_map = false; ///< GL 4.4+ or ARB_buffer_storage
bool core_profile = false; ///< GL_CONTEXT_CORE_PROFILE_BIT
};
/// Capabilities of the context that is current on the calling thread, probed
/// once on the first successful query and cached afterwards. Safe to call
/// before load(): with no usable context (or no resolved entry points) every
/// field stays zero. `load()` invalidates the cache. The cache is
/// process-global and unsynchronised: probe from the thread that owns the
/// current context.
const Caps& caps() noexcept;
} // namespace plot::gl