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; GLint next = 64;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
QOpenGLFunctions_1_0 *gl1funcs = nullptr; QOpenGLExtraFunctions *extraFuncs = q->extraFunctions();
QOpenGLFunctions_3_2_Core *gl3funcs = nullptr; extraFuncs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
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);
if (size == 0) { if (size == 0) {
return max_texture_size; return max_texture_size;
@ -397,11 +385,7 @@ int QOpenGLContextPrivate::maxTextureSize()
if (next > max_texture_size) if (next > max_texture_size)
break; break;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
if (gl1funcs) extraFuncs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
else
gl3funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
} while (next > size); } while (next > size);
max_texture_size = size; max_texture_size = size;