From fdb287e6207476773fa242c5b7a465ab3903356d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 20 Apr 2023 10:54:57 +0200 Subject: [PATCH] rhi: gl: Introduce a fourth code path to query the max vertex outputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gui/rhi/qrhigles2.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 4620dbd2ca..666395437a 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -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