Remove internal public function from QOpenGLFunctions

QOpenGLContext uses glGetTexLevelParameteriv on desktop OpenGL and so it
got recently added to QOpenGLFunctions as part of the dynamic GL loading
support.

This is unnecessary since such desktop-only code can use the versioned
wrappers (QOpenGLFunction_1_0 for example). In related upcoming changes
in 5.4 the function is removed. This change has to be backported to 5.3
to prevent introducing this public API unnecessarily.

Change-Id: I6fc331091e4e6416e430bf985afcc17a392fc2e3
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This commit is contained in:
Laszlo Agocs 2014-04-10 11:49:48 +02:00 committed by The Qt Project
parent 8b0fd78caa
commit 7aac93b6ce
3 changed files with 10 additions and 49 deletions

View File

@ -61,6 +61,10 @@
#include <QDebug>
#ifndef QT_OPENGL_ES_2
#include <QOpenGLFunctions_1_0>
#endif
QT_BEGIN_NAMESPACE
class QOpenGLVersionProfilePrivate
@ -366,7 +370,9 @@ int QOpenGLContextPrivate::maxTextureSize()
GLint size;
GLint next = 64;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
QOpenGLFunctions_1_0 *gl1funcs = q->versionFunctions<QOpenGLFunctions_1_0>();
gl1funcs->initializeOpenGLFunctions();
gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
if (size == 0) {
return max_texture_size;
}
@ -377,7 +383,7 @@ int QOpenGLContextPrivate::maxTextureSize()
if (next > max_texture_size)
break;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
} while (next > size);
max_texture_size = size;

View File

@ -2011,12 +2011,6 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
\fn void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
\internal
*/
/*!
\fn bool QOpenGLFunctions::isInitialized(const QOpenGLFunctionsPrivate *d)
\internal
@ -3174,15 +3168,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qop
(target, offset, size, data);
}
#ifndef QT_OPENGL_ES_2
// Desktop only
static void QOPENGLF_APIENTRY qopenglfResolveGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
{
RESOLVE_FUNC_VOID(0, GetTexLevelParameteriv)(target, level, pname, params);
}
#ifndef QT_OPENGL_DYNAMIC
#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC)
// Special translation functions for ES-specific calls on desktop GL
static void QOPENGLF_APIENTRY qopenglfTranslateClearDepthf(GLclampf depth)
@ -3194,10 +3180,7 @@ static void QOPENGLF_APIENTRY qopenglfTranslateDepthRangef(GLclampf zNear, GLcla
{
::glDepthRange(zNear, zFar);
}
#endif // QT_OPENGL_DYNAMIC
#endif // QT_OPENGL_ES2
#endif // !ES && !DYNAMIC
QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *)
{
@ -3256,8 +3239,6 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *)
TexParameteriv = qopenglfResolveTexParameteriv;
TexSubImage2D = qopenglfResolveTexSubImage2D;
Viewport = qopenglfResolveViewport;
GetTexLevelParameteriv = qopenglfResolveGetTexLevelParameteriv;
} else {
#ifndef QT_OPENGL_DYNAMIC
// Use the functions directly. This requires linking QtGui to an OpenGL implementation.
@ -3308,8 +3289,6 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *)
TexParameteriv = ::glTexParameteriv;
TexSubImage2D = ::glTexSubImage2D;
Viewport = ::glViewport;
GetTexLevelParameteriv = ::glGetTexLevelParameteriv;
#else // QT_OPENGL_DYNAMIC
// This should not happen.
qFatal("QOpenGLFunctions: Dynamic OpenGL builds do not support platforms with insufficient function resolving capabilities");

View File

@ -407,9 +407,6 @@ public:
void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
// OpenGL1, not GLES2
void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
protected:
QOpenGLFunctionsPrivate *d_ptr;
static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; }
@ -565,9 +562,6 @@ struct QOpenGLFunctionsPrivate
void (QOPENGLF_APIENTRYP VertexAttrib4fv)(GLuint indx, const GLfloat* values);
void (QOPENGLF_APIENTRYP VertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
// OpenGL1 only, not GLES2
void (QOPENGLF_APIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
// Special non-ES OpenGL variants, not to be called directly
void (QOPENGLF_APIENTRYP ClearDepth)(GLdouble depth);
void (QOPENGLF_APIENTRYP DepthRange)(GLdouble zNear, GLdouble zFar);
@ -2154,24 +2148,6 @@ inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLe
Q_OPENGL_FUNCTIONS_DEBUG
}
// OpenGL1, not GLES2
inline void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
{
#ifdef QT_OPENGL_ES_2
Q_UNUSED(target);
Q_UNUSED(level);
Q_UNUSED(pname);
Q_UNUSED(params);
// Cannot get here.
qFatal("QOpenGLFunctions: glGetTexLevelParameteriv not available with OpenGL ES");
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
d_ptr->GetTexLevelParameteriv(target, level, pname, params);
#endif
Q_OPENGL_FUNCTIONS_DEBUG
}
QT_END_NAMESPACE
#endif // QT_NO_OPENGL