Files
plotter/include/plot/gl/caps.hpp
T

31 lines
1.2 KiB
C++

#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