summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2010-02-04 14:48:30 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2010-02-04 14:48:30 (GMT)
commit760319b312aceb2cc7438ad09eecd305c1b663e8 (patch)
treecb223918e0c8c370bb6991103e905bb21857556d
parentfe849f50ca83f50f6068b7d494cb228fae1d6309 (diff)
downloadQt-760319b312aceb2cc7438ad09eecd305c1b663e8.zip
Qt-760319b312aceb2cc7438ad09eecd305c1b663e8.tar.gz
Qt-760319b312aceb2cc7438ad09eecd305c1b663e8.tar.bz2
Fix Geometry shaders based on review
-rw-r--r--src/opengl/qglshaderprogram.cpp24
-rw-r--r--src/opengl/qglshaderprogram.h2
2 files changed, 16 insertions, 10 deletions
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index 43d1df8..7af488d 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -517,9 +517,6 @@ public:
, geometryVertexCount(64)
, geometryInputType(0)
, geometryOutputType(0)
- , vertexShader(0)
- , fragmentShader(0)
- , geometryShader(0)
{
}
~QGLShaderProgramPrivate();
@@ -536,9 +533,6 @@ public:
QString log;
QList<QGLShader *> shaders;
QList<QGLShader *> anonShaders;
- QGLShader *vertexShader;
- QGLShader *fragmentShader;
- QGLShader *geometryShader;
bool hasShader(QGLShader::ShaderType type) const;
};
@@ -564,6 +558,17 @@ bool QGLShaderProgramPrivate::hasShader(QGLShader::ShaderType type) const
#define ctx d->programGuard.context()
/*!
+ \enum GeometryTypes
+
+ Defines the geometry types specificed by the GL_EXT_geometry_shader4 extension
+
+ \value LinesWithAdjacencyGeometryType Corresponds to GL_LINES_ADJACENCY.
+ \value LineStripWithAdjacencyGeometryType Corresponds to GL_LINE_STRIP_ADJACENCY.
+ \value TrianglesWithAdjacencyGeometryType Corresponds to GL_TRIANGLES_ADJACENCY.
+ \value TriangleStripWithAdjacencyGeometryType Corresponds to GL_TRIANGLE_STRIP_ADJACENCY.
+ */
+
+/*!
Constructs a new shader program and attaches it to \a parent.
The program will be invalid until addShader() is called.
@@ -2995,7 +3000,7 @@ void QGLShaderProgram::shaderDestroyed()
The \a context is used to resolve the GLSL extensions.
If \a context is null, then QGLContext::currentContext() is used.
*/
-bool QGLShader::hasShaders(ShaderType type, const QGLContext *context)
+bool QGLShader::hasOpenGLShaders(ShaderType type, const QGLContext *context)
{
#if !defined(QT_OPENGL_ES_2)
if (!context)
@@ -3006,9 +3011,10 @@ bool QGLShader::hasShaders(ShaderType type, const QGLContext *context)
bool resolved = qt_resolve_glsl_extensions(const_cast<QGLContext *>(context));
if (!resolved)
return false;
- const QGLContext *ctx = context;
- if ((type & Geometry) && !glProgramParameteriEXT)
+
+ if ((type & Geometry) && !QByteArray((const char *) glGetString(GL_EXTENSIONS)).contains("GL_EXT_geometry_shader4"))
return false;
+
return true;
}
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index face66e..6dfbb77 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -89,7 +89,7 @@ public:
GLuint shaderId() const;
- static bool hasShaders(ShaderType type, const QGLContext *context = 0);
+ static bool hasOpenGLShaders(ShaderType type, const QGLContext *context = 0);
private:
friend class QGLShaderProgram;