Core-profile OpenGL context with compatibility-era GLSL shaders: which mixes are actually portable?
0 reputation · 29 Apr 2020, 06:58 UTC
Our rendering layer loads shaders authored at different times, some declaring #version 330 core and others written against older GLSL that relies on legacy built-ins and compatibility-profile state. We now create the context explicitly with a version and profile mask, but we are unsure how strict we must be at the boundary between the context profile and the shader #version directives.
The constraints: we must run on at least one Mesa stack, one proprietary Windows/Linux driver, and possibly macOS, where modern OpenGL is effectively core-profile only and deprecated. We also know context creation may silently return a different version or profile than requested, and that extension availability must be queried per context rather than assumed from the advertised OpenGL version.
Assume OpenGL 3.3+ as the baseline; exact driver versions are still being verified.
Specifically:
- If we request a core-profile context, is a shader declaring an older non-core
#versionguaranteed to fail compilation, or is acceptance driver-dependent? - Which profile-dependent defaults (default VAO, fixed-function state, sRGB framebuffer behavior) are most likely to break when the same draw path runs under both profiles?
- Is checking the returned profile mask and forward-compatible flag after creation sufficient to decide which shader set to load, or do we need per-driver validation tests?