diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qglshaderprogram.cpp | 18 | ||||
-rw-r--r-- | src/opengl/qglshaderprogram.h | 16 |
2 files changed, 13 insertions, 21 deletions
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 7af488d..22db731 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -558,17 +558,6 @@ 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. @@ -612,6 +601,7 @@ bool QGLShaderProgram::init() context = QGLContext::currentContext(); d->programGuard.setContext(context); } + if (!context) return false; if (qt_resolve_glsl_extensions(const_cast<QGLContext *>(context))) { @@ -3002,12 +2992,14 @@ void QGLShaderProgram::shaderDestroyed() */ bool QGLShader::hasOpenGLShaders(ShaderType type, const QGLContext *context) { -#if !defined(QT_OPENGL_ES_2) if (!context) context = QGLContext::currentContext(); if (!context) return false; -#endif + + if ((type & ~(Geometry | Vertex | Fragment)) || type == 0) + return false; + bool resolved = qt_resolve_glsl_extensions(const_cast<QGLContext *>(context)); if (!resolved) return false; diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index 6dfbb77..56034ee 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -103,18 +103,18 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QGLShader::ShaderType) class QGLShaderProgramPrivate; +#ifndef GL_EXT_geometry_shader4 +# define GL_LINES_ADJACENCY_EXT 0xA +# define GL_LINE_STRIP_ADJACENCY_EXT 0xB +# define GL_TRIANGLES_ADJACENCY_EXT 0xC +# define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0xD +#endif + + class Q_OPENGL_EXPORT QGLShaderProgram : public QObject { Q_OBJECT public: - enum GeometryTypes - { - LinesWithAdjacencyGeometryType = 0xa, - LineStripWithAdjacencyGeometryType = 0xb, - TrianglesWithAdjacencyGeometryType = 0xc, - TriangleStripWithAdjacencyGeometryType = 0xd - }; - explicit QGLShaderProgram(QObject *parent = 0); explicit QGLShaderProgram(const QGLContext *context, QObject *parent = 0); virtual ~QGLShaderProgram(); |