diff options
author | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2009-10-30 08:38:23 (GMT) |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2009-10-30 08:38:23 (GMT) |
commit | af92a4e78613ee3a0d402d3f67126284d0bb6656 (patch) | |
tree | 5210fa7f769602c95d6bd7bc3a396898b3143acf /src/opengl | |
parent | a4b77f3887a4eb0f3ce103d2457f57e94938d771 (diff) | |
parent | a9f7e08ab08ce25413b85272526907f7347e6fe3 (diff) | |
download | Qt-af92a4e78613ee3a0d402d3f67126284d0bb6656.zip Qt-af92a4e78613ee3a0d402d3f67126284d0bb6656.tar.gz Qt-af92a4e78613ee3a0d402d3f67126284d0bb6656.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qtriangulatingstroker.cpp | 4 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qtriangulatingstroker_p.h | 2 | ||||
-rw-r--r-- | src/opengl/qglshaderprogram.cpp | 213 | ||||
-rw-r--r-- | src/opengl/qglshaderprogram.h | 9 |
4 files changed, 6 insertions, 222 deletions
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index a3c8266..ec05020 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -42,6 +42,7 @@ #include "qtriangulatingstroker_p.h" #include <qmath.h> +QT_BEGIN_NAMESPACE #define CURVE_FLATNESS Q_PI / 8 @@ -338,3 +339,6 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen) m_dash_stroker.end(); } + +QT_END_NAMESPACE + diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index b7354db..483cea9 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -48,6 +48,7 @@ #include <private/qnumeric_p.h> #include <private/qmath_p.h> +QT_BEGIN_NAMESPACE class QTriangulatingStroker { @@ -295,5 +296,6 @@ void QTriangulatingStroker::join(const qreal *pts) emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); } +QT_END_NAMESPACE #endif diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index d028522..90b496e 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -612,95 +612,6 @@ bool QGLShader::compileFile(const QString& fileName) } /*! - Sets the binary code for this shader to the \a length bytes from - the array \a binary. The \a format specifies how the binary data - should be interpreted by the OpenGL engine. Returns true if the - binary was set on the shader; false otherwise. - - This function cannot be used with PartialVertexShader or - PartialFragmentShader. - - If this function succeeds, then the shader will be considered compiled. - - \sa shaderBinaryFormats() -*/ -bool QGLShader::setShaderBinary(GLenum format, const void *binary, int length) -{ - Q_D(QGLShader); -#if !defined(QT_OPENGL_ES_2) - if (!glShaderBinary) - return false; -#endif - GLuint shader = d->shaderGuard.id(); - if (d->isPartial || !shader) - return false; - glGetError(); // Clear error state. - glShaderBinary(1, &shader, format, binary, length); - d->compiled = (glGetError() == GL_NO_ERROR); - return d->compiled; -} - -/*! - Sets the binary code for this shader to the \a length bytes from - the array \a binary. The \a format specifies how the binary data - should be interpreted by the OpenGL engine. Returns true if the - binary was set on the shader; false otherwise. - - The \a otherShader will also have binary code set on it. This is - for the case where \a binary contains both vertex and fragment - shader code. - - This function cannot be used with PartialVertexShader or - PartialFragmentShader. - - If this function succeeds, then the shader will be considered compiled. - - \sa shaderBinaryFormats() -*/ -bool QGLShader::setShaderBinary - (QGLShader& otherShader, GLenum format, const void *binary, int length) -{ - Q_D(QGLShader); -#if !defined(QT_OPENGL_ES_2) - if (!glShaderBinary) - return false; -#endif - if (d->isPartial || !d->shaderGuard.id()) - return false; - if (otherShader.d_func()->isPartial || !otherShader.d_func()->shaderGuard.id()) - return false; - glGetError(); // Clear error state. - GLuint shaders[2]; - shaders[0] = d->shaderGuard.id(); - shaders[1] = otherShader.d_func()->shaderGuard.id(); - glShaderBinary(2, shaders, format, binary, length); - d->compiled = (glGetError() == GL_NO_ERROR); - otherShader.d_func()->compiled = d->compiled; - return d->compiled; -} - -/*! - Returns a list of all binary formats that are supported by - setShaderBinary() on this system. - - \sa setShaderBinary() -*/ -QList<GLenum> QGLShader::shaderBinaryFormats() -{ - GLint num; - QList<GLenum> list; - glGetError(); // Clear error state. - glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &num); - if (glGetError() != GL_NO_ERROR || num <= 0) - return list; - QVarLengthArray<GLint> formats(num); - glGetIntegerv(GL_SHADER_BINARY_FORMATS, formats.data()); - for (GLint i = 0; i < num; ++i) - list += (GLenum)(formats[i]); - return list; -} - -/*! Returns the source code for this shader. \sa compile() @@ -1068,130 +979,6 @@ void QGLShaderProgram::removeAllShaders() d->removingShaders = false; } -#if defined(QT_OPENGL_ES_2) - -#ifndef GL_PROGRAM_BINARY_LENGTH_OES -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#endif -#ifndef GL_NUM_PROGRAM_BINARY_FORMATS_OES -#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE -#endif -#ifndef GL_PROGRAM_BINARY_FORMATS_OES -#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF -#endif - -#endif - -/*! - Returns the program binary associated with this shader program. - The numeric identifier of the program binary format is returned - in \a format. The \c OES_get_program_binary extension will need - to be supported by the system for binary retrieval to succeed. - - Returns an empty QByteArray if the program binary cannot be - retrieved on this system, or the shader program has not yet - been linked. - - The returned binary can be supplied to setProgramBinary() on the - same machine at some future point to reload the program. It contains - the compiled code of all of the shaders that were attached to the - program at the time programBinary() is called. - - \sa setProgramBinary(), programBinaryFormats() -*/ -QByteArray QGLShaderProgram::programBinary(int *format) const -{ -#if defined(QT_OPENGL_ES_2) - Q_D(const QGLShaderProgram); - if (!isLinked()) - return QByteArray(); - - // Get the length of the binary data, bailing out if there is none. - GLint length = 0; - GLuint program = d->programGuard.id(); - glGetProgramiv(program, GL_PROGRAM_BINARY_LENGTH_OES, &length); - if (length <= 0) - return QByteArray(); - - // Retrieve the binary data. - QByteArray binary(length, 0); - GLenum binaryFormat; - glGetProgramBinaryOES(program, length, 0, &binaryFormat, binary.data()); - if (format) - *format = (int)binaryFormat; - return binary; -#else - Q_UNUSED(format); - return QByteArray(); -#endif -} - -/*! - Sets the \a binary for this shader program according to \a format. - Returns true if the binary was set, or false if the binary format - is not supported or this system does not support program binaries. - The program will be linked if the load succeeds. - - \sa programBinary(), programBinaryFormats(), isLinked() -*/ -bool QGLShaderProgram::setProgramBinary(int format, const QByteArray& binary) -{ -#if defined(QT_OPENGL_ES_2) - // Load the binary and check that it was linked correctly. - Q_D(QGLShaderProgram); - GLuint program = d->programGuard.id(); - if (!program) - return false; - glProgramBinaryOES(program, (GLenum)format, - binary.constData(), binary.size()); - GLint value = 0; - glGetProgramiv(program, GL_LINK_STATUS, &value); - d->linked = (value != 0); - value = 0; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value); - d->log = QString(); - if (value > 1) { - char *logbuf = new char [value]; - GLint len; - glGetProgramInfoLog(program, value, &len, logbuf); - d->log = QString::fromLatin1(logbuf); - QString name = objectName(); - if (name.isEmpty()) - qWarning() << "QGLShader::setProgramBinary:" << d->log; - else - qWarning() << "QGLShader::setProgramBinary[" << name << "]:" << d->log; - delete [] logbuf; - } - return d->linked; -#else - Q_UNUSED(format); - Q_UNUSED(binary); - return false; -#endif -} - -/*! - Returns the list of program binary formats that are accepted by - this system for use with setProgramBinary(). - - \sa programBinary(), setProgramBinary() -*/ -QList<int> QGLShaderProgram::programBinaryFormats() -{ -#if defined(QT_OPENGL_ES_2) - GLint count = 0; - glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES, &count); - if (count <= 0) - return QList<int>(); - QVector<int> list; - list.resize(count); - glGetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES, list.data()); - return list.toList(); -#else - return QList<int>(); -#endif -} - /*! Links together the shaders that were added to this program with addShader(). Returns true if the link was successful or diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index d8b9a0c..708cf09 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -88,11 +88,6 @@ public: bool compile(const QString& source); bool compileFile(const QString& fileName); - bool setShaderBinary(GLenum format, const void *binary, int length); - bool setShaderBinary(QGLShader& otherShader, GLenum format, const void *binary, int length); - - static QList<GLenum> shaderBinaryFormats(); - QByteArray sourceCode() const; bool isCompiled() const; @@ -133,10 +128,6 @@ public: void removeAllShaders(); - QByteArray programBinary(int *format) const; - bool setProgramBinary(int format, const QByteArray& binary); - static QList<int> programBinaryFormats(); - virtual bool link(); bool isLinked() const; QString log() const; |