QOpenGLContext: use extraFunctions instead of versioned functions

Task-number: QTBUG-74409
Change-Id: I548cd4b683cbf67c9716d424b48fdc8b3f6a8c09
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2020-01-28 12:34:18 +01:00
parent ef442327b8
commit 1bd60749d1

View File

@ -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<QOpenGLFunctions_3_2_Core>();
else
gl1funcs = q->versionFunctions<QOpenGLFunctions_1_0>();
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;