diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-08-26 06:54:04 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-08-27 03:39:49 (GMT) |
commit | c52061e7980fcde5d59a7657a254ce00d117b611 (patch) | |
tree | 6f6b3c82d116031949ef2567cf51cc8ad73ccc45 /src | |
parent | 843b53d2e9471310c956950606737e867888b0a1 (diff) | |
download | Qt-c52061e7980fcde5d59a7657a254ce00d117b611.zip Qt-c52061e7980fcde5d59a7657a254ce00d117b611.tar.gz Qt-c52061e7980fcde5d59a7657a254ce00d117b611.tar.bz2 |
Make QGLShader::ShaderType slightly more future proof by
making it into a bitmask. I'll add GeometryShader in the future
Reviewed-by: Rhys Weatherley
Diffstat (limited to 'src')
-rw-r--r-- | src/opengl/qglshaderprogram.cpp | 9 | ||||
-rw-r--r-- | src/opengl/qglshaderprogram.h | 17 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 83578b3..8ce50cf 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -104,7 +104,7 @@ QT_BEGIN_NAMESPACE on desktop systems. The programmer should restrict themselves to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop. - + \section1 Simple shader example \code @@ -199,8 +199,11 @@ QT_BEGIN_NAMESPACE \value VertexShader Vertex shader written in the OpenGL Shading Language (GLSL). \value FragmentShader Fragment shader written in the OpenGL Shading Language (GLSL). + \value PartialVertexShader Partial vertex shader that will be concatenated with all other partial vertex shaders at link time. \value PartialFragmentShader Partial fragment shader that will be concatenated with all other partial fragment shaders at link time. + + \omitvalue PartialShader */ #ifndef GL_FRAGMENT_SHADER @@ -251,8 +254,7 @@ public: , shader(0) , shaderType(type) , compiled(false) - , isPartial(type == QGLShader::PartialVertexShader || - type == QGLShader::PartialFragmentShader) + , isPartial((type & QGLShader::PartialShader) != 0) , hasPartialSource(false) { } @@ -2960,6 +2962,7 @@ bool QGLShaderProgram::hasShaderPrograms(const QGLContext *context) #endif } + #endif QT_END_NAMESPACE diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index 5499f8a..4f95ef3 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -63,13 +63,17 @@ class Q_OPENGL_EXPORT QGLShader : public QObject { Q_OBJECT public: - enum ShaderType + enum ShaderTypeBits { - VertexShader, - FragmentShader, - PartialVertexShader, - PartialFragmentShader + VertexShader = 0x0001, + FragmentShader = 0x0002, + + PartialShader = 0x1000, + + PartialVertexShader = PartialShader | VertexShader, + PartialFragmentShader = PartialShader | FragmentShader }; + Q_DECLARE_FLAGS(ShaderType, ShaderTypeBits); explicit QGLShader(QGLShader::ShaderType type, QObject *parent = 0); QGLShader(const QString& fileName, QGLShader::ShaderType type, QObject *parent = 0); @@ -104,6 +108,9 @@ private: Q_DISABLE_COPY(QGLShader) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLShader::ShaderType); + + class QGLShaderProgramPrivate; class Q_OPENGL_EXPORT QGLShaderProgram : public QObject |