summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-06-29 16:46:59 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-07-03 14:05:35 +0200
commit914752257634dede18cc5079f2a506b699744058 (patch)
tree00ea67c3d0fc11b9688472061b7d870f9860534e /src
parent7beecb9913b25c4e7629cffad3389faea5608762 (diff)
GraphicsHelpers/GLShader: switch to std::vector
Change-Id: I8be6695e0c52dfbe353cd381d94548aba1c7da82 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp26
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h8
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp12
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp4
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h2
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h4
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp21
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h8
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp23
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h8
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp23
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h8
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp22
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h8
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h8
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h2
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp6
-rw-r--r--src/plugins/renderers/opengl/jobs/filtercompatibletechniquejob.cpp2
-rw-r--r--src/plugins/renderers/opengl/jobs/renderviewjobutils.cpp14
-rw-r--r--src/plugins/renderers/opengl/jobs/renderviewjobutils_p.h4
-rw-r--r--src/plugins/renderers/opengl/renderer/glshader.cpp94
-rw-r--r--src/plugins/renderers/opengl/renderer/glshader_p.h74
-rw-r--r--src/plugins/renderers/opengl/renderer/rendercommand_p.h2
-rw-r--r--src/plugins/renderers/opengl/renderer/renderer.cpp13
-rw-r--r--src/plugins/renderers/opengl/renderer/renderview.cpp12
-rw-r--r--src/render/backend/apishadermanager_p.h10
-rw-r--r--src/render/geometry/buffer_p.h4
-rw-r--r--src/render/materialsystem/shader.cpp4
-rw-r--r--src/render/materialsystem/shader_p.h4
-rw-r--r--src/render/materialsystem/techniquemanager.cpp6
-rw-r--r--src/render/materialsystem/techniquemanager_p.h4
-rw-r--r--src/render/renderstates/renderstateset.cpp2
-rw-r--r--src/render/renderstates/renderstateset_p.h6
33 files changed, 226 insertions, 222 deletions
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
index ef41f1770..58bb23a5f 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
@@ -196,9 +196,9 @@ void GraphicsHelperES2::useProgram(GLuint programId)
m_funcs->glUseProgram(programId);
}
-QVector<ShaderUniform> GraphicsHelperES2::programUniformsAndLocations(GLuint programId)
+std::vector<ShaderUniform> GraphicsHelperES2::programUniformsAndLocations(GLuint programId)
{
- QVector<ShaderUniform> uniforms;
+ std::vector<ShaderUniform> uniforms;
GLint nbrActiveUniforms = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_UNIFORMS, &nbrActiveUniforms);
@@ -218,14 +218,14 @@ QVector<ShaderUniform> GraphicsHelperES2::programUniformsAndLocations(GLuint pro
if (uniform.m_size > 1 && !uniform.m_name.endsWith(QLatin1String("[0]")))
uniform.m_name.append(QLatin1String("[0]"));
uniform.m_rawByteSize = uniformByteSize(uniform);
- uniforms.append(uniform);
+ uniforms.push_back(uniform);
}
return uniforms;
}
-QVector<ShaderAttribute> GraphicsHelperES2::programAttributesAndLocations(GLuint programId)
+std::vector<ShaderAttribute> GraphicsHelperES2::programAttributesAndLocations(GLuint programId)
{
- QVector<ShaderAttribute> attributes;
+ std::vector<ShaderAttribute> attributes;
GLint nbrActiveAttributes = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_ATTRIBUTES, &nbrActiveAttributes);
attributes.reserve(nbrActiveAttributes);
@@ -240,33 +240,31 @@ QVector<ShaderAttribute> GraphicsHelperES2::programAttributesAndLocations(GLuint
attributeName[sizeof(attributeName) - 1] = '\0';
attribute.m_location = m_funcs->glGetAttribLocation(programId, attributeName);
attribute.m_name = QString::fromUtf8(attributeName, attributeNameLength);
- attributes.append(attribute);
+ attributes.push_back(attribute);
}
return attributes;
}
-QVector<ShaderUniformBlock> GraphicsHelperES2::programUniformBlocks(GLuint programId)
+std::vector<ShaderUniformBlock> GraphicsHelperES2::programUniformBlocks(GLuint programId)
{
Q_UNUSED(programId);
- QVector<ShaderUniformBlock> blocks;
static bool showWarning = true;
if (!showWarning)
- return blocks;
+ return {};
showWarning = false;
qWarning() << "UBO are not supported by OpenGL ES 2.0 (since OpenGL ES 3.0)";
- return blocks;
+ return {};
}
-QVector<ShaderStorageBlock> GraphicsHelperES2::programShaderStorageBlocks(GLuint programId)
+std::vector<ShaderStorageBlock> GraphicsHelperES2::programShaderStorageBlocks(GLuint programId)
{
Q_UNUSED(programId);
- QVector<ShaderStorageBlock> blocks;
static bool showWarning = true;
if (!showWarning)
- return blocks;
+ return {};
showWarning = false;
qWarning() << "SSBO are not supported by OpenGL ES 2.0 (since OpenGL ES 3.1)";
- return blocks;
+ return {};
}
void GraphicsHelperES2::vertexAttribDivisor(GLuint index, GLuint divisor)
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
index 9f820c72b..dd38b8c3a 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
@@ -117,10 +117,10 @@ public:
void pointSize(bool programmable, GLfloat value) override;
GLint maxClipPlaneCount() override;
void memoryBarrier(QMemoryBarrier::Operations barriers) override;
- QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
- QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
- QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
- QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
+ std::vector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
+ std::vector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
+ std::vector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
+ std::vector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
void releaseFrameBufferObject(GLuint frameBufferId) override;
void setMSAAEnabled(bool enable) override;
void setAlphaCoverageEnabled(bool enable) override;
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp
index c4a68229c..8a516c110 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp
@@ -710,9 +710,9 @@ GLboolean GraphicsHelperES3::unmapBuffer(GLenum target)
return m_extraFuncs->glUnmapBuffer(target);
}
-QVector<ShaderUniform> GraphicsHelperES3::programUniformsAndLocations(GLuint programId)
+std::vector<ShaderUniform> GraphicsHelperES3::programUniformsAndLocations(GLuint programId)
{
- QVector<ShaderUniform> uniforms;
+ std::vector<ShaderUniform> uniforms;
GLint nbrActiveUniforms = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_UNIFORMS, &nbrActiveUniforms);
@@ -733,7 +733,7 @@ QVector<ShaderUniform> GraphicsHelperES3::programUniformsAndLocations(GLuint pro
m_extraFuncs->glGetActiveUniformsiv(programId, 1, (GLuint*)&i, GL_UNIFORM_ARRAY_STRIDE, &uniform.m_arrayStride);
m_extraFuncs->glGetActiveUniformsiv(programId, 1, (GLuint*)&i, GL_UNIFORM_MATRIX_STRIDE, &uniform.m_matrixStride);
uniform.m_rawByteSize = uniformByteSize(uniform);
- uniforms.append(uniform);
+ uniforms.push_back(uniform);
qCDebug(Rendering) << uniform.m_name << "size" << uniform.m_size
<< " offset" << uniform.m_offset
<< " rawSize" << uniform.m_rawByteSize;
@@ -742,9 +742,9 @@ QVector<ShaderUniform> GraphicsHelperES3::programUniformsAndLocations(GLuint pro
return uniforms;
}
-QVector<ShaderUniformBlock> GraphicsHelperES3::programUniformBlocks(GLuint programId)
+std::vector<ShaderUniformBlock> GraphicsHelperES3::programUniformBlocks(GLuint programId)
{
- QVector<ShaderUniformBlock> blocks;
+ std::vector<ShaderUniformBlock> blocks;
GLint nbrActiveUniformsBlocks = 0;
m_extraFuncs->glGetProgramiv(programId, GL_ACTIVE_UNIFORM_BLOCKS, &nbrActiveUniformsBlocks);
blocks.reserve(nbrActiveUniformsBlocks);
@@ -758,7 +758,7 @@ QVector<ShaderUniformBlock> GraphicsHelperES3::programUniformBlocks(GLuint progr
m_extraFuncs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &uniformBlock.m_activeUniformsCount);
m_extraFuncs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_BINDING, &uniformBlock.m_binding);
m_extraFuncs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_DATA_SIZE, &uniformBlock.m_size);
- blocks.append(uniformBlock);
+ blocks.push_back(uniformBlock);
}
return blocks;
}
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp
index 692e0880b..791906a5c 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp
@@ -260,9 +260,9 @@ void GraphicsHelperES3_1::bindShaderStorageBlock(GLuint , GLuint , GLuint )
qWarning() << "ES 3.1 has no bindShaderStorageBlock API, it uses binding declaration from the shader storage block";
}
-QVector<ShaderStorageBlock> GraphicsHelperES3_1::programShaderStorageBlocks(GLuint programId)
+std::vector<ShaderStorageBlock> GraphicsHelperES3_1::programShaderStorageBlocks(GLuint programId)
{
- QVector<ShaderStorageBlock> blocks;
+ std::vector<ShaderStorageBlock> blocks;
GLint nbrActiveShaderStorageBlocks = 0;
m_extraFuncs->glGetProgramInterfaceiv(programId, GL_SHADER_STORAGE_BLOCK, GL_ACTIVE_RESOURCES, &nbrActiveShaderStorageBlocks);
blocks.reserve(nbrActiveShaderStorageBlocks);
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h
index 408db0766..d3deb5b57 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h
@@ -72,7 +72,7 @@ public:
void drawArraysIndirect(GLenum mode,void *indirect) override;
void drawElementsIndirect(GLenum mode, GLenum type, void *indirect) override;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) override;
- QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
+ std::vector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
// QGraphicHelperInterface interface
UniformType uniformTypeFromGLType(GLenum glType) override;
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h
index 5c34a8abb..66c674421 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h
@@ -81,8 +81,8 @@ public:
void drawBuffer(GLenum mode) override;
void initializeHelper(QOpenGLContext *context, QAbstractOpenGLFunctions *functions) override;
char *mapBuffer(GLenum target, GLsizeiptr size) override;
- QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
- QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
+ std::vector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
+ std::vector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
bool supportsFeature(Feature feature) const override;
GLboolean unmapBuffer(GLenum target) override;
void vertexAttribDivisor(GLuint index, GLuint divisor) override;
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
index 120e9e655..e8213015f 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
@@ -156,9 +156,9 @@ void GraphicsHelperGL2::useProgram(GLuint programId)
m_funcs->glUseProgram(programId);
}
-QVector<ShaderUniform> GraphicsHelperGL2::programUniformsAndLocations(GLuint programId)
+std::vector<ShaderUniform> GraphicsHelperGL2::programUniformsAndLocations(GLuint programId)
{
- QVector<ShaderUniform> uniforms;
+ std::vector<ShaderUniform> uniforms;
GLint nbrActiveUniforms = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_UNIFORMS, &nbrActiveUniforms);
@@ -178,14 +178,14 @@ QVector<ShaderUniform> GraphicsHelperGL2::programUniformsAndLocations(GLuint pro
if (uniform.m_size > 1 && !uniform.m_name.endsWith(QLatin1String("[0]")))
uniform.m_name.append(QLatin1String("[0]"));
uniform.m_rawByteSize = uniformByteSize(uniform);
- uniforms.append(uniform);
+ uniforms.push_back(uniform);
}
return uniforms;
}
-QVector<ShaderAttribute> GraphicsHelperGL2::programAttributesAndLocations(GLuint programId)
+std::vector<ShaderAttribute> GraphicsHelperGL2::programAttributesAndLocations(GLuint programId)
{
- QVector<ShaderAttribute> attributes;
+ std::vector<ShaderAttribute> attributes;
GLint nbrActiveAttributes = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_ATTRIBUTES, &nbrActiveAttributes);
attributes.reserve(nbrActiveAttributes);
@@ -200,24 +200,23 @@ QVector<ShaderAttribute> GraphicsHelperGL2::programAttributesAndLocations(GLuint
attributeName[sizeof(attributeName) - 1] = '\0';
attribute.m_location = m_funcs->glGetAttribLocation(programId, attributeName);
attribute.m_name = QString::fromUtf8(attributeName, attributeNameLength);
- attributes.append(attribute);
+ attributes.push_back(attribute);
}
return attributes;
}
-QVector<ShaderUniformBlock> GraphicsHelperGL2::programUniformBlocks(GLuint programId)
+std::vector<ShaderUniformBlock> GraphicsHelperGL2::programUniformBlocks(GLuint programId)
{
Q_UNUSED(programId);
- QVector<ShaderUniformBlock> blocks;
qWarning() << "UBO are not supported by OpenGL 2.0 (since OpenGL 3.1)";
- return blocks;
+ return {};
}
-QVector<ShaderStorageBlock> GraphicsHelperGL2::programShaderStorageBlocks(GLuint programId)
+std::vector<ShaderStorageBlock> GraphicsHelperGL2::programShaderStorageBlocks(GLuint programId)
{
Q_UNUSED(programId);
qWarning() << "SSBO are not supported by OpenGL 2.0 (since OpenGL 4.3)";
- return QVector<ShaderStorageBlock>();
+ return {};
}
void GraphicsHelperGL2::vertexAttribDivisor(GLuint index,
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
index f6ab6c409..24ddc72f7 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
@@ -117,10 +117,10 @@ public:
void pointSize(bool programmable, GLfloat value) override;
GLint maxClipPlaneCount() override;
void memoryBarrier(QMemoryBarrier::Operations barriers) override;
- QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
- QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
- QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
- QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
+ std::vector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
+ std::vector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
+ std::vector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
+ std::vector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
void releaseFrameBufferObject(GLuint frameBufferId) override;
void setMSAAEnabled(bool enable) override;
void setAlphaCoverageEnabled(bool enable) override;
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
index 4b82af0ba..5f9d2b9db 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
@@ -175,9 +175,9 @@ void GraphicsHelperGL3_2::useProgram(GLuint programId)
m_funcs->glUseProgram(programId);
}
-QVector<ShaderUniform> GraphicsHelperGL3_2::programUniformsAndLocations(GLuint programId)
+std::vector<ShaderUniform> GraphicsHelperGL3_2::programUniformsAndLocations(GLuint programId)
{
- QVector<ShaderUniform> uniforms;
+ std::vector<ShaderUniform> uniforms;
GLint nbrActiveUniforms = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_UNIFORMS, &nbrActiveUniforms);
@@ -201,7 +201,7 @@ QVector<ShaderUniform> GraphicsHelperGL3_2::programUniformsAndLocations(GLuint p
m_funcs->glGetActiveUniformsiv(programId, 1, (GLuint*)&i, GL_UNIFORM_ARRAY_STRIDE, &uniform.m_arrayStride);
m_funcs->glGetActiveUniformsiv(programId, 1, (GLuint*)&i, GL_UNIFORM_MATRIX_STRIDE, &uniform.m_matrixStride);
uniform.m_rawByteSize = uniformByteSize(uniform);
- uniforms.append(uniform);
+ uniforms.push_back(uniform);
qCDebug(Rendering) << uniform.m_name << "size" << uniform.m_size
<< " offset" << uniform.m_offset
<< " rawSize" << uniform.m_rawByteSize;
@@ -210,9 +210,9 @@ QVector<ShaderUniform> GraphicsHelperGL3_2::programUniformsAndLocations(GLuint p
return uniforms;
}
-QVector<ShaderAttribute> GraphicsHelperGL3_2::programAttributesAndLocations(GLuint programId)
+std::vector<ShaderAttribute> GraphicsHelperGL3_2::programAttributesAndLocations(GLuint programId)
{
- QVector<ShaderAttribute> attributes;
+ std::vector<ShaderAttribute> attributes;
GLint nbrActiveAttributes = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_ATTRIBUTES, &nbrActiveAttributes);
attributes.reserve(nbrActiveAttributes);
@@ -227,14 +227,14 @@ QVector<ShaderAttribute> GraphicsHelperGL3_2::programAttributesAndLocations(GLui
attributeName[sizeof(attributeName) - 1] = '\0';
attribute.m_location = m_funcs->glGetAttribLocation(programId, attributeName);
attribute.m_name = QString::fromUtf8(attributeName, attributeNameLength);
- attributes.append(attribute);
+ attributes.push_back(attribute);
}
return attributes;
}
-QVector<ShaderUniformBlock> GraphicsHelperGL3_2::programUniformBlocks(GLuint programId)
+std::vector<ShaderUniformBlock> GraphicsHelperGL3_2::programUniformBlocks(GLuint programId)
{
- QVector<ShaderUniformBlock> blocks;
+ std::vector<ShaderUniformBlock> blocks;
GLint nbrActiveUniformsBlocks = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_UNIFORM_BLOCKS, &nbrActiveUniformsBlocks);
blocks.reserve(nbrActiveUniformsBlocks);
@@ -248,17 +248,16 @@ QVector<ShaderUniformBlock> GraphicsHelperGL3_2::programUniformBlocks(GLuint pro
m_funcs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &uniformBlock.m_activeUniformsCount);
m_funcs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_BINDING, &uniformBlock.m_binding);
m_funcs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_DATA_SIZE, &uniformBlock.m_size);
- blocks.append(uniformBlock);
+ blocks.push_back(uniformBlock);
}
return blocks;
}
-QVector<ShaderStorageBlock> GraphicsHelperGL3_2::programShaderStorageBlocks(GLuint programId)
+std::vector<ShaderStorageBlock> GraphicsHelperGL3_2::programShaderStorageBlocks(GLuint programId)
{
Q_UNUSED(programId);
- QVector<ShaderStorageBlock> blocks;
qWarning() << "SSBO are not supported by OpenGL 3.2 (since OpenGL 4.3)";
- return blocks;
+ return {};
}
void GraphicsHelperGL3_2::vertexAttribDivisor(GLuint index, GLuint divisor)
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
index ea8c11d0b..7cc5c838d 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
@@ -118,10 +118,10 @@ public:
void pointSize(bool programmable, GLfloat value) override;
GLint maxClipPlaneCount() override;
void memoryBarrier(QMemoryBarrier::Operations barriers) override;
- QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
- QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
- QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
- QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
+ std::vector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
+ std::vector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
+ std::vector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
+ std::vector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
void releaseFrameBufferObject(GLuint frameBufferId) override;
void setMSAAEnabled(bool enable) override;
void setAlphaCoverageEnabled(bool enable) override;
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
index 6aaa2d7ff..ff82ae587 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
@@ -174,9 +174,9 @@ void GraphicsHelperGL3_3::useProgram(GLuint programId)
m_funcs->glUseProgram(programId);
}
-QVector<ShaderUniform> GraphicsHelperGL3_3::programUniformsAndLocations(GLuint programId)
+std::vector<ShaderUniform> GraphicsHelperGL3_3::programUniformsAndLocations(GLuint programId)
{
- QVector<ShaderUniform> uniforms;
+ std::vector<ShaderUniform> uniforms;
GLint nbrActiveUniforms = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_UNIFORMS, &nbrActiveUniforms);
@@ -200,7 +200,7 @@ QVector<ShaderUniform> GraphicsHelperGL3_3::programUniformsAndLocations(GLuint p
m_funcs->glGetActiveUniformsiv(programId, 1, (GLuint*)&i, GL_UNIFORM_ARRAY_STRIDE, &uniform.m_arrayStride);
m_funcs->glGetActiveUniformsiv(programId, 1, (GLuint*)&i, GL_UNIFORM_MATRIX_STRIDE, &uniform.m_matrixStride);
uniform.m_rawByteSize = uniformByteSize(uniform);
- uniforms.append(uniform);
+ uniforms.push_back(uniform);
qCDebug(Rendering) << uniform.m_name << "size" << uniform.m_size
<< " offset" << uniform.m_offset
<< " rawSize" << uniform.m_rawByteSize;
@@ -209,9 +209,9 @@ QVector<ShaderUniform> GraphicsHelperGL3_3::programUniformsAndLocations(GLuint p
return uniforms;
}
-QVector<ShaderAttribute> GraphicsHelperGL3_3::programAttributesAndLocations(GLuint programId)
+std::vector<ShaderAttribute> GraphicsHelperGL3_3::programAttributesAndLocations(GLuint programId)
{
- QVector<ShaderAttribute> attributes;
+ std::vector<ShaderAttribute> attributes;
GLint nbrActiveAttributes = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_ATTRIBUTES, &nbrActiveAttributes);
attributes.reserve(nbrActiveAttributes);
@@ -226,14 +226,14 @@ QVector<ShaderAttribute> GraphicsHelperGL3_3::programAttributesAndLocations(GLui
attributeName[sizeof(attributeName) - 1] = '\0';
attribute.m_location = m_funcs->glGetAttribLocation(programId, attributeName);
attribute.m_name = QString::fromUtf8(attributeName, attributeNameLength);
- attributes.append(attribute);
+ attributes.push_back(attribute);
}
return attributes;
}
-QVector<ShaderUniformBlock> GraphicsHelperGL3_3::programUniformBlocks(GLuint programId)
+std::vector<ShaderUniformBlock> GraphicsHelperGL3_3::programUniformBlocks(GLuint programId)
{
- QVector<ShaderUniformBlock> blocks;
+ std::vector<ShaderUniformBlock> blocks;
GLint nbrActiveUniformsBlocks = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_UNIFORM_BLOCKS, &nbrActiveUniformsBlocks);
blocks.reserve(nbrActiveUniformsBlocks);
@@ -247,17 +247,16 @@ QVector<ShaderUniformBlock> GraphicsHelperGL3_3::programUniformBlocks(GLuint pro
m_funcs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &uniformBlock.m_activeUniformsCount);
m_funcs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_BINDING, &uniformBlock.m_binding);
m_funcs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_DATA_SIZE, &uniformBlock.m_size);
- blocks.append(uniformBlock);
+ blocks.push_back(uniformBlock);
}
return blocks;
}
-QVector<ShaderStorageBlock> GraphicsHelperGL3_3::programShaderStorageBlocks(GLuint programId)
+std::vector<ShaderStorageBlock> GraphicsHelperGL3_3::programShaderStorageBlocks(GLuint programId)
{
Q_UNUSED(programId);
- QVector<ShaderStorageBlock> blocks;
qWarning() << "SSBO are not supported by OpenGL 3.3 (since OpenGL 4.3)";
- return blocks;
+ return {};
}
void GraphicsHelperGL3_3::vertexAttribDivisor(GLuint index, GLuint divisor)
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
index 31f2b5383..c3f94d3d2 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
@@ -118,10 +118,10 @@ public:
void pointSize(bool programmable, GLfloat value) override;
GLint maxClipPlaneCount() override;
void memoryBarrier(QMemoryBarrier::Operations barriers) override;
- QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
- QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
- QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
- QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
+ std::vector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
+ std::vector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
+ std::vector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
+ std::vector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
void releaseFrameBufferObject(GLuint frameBufferId) override;
void setMSAAEnabled(bool enable) override;
void setAlphaCoverageEnabled(bool enable) override;
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
index 5bd1e03e4..cfefa9917 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
@@ -264,9 +264,9 @@ void GraphicsHelperGL4::useProgram(GLuint programId)
m_funcs->glUseProgram(programId);
}
-QVector<ShaderUniform> GraphicsHelperGL4::programUniformsAndLocations(GLuint programId)
+std::vector<ShaderUniform> GraphicsHelperGL4::programUniformsAndLocations(GLuint programId)
{
- QVector<ShaderUniform> uniforms;
+ std::vector<ShaderUniform> uniforms;
GLint nbrActiveUniforms = 0;
m_funcs->glGetProgramInterfaceiv(programId, GL_UNIFORM, GL_ACTIVE_RESOURCES, &nbrActiveUniforms);
@@ -290,7 +290,7 @@ QVector<ShaderUniform> GraphicsHelperGL4::programUniformsAndLocations(GLuint pro
m_funcs->glGetActiveUniformsiv(programId, 1, (GLuint*)&i, GL_UNIFORM_ARRAY_STRIDE, &uniform.m_arrayStride);
m_funcs->glGetActiveUniformsiv(programId, 1, (GLuint*)&i, GL_UNIFORM_MATRIX_STRIDE, &uniform.m_matrixStride);
uniform.m_rawByteSize = uniformByteSize(uniform);
- uniforms.append(uniform);
+ uniforms.push_back(uniform);
qCDebug(Rendering) << uniform.m_name << "size" << uniform.m_size
<< " offset" << uniform.m_offset
<< " rawSize" << uniform.m_rawByteSize;
@@ -299,9 +299,9 @@ QVector<ShaderUniform> GraphicsHelperGL4::programUniformsAndLocations(GLuint pro
return uniforms;
}
-QVector<ShaderAttribute> GraphicsHelperGL4::programAttributesAndLocations(GLuint programId)
+std::vector<ShaderAttribute> GraphicsHelperGL4::programAttributesAndLocations(GLuint programId)
{
- QVector<ShaderAttribute> attributes;
+ std::vector<ShaderAttribute> attributes;
GLint nbrActiveAttributes = 0;
m_funcs->glGetProgramiv(programId, GL_ACTIVE_ATTRIBUTES, &nbrActiveAttributes);
attributes.reserve(nbrActiveAttributes);
@@ -316,14 +316,14 @@ QVector<ShaderAttribute> GraphicsHelperGL4::programAttributesAndLocations(GLuint
attributeName[sizeof(attributeName) - 1] = '\0';
attribute.m_location = m_funcs->glGetAttribLocation(programId, attributeName);
attribute.m_name = QString::fromUtf8(attributeName, attributeNameLength);
- attributes.append(attribute);
+ attributes.push_back(attribute);
}
return attributes;
}
-QVector<ShaderUniformBlock> GraphicsHelperGL4::programUniformBlocks(GLuint programId)
+std::vector<ShaderUniformBlock> GraphicsHelperGL4::programUniformBlocks(GLuint programId)
{
- QVector<ShaderUniformBlock> blocks;
+ std::vector<ShaderUniformBlock> blocks;
GLint nbrActiveUniformsBlocks = 0;
m_funcs->glGetProgramInterfaceiv(programId, GL_UNIFORM_BLOCK, GL_ACTIVE_RESOURCES, &nbrActiveUniformsBlocks);
blocks.reserve(nbrActiveUniformsBlocks);
@@ -340,14 +340,14 @@ QVector<ShaderUniformBlock> GraphicsHelperGL4::programUniformBlocks(GLuint progr
m_funcs->glGetProgramResourceiv(programId, GL_UNIFORM_BLOCK, i, 1, &prop, 4, NULL, &uniformBlock.m_size);
prop = GL_NUM_ACTIVE_VARIABLES;
m_funcs->glGetProgramResourceiv(programId, GL_UNIFORM_BLOCK, i, 1, &prop, 4, NULL, &uniformBlock.m_activeUniformsCount);
- blocks.append(uniformBlock);
+ blocks.push_back(uniformBlock);
}
return blocks;
}
-QVector<ShaderStorageBlock> GraphicsHelperGL4::programShaderStorageBlocks(GLuint programId)
+std::vector<ShaderStorageBlock> GraphicsHelperGL4::programShaderStorageBlocks(GLuint programId)
{
- QVector<ShaderStorageBlock> blocks;
+ std::vector<ShaderStorageBlock> blocks;
GLint nbrActiveShaderStorageBlocks = 0;
m_funcs->glGetProgramInterfaceiv(programId, GL_SHADER_STORAGE_BLOCK, GL_ACTIVE_RESOURCES, &nbrActiveShaderStorageBlocks);
blocks.reserve(nbrActiveShaderStorageBlocks);
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
index 8d3e8f957..5941d8a52 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
@@ -117,10 +117,10 @@ public:
void pointSize(bool programmable, GLfloat value) override;
GLint maxClipPlaneCount() override;
void memoryBarrier(QMemoryBarrier::Operations barriers) override;
- QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
- QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
- QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
- QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
+ std::vector<ShaderUniformBlock> programUniformBlocks(GLuint programId) override;
+ std::vector<ShaderAttribute> programAttributesAndLocations(GLuint programId) override;
+ std::vector<ShaderUniform> programUniformsAndLocations(GLuint programId) override;
+ std::vector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) override;
void releaseFrameBufferObject(GLuint frameBufferId) override;
void setMSAAEnabled(bool enable) override;
void setAlphaCoverageEnabled(bool enable) override;
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
index b574c34a1..11d501e03 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
@@ -145,10 +145,10 @@ public:
virtual GLint maxClipPlaneCount() = 0;
virtual void memoryBarrier(QMemoryBarrier::Operations barriers) = 0;
virtual void pointSize(bool programmable, GLfloat value) = 0;
- virtual QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) = 0;
- virtual QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) = 0;
- virtual QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) = 0;
- virtual QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) = 0;
+ virtual std::vector<ShaderAttribute> programAttributesAndLocations(GLuint programId) = 0;
+ virtual std::vector<ShaderUniform> programUniformsAndLocations(GLuint programId) = 0;
+ virtual std::vector<ShaderUniformBlock> programUniformBlocks(GLuint programId) = 0;
+ virtual std::vector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) = 0;
virtual void releaseFrameBufferObject(GLuint frameBufferId) = 0;
virtual void setAlphaCoverageEnabled(bool enable) = 0;
virtual void setClipPlane(int clipPlane, const QVector3D &normal, float distance) = 0;
diff --git a/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h b/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h
index 52a0152f8..71e224942 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h
@@ -86,7 +86,7 @@ private:
int score = 0;
bool pinned = false;
};
- QVector<ActiveImage> m_activeImages;
+ std::vector<ActiveImage> m_activeImages;
GraphicsContext *m_ctx;
};
diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
index 2e83752cd..7e133ec5c 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -1150,7 +1150,7 @@ void SubmissionContext::applyStateSet(RenderStateSet *ss)
// Apply states that weren't in the previous state or that have
// different values
- const QVector<StateVariant> statesToSet = ss->states();
+ const std::vector<StateVariant> statesToSet = ss->states();
for (const StateVariant &ds : statesToSet) {
if (previousStates && previousStates->contains(ds))
continue;
@@ -1321,7 +1321,7 @@ bool SubmissionContext::setParameters(ShaderParameterPack &parameterPack, GLShad
// Update uniforms in the Default Uniform Block
const PackUniformHash& values = parameterPack.uniforms();
const auto &activeUniformsIndices = parameterPack.submissionUniformIndices();
- const QVector<ShaderUniform> &shaderUniforms = shader->uniforms();
+ const std::vector<ShaderUniform> &shaderUniforms = shader->uniforms();
for (const int shaderUniformIndex : activeUniformsIndices) {
const ShaderUniform &uniform = shaderUniforms[shaderUniformIndex];
@@ -1512,7 +1512,7 @@ void SubmissionContext::uploadDataToGLBuffer(Buffer *buffer, GLBuffer *b, bool r
// * partial buffer updates where received
// TO DO: Handle usage pattern
- QVector<Qt3DCore::QBufferUpdate> updates = std::move(buffer->pendingBufferUpdates());
+ std::vector<Qt3DCore::QBufferUpdate> updates = std::move(buffer->pendingBufferUpdates());
for (auto it = updates.begin(); it != updates.end(); ++it) {
auto update = it;
// We have a partial update
diff --git a/src/plugins/renderers/opengl/jobs/filtercompatibletechniquejob.cpp b/src/plugins/renderers/opengl/jobs/filtercompatibletechniquejob.cpp
index 52fd99f52..e8f5f0c00 100644
--- a/src/plugins/renderers/opengl/jobs/filtercompatibletechniquejob.cpp
+++ b/src/plugins/renderers/opengl/jobs/filtercompatibletechniquejob.cpp
@@ -82,7 +82,7 @@ void FilterCompatibleTechniqueJob::run()
Q_ASSERT(m_manager != nullptr && m_renderer != nullptr);
Q_ASSERT(m_renderer->isRunning() && m_renderer->submissionContext()->isInitialized());
- const QVector<Qt3DCore::QNodeId> dirtyTechniqueIds = m_manager->takeDirtyTechniques();
+ const std::vector<Qt3DCore::QNodeId> dirtyTechniqueIds = m_manager->takeDirtyTechniques();
for (const Qt3DCore::QNodeId techniqueId : dirtyTechniqueIds) {
Technique *technique = m_manager->lookupResource(techniqueId);
if (Q_LIKELY(technique != nullptr))
diff --git a/src/plugins/renderers/opengl/jobs/renderviewjobutils.cpp b/src/plugins/renderers/opengl/jobs/renderviewjobutils.cpp
index 3a7777170..3758d959c 100644
--- a/src/plugins/renderers/opengl/jobs/renderviewjobutils.cpp
+++ b/src/plugins/renderers/opengl/jobs/renderviewjobutils.cpp
@@ -313,7 +313,7 @@ Technique *findTechniqueForEffect(NodeManagers *manager,
if (!effect)
return nullptr;
- QVector<Technique*> matchingTechniques;
+ std::vector<Technique*> matchingTechniques;
const bool hasInvalidTechniqueFilter = (techniqueFilter == nullptr || techniqueFilter->filters().isEmpty());
// Iterate through the techniques in the effect
@@ -327,17 +327,17 @@ Technique *findTechniqueForEffect(NodeManagers *manager,
// Check if the technique is compatible with the rendering API
// If no techniqueFilter is present, we return the technique as it satisfies OpenGL version
if (technique->isCompatibleWithRenderer() && (hasInvalidTechniqueFilter || technique->isCompatibleWithFilters(techniqueFilter->filters())))
- matchingTechniques.append(technique);
+ matchingTechniques.push_back(technique);
}
if (matchingTechniques.size() == 0) // We failed to find a suitable technique to use :(
return nullptr;
if (matchingTechniques.size() == 1)
- return matchingTechniques.first();
+ return matchingTechniques.front();
// Several compatible techniques, return technique with highest major and minor version
- Technique* highest = matchingTechniques.first();
+ Technique* highest = matchingTechniques.front();
GraphicsApiFilterData filter = *highest->graphicsApiFilter();
for (auto it = matchingTechniques.cbegin() + 1; it < matchingTechniques.cend(); ++it) {
if (filter < *(*it)->graphicsApiFilter()) {
@@ -459,7 +459,7 @@ const int qNodeIdTypeId = qMetaTypeId<QNodeId>();
}
UniformBlockValueBuilder::UniformBlockValueBuilder(
- const QVector<int> &uniformNamesIds,
+ const std::vector<int> &uniformNamesIds,
ShaderDataManager *shaderDataManager,
TextureManager *textureManager,
const Matrix4x4 &matrix)
@@ -494,7 +494,7 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const Shader
}
}
} else { // Array of scalar/vec qmlPropertyName[0]
- if (m_uniformNamesIds.contains(propertyInBlockNameId)) {
+ if (std::find(m_uniformNamesIds.begin(), m_uniformNamesIds.end(), propertyInBlockNameId) != m_uniformNamesIds.end()) {
activeUniformNamesToValue.insert(propertyInBlockNameId, value->value);
}
}
@@ -509,7 +509,7 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const Shader
activeUniformNamesToValue.insert(propertyInBlockNameId, value->value);
}
} else { // Scalar / Vec
- if (m_uniformNamesIds.contains(propertyInBlockNameId)) {
+ if (std::find(m_uniformNamesIds.begin(), m_uniformNamesIds.end(), propertyInBlockNameId) != m_uniformNamesIds.end()) {
// If the property needs to be transformed, we transform it here as
// the shaderdata cannot hold transformed properties for multiple
// thread contexts at once
diff --git a/src/plugins/renderers/opengl/jobs/renderviewjobutils_p.h b/src/plugins/renderers/opengl/jobs/renderviewjobutils_p.h
index 05fb865ea..5ebbe7158 100644
--- a/src/plugins/renderers/opengl/jobs/renderviewjobutils_p.h
+++ b/src/plugins/renderers/opengl/jobs/renderviewjobutils_p.h
@@ -156,7 +156,7 @@ typedef QHash<int, QVariant> UniformBlockValueBuilderHash;
struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder
{
- explicit UniformBlockValueBuilder(const QVector<int> &uniformNamesIds,
+ explicit UniformBlockValueBuilder(const std::vector<int> &uniformNamesIds,
ShaderDataManager *shaderDataManager,
TextureManager *textureManager,
const Matrix4x4 &matrix);
@@ -173,7 +173,7 @@ struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder
UniformBlockValueBuilderHash activeUniformNamesToValue;
private:
- const QVector<int> &m_uniformNamesIds;
+ const std::vector<int> &m_uniformNamesIds;
ShaderDataManager *m_shaderDataManager = nullptr;
TextureManager *m_textureManager = nullptr;
const Matrix4x4 &m_viewMatrix;
diff --git a/src/plugins/renderers/opengl/renderer/glshader.cpp b/src/plugins/renderers/opengl/renderer/glshader.cpp
index 55a711921..f9f2a99b8 100644
--- a/src/plugins/renderers/opengl/renderer/glshader.cpp
+++ b/src/plugins/renderers/opengl/renderer/glshader.cpp
@@ -54,31 +54,31 @@ namespace OpenGL {
namespace {
-QVector<int> getLightUniformNameIds()
+std::vector<int> getLightUniformNameIds()
{
- QVector<int> names;
+ std::vector<int> names;
names.reserve(MAX_LIGHTS * 18 + 1);
- names << GLLights::LIGHT_COUNT_NAME_ID;
+ names.push_back(GLLights::LIGHT_COUNT_NAME_ID);
for (int i = 0; i < MAX_LIGHTS; ++i) {
- names << GLLights::LIGHT_TYPE_NAMES[i]
- << GLLights::LIGHT_COLOR_NAMES[i]
- << GLLights::LIGHT_POSITION_NAMES[i]
- << GLLights::LIGHT_INTENSITY_NAMES[i]
- << GLLights::LIGHT_DIRECTION_NAMES[i]
- << GLLights::LIGHT_LINEAR_ATTENUATION_NAMES[i]
- << GLLights::LIGHT_QUADRATIC_ATTENUATION_NAMES[i]
- << GLLights::LIGHT_CONSTANT_ATTENUATION_NAMES[i]
- << GLLights::LIGHT_CUT_OFF_ANGLE_NAMES[i]
- << GLLights::LIGHT_TYPE_UNROLL_NAMES[i]
- << GLLights::LIGHT_COLOR_UNROLL_NAMES[i]
- << GLLights::LIGHT_POSITION_UNROLL_NAMES[i]
- << GLLights::LIGHT_INTENSITY_UNROLL_NAMES[i]
- << GLLights::LIGHT_DIRECTION_UNROLL_NAMES[i]
- << GLLights::LIGHT_LINEAR_ATTENUATION_UNROLL_NAMES[i]
- << GLLights::LIGHT_QUADRATIC_ATTENUATION_UNROLL_NAMES[i]
- << GLLights::LIGHT_CONSTANT_ATTENUATION_UNROLL_NAMES[i]
- << GLLights::LIGHT_CUT_OFF_ANGLE_UNROLL_NAMES[i];
+ names.push_back(GLLights::LIGHT_TYPE_NAMES[i]);
+ names.push_back(GLLights::LIGHT_COLOR_NAMES[i]);
+ names.push_back(GLLights::LIGHT_POSITION_NAMES[i]);
+ names.push_back(GLLights::LIGHT_INTENSITY_NAMES[i]);
+ names.push_back(GLLights::LIGHT_DIRECTION_NAMES[i]);
+ names.push_back(GLLights::LIGHT_LINEAR_ATTENUATION_NAMES[i]);
+ names.push_back(GLLights::LIGHT_QUADRATIC_ATTENUATION_NAMES[i]);
+ names.push_back(GLLights::LIGHT_CONSTANT_ATTENUATION_NAMES[i]);
+ names.push_back(GLLights::LIGHT_CUT_OFF_ANGLE_NAMES[i]);
+ names.push_back(GLLights::LIGHT_TYPE_UNROLL_NAMES[i]);
+ names.push_back(GLLights::LIGHT_COLOR_UNROLL_NAMES[i]);
+ names.push_back(GLLights::LIGHT_POSITION_UNROLL_NAMES[i]);
+ names.push_back(GLLights::LIGHT_INTENSITY_UNROLL_NAMES[i]);
+ names.push_back(GLLights::LIGHT_DIRECTION_UNROLL_NAMES[i]);
+ names.push_back(GLLights::LIGHT_LINEAR_ATTENUATION_UNROLL_NAMES[i]);
+ names.push_back(GLLights::LIGHT_QUADRATIC_ATTENUATION_UNROLL_NAMES[i]);
+ names.push_back(GLLights::LIGHT_CONSTANT_ATTENUATION_UNROLL_NAMES[i]);
+ names.push_back(GLLights::LIGHT_CUT_OFF_ANGLE_UNROLL_NAMES[i]);
}
return names;
@@ -125,27 +125,27 @@ GraphicsContext *GLShader::graphicsContext()
}
-QVector<QString> GLShader::uniformsNames() const
+std::vector<QString> GLShader::uniformsNames() const
{
return m_uniformsNames;
}
-QVector<QString> GLShader::attributesNames() const
+std::vector<QString> GLShader::attributesNames() const
{
return m_attributesNames;
}
-QVector<QString> GLShader::uniformBlockNames() const
+std::vector<QString> GLShader::uniformBlockNames() const
{
return m_uniformBlockNames;
}
-QVector<QString> GLShader::storageBlockNames() const
+std::vector<QString> GLShader::storageBlockNames() const
{
return m_shaderStorageBlockNames;
}
-QVector<QByteArray> GLShader::shaderCode() const
+std::vector<QByteArray> GLShader::shaderCode() const
{
return m_shaderCode;
}
@@ -157,7 +157,7 @@ QHash<QString, ShaderUniform> GLShader::activeUniformsForUniformBlock(int blockI
ShaderUniformBlock GLShader::uniformBlockForBlockIndex(int blockIndex) const noexcept
{
- for (int i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
if (m_uniformBlocks[i].m_index == blockIndex) {
return m_uniformBlocks[i];
}
@@ -167,7 +167,7 @@ ShaderUniformBlock GLShader::uniformBlockForBlockIndex(int blockIndex) const noe
ShaderUniformBlock GLShader::uniformBlockForBlockNameId(int blockNameId) const noexcept
{
- for (int i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
if (m_uniformBlocks[i].m_nameId == blockNameId) {
return m_uniformBlocks[i];
}
@@ -177,7 +177,7 @@ ShaderUniformBlock GLShader::uniformBlockForBlockNameId(int blockNameId) const n
ShaderUniformBlock GLShader::uniformBlockForBlockName(const QString &blockName) const noexcept
{
- for (int i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
if (m_uniformBlocks[i].m_name == blockName) {
return m_uniformBlocks[i];
}
@@ -187,7 +187,7 @@ ShaderUniformBlock GLShader::uniformBlockForBlockName(const QString &blockName)
ShaderStorageBlock GLShader::storageBlockForBlockIndex(int blockIndex) const noexcept
{
- for (int i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
if (m_shaderStorageBlocks[i].m_index == blockIndex)
return m_shaderStorageBlocks[i];
}
@@ -196,7 +196,7 @@ ShaderStorageBlock GLShader::storageBlockForBlockIndex(int blockIndex) const noe
ShaderStorageBlock GLShader::storageBlockForBlockNameId(int blockNameId) const noexcept
{
- for (int i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
if (m_shaderStorageBlocks[i].m_nameId == blockNameId)
return m_shaderStorageBlocks[i];
}
@@ -205,7 +205,7 @@ ShaderStorageBlock GLShader::storageBlockForBlockNameId(int blockNameId) const n
ShaderStorageBlock GLShader::storageBlockForBlockName(const QString &blockName) const noexcept
{
- for (int i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
if (m_shaderStorageBlocks[i].m_name == blockName)
return m_shaderStorageBlocks[i];
}
@@ -225,7 +225,9 @@ GLShader::ParameterKind GLShader::categorizeVariable(int nameId) const noexcept
bool GLShader::hasUniform(int nameId) const noexcept
{
- return m_uniformsNamesIds.contains(nameId);
+ return std::find(m_uniformsNamesIds.begin(),
+ m_uniformsNamesIds.end(),
+ nameId) != m_uniformsNamesIds.end();
}
void GLShader::prepareUniforms(ShaderParameterPack &pack)
@@ -267,7 +269,7 @@ const QHash<QString, int> GLShader::fragOutputs() const
return m_fragOutputs;
}
-void GLShader::initializeUniforms(const QVector<ShaderUniform> &uniformsDescription)
+void GLShader::initializeUniforms(const std::vector<ShaderUniform> &uniformsDescription)
{
m_uniforms = uniformsDescription;
m_uniformsNames.resize(uniformsDescription.size());
@@ -276,7 +278,7 @@ void GLShader::initializeUniforms(const QVector<ShaderUniform> &uniformsDescript
m_lightUniformsNamesIds.reserve(MAX_LIGHTS * 8 + 1);
QHash<QString, ShaderUniform> activeUniformsInDefaultBlock;
- static const QVector<int> standardUniformNameIds = {
+ static const std::vector<int> standardUniformNameIds = {
Shader::modelMatrixNameId,
Shader::viewMatrixNameId,
Shader::projectionMatrixNameId,
@@ -302,17 +304,17 @@ void GLShader::initializeUniforms(const QVector<ShaderUniform> &uniformsDescript
Shader::skinningPaletteNameId,
};
- static const QVector<int> lightUniformNameIds = getLightUniformNameIds();
+ static const std::vector<int> lightUniformNameIds = getLightUniformNameIds();
- for (int i = 0, m = uniformsDescription.size(); i < m; i++) {
+ for (size_t i = 0, m = uniformsDescription.size(); i < m; i++) {
m_uniformsNames[i] = m_uniforms[i].m_name;
const int nameId = StringToInt::lookupId(m_uniformsNames[i]);
m_uniforms[i].m_nameId = nameId;
// Is the uniform a Qt3D "Standard" uniform, a light uniform or a user defined one?
- if (standardUniformNameIds.contains(nameId))
+ if (std::find(standardUniformNameIds.begin(), standardUniformNameIds.end(), nameId) != standardUniformNameIds.end())
m_standardUniformNamesIds.push_back(nameId);
- else if (lightUniformNameIds.contains(nameId))
+ else if (std::find(lightUniformNameIds.begin(), lightUniformNameIds.end(), nameId) != lightUniformNameIds.end())
m_lightUniformsNamesIds.push_back(nameId);
else
m_uniformsNamesIds.push_back(nameId);
@@ -337,7 +339,7 @@ void GLShader::initializeUniforms(const QVector<ShaderUniform> &uniformsDescript
});
}
-void GLShader::initializeAttributes(const QVector<ShaderAttribute> &attributesDescription)
+void GLShader::initializeAttributes(const std::vector<ShaderAttribute> &attributesDescription)
{
m_attributes = attributesDescription;
m_attributesNames.resize(attributesDescription.size());
@@ -351,7 +353,7 @@ void GLShader::initializeAttributes(const QVector<ShaderAttribute> &attributesDe
m_hasActiveVariables |= (m_attributeNamesIds.size() > 0);
}
-void GLShader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &uniformBlockDescription)
+void GLShader::initializeUniformBlocks(const std::vector<ShaderUniformBlock> &uniformBlockDescription)
{
m_uniformBlocks = uniformBlockDescription;
m_uniformBlockNames.resize(uniformBlockDescription.size());
@@ -363,11 +365,11 @@ void GLShader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &unifor
qCDebug(Shaders) << "Initializing Uniform Block {" << m_uniformBlockNames[i] << "}";
// Find all active uniforms for the shader block
- QVector<ShaderUniform>::const_iterator uniformsIt = m_uniforms.cbegin();
- const QVector<ShaderUniform>::const_iterator uniformsEnd = m_uniforms.cend();
+ std::vector<ShaderUniform>::const_iterator uniformsIt = m_uniforms.cbegin();
+ const std::vector<ShaderUniform>::const_iterator uniformsEnd = m_uniforms.cend();
- QVector<QString>::const_iterator uniformNamesIt = m_uniformsNames.cbegin();
- const QVector<QString>::const_iterator uniformNamesEnd = m_attributesNames.cend();
+ std::vector<QString>::const_iterator uniformNamesIt = m_uniformsNames.cbegin();
+ const std::vector<QString>::const_iterator uniformNamesEnd = m_attributesNames.cend();
QHash<QString, ShaderUniform> activeUniformsInBlock;
@@ -392,7 +394,7 @@ void GLShader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &unifor
std::sort(m_uniformBlockNamesIds.begin(), m_uniformBlockNamesIds.end());
}
-void GLShader::initializeShaderStorageBlocks(const QVector<ShaderStorageBlock> &shaderStorageBlockDescription)
+void GLShader::initializeShaderStorageBlocks(const std::vector<ShaderStorageBlock> &shaderStorageBlockDescription)
{
m_shaderStorageBlocks = shaderStorageBlockDescription;
m_shaderStorageBlockNames.resize(shaderStorageBlockDescription.size());
diff --git a/src/plugins/renderers/opengl/renderer/glshader_p.h b/src/plugins/renderers/opengl/renderer/glshader_p.h
index 977587c68..a450415f8 100644
--- a/src/plugins/renderers/opengl/renderer/glshader_p.h
+++ b/src/plugins/renderers/opengl/renderer/glshader_p.h
@@ -88,22 +88,22 @@ public:
void setFragOutputs(const QHash<QString, int> &fragOutputs);
const QHash<QString, int> fragOutputs() const;
- inline const QVector<int> &uniformsNamesIds() const { return m_uniformsNamesIds; }
- inline const QVector<int> &lightUniformsNamesIds() const { return m_lightUniformsNamesIds; }
- inline const QVector<int> &standardUniformNameIds() const { return m_standardUniformNamesIds; }
- inline const QVector<int> &uniformBlockNamesIds() const { return m_uniformBlockNamesIds; }
- inline const QVector<int> &storageBlockNamesIds() const { return m_shaderStorageBlockNamesIds; }
- inline const QVector<int> &attributeNamesIds() const { return m_attributeNamesIds; }
-
- QVector<QString> uniformsNames() const;
- QVector<QString> attributesNames() const;
- QVector<QString> uniformBlockNames() const;
- QVector<QString> storageBlockNames() const;
-
- inline const QVector<ShaderUniform> &uniforms() const { return m_uniforms; }
- inline const QVector<ShaderAttribute> &attributes() const { return m_attributes; }
- inline const QVector<ShaderUniformBlock> &uniformBlocks() const { return m_uniformBlocks; }
- inline const QVector<ShaderStorageBlock> &storageBlocks() const { return m_shaderStorageBlocks; }
+ inline const std::vector<int> &uniformsNamesIds() const { return m_uniformsNamesIds; }
+ inline const std::vector<int> &lightUniformsNamesIds() const { return m_lightUniformsNamesIds; }
+ inline const std::vector<int> &standardUniformNameIds() const { return m_standardUniformNamesIds; }
+ inline const std::vector<int> &uniformBlockNamesIds() const { return m_uniformBlockNamesIds; }
+ inline const std::vector<int> &storageBlockNamesIds() const { return m_shaderStorageBlockNamesIds; }
+ inline const std::vector<int> &attributeNamesIds() const { return m_attributeNamesIds; }
+
+ std::vector<QString> uniformsNames() const;
+ std::vector<QString> attributesNames() const;
+ std::vector<QString> uniformBlockNames() const;
+ std::vector<QString> storageBlockNames() const;
+
+ inline const std::vector<ShaderUniform> &uniforms() const { return m_uniforms; }
+ inline const std::vector<ShaderAttribute> &attributes() const { return m_attributes; }
+ inline const std::vector<ShaderUniformBlock> &uniformBlocks() const { return m_uniformBlocks; }
+ inline const std::vector<ShaderStorageBlock> &storageBlocks() const { return m_shaderStorageBlocks; }
QHash<QString, ShaderUniform> activeUniformsForUniformBlock(int blockIndex) const;
@@ -129,44 +129,44 @@ public:
QOpenGLShaderProgram *shaderProgram() { return &m_shader; }
- void setShaderCode(const QVector<QByteArray> shaderCode) { m_shaderCode = shaderCode; }
- QVector<QByteArray> shaderCode() const;
+ void setShaderCode(const std::vector<QByteArray> shaderCode) { m_shaderCode = shaderCode; }
+ std::vector<QByteArray> shaderCode() const;
private:
bool m_isLoaded;
QOpenGLShaderProgram m_shader;
GraphicsContext *m_graphicsContext;
- QVector<QString> m_uniformsNames;
- QVector<int> m_uniformsNamesIds;
- QVector<int> m_lightUniformsNamesIds;
- QVector<int> m_standardUniformNamesIds;
- QVector<ShaderUniform> m_uniforms;
+ std::vector<QString> m_uniformsNames;
+ std::vector<int> m_uniformsNamesIds;
+ std::vector<int> m_lightUniformsNamesIds;
+ std::vector<int> m_standardUniformNamesIds;
+ std::vector<ShaderUniform> m_uniforms;
- QVector<QString> m_attributesNames;
- QVector<int> m_attributeNamesIds;
- QVector<ShaderAttribute> m_attributes;
+ std::vector<QString> m_attributesNames;
+ std::vector<int> m_attributeNamesIds;
+ std::vector<ShaderAttribute> m_attributes;
- QVector<QString> m_uniformBlockNames;
- QVector<int> m_uniformBlockNamesIds;
- QVector<ShaderUniformBlock> m_uniformBlocks;
+ std::vector<QString> m_uniformBlockNames;
+ std::vector<int> m_uniformBlockNamesIds;
+ std::vector<ShaderUniformBlock> m_uniformBlocks;
QHash<int, QHash<QString, ShaderUniform> > m_uniformBlockIndexToShaderUniforms;
- QVector<QString> m_shaderStorageBlockNames;
- QVector<int> m_shaderStorageBlockNamesIds;
- QVector<ShaderStorageBlock> m_shaderStorageBlocks;
+ std::vector<QString> m_shaderStorageBlockNames;
+ std::vector<int> m_shaderStorageBlockNamesIds;
+ std::vector<ShaderStorageBlock> m_shaderStorageBlocks;
QHash<QString, int> m_fragOutputs;
- QVector<QByteArray> m_shaderCode;
+ std::vector<QByteArray> m_shaderCode;
int m_parameterPackSize;
int m_hasActiveVariables;
// Private so that only GraphicContext can call it
- void initializeUniforms(const QVector<ShaderUniform> &uniformsDescription);
- void initializeAttributes(const QVector<ShaderAttribute> &attributesDescription);
- void initializeUniformBlocks(const QVector<ShaderUniformBlock> &uniformBlockDescription);
- void initializeShaderStorageBlocks(const QVector<ShaderStorageBlock> &shaderStorageBlockDescription);
+ void initializeUniforms(const std::vector<ShaderUniform> &uniformsDescription);
+ void initializeAttributes(const std::vector<ShaderAttribute> &attributesDescription);
+ void initializeUniformBlocks(const std::vector<ShaderUniformBlock> &uniformBlockDescription);
+ void initializeShaderStorageBlocks(const std::vector<ShaderStorageBlock> &shaderStorageBlockDescription);
friend class GraphicsContext;
#ifdef QT_BUILD_INTERNAL
diff --git a/src/plugins/renderers/opengl/renderer/rendercommand_p.h b/src/plugins/renderers/opengl/renderer/rendercommand_p.h
index 344dc426b..4aba7f9fe 100644
--- a/src/plugins/renderers/opengl/renderer/rendercommand_p.h
+++ b/src/plugins/renderers/opengl/renderer/rendercommand_p.h
@@ -108,7 +108,7 @@ public:
// A QAttribute pack might be interesting
// This is a temporary fix in the meantime, to remove the hacked methods in Technique
- QVector<int> m_activeAttributes;
+ std::vector<int> m_activeAttributes;
float m_depth;
int m_changeCost;
diff --git a/src/plugins/renderers/opengl/renderer/renderer.cpp b/src/plugins/renderers/opengl/renderer/renderer.cpp
index 6b76afa0f..4f77f19d0 100644
--- a/src/plugins/renderers/opengl/renderer/renderer.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderer.cpp
@@ -946,7 +946,7 @@ void Renderer::prepareCommandsSubmission(const QVector<RenderView *> &renderView
if (rGeometry->isDirty())
m_dirtyGeometry.push_back(rGeometry);
- if (!command.m_activeAttributes.isEmpty() && (requiresFullVAOUpdate || requiresPartialVAOUpdate)) {
+ if (!command.m_activeAttributes.empty() && (requiresFullVAOUpdate || requiresPartialVAOUpdate)) {
Profiling::GLTimeRecorder recorder(Profiling::VAOUpload, activeProfiler());
// Activate shader
m_submissionContext->activateShader(shader);
@@ -2220,10 +2220,12 @@ bool Renderer::updateVAOWithAttributes(Geometry *geometry,
if ((attributeWasDirty = attribute->isDirty()) == true || forceUpdate)
m_submissionContext->specifyIndices(buffer);
// Vertex Attribute
- } else if (command->m_activeAttributes.contains(attribute->nameId())) {
+ } else if (std::find(command->m_activeAttributes.begin(),
+ command->m_activeAttributes.end(),
+ attribute->nameId()) != command->m_activeAttributes.end()) {
if ((attributeWasDirty = attribute->isDirty()) == true || forceUpdate) {
// Find the location for the attribute
- const QVector<ShaderAttribute> shaderAttributes = shader->attributes();
+ const std::vector<ShaderAttribute> &shaderAttributes = shader->attributes();
const ShaderAttribute *attributeDescription = nullptr;
for (const ShaderAttribute &shaderAttribute : shaderAttributes) {
if (shaderAttribute.m_nameId == attribute->nameId()) {
@@ -2265,7 +2267,10 @@ bool Renderer::requiresVAOAttributeUpdate(Geometry *geometry,
continue;
if ((attribute->attributeType() == QAttribute::IndexAttribute && attribute->isDirty()) ||
- (command->m_activeAttributes.contains(attribute->nameId()) && attribute->isDirty()))
+ (std::find(command->m_activeAttributes.begin(),
+ command->m_activeAttributes.end(),
+ attribute->nameId()) != command->m_activeAttributes.end() &&
+ attribute->isDirty()))
return true;
}
return false;
diff --git a/src/plugins/renderers/opengl/renderer/renderview.cpp b/src/plugins/renderers/opengl/renderer/renderview.cpp
index 84fd075e2..24766dab0 100644
--- a/src/plugins/renderers/opengl/renderer/renderview.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderview.cpp
@@ -1065,7 +1065,7 @@ void RenderView::setShaderAndUniforms(RenderCommand *command,
}
if (shader->hasActiveVariables()) {
- const QVector<int> &standardUniformNamesIds = shader->standardUniformNameIds();
+ const std::vector<int> &standardUniformNamesIds = shader->standardUniformNameIds();
// It only makes sense to update the standard uniforms if:
// - Camera changed
@@ -1096,7 +1096,7 @@ void RenderView::setShaderAndUniforms(RenderCommand *command,
void RenderView::updateLightUniforms(RenderCommand *command, const Entity *entity) const
{
GLShader *shader = command->m_glShader;
- const QVector<int> &lightUniformNamesIds = shader->lightUniformsNamesIds();
+ const std::vector<int> &lightUniformNamesIds = shader->lightUniformsNamesIds();
if (!lightUniformNamesIds.empty()) {
// Pick which lights to take in to account.
// For now decide based on the distance by taking the MAX_LIGHTS closest lights.
@@ -1134,12 +1134,12 @@ void RenderView::updateLightUniforms(RenderCommand *command, const Entity *entit
break;
// Note: implicit conversion of values to UniformValue
- if (lightUniformNamesIds.contains(GLLights::LIGHT_TYPE_NAMES[lightIdx])) {
+ if (std::find(lightUniformNamesIds.begin(), lightUniformNamesIds.end(), GLLights::LIGHT_TYPE_NAMES[lightIdx]) != lightUniformNamesIds.end()) {
setUniformValue(command->m_parameterPack, GLLights::LIGHT_POSITION_NAMES[lightIdx], worldPos);
setUniformValue(command->m_parameterPack, GLLights::LIGHT_TYPE_NAMES[lightIdx], int(QAbstractLight::PointLight));
setUniformValue(command->m_parameterPack, GLLights::LIGHT_COLOR_NAMES[lightIdx], Vector3D(1.0f, 1.0f, 1.0f));
setUniformValue(command->m_parameterPack, GLLights::LIGHT_INTENSITY_NAMES[lightIdx], 0.5f);
- } else if (lightUniformNamesIds.contains(GLLights::LIGHT_TYPE_UNROLL_NAMES[lightIdx])) {
+ } else if (std::find(lightUniformNamesIds.begin(), lightUniformNamesIds.end(), GLLights::LIGHT_TYPE_UNROLL_NAMES[lightIdx]) != lightUniformNamesIds.end()) {
setUniformValue(command->m_parameterPack, GLLights::LIGHT_POSITION_UNROLL_NAMES[lightIdx], worldPos);
setUniformValue(command->m_parameterPack, GLLights::LIGHT_TYPE_UNROLL_NAMES[lightIdx], int(QAbstractLight::PointLight));
setUniformValue(command->m_parameterPack, GLLights::LIGHT_COLOR_UNROLL_NAMES[lightIdx], Vector3D(1.0f, 1.0f, 1.0f));
@@ -1164,12 +1164,12 @@ void RenderView::updateLightUniforms(RenderCommand *command, const Entity *entit
// If no active light sources and no environment light, add a default light
if (m_lightSources.empty() && !m_environmentLight) {
// Note: implicit conversion of values to UniformValue
- if (lightUniformNamesIds.contains(GLLights::LIGHT_TYPE_NAMES[0])) {
+ if (std::find(lightUniformNamesIds.begin(), lightUniformNamesIds.end(), GLLights::LIGHT_TYPE_NAMES[lightIdx]) != lightUniformNamesIds.end()) {
setUniformValue(command->m_parameterPack, GLLights::LIGHT_POSITION_NAMES[0], Vector3D(10.0f, 10.0f, 0.0f));
setUniformValue(command->m_parameterPack, GLLights::LIGHT_TYPE_NAMES[0], int(QAbstractLight::PointLight));
setUniformValue(command->m_parameterPack, GLLights::LIGHT_COLOR_NAMES[0], Vector3D(1.0f, 1.0f, 1.0f));
setUniformValue(command->m_parameterPack, GLLights::LIGHT_INTENSITY_NAMES[0], 0.5f);
- } else if (lightUniformNamesIds.contains(GLLights::LIGHT_TYPE_UNROLL_NAMES[lightIdx])) {
+ } else if (std::find(lightUniformNamesIds.begin(), lightUniformNamesIds.end(), GLLights::LIGHT_TYPE_UNROLL_NAMES[lightIdx]) != lightUniformNamesIds.end()) {
setUniformValue(command->m_parameterPack, GLLights::LIGHT_POSITION_UNROLL_NAMES[0], Vector3D(10.0f, 10.0f, 0.0f));
setUniformValue(command->m_parameterPack, GLLights::LIGHT_TYPE_UNROLL_NAMES[0], int(QAbstractLight::PointLight));
setUniformValue(command->m_parameterPack, GLLights::LIGHT_COLOR_UNROLL_NAMES[0], Vector3D(1.0f, 1.0f, 1.0f));
diff --git a/src/render/backend/apishadermanager_p.h b/src/render/backend/apishadermanager_p.h
index 17a3a9865..d8820d12f 100644
--- a/src/render/backend/apishadermanager_p.h
+++ b/src/render/backend/apishadermanager_p.h
@@ -200,15 +200,15 @@ private:
bool isSameShader(const APIShader *apiShader, const Shader *shaderNode)
{
- const QVector<QByteArray> nodeShaderCode = shaderNode->shaderCode();
- const QVector<QByteArray> apiShaderCode = apiShader->shaderCode();
+ const std::vector<QByteArray> &nodeShaderCode = shaderNode->shaderCode();
+ const std::vector<QByteArray> &apiShaderCode = apiShader->shaderCode();
- const int s = nodeShaderCode.size();
+ const size_t s = nodeShaderCode.size();
Q_ASSERT(s == apiShaderCode.size());
- for (int i = 0; i < s; ++i)
- if (nodeShaderCode.at(i) != apiShaderCode.at(i))
+ for (size_t i = 0; i < s; ++i)
+ if (nodeShaderCode[i] != apiShaderCode[i])
return false;
return true;
diff --git a/src/render/geometry/buffer_p.h b/src/render/geometry/buffer_p.h
index 28600581d..407f788a0 100644
--- a/src/render/geometry/buffer_p.h
+++ b/src/render/geometry/buffer_p.h
@@ -79,7 +79,7 @@ public:
void updateDataFromGPUToCPU(QByteArray data);
inline Qt3DCore::QBuffer::UsageType usage() const { return m_usage; }
inline QByteArray data() const { return m_data; }
- inline QVector<Qt3DCore::QBufferUpdate> &pendingBufferUpdates() { return m_bufferUpdates; }
+ inline std::vector<Qt3DCore::QBufferUpdate> &pendingBufferUpdates() { return m_bufferUpdates; }
inline bool isDirty() const { return m_bufferDirty; }
inline Qt3DCore::QBuffer::AccessType access() const { return m_access; }
void unsetDirty();
@@ -89,7 +89,7 @@ private:
Qt3DCore::QBuffer::UsageType m_usage;
QByteArray m_data;
- QVector<Qt3DCore::QBufferUpdate> m_bufferUpdates;
+ std::vector<Qt3DCore::QBufferUpdate> m_bufferUpdates;
bool m_bufferDirty;
Qt3DCore::QBuffer::AccessType m_access;
BufferManager *m_manager;
diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp
index ebdb4c64b..0e777e9aa 100644
--- a/src/render/materialsystem/shader.cpp
+++ b/src/render/materialsystem/shader.cpp
@@ -120,7 +120,7 @@ void Shader::syncFromFrontEnd(const QNode *frontEnd, bool firstTime)
for (int i = QShaderProgram::Vertex; i <= QShaderProgram::Compute; ++i) {
const QShaderProgram::ShaderType shaderType = static_cast<QShaderProgram::ShaderType>(i);
const QByteArray code = node->shaderCode(shaderType);
- if (code != m_shaderCode.value(shaderType))
+ if (code != m_shaderCode[shaderType])
setShaderCode(shaderType, code);
}
setFormat(node->format());
@@ -148,7 +148,7 @@ void Shader::setFormat(QShaderProgram::Format format)
markDirty(AbstractRenderer::ShadersDirty);
}
-QVector<QByteArray> Shader::shaderCode() const
+const std::vector<QByteArray> &Shader::shaderCode() const
{
return m_shaderCode;
}
diff --git a/src/render/materialsystem/shader_p.h b/src/render/materialsystem/shader_p.h
index a393c1809..924d60db4 100644
--- a/src/render/materialsystem/shader_p.h
+++ b/src/render/materialsystem/shader_p.h
@@ -99,7 +99,7 @@ public:
void cleanup();
- QVector<QByteArray> shaderCode() const;
+ const std::vector<QByteArray> &shaderCode() const;
void setShaderCode(QShaderProgram::ShaderType type, const QByteArray &code);
void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
@@ -123,7 +123,7 @@ public:
void requestCacheRebuild();
private:
- QVector<QByteArray> m_shaderCode;
+ std::vector<QByteArray> m_shaderCode;
QString m_log;
bool m_requiresFrontendSync;
diff --git a/src/render/materialsystem/techniquemanager.cpp b/src/render/materialsystem/techniquemanager.cpp
index a59810ea1..2ecb5c3b3 100644
--- a/src/render/materialsystem/techniquemanager.cpp
+++ b/src/render/materialsystem/techniquemanager.cpp
@@ -52,12 +52,14 @@ TechniqueManager::TechniqueManager()
// AspectThread
void TechniqueManager::addDirtyTechnique(Qt3DCore::QNodeId techniqueId)
{
- if (!m_dirtyTechniques.contains(techniqueId))
+ if (std::find(m_dirtyTechniques.begin(),
+ m_dirtyTechniques.end(),
+ techniqueId) == m_dirtyTechniques.end())
m_dirtyTechniques.push_back(techniqueId);
}
// AspectThread
-QVector<Qt3DCore::QNodeId> TechniqueManager::takeDirtyTechniques()
+std::vector<Qt3DCore::QNodeId> TechniqueManager::takeDirtyTechniques()
{
return std::move(m_dirtyTechniques);
}
diff --git a/src/render/materialsystem/techniquemanager_p.h b/src/render/materialsystem/techniquemanager_p.h
index 205dbc191..84c82d22d 100644
--- a/src/render/materialsystem/techniquemanager_p.h
+++ b/src/render/materialsystem/techniquemanager_p.h
@@ -69,10 +69,10 @@ public:
TechniqueManager();
void addDirtyTechnique(Qt3DCore::QNodeId techniqueId);
- QVector<Qt3DCore::QNodeId> takeDirtyTechniques();
+ std::vector<Qt3DCore::QNodeId> takeDirtyTechniques();
private:
- QVector<Qt3DCore::QNodeId> m_dirtyTechniques;
+ std::vector<Qt3DCore::QNodeId> m_dirtyTechniques;
};
} // Render
diff --git a/src/render/renderstates/renderstateset.cpp b/src/render/renderstates/renderstateset.cpp
index 5b9c4e8b5..1d0dce4c8 100644
--- a/src/render/renderstates/renderstateset.cpp
+++ b/src/render/renderstates/renderstateset.cpp
@@ -105,7 +105,7 @@ StateMaskSet RenderStateSet::stateMask() const
void RenderStateSet::merge(const RenderStateSet *other)
{
m_stateMask |= other->stateMask();
- const QVector<StateVariant> otherStates = other->states();
+ const std::vector<StateVariant> &otherStates = other->states();
// We only add states which are new (different type)
for (const StateVariant &otherState : otherStates) {
diff --git a/src/render/renderstates/renderstateset_p.h b/src/render/renderstates/renderstateset_p.h
index 667c2614d..8442ea357 100644
--- a/src/render/renderstates/renderstateset_p.h
+++ b/src/render/renderstates/renderstateset_p.h
@@ -91,8 +91,8 @@ public:
StateMaskSet stateMask() const;
void merge(const RenderStateSet *other);
- const QVector<StateVariant>& states() const noexcept { return m_states; }
- QVector<StateVariant>& states() noexcept { return m_states; }
+ const std::vector<StateVariant>& states() const noexcept { return m_states; }
+ std::vector<StateVariant>& states() noexcept { return m_states; }
bool canAddStateOfType(StateMask type) const;
@@ -109,7 +109,7 @@ private:
private:
StateMaskSet m_stateMask;
- QVector<StateVariant> m_states;
+ std::vector<StateVariant> m_states;
};
template<>