OpenGL: Remove API for stubbed Geometry shader support in gui/opengl

There is a pending patch to reinstate this for Qt 5.1 (the patch
introduces new API top QOpenGLContext). I will fold the revert of this
patch into:

https://codereview.qt-project.org/#change,31231

Note that QGLShaderProgram still supports Geometry shaders so source
compatibility with Qt 4.8 is maintained.

Change-Id: I53faedd4e4a2a6c2a9765afdc1bee6df5ae2f711
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
Sean Harmer 2012-09-24 09:41:17 +01:00 committed by The Qt Project
parent c06106f28d
commit 57b4a504ff
2 changed files with 2 additions and 145 deletions

View File

@ -145,8 +145,6 @@ QT_BEGIN_NAMESPACE
\value Vertex Vertex shader written in the OpenGL Shading Language (GLSL).
\value Fragment Fragment shader written in the OpenGL Shading Language (GLSL).
\value Geometry Geometry shaders written in the OpenGL Shading
Language (GLSL), based on the GL_EXT_geometry_shader4 extension.
*/
class QOpenGLShaderPrivate : public QObjectPrivate
@ -196,10 +194,6 @@ bool QOpenGLShaderPrivate::create()
GLuint shader;
if (shaderType == QOpenGLShader::Vertex)
shader = glfuncs->glCreateShader(GL_VERTEX_SHADER);
#if 0
else if (shaderType == QOpenGLShader::Geometry)
shader = glfuncs->glCreateShader(GL_GEOMETRY_SHADER_EXT);
#endif
else
shader = glfuncs->glCreateShader(GL_FRAGMENT_SHADER);
if (!shader) {
@ -240,8 +234,6 @@ bool QOpenGLShaderPrivate::compile(QOpenGLShader *q)
type = types[0];
else if (shaderType == QOpenGLShader::Vertex)
type = types[1];
else if (shaderType == QOpenGLShader::Geometry)
type = types[2];
// Get info and source code lengths
GLint infoLogLength = 0;
@ -517,9 +509,6 @@ public:
, linked(false)
, inited(false)
, removingShaders(false)
, geometryVertexCount(64)
, geometryInputType(0)
, geometryOutputType(0)
, glfuncs(new QOpenGLFunctions)
{
}
@ -530,10 +519,6 @@ public:
bool inited;
bool removingShaders;
int geometryVertexCount;
GLenum geometryInputType;
GLenum geometryOutputType;
QString log;
QList<QOpenGLShader *> shaders;
QList<QOpenGLShader *> anonShaders;
@ -838,23 +823,6 @@ bool QOpenGLShaderProgram::link()
return true;
}
// Set up the geometry shader parameters
#if 0
if (glProgramParameteriEXT) {
foreach (QOpenGLShader *shader, d->shaders) {
if (shader->shaderType() & QOpenGLShader::Geometry) {
glProgramParameteriEXT(program, GL_GEOMETRY_INPUT_TYPE_EXT,
d->geometryInputType);
glProgramParameteriEXT(program, GL_GEOMETRY_OUTPUT_TYPE_EXT,
d->geometryOutputType);
glProgramParameteriEXT(program, GL_GEOMETRY_VERTICES_OUT_EXT,
d->geometryVertexCount);
break;
}
}
}
#endif
d->glfuncs->glLinkProgram(program);
value = 0;
d->glfuncs->glGetProgramiv(program, GL_LINK_STATUS, &value);
@ -2958,96 +2926,6 @@ void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4
setUniformValueArray(uniformLocation(name), values, count);
}
/*!
Returns the hardware limit for how many vertices a geometry shader
can output.
\sa setGeometryOutputVertexCount()
*/
int QOpenGLShaderProgram::maxGeometryOutputVertices() const
{
GLint n = 0;
// glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT, &n);
return n;
}
/*!
Sets the maximum number of vertices the current geometry shader
program will produce, if active, to \a count.
This parameter takes effect the next time the program is linked.
*/
void QOpenGLShaderProgram::setGeometryOutputVertexCount(int count)
{
#ifndef QT_NO_DEBUG
int max = maxGeometryOutputVertices();
if (count > max) {
qWarning("QOpenGLShaderProgram::setGeometryOutputVertexCount: count: %d higher than maximum: %d",
count, max);
}
#endif
d_func()->geometryVertexCount = count;
}
/*!
Returns the maximum number of vertices the current geometry shader
program will produce, if active.
This parameter takes effect the ntext time the program is linked.
*/
int QOpenGLShaderProgram::geometryOutputVertexCount() const
{
return d_func()->geometryVertexCount;
}
/*!
Sets the input type from \a inputType.
This parameter takes effect the next time the program is linked.
*/
void QOpenGLShaderProgram::setGeometryInputType(GLenum inputType)
{
d_func()->geometryInputType = inputType;
}
/*!
Returns the geometry shader input type, if active.
This parameter takes effect the next time the program is linked.
*/
GLenum QOpenGLShaderProgram::geometryInputType() const
{
return d_func()->geometryInputType;
}
/*!
Sets the output type from the geometry shader, if active, to
\a outputType.
This parameter takes effect the next time the program is linked.
*/
void QOpenGLShaderProgram::setGeometryOutputType(GLenum outputType)
{
d_func()->geometryOutputType = outputType;
}
/*!
Returns the geometry shader output type, if active.
This parameter takes effect the next time the program is linked.
*/
GLenum QOpenGLShaderProgram::geometryOutputType() const
{
return d_func()->geometryOutputType;
}
/*!
Returns true if shader programs written in the OpenGL Shading
Language (GLSL) are supported on this system; false otherwise.
@ -3094,18 +2972,9 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context)
if (!context)
return false;
if ((type & ~(Geometry | Vertex | Fragment)) || type == 0)
if ((type & ~(Vertex | Fragment)) || type == 0)
return false;
#if 0
bool resolved = qt_resolve_glsl_extensions(const_cast<QOpenGLContext *>(context));
if (!resolved)
return false;
if ((type & Geometry) && !QByteArray((const char *) glGetString(GL_EXTENSIONS)).contains("GL_EXT_geometry_shader4"))
return false;
#endif
return true;
}

View File

@ -66,8 +66,7 @@ public:
enum ShaderTypeBit
{
Vertex = 0x0001,
Fragment = 0x0002,
Geometry = 0x0004
Fragment = 0x0002
};
Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit)
@ -129,17 +128,6 @@ public:
GLuint programId() const;
int maxGeometryOutputVertices() const;
void setGeometryOutputVertexCount(int count);
int geometryOutputVertexCount() const;
void setGeometryInputType(GLenum inputType);
GLenum geometryInputType() const;
void setGeometryOutputType(GLenum outputType);
GLenum geometryOutputType() const;
void bindAttributeLocation(const char *name, int location);
void bindAttributeLocation(const QByteArray& name, int location);
void bindAttributeLocation(const QString& name, int location);