rhi: gl: Introduce a fourth code path to query the max vertex outputs

Three is not enough, need four. This is because in core profile contexts
querying GL_MAX_VARYING_COMPONENTS may apparently be an error (this is
enforced in macOS with 4.1 core contexts for example), so we need to
use something else: GL_MAX_VERTEX_OUTPUT_COMPONENTS.

Change-Id: I005c30e5798b0bf8bb7666bd732aaf996d123db9
Pick-to: 6.5 6.2
Fixes: QTBUG-112985
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Laszlo Agocs 2023-04-20 10:54:57 +02:00
parent bbadd4205d
commit fdb287e620
1 changed files with 5 additions and 1 deletions

View File

@ -454,6 +454,10 @@ QT_BEGIN_NAMESPACE
#define GL_HALF_FLOAT 0x140B
#endif
#ifndef GL_MAX_VERTEX_OUTPUT_COMPONENTS
#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
#endif
/*!
Constructs a new QRhiGles2InitParams.
@ -939,7 +943,7 @@ bool QRhiGles2::create(QRhi::Flags flags)
f->glGetIntegerv(GL_MAX_VARYING_VECTORS, &caps.maxVertexOutputs);
} else if (caps.ctxMajor >= 3) {
GLint components = 0;
f->glGetIntegerv(GL_MAX_VARYING_COMPONENTS, &components);
f->glGetIntegerv(caps.coreProfile ? GL_MAX_VERTEX_OUTPUT_COMPONENTS : GL_MAX_VARYING_COMPONENTS, &components);
caps.maxVertexOutputs = components / 4;
} else {
// OpenGL before 3.0 only has this, and not the same as