easy-gl › Capabilities

Capabilities

Populated automatically by Device::initialize(). Provides read-only access to the GL context information, supported features and implementation limits.

Accessing capabilities

const auto& caps = device.capabilities();
const auto& info = caps.context_info();

std::cout << "Vendor:   "   << info.vendor             << '\n';
std::cout << "Renderer: "   << info.renderer           << '\n';
std::cout << "Version:  "   << info.version_string     << '\n';
std::cout << "GLSL:     "   << info.shading_language_version << '\n';
std::cout << "API kind: "   << (caps.is_opengl() ? "OpenGL" : "OpenGL ES") << '\n';
std::cout << "GL >= 4.1: " << caps.is_at_least(4, 1) << '\n';

Feature checks

if (caps.supports(easygl::Feature::ComputeShader)) { ... }
if (caps.supports(easygl::Feature::AnisotropicFiltering)) { ... }

Extension check

if (caps.supports_extension("GL_ARB_bindless_texture")) {
    // use bindless textures
}

Implementation limits

int maxTexUnits  = caps.get_limit("MAX_COMBINED_TEXTURE_IMAGE_UNITS");
int maxUboSize   = caps.get_limit("MAX_UNIFORM_BLOCK_SIZE");
int maxComputeX  = caps.get_limit("MAX_COMPUTE_WORK_GROUP_SIZE_X");

Feature enum reference

FeatureMinimum GLDescription
VertexArrayObject3.0VAO support
Shader2.0Programmable shaders
Program2.0Linked shader programs
Buffer1.5VBOs
BasicRendering1.0Draw calls, clear
DebugOutput4.3 / KHR_debugGL debug callback
ComputeShader4.3Compute shaders
GeometryShader3.2Geometry shaders
TessellationShader4.0Tessellation stages
Texture3D1.23D texture targets
TextureFloat3.0 / ARB_texture_floatFloat internal formats
TextureRG3.0 / ARB_texture_rgRed/RG-only formats
SamplerObject3.3Sampler objects
Instancing3.1Instanced draw calls
UniformBufferObject3.1UBOs
FramebufferObject3.0FBOs
Multisampling3.2MSAA
DrawBuffers2.0MRT
MapBuffer1.5Buffer mapping
DirectStateAccess4.5DSA calls
TextureCompression1.3Compressed texture formats
AnisotropicFilteringEXT_texture_filter_anisotropicAnisotropic filtering

Method reference

MethodDescription
context_info()Returns ContextInfo struct.
supports(Feature)True if the feature is available.
supports_extension(name)True if the named extension is present.
get_limit(name)Return a named implementation limit as int.
is_opengl()True if desktop OpenGL context.
is_opengles()True if OpenGL ES context.
is_at_least(major, minor)True if context version ≥ major.minor.