summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-06-22 12:36:03 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-06-26 15:09:17 +0200
commitb043871d2b1ee9c57d75fe8a3f8cb22e35a4fe4d (patch)
tree129fd32333589a0a2e2351ef699fafbe97f4969b /src
parentf529f94132e8095ccd50030baeba2b2f18cabdb8 (diff)
Use QList instead of QVector in opengl
Task-number: QTBUG-84469 Change-Id: I26c1cfab7f2d9aa5c71847ae02bfe0cf15c04a1b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/opengl/qopengldebug.cpp31
-rw-r--r--src/opengl/qopengldebug.h5
-rw-r--r--src/opengl/qopenglengineshadermanager.cpp2
-rw-r--r--src/opengl/qopenglengineshadermanager_p.h2
-rw-r--r--src/opengl/qopenglframebufferobject.cpp8
-rw-r--r--src/opengl/qopenglframebufferobject.h4
-rw-r--r--src/opengl/qopenglframebufferobject_p.h2
-rw-r--r--src/opengl/qopenglpaintengine_p.h6
-rw-r--r--src/opengl/qopenglshaderprogram.cpp32
-rw-r--r--src/opengl/qopenglshaderprogram.h8
-rw-r--r--src/opengl/qopengltimerquery.cpp28
-rw-r--r--src/opengl/qopengltimerquery.h6
-rw-r--r--src/opengl/qplatformbackingstoreopenglsupport.cpp2
13 files changed, 62 insertions, 74 deletions
diff --git a/src/opengl/qopengldebug.cpp b/src/opengl/qopengldebug.cpp
index a69f6069dc..ef3b955f90 100644
--- a/src/opengl/qopengldebug.cpp
+++ b/src/opengl/qopengldebug.cpp
@@ -1079,10 +1079,8 @@ public:
void handleMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *rawMessage);
void controlDebugMessages(QOpenGLDebugMessage::Sources sources,
QOpenGLDebugMessage::Types types,
- QOpenGLDebugMessage::Severities severities,
- const QVector<GLuint> &ids,
- const QByteArray &callerName,
- bool enable);
+ QOpenGLDebugMessage::Severities severities, const QList<GLuint> &ids,
+ const QByteArray &callerName, bool enable);
void _q_contextAboutToBeDestroyed();
qt_glDebugMessageControl_t glDebugMessageControl;
@@ -1159,9 +1157,8 @@ void QOpenGLDebugLoggerPrivate::handleMessage(GLenum source,
void QOpenGLDebugLoggerPrivate::controlDebugMessages(QOpenGLDebugMessage::Sources sources,
QOpenGLDebugMessage::Types types,
QOpenGLDebugMessage::Severities severities,
- const QVector<GLuint> &ids,
- const QByteArray &callerName,
- bool enable)
+ const QList<GLuint> &ids,
+ const QByteArray &callerName, bool enable)
{
if (!initialized) {
qWarning("QOpenGLDebugLogger::%s(): object must be initialized before enabling/disabling messages", callerName.constData());
@@ -1644,12 +1641,8 @@ void QOpenGLDebugLogger::enableMessages(QOpenGLDebugMessage::Sources sources,
QOpenGLDebugMessage::Severities severities)
{
Q_D(QOpenGLDebugLogger);
- d->controlDebugMessages(sources,
- types,
- severities,
- QVector<GLuint>(),
- QByteArrayLiteral("enableMessages"),
- true);
+ d->controlDebugMessages(sources, types, severities, QList<GLuint>(),
+ QByteArrayLiteral("enableMessages"), true);
}
/*!
@@ -1660,7 +1653,7 @@ void QOpenGLDebugLogger::enableMessages(QOpenGLDebugMessage::Sources sources,
\sa disableMessages(), pushGroup(), popGroup()
*/
-void QOpenGLDebugLogger::enableMessages(const QVector<GLuint> &ids,
+void QOpenGLDebugLogger::enableMessages(const QList<GLuint> &ids,
QOpenGLDebugMessage::Sources sources,
QOpenGLDebugMessage::Types types)
{
@@ -1686,12 +1679,8 @@ void QOpenGLDebugLogger::disableMessages(QOpenGLDebugMessage::Sources sources,
QOpenGLDebugMessage::Severities severities)
{
Q_D(QOpenGLDebugLogger);
- d->controlDebugMessages(sources,
- types,
- severities,
- QVector<GLuint>(),
- QByteArrayLiteral("disableMessages"),
- false);
+ d->controlDebugMessages(sources, types, severities, QList<GLuint>(),
+ QByteArrayLiteral("disableMessages"), false);
}
/*!
@@ -1702,7 +1691,7 @@ void QOpenGLDebugLogger::disableMessages(QOpenGLDebugMessage::Sources sources,
\sa enableMessages(), pushGroup(), popGroup()
*/
-void QOpenGLDebugLogger::disableMessages(const QVector<GLuint> &ids,
+void QOpenGLDebugLogger::disableMessages(const QList<GLuint> &ids,
QOpenGLDebugMessage::Sources sources,
QOpenGLDebugMessage::Types types)
{
diff --git a/src/opengl/qopengldebug.h b/src/opengl/qopengldebug.h
index fef2782302..c12d996493 100644
--- a/src/opengl/qopengldebug.h
+++ b/src/opengl/qopengldebug.h
@@ -47,7 +47,6 @@
#include <QtCore/qshareddata.h>
#include <QtCore/qflags.h>
#include <QtCore/qlist.h>
-#include <QtCore/qvector.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qdebug.h>
#include <QtGui/qopenglcontext.h>
@@ -184,7 +183,7 @@ public:
QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType,
QOpenGLDebugMessage::Severities severities = QOpenGLDebugMessage::AnySeverity);
- void enableMessages(const QVector<GLuint> &ids,
+ void enableMessages(const QList<GLuint> &ids,
QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource,
QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType);
@@ -192,7 +191,7 @@ public:
QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType,
QOpenGLDebugMessage::Severities severities = QOpenGLDebugMessage::AnySeverity);
- void disableMessages(const QVector<GLuint> &ids,
+ void disableMessages(const QList<GLuint> &ids,
QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource,
QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType);
diff --git a/src/opengl/qopenglengineshadermanager.cpp b/src/opengl/qopenglengineshadermanager.cpp
index 09bd9ff096..dc52b326bb 100644
--- a/src/opengl/qopenglengineshadermanager.cpp
+++ b/src/opengl/qopenglengineshadermanager.cpp
@@ -524,7 +524,7 @@ GLuint QOpenGLEngineShaderManager::getUniformLocation(Uniform id)
if (!currentShaderProg)
return 0;
- QVector<uint> &uniformLocations = currentShaderProg->uniformLocations;
+ QList<uint> &uniformLocations = currentShaderProg->uniformLocations;
if (uniformLocations.isEmpty())
uniformLocations.fill(GLuint(-1), NumUniforms);
diff --git a/src/opengl/qopenglengineshadermanager_p.h b/src/opengl/qopenglengineshadermanager_p.h
index 71e6214278..5aaa1903a1 100644
--- a/src/opengl/qopenglengineshadermanager_p.h
+++ b/src/opengl/qopenglengineshadermanager_p.h
@@ -386,7 +386,7 @@ public:
QByteArray customStageSource; //TODO: Decent cache key for custom stages
QOpenGLShaderProgram* program;
- QVector<uint> uniformLocations;
+ QList<uint> uniformLocations;
bool useTextureCoords;
bool useOpacityAttribute;
diff --git a/src/opengl/qopenglframebufferobject.cpp b/src/opengl/qopenglframebufferobject.cpp
index 813c01b0a5..588ddd6535 100644
--- a/src/opengl/qopenglframebufferobject.cpp
+++ b/src/opengl/qopenglframebufferobject.cpp
@@ -1223,10 +1223,10 @@ GLuint QOpenGLFramebufferObject::texture() const
\sa takeTexture(), texture()
*/
-QVector<GLuint> QOpenGLFramebufferObject::textures() const
+QList<GLuint> QOpenGLFramebufferObject::textures() const
{
Q_D(const QOpenGLFramebufferObject);
- QVector<GLuint> ids;
+ QList<GLuint> ids;
if (d->format.samples() != 0)
return ids;
ids.reserve(d->colorAttachments.count());
@@ -1310,10 +1310,10 @@ QSize QOpenGLFramebufferObject::size() const
\since 5.6
*/
-QVector<QSize> QOpenGLFramebufferObject::sizes() const
+QList<QSize> QOpenGLFramebufferObject::sizes() const
{
Q_D(const QOpenGLFramebufferObject);
- QVector<QSize> sz;
+ QList<QSize> sz;
sz.reserve(d->colorAttachments.size());
for (const auto &color : d->colorAttachments)
sz.append(color.size);
diff --git a/src/opengl/qopenglframebufferobject.h b/src/opengl/qopenglframebufferobject.h
index da3347eaec..9351f6f1a6 100644
--- a/src/opengl/qopenglframebufferobject.h
+++ b/src/opengl/qopenglframebufferobject.h
@@ -100,13 +100,13 @@ public:
int height() const { return size().height(); }
GLuint texture() const;
- QVector<GLuint> textures() const;
+ QList<GLuint> textures() const;
GLuint takeTexture();
GLuint takeTexture(int colorAttachmentIndex);
QSize size() const;
- QVector<QSize> sizes() const;
+ QList<QSize> sizes() const;
QImage toImage() const;
QImage toImage(bool flipped) const;
diff --git a/src/opengl/qopenglframebufferobject_p.h b/src/opengl/qopenglframebufferobject_p.h
index 3721e2affa..2eb5936cb4 100644
--- a/src/opengl/qopenglframebufferobject_p.h
+++ b/src/opengl/qopenglframebufferobject_p.h
@@ -141,7 +141,7 @@ public:
GLenum internalFormat;
QOpenGLSharedResourceGuard *guard;
};
- QVector<ColorAttachment> colorAttachments;
+ QList<ColorAttachment> colorAttachments;
inline GLuint fbo() const { return fbo_guard ? fbo_guard->id() : 0; }
};
diff --git a/src/opengl/qopenglpaintengine_p.h b/src/opengl/qopenglpaintengine_p.h
index 9dc92e3810..1a5f82b313 100644
--- a/src/opengl/qopenglpaintengine_p.h
+++ b/src/opengl/qopenglpaintengine_p.h
@@ -306,7 +306,7 @@ public:
QOpenGL2PEXVertexArray vertexCoordinateArray;
QOpenGL2PEXVertexArray textureCoordinateArray;
- QVector<GLushort> elementIndices;
+ QList<GLushort> elementIndices;
GLuint elementIndicesVBOId;
QDataBuffer<GLfloat> opacityArray;
GLfloat staticVertexCoordinateArray[8];
@@ -332,8 +332,8 @@ public:
QTriangulatingStroker stroker;
QDashedStrokeProcessor dasher;
- QVector<GLuint> unusedVBOSToClean;
- QVector<GLuint> unusedIBOSToClean;
+ QList<GLuint> unusedVBOSToClean;
+ QList<GLuint> unusedIBOSToClean;
const GLfloat *vertexAttribPointers[3];
};
diff --git a/src/opengl/qopenglshaderprogram.cpp b/src/opengl/qopenglshaderprogram.cpp
index 968163fd4d..b786c82516 100644
--- a/src/opengl/qopenglshaderprogram.cpp
+++ b/src/opengl/qopenglshaderprogram.cpp
@@ -44,9 +44,9 @@
#include <QtCore/private/qobject_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qfile.h>
-#include <QtCore/qvarlengtharray.h>
-#include <QtCore/qvector.h>
+#include <QtCore/qlist.h>
#include <QtCore/qloggingcategory.h>
+#include <QtCore/qvarlengtharray.h>
#include <QtGui/private/qopenglprogrambinarycache_p.h>
#include <QtGui/qtransform.h>
#include <QtGui/QColor>
@@ -3552,7 +3552,7 @@ int QOpenGLShaderProgram::patchVertexCount() const
does not output them to \a levels. For more details on OpenGL and Tessellation
shaders see \l{OpenGL Tessellation Shaders}.
- The \a levels argument should be a QVector consisting of 4 floats. Not all
+ The \a levels argument should be a QList consisting of 4 floats. Not all
of the values make sense for all tessellation modes. If you specify a vector with
fewer than 4 elements, the remaining elements will be given a default value of 1.
@@ -3566,12 +3566,12 @@ int QOpenGLShaderProgram::patchVertexCount() const
\sa defaultOuterTessellationLevels(), setDefaultInnerTessellationLevels()
*/
-void QOpenGLShaderProgram::setDefaultOuterTessellationLevels(const QVector<float> &levels)
+void QOpenGLShaderProgram::setDefaultOuterTessellationLevels(const QList<float> &levels)
{
#if !QT_CONFIG(opengles2)
Q_D(QOpenGLShaderProgram);
if (d->tessellationFuncs) {
- QVector<float> tessLevels = levels;
+ QList<float> tessLevels = levels;
// Ensure we have the required 4 outer tessellation levels
// Use default of 1 for missing entries (same as spec)
@@ -3594,7 +3594,7 @@ void QOpenGLShaderProgram::setDefaultOuterTessellationLevels(const QVector<float
does not output them. For more details on OpenGL and Tessellation shaders see
\l{OpenGL Tessellation Shaders}.
- Returns a QVector of floats describing the outer tessellation levels. The vector
+ Returns a QList of floats describing the outer tessellation levels. The vector
will always have four elements but not all of them make sense for every mode
of tessellation.
@@ -3606,16 +3606,16 @@ void QOpenGLShaderProgram::setDefaultOuterTessellationLevels(const QVector<float
\sa setDefaultOuterTessellationLevels(), defaultInnerTessellationLevels()
*/
-QVector<float> QOpenGLShaderProgram::defaultOuterTessellationLevels() const
+QList<float> QOpenGLShaderProgram::defaultOuterTessellationLevels() const
{
#if !QT_CONFIG(opengles2)
- QVector<float> tessLevels(4, 1.0f);
+ QList<float> tessLevels(4, 1.0f);
Q_D(const QOpenGLShaderProgram);
if (d->tessellationFuncs)
d->tessellationFuncs->glGetFloatv(GL_PATCH_DEFAULT_OUTER_LEVEL, tessLevels.data());
return tessLevels;
#else
- return QVector<float>();
+ return QList<float>();
#endif
}
@@ -3625,7 +3625,7 @@ QVector<float> QOpenGLShaderProgram::defaultOuterTessellationLevels() const
does not output them to \a levels. For more details on OpenGL and Tessellation shaders see
\l{OpenGL Tessellation Shaders}.
- The \a levels argument should be a QVector consisting of 2 floats. Not all
+ The \a levels argument should be a QList consisting of 2 floats. Not all
of the values make sense for all tessellation modes. If you specify a vector with
fewer than 2 elements, the remaining elements will be given a default value of 1.
@@ -3639,12 +3639,12 @@ QVector<float> QOpenGLShaderProgram::defaultOuterTessellationLevels() const
\sa defaultInnerTessellationLevels(), setDefaultOuterTessellationLevels()
*/
-void QOpenGLShaderProgram::setDefaultInnerTessellationLevels(const QVector<float> &levels)
+void QOpenGLShaderProgram::setDefaultInnerTessellationLevels(const QList<float> &levels)
{
#if !QT_CONFIG(opengles2)
Q_D(QOpenGLShaderProgram);
if (d->tessellationFuncs) {
- QVector<float> tessLevels = levels;
+ QList<float> tessLevels = levels;
// Ensure we have the required 2 inner tessellation levels
// Use default of 1 for missing entries (same as spec)
@@ -3667,7 +3667,7 @@ void QOpenGLShaderProgram::setDefaultInnerTessellationLevels(const QVector<float
does not output them. For more details on OpenGL and Tessellation shaders see
\l{OpenGL Tessellation Shaders}.
- Returns a QVector of floats describing the inner tessellation levels. The vector
+ Returns a QList of floats describing the inner tessellation levels. The vector
will always have two elements but not all of them make sense for every mode
of tessellation.
@@ -3679,16 +3679,16 @@ void QOpenGLShaderProgram::setDefaultInnerTessellationLevels(const QVector<float
\sa setDefaultInnerTessellationLevels(), defaultOuterTessellationLevels()
*/
-QVector<float> QOpenGLShaderProgram::defaultInnerTessellationLevels() const
+QList<float> QOpenGLShaderProgram::defaultInnerTessellationLevels() const
{
#if !QT_CONFIG(opengles2)
- QVector<float> tessLevels(2, 1.0f);
+ QList<float> tessLevels(2, 1.0f);
Q_D(const QOpenGLShaderProgram);
if (d->tessellationFuncs)
d->tessellationFuncs->glGetFloatv(GL_PATCH_DEFAULT_INNER_LEVEL, tessLevels.data());
return tessLevels;
#else
- return QVector<float>();
+ return QList<float>();
#endif
}
diff --git a/src/opengl/qopenglshaderprogram.h b/src/opengl/qopenglshaderprogram.h
index 87da4fc072..4cbf7e0d3b 100644
--- a/src/opengl/qopenglshaderprogram.h
+++ b/src/opengl/qopenglshaderprogram.h
@@ -140,11 +140,11 @@ public:
void setPatchVertexCount(int count);
int patchVertexCount() const;
- void setDefaultOuterTessellationLevels(const QVector<float> &levels);
- QVector<float> defaultOuterTessellationLevels() const;
+ void setDefaultOuterTessellationLevels(const QList<float> &levels);
+ QList<float> defaultOuterTessellationLevels() const;
- void setDefaultInnerTessellationLevels(const QVector<float> &levels);
- QVector<float> defaultInnerTessellationLevels() const;
+ void setDefaultInnerTessellationLevels(const QList<float> &levels);
+ QList<float> defaultInnerTessellationLevels() const;
void bindAttributeLocation(const char *name, int location);
void bindAttributeLocation(const QByteArray& name, int location);
diff --git a/src/opengl/qopengltimerquery.cpp b/src/opengl/qopengltimerquery.cpp
index d5ef875efa..921a9f759f 100644
--- a/src/opengl/qopengltimerquery.cpp
+++ b/src/opengl/qopengltimerquery.cpp
@@ -487,12 +487,12 @@ public:
void destroy();
void recordSample();
bool isResultAvailable() const;
- QVector<GLuint64> samples() const;
- QVector<GLuint64> intervals() const;
+ QList<GLuint64> samples() const;
+ QList<GLuint64> intervals() const;
void reset();
- QVector<GLuint> timers;
- mutable QVector<GLuint64> timeSamples;
+ QList<GLuint> timers;
+ mutable QList<GLuint64> timeSamples;
QOpenGLContext *context;
QOpenGLQueryHelper *core;
@@ -596,7 +596,7 @@ bool QOpenGLTimeMonitorPrivate::isResultAvailable() const
return available;
}
-QVector<GLuint64> QOpenGLTimeMonitorPrivate::samples() const
+QList<GLuint64> QOpenGLTimeMonitorPrivate::samples() const
{
// For the Core and ARB options just ask for the timestamp for each timer query.
// For the EXT implementation we cannot obtain timestamps so we defer any result
@@ -611,12 +611,12 @@ QVector<GLuint64> QOpenGLTimeMonitorPrivate::samples() const
return timeSamples;
}
-QVector<GLuint64> QOpenGLTimeMonitorPrivate::intervals() const
+QList<GLuint64> QOpenGLTimeMonitorPrivate::intervals() const
{
- QVector<GLuint64> intervals(timers.size() - 1);
+ QList<GLuint64> intervals(timers.size() - 1);
if (!ext) {
// Obtain the timestamp samples and calculate the interval durations
- const QVector<GLuint64> timeStamps = samples();
+ const QList<GLuint64> timeStamps = samples();
for (int i = 0; i < intervals.size(); ++i)
intervals[i] = timeStamps[i+1] - timeStamps[i];
} else {
@@ -794,9 +794,9 @@ bool QOpenGLTimeMonitor::isCreated() const
}
/*!
- Returns a QVector containing the object Ids of the OpenGL timer query objects.
+ Returns a QList containing the object Ids of the OpenGL timer query objects.
*/
-QVector<GLuint> QOpenGLTimeMonitor::objectIds() const
+QList<GLuint> QOpenGLTimeMonitor::objectIds() const
{
Q_D(const QOpenGLTimeMonitor);
return d->timers;
@@ -829,7 +829,7 @@ bool QOpenGLTimeMonitor::isResultAvailable() const
}
/*!
- Returns a QVector containing the GPU timestamps taken with recordSample().
+ Returns a QList containing the GPU timestamps taken with recordSample().
This function will block until OpenGL indicates the results are available. It
is recommended to check the availability of the result prior to calling this
@@ -840,14 +840,14 @@ bool QOpenGLTimeMonitor::isResultAvailable() const
\sa waitForIntervals(), isResultAvailable()
*/
-QVector<GLuint64> QOpenGLTimeMonitor::waitForSamples() const
+QList<GLuint64> QOpenGLTimeMonitor::waitForSamples() const
{
Q_D(const QOpenGLTimeMonitor);
return d->samples();
}
/*!
- Returns a QVector containing the time intervals delimited by the calls to
+ Returns a QList containing the time intervals delimited by the calls to
recordSample(). The resulting vector will contain one fewer element as
this represents the intervening intervals rather than the actual timestamp
samples.
@@ -858,7 +858,7 @@ QVector<GLuint64> QOpenGLTimeMonitor::waitForSamples() const
\sa waitForSamples(), isResultAvailable()
*/
-QVector<GLuint64> QOpenGLTimeMonitor::waitForIntervals() const
+QList<GLuint64> QOpenGLTimeMonitor::waitForIntervals() const
{
Q_D(const QOpenGLTimeMonitor);
return d->intervals();
diff --git a/src/opengl/qopengltimerquery.h b/src/opengl/qopengltimerquery.h
index fa0e5b3203..a81c181b51 100644
--- a/src/opengl/qopengltimerquery.h
+++ b/src/opengl/qopengltimerquery.h
@@ -93,14 +93,14 @@ public:
bool create();
void destroy();
bool isCreated() const;
- QVector<GLuint> objectIds() const;
+ QList<GLuint> objectIds() const;
int recordSample();
bool isResultAvailable() const;
- QVector<GLuint64> waitForSamples() const;
- QVector<GLuint64> waitForIntervals() const;
+ QList<GLuint64> waitForSamples() const;
+ QList<GLuint64> waitForIntervals() const;
void reset();
diff --git a/src/opengl/qplatformbackingstoreopenglsupport.cpp b/src/opengl/qplatformbackingstoreopenglsupport.cpp
index a188d25db5..5a9b41dd29 100644
--- a/src/opengl/qplatformbackingstoreopenglsupport.cpp
+++ b/src/opengl/qplatformbackingstoreopenglsupport.cpp
@@ -94,7 +94,7 @@ static QRegion deviceRegion(const QRegion &region, QWindow *window, const QPoint
if (offset.isNull() && window->devicePixelRatio() <= 1)
return region;
- QVector<QRect> rects;
+ QList<QRect> rects;
rects.reserve(region.rectCount());
for (const QRect &rect : region)
rects.append(deviceRect(rect.translated(offset), window));