Clean up legacy defines in gui/opengl.

Change-Id: I14d477c3f7a98cecca2c0a240ff13ea8ec64a154
Reviewed-on: http://codereview.qt.nokia.com/3716
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
This commit is contained in:
Samuel Rødal 2011-08-29 10:22:28 +02:00 committed by Gunnar Sletta
parent 6e28e8441b
commit e35a83b293
3 changed files with 10 additions and 78 deletions

View File

@ -186,8 +186,6 @@ QOpenGLBuffer::QOpenGLBuffer(const QOpenGLBuffer &other)
d_ptr->ref.ref(); d_ptr->ref.ref();
} }
#define ctx QOpenGLContext::currentContext();
/*! /*!
Destroys this buffer object, including the storage being Destroys this buffer object, including the storage being
used in the GL server. used in the GL server.
@ -250,8 +248,6 @@ void QOpenGLBuffer::setUsagePattern(QOpenGLBuffer::UsagePattern value)
d->usagePattern = d->actualUsagePattern = value; d->usagePattern = d->actualUsagePattern = value;
} }
#undef ctx
namespace { namespace {
void freeBufferFunc(QOpenGLFunctions *funcs, GLuint id) void freeBufferFunc(QOpenGLFunctions *funcs, GLuint id)
{ {
@ -294,8 +290,6 @@ bool QOpenGLBuffer::create()
return false; return false;
} }
#define ctx QOpenGLContext::currentContext()
/*! /*!
Returns true if this buffer has been created; false otherwise. Returns true if this buffer has been created; false otherwise.
@ -455,8 +449,6 @@ void QOpenGLBuffer::release()
d->funcs->glBindBuffer(d->type, 0); d->funcs->glBindBuffer(d->type, 0);
} }
#undef ctx
/*! /*!
Releases the buffer associated with \a type in the current Releases the buffer associated with \a type in the current
QOpenGLContext. QOpenGLContext.
@ -473,13 +465,10 @@ void QOpenGLBuffer::release()
void QOpenGLBuffer::release(QOpenGLBuffer::Type type) void QOpenGLBuffer::release(QOpenGLBuffer::Type type)
{ {
QOpenGLContext *ctx = QOpenGLContext::currentContext(); QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (ctx) { if (ctx)
QOpenGLFunctions(ctx).glBindBuffer(GLenum(type), 0); ctx->functions()->glBindBuffer(GLenum(type), 0);
}
} }
#define ctx QOpenGLContext::currentContext()
/*! /*!
Returns the GL identifier associated with this buffer; zero if Returns the GL identifier associated with this buffer; zero if
the buffer has not been created. the buffer has not been created.
@ -492,10 +481,6 @@ GLuint QOpenGLBuffer::bufferId() const
return d->guard ? d->guard->id() : 0; return d->guard ? d->guard->id() : 0;
} }
#ifndef GL_BUFFER_SIZE
#define GL_BUFFER_SIZE 0x8764
#endif
/*! /*!
Returns the size of the data in this buffer, for reading operations. Returns the size of the data in this buffer, for reading operations.
Returns -1 if fetching the buffer size is not supported, or the Returns -1 if fetching the buffer size is not supported, or the

View File

@ -55,9 +55,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#define QOPENGL_FUNC_CONTEXT QOpenGLContext *ctx = QOpenGLContext::currentContext();
#define QOPENGL_FUNCP_CONTEXT QOpenGLContext *ctx = QOpenGLContext::currentContext();
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
#define QT_RESET_GLERROR() \ #define QT_RESET_GLERROR() \
{ \ { \
@ -358,10 +355,10 @@ QOpenGLContextGroup *QOpenGLFBOGLPaintDevice::group() const
bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus() const bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus() const
{ {
QOPENGL_FUNCP_CONTEXT; QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (!ctx) if (!ctx)
return false; // Context no longer exists. return false; // Context no longer exists.
GLenum status = QOpenGLFunctions(ctx).glCheckFramebufferStatus(GL_FRAMEBUFFER); GLenum status = ctx->functions()->glCheckFramebufferStatus(GL_FRAMEBUFFER);
switch(status) { switch(status) {
case GL_NO_ERROR: case GL_NO_ERROR:
case GL_FRAMEBUFFER_COMPLETE: case GL_FRAMEBUFFER_COMPLETE:
@ -384,7 +381,6 @@ bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus() const
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attached images must have same dimensions."); qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attached images must have same dimensions.");
break; break;
#if 1
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS: case GL_FRAMEBUFFER_INCOMPLETE_FORMATS:
qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attached images must have same format."); qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attached images must have same format.");
break; break;
@ -397,7 +393,6 @@ bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus() const
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attachments must have same number of samples per pixel."); qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attachments must have same number of samples per pixel.");
break; break;
#endif
default: default:
qDebug() <<"QOpenGLFramebufferObject: An undefined error has occurred: "<< status; qDebug() <<"QOpenGLFramebufferObject: An undefined error has occurred: "<< status;
break; break;
@ -937,12 +932,11 @@ bool QOpenGLFramebufferObject::bind()
if (!isValid()) if (!isValid())
return false; return false;
Q_D(QOpenGLFramebufferObject); Q_D(QOpenGLFramebufferObject);
QOPENGL_FUNC_CONTEXT;
if (!ctx)
return false; // Context no longer exists.
QOpenGLContext *current = QOpenGLContext::currentContext(); QOpenGLContext *current = QOpenGLContext::currentContext();
if (!current)
return false;
#ifdef QT_DEBUG #ifdef QT_DEBUG
if (!current || current->shareGroup() != d->fbo_guard->group()) if (current->shareGroup() != d->fbo_guard->group())
qWarning("QOpenGLFramebufferObject::bind() called from incompatible context"); qWarning("QOpenGLFramebufferObject::bind() called from incompatible context");
#endif #endif
d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, d->fbo()); d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, d->fbo());
@ -965,15 +959,14 @@ bool QOpenGLFramebufferObject::release()
{ {
if (!isValid()) if (!isValid())
return false; return false;
QOPENGL_FUNC_CONTEXT;
if (!ctx)
return false; // Context no longer exists.
QOpenGLContext *current = QOpenGLContext::currentContext(); QOpenGLContext *current = QOpenGLContext::currentContext();
if (!current)
return false;
#ifdef QT_DEBUG #ifdef QT_DEBUG
Q_D(QOpenGLFramebufferObject); Q_D(QOpenGLFramebufferObject);
if (!current || current->shareGroup() != d->fbo_guard->group()) if (current->shareGroup() != d->fbo_guard->group())
qWarning("QOpenGLFramebufferObject::release() called from incompatible context"); qWarning("QOpenGLFramebufferObject::release() called from incompatible context");
#endif #endif

View File

@ -145,46 +145,6 @@ QT_BEGIN_NAMESPACE
Language (GLSL), based on the GL_EXT_geometry_shader4 extension. Language (GLSL), based on the GL_EXT_geometry_shader4 extension.
*/ */
#ifndef GL_FRAGMENT_SHADER
#define GL_FRAGMENT_SHADER 0x8B30
#endif
#ifndef GL_VERTEX_SHADER
#define GL_VERTEX_SHADER 0x8B31
#endif
#ifndef GL_COMPILE_STATUS
#define GL_COMPILE_STATUS 0x8B81
#endif
#ifndef GL_LINK_STATUS
#define GL_LINK_STATUS 0x8B82
#endif
#ifndef GL_INFO_LOG_LENGTH
#define GL_INFO_LOG_LENGTH 0x8B84
#endif
#ifndef GL_ACTIVE_UNIFORMS
#define GL_ACTIVE_UNIFORMS 0x8B86
#endif
#ifndef GL_ACTIVE_UNIFORM_MAX_LENGTH
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
#endif
#ifndef GL_ACTIVE_ATTRIBUTES
#define GL_ACTIVE_ATTRIBUTES 0x8B89
#endif
#ifndef GL_ACTIVE_ATTRIBUTE_MAX_LENGTH
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
#endif
#ifndef GL_CURRENT_VERTEX_ATTRIB
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
#endif
#ifndef GL_SHADER_SOURCE_LENGTH
#define GL_SHADER_SOURCE_LENGTH 0x8B88
#endif
#ifndef GL_SHADER_BINARY_FORMATS
#define GL_SHADER_BINARY_FORMATS 0x8DF8
#endif
#ifndef GL_NUM_SHADER_BINARY_FORMATS
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
#endif
class QOpenGLShaderPrivate : public QObjectPrivate class QOpenGLShaderPrivate : public QObjectPrivate
{ {
Q_DECLARE_PUBLIC(QOpenGLShader) Q_DECLARE_PUBLIC(QOpenGLShader)
@ -2997,8 +2957,6 @@ void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4
setUniformValueArray(uniformLocation(name), values, count); setUniformValueArray(uniformLocation(name), values, count);
} }
#undef ctx
/*! /*!
Returns the hardware limit for how many vertices a geometry shader Returns the hardware limit for how many vertices a geometry shader
can output. can output.
@ -3133,10 +3091,6 @@ void QOpenGLShaderProgram::shaderDestroyed()
removeShader(shader); removeShader(shader);
} }
#undef ctx
#undef context
/*! /*!
Returns true if shader programs of type \a type are supported on Returns true if shader programs of type \a type are supported on
this system; false otherwise. this system; false otherwise.