From 1bd60749d140d14d152b59eccbda4790c517c54e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 28 Jan 2020 12:34:18 +0100 Subject: [PATCH] QOpenGLContext: use extraFunctions instead of versioned functions Task-number: QTBUG-74409 Change-Id: I548cd4b683cbf67c9716d424b48fdc8b3f6a8c09 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qopenglcontext.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index fbaff74561..6915433aed 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -372,20 +372,8 @@ int QOpenGLContextPrivate::maxTextureSize() GLint next = 64; funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - QOpenGLFunctions_1_0 *gl1funcs = nullptr; - QOpenGLFunctions_3_2_Core *gl3funcs = nullptr; - - if (q->format().profile() == QSurfaceFormat::CoreProfile) - gl3funcs = q->versionFunctions(); - else - gl1funcs = q->versionFunctions(); - - Q_ASSERT(gl1funcs || gl3funcs); - - if (gl1funcs) - gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); - else - gl3funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); + QOpenGLExtraFunctions *extraFuncs = q->extraFunctions(); + extraFuncs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); if (size == 0) { return max_texture_size; @@ -397,11 +385,7 @@ int QOpenGLContextPrivate::maxTextureSize() if (next > max_texture_size) break; funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - if (gl1funcs) - gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); - else - gl3funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); - + extraFuncs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); } while (next > size); max_texture_size = size;