summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-01-28 17:01:59 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-01-29 07:58:27 +0000
commit498b39a5136bc13f20a9cf0b3c92e6a7ff796fb5 (patch)
treec125c5ab01b48bc70fbd4278bd580acd5e1d43e5
parent2335abeaf994950a2420c33802b4cdd63dbc3323 (diff)
Fix a number of MSVC int conversion warnings
- Port the qHash() functions to size_t - Add some casts - Adapt some types Change-Id: Ib889d46dd56c1a1c4bf6b87ae1f756c188069180 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 05767abb7ef1b3c9c84633e53c29483510ba746d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/core/resources/qhandle_p.h4
-rw-r--r--src/plugins/renderers/opengl/debug/imguirenderer.cpp2
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp2
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp14
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp2
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp4
-rw-r--r--src/plugins/renderers/opengl/renderer/commandexecuter.cpp2
-rw-r--r--src/plugins/renderers/opengl/renderer/renderer.cpp6
-rw-r--r--src/plugins/renderers/opengl/renderer/renderview.cpp6
-rw-r--r--src/plugins/renderers/opengl/renderer/renderview_p.h2
-rw-r--r--src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp2
-rw-r--r--src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp4
-rw-r--r--src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp4
-rw-r--r--src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h4
-rw-r--r--src/plugins/renderers/rhi/renderer/commandexecuter.cpp2
-rw-r--r--src/plugins/renderers/rhi/renderer/pipelineuboset.cpp10
-rw-r--r--src/plugins/renderers/rhi/renderer/renderer.cpp20
-rw-r--r--src/plugins/renderers/rhi/renderer/renderview.cpp6
-rw-r--r--src/plugins/renderers/rhi/renderer/renderview_p.h2
-rw-r--r--src/render/backend/attachmentpack.cpp2
-rw-r--r--src/render/backend/stringtoint.cpp2
-rw-r--r--src/render/jobs/rendersyncjobs_p.h10
22 files changed, 56 insertions, 56 deletions
diff --git a/src/core/resources/qhandle_p.h b/src/core/resources/qhandle_p.h
index 15f34fe98..8914df9d0 100644
--- a/src/core/resources/qhandle_p.h
+++ b/src/core/resources/qhandle_p.h
@@ -117,14 +117,14 @@ QDebug operator<<(QDebug dbg, const QHandle<T> &h)
}
template <typename T>
-uint qHash(const QHandle<T> &h, uint seed)
+size_t qHash(const QHandle<T> &h, size_t seed)
{
using QT_PREPEND_NAMESPACE(qHash);
return qHash(h.handle(), seed);
}
template <typename T>
-uint qHash(const QHandle<T> &h)
+size_t qHash(const QHandle<T> &h)
{
using QT_PREPEND_NAMESPACE(qHash);
return qHash(h.handle());
diff --git a/src/plugins/renderers/opengl/debug/imguirenderer.cpp b/src/plugins/renderers/opengl/debug/imguirenderer.cpp
index de8cf0a09..744060fcf 100644
--- a/src/plugins/renderers/opengl/debug/imguirenderer.cpp
+++ b/src/plugins/renderers/opengl/debug/imguirenderer.cpp
@@ -171,7 +171,7 @@ void ImGuiRenderer::renderDebugOverlay(const std::vector<RenderView *> &renderVi
if (!newFrame(renderView))
return;
- const int renderViewsCount = renderViews.size();
+ const int renderViewsCount = int(renderViews.size());
int logIndex = qMin(IMGUI_PERF_LOG_SIZE - 1, ImGui::GetFrameCount());
if (logIndex == IMGUI_PERF_LOG_SIZE - 1) {
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp
index 56af99d6a..97a3d6eb8 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp
@@ -344,7 +344,7 @@ void GraphicsContext::activateDrawBuffers(const AttachmentPack &attachments)
if (activeDrawBuffers.size() > 1) {// We need MRT
if (m_glHelper->supportsFeature(GraphicsHelperInterface::MRT)) {
// Set up MRT, glDrawBuffers...
- m_glHelper->drawBuffers(activeDrawBuffers.size(), activeDrawBuffers.data());
+ m_glHelper->drawBuffers(GLsizei(activeDrawBuffers.size()), activeDrawBuffers.data());
}
}
} else {
diff --git a/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp
index c2316d81a..f641d6641 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp
@@ -255,7 +255,7 @@ int ImageSubmissionContext::activateImage(ShaderImage *image, GLTexture *tex)
// Unset pinned Active Image and reduce their score
void ImageSubmissionContext::deactivateImages()
{
- for (int u = 0, m = m_activeImages.size(); u < m; ++u) {
+ for (size_t u = 0, m = m_activeImages.size(); u < m; ++u) {
if (m_activeImages[u].pinned) {
m_activeImages[u].pinned = false;
m_activeImages[u].score = qMax(m_activeImages[u].score - 1, 0);
@@ -267,7 +267,7 @@ void ImageSubmissionContext::deactivateImages()
// Reduce score of all active images (pinned or not)
void ImageSubmissionContext::decayImageScores()
{
- for (int u = 0, m = m_activeImages.size(); u < m; ++u)
+ for (size_t u = 0, m = m_activeImages.size(); u < m; ++u)
m_activeImages[u].score = qMax(m_activeImages[u].score - 1, 0);
}
@@ -276,13 +276,13 @@ int ImageSubmissionContext::assignUnitForImage(Qt3DCore::QNodeId shaderImageId)
int lowestScoredUnit = -1;
int lowestScore = 0xfffffff;
- const int m = m_activeImages.size();
- for (int u = 0; u < m; ++u) {
+ const size_t m = m_activeImages.size();
+ for (size_t u = 0; u < m; ++u) {
if (m_activeImages[u].shaderImageId == shaderImageId)
- return u;
+ return int(u);
}
- for (int u = 0; u < m; ++u) {
+ for (size_t u = 0; u < m; ++u) {
// No image is currently active on the image unit
// we save the image unit with the texture that has been on there
// the longest time while not being used
@@ -290,7 +290,7 @@ int ImageSubmissionContext::assignUnitForImage(Qt3DCore::QNodeId shaderImageId)
const int score = m_activeImages[u].score;
if (score < lowestScore) {
lowestScore = score;
- lowestScoredUnit = u;
+ lowestScoredUnit = int(u);
}
}
}
diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
index 2df7b7736..233abf51c 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -886,7 +886,7 @@ void SubmissionContext::activateDrawBuffers(const AttachmentPack &attachments)
if (activeDrawBuffers.size() > 1) {// We need MRT
if (m_glHelper->supportsFeature(GraphicsHelperInterface::MRT)) {
// Set up MRT, glDrawBuffers...
- m_glHelper->drawBuffers(activeDrawBuffers.size(), activeDrawBuffers.data());
+ m_glHelper->drawBuffers(GLsizei(activeDrawBuffers.size()), activeDrawBuffers.data());
}
}
} else {
diff --git a/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp
index f997dfeeb..1650f8563 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp
@@ -193,7 +193,7 @@ int TextureSubmissionContext::assignUnitForTexture(GLTexture *tex)
for (size_t u=0; u<m_activeTextures.size(); ++u) {
if (m_activeTextures[u].texture == tex)
- return u;
+ return int(u);
}
for (size_t u=0; u<m_activeTextures.size(); ++u) {
@@ -204,7 +204,7 @@ int TextureSubmissionContext::assignUnitForTexture(GLTexture *tex)
int score = m_activeTextures[u].score;
if (score < lowestScore) {
lowestScore = score;
- lowestScoredUnit = u;
+ lowestScoredUnit = int(u);
}
}
} // of units iteration
diff --git a/src/plugins/renderers/opengl/renderer/commandexecuter.cpp b/src/plugins/renderers/opengl/renderer/commandexecuter.cpp
index 64878c926..beb032935 100644
--- a/src/plugins/renderers/opengl/renderer/commandexecuter.cpp
+++ b/src/plugins/renderers/opengl/renderer/commandexecuter.cpp
@@ -178,7 +178,7 @@ QJsonObject parameterPackToJson(const Render::OpenGL::ShaderParameterPack &pack)
const Render::OpenGL::PackUniformHash &uniforms = pack.uniforms();
QJsonArray uniformsArray;
- for (int i = 0, m = uniforms.keys.size(); i < m; ++i) {
+ for (qsizetype i = 0, m = uniforms.keys.size(); i < m; ++i) {
QJsonObject uniformObj;
uniformObj.insert(QLatin1String("name"), Render::StringToInt::lookupString(uniforms.keys.at(i)));
const Render::UniformValue::ValueType type = uniforms.values.at(i).valueType();
diff --git a/src/plugins/renderers/opengl/renderer/renderer.cpp b/src/plugins/renderers/opengl/renderer/renderer.cpp
index 085556a88..4fcf35496 100644
--- a/src/plugins/renderers/opengl/renderer/renderer.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderer.cpp
@@ -1866,7 +1866,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
const size_t fgBranchCount = m_frameGraphLeaves.size();
if (fgBranchCount > 1) {
- int workBranches = fgBranchCount;
+ int workBranches = int(fgBranchCount);
for (auto leaf: m_frameGraphLeaves)
if (leaf->nodeType() == FrameGraphNode::NoDraw)
--workBranches;
@@ -1877,7 +1877,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
for (size_t i = 0; i < fgBranchCount; ++i) {
FrameGraphNode *leaf = m_frameGraphLeaves[i];
- RenderViewBuilder builder(leaf, i, this);
+ RenderViewBuilder builder(leaf, int(i), this);
builder.setOptimalJobCount(leaf->nodeType() == FrameGraphNode::NoDraw ? 1 : idealThreadCount);
// If we have a new RV (wasn't in the cache before, then it contains no cached data)
@@ -1896,7 +1896,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
}
// Set target number of RenderViews
- m_renderQueue.setTargetRenderViewCount(fgBranchCount);
+ m_renderQueue.setTargetRenderViewCount(int(fgBranchCount));
if (isRunning() && m_submissionContext->isInitialized()) {
if (dirtyBitsForFrame & AbstractRenderer::TechniquesDirty )
diff --git a/src/plugins/renderers/opengl/renderer/renderview.cpp b/src/plugins/renderers/opengl/renderer/renderview.cpp
index db1b6123c..96ffd73f3 100644
--- a/src/plugins/renderers/opengl/renderer/renderview.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderview.cpp
@@ -569,7 +569,7 @@ int advanceUntilNonAdjacent(const EntityRenderCommandDataView *view,
++i;
}
}
- return i;
+ return int(i);
}
@@ -772,7 +772,7 @@ void RenderView::sort()
assert(m_renderCommandDataView);
// Compares the bitsetKey of the RenderCommands
// Key[Depth | StateCost | Shader]
- sortCommandRange(m_renderCommandDataView.data(), 0, m_renderCommandDataView->size(), 0, m_sortingTypes);
+ sortCommandRange(m_renderCommandDataView.data(), 0, int(m_renderCommandDataView->size()), 0, m_sortingTypes);
// For RenderCommand with the same shader
// We compute the adjacent change cost
@@ -815,7 +815,7 @@ void RenderView::sort()
const UniformValue &refValue = cachedUniforms.value(uniformNameId);
const UniformValue &newValue = uniforms.values.at(u);
if (newValue == refValue) {
- uniforms.erase(u);
+ uniforms.erase(int(u));
} else {
// Record updated value so that subsequent comparison
// for the next command will be made againts latest
diff --git a/src/plugins/renderers/opengl/renderer/renderview_p.h b/src/plugins/renderers/opengl/renderer/renderview_p.h
index 7914b1989..d67a04b8c 100644
--- a/src/plugins/renderers/opengl/renderer/renderview_p.h
+++ b/src/plugins/renderers/opengl/renderer/renderview_p.h
@@ -286,7 +286,7 @@ public:
m_renderCommandDataView->forEachCommand(func);
}
- inline int commandCount() const { return m_renderCommandDataView ? m_renderCommandDataView->size() : 0; }
+ inline int commandCount() const { return m_renderCommandDataView ? int(m_renderCommandDataView->size()) : 0; }
private:
void setShaderAndUniforms(RenderCommand *command,
diff --git a/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp b/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp
index a3d8c4b61..6eaaaa84a 100644
--- a/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp
+++ b/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp
@@ -84,7 +84,7 @@ void ShaderParameterPack::setTexture(const int glslNameId, int uniformArrayIndex
void ShaderParameterPack::setImage(const int glslNameId, int uniformArrayIndex, Qt3DCore::QNodeId id)
{
- for (int i=0, m = m_images.size(); i < m; ++i) {
+ for (qsizetype i=0, m = m_images.size(); i < m; ++i) {
if (m_images[i].glslNameId != glslNameId || m_images[i].uniformArrayIndex != uniformArrayIndex)
continue;
diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
index 1121c7041..8ae2147a5 100644
--- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
@@ -1138,7 +1138,7 @@ void SubmissionContext::applyStateSet(const RenderStateSet *ss,
StateVariant *SubmissionContext::getState(RenderStateSet *ss, StateMask type) const
{
const auto &statesToSet = ss->states();
- for (int i = 0, m = statesToSet.size(); i < m; ++i) {
+ for (qsizetype i = 0, m = statesToSet.size(); i < m; ++i) {
const StateVariant &ds = statesToSet.at(i);
if (ds.type == type)
return ss->states().data() + i;
@@ -1367,7 +1367,7 @@ constexpr int getFirstAvailableBit(const std::bitset<N> &bits)
{
for (std::size_t i = 0; i < N; i++) {
if (!bits.test(i))
- return i;
+ return int(i);
}
return -1;
}
diff --git a/src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp b/src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp
index e653a364e..5be374aa2 100644
--- a/src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp
+++ b/src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp
@@ -94,7 +94,7 @@ int RHIGraphicsPipelineManager::getIdForAttributeVec(const std::vector<Attribute
attributesInfo);
if (it == m_attributesInfo.end()) {
m_attributesInfo.emplace_back(attributesInfo);
- return m_attributesInfo.size() - 1;
+ return int(m_attributesInfo.size()) - 1;
}
return std::distance(m_attributesInfo.begin(), it);
}
@@ -109,7 +109,7 @@ int RHIGraphicsPipelineManager::getIdForRenderStates(const RenderStateSetPtr &st
states);
if (it == m_renderStates.end()) {
m_renderStates.emplace_back(states);
- return m_renderStates.size() - 1;
+ return int(m_renderStates.size()) - 1;
}
return std::distance(m_renderStates.begin(), it);
}
diff --git a/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h b/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h
index 677632675..0e15afe91 100644
--- a/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h
+++ b/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h
@@ -152,7 +152,7 @@ private:
RHIComputePipelineManager *m_rhiComputePipelineManager;
};
-inline uint qHash(const GraphicsPipelineIdentifier &key, uint seed = 0)
+inline size_t qHash(const GraphicsPipelineIdentifier &key, size_t seed = 0)
{
const QPair<int, Qt3DCore::QNodeId> p = { key.geometryLayoutKey, key.shader };
using QT_PREPEND_NAMESPACE(qHash);
@@ -172,7 +172,7 @@ inline bool operator==(const GraphicsPipelineIdentifier &a, const GraphicsPipeli
a.primitiveType == b.primitiveType;
}
-inline uint qHash(const ComputePipelineIdentifier &key, uint seed = 0)
+inline size_t qHash(const ComputePipelineIdentifier &key, size_t seed = 0)
{
using QT_PREPEND_NAMESPACE(qHash);
seed = qHash(key.shader, seed);
diff --git a/src/plugins/renderers/rhi/renderer/commandexecuter.cpp b/src/plugins/renderers/rhi/renderer/commandexecuter.cpp
index d29fae5de..122329934 100644
--- a/src/plugins/renderers/rhi/renderer/commandexecuter.cpp
+++ b/src/plugins/renderers/rhi/renderer/commandexecuter.cpp
@@ -249,7 +249,7 @@ QJsonObject parameterPackToJson(const Render::Rhi::ShaderParameterPack &pack) no
const Render::Rhi::PackUniformHash &uniforms = pack.uniforms();
QJsonArray uniformsArray;
- for (int i = 0, m = uniforms.keys.size(); i < m; ++i) {
+ for (qsizetype i = 0, m = uniforms.keys.size(); i < m; ++i) {
QJsonObject uniformObj;
uniformObj.insert(QLatin1String("name"), Render::StringToInt::lookupString(uniforms.keys.at(i)));
const Render::UniformValue::ValueType type = uniforms.values.at(i).valueType();
diff --git a/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp b/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp
index 0578c6a09..ce53de1ab 100644
--- a/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp
+++ b/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp
@@ -293,7 +293,7 @@ std::vector<QRhiShaderResourceBinding> PipelineUBOSet::resourceBindings(const Re
QRhiShaderResourceBinding::uniformBufferWithDynamicOffset(1,
stages,
commandUBO->rhiBuffer(),
- m_commandsUBO.alignedBlockSize));
+ int(m_commandsUBO.alignedBlockSize)));
}
// Create additional empty UBO Buffer for UBO with binding point > 1 (since
@@ -304,7 +304,7 @@ std::vector<QRhiShaderResourceBinding> PipelineUBOSet::resourceBindings(const Re
const HRHIBuffer &materialUBO = ubo.bufferForCommand(dToCmd);
bindings.push_back(
QRhiShaderResourceBinding::uniformBufferWithDynamicOffset(
- ubo.binding, stages, materialUBO->rhiBuffer(), ubo.alignedBlockSize));
+ ubo.binding, stages, materialUBO->rhiBuffer(), int(ubo.alignedBlockSize)));
}
// Samplers
@@ -433,7 +433,7 @@ inline void uploadDataToUBO(const QByteArray rawData,
{
const HRHIBuffer &buffer = ubo->bufferForCommand(distanceToCommand);
const size_t localOffset = ubo->localOffsetInBufferForCommand(distanceToCommand);
- buffer->update(rawData, localOffset+ member.blockVariable.offset + arrayOffset);
+ buffer->update(rawData, int(localOffset) + member.blockVariable.offset + arrayOffset);
}
QByteArray rawDataForUniformValue(const QShaderDescription::BlockVariable &blockVariable,
@@ -574,7 +574,7 @@ void PipelineUBOSet::uploadUBOsForCommand(const RenderCommand &command,
commandUBOBuffer->update(QByteArray::fromRawData(
reinterpret_cast<const char *>(&command.m_commandUBO),
sizeof(CommandUBO)),
- localOffset);
+ int(localOffset));
}
const std::vector<RHIShader::UBO_Block> &uboBlocks = shader->uboBlocks();
@@ -671,7 +671,7 @@ void PipelineUBOSet::uploadUBOsForCommand(const RenderCommand &command,
const HRHIBuffer &materialBuffer = materialsUBO->bufferForCommand(distanceToCommand);
const size_t localOffsetIntoBuffer = materialsUBO->localOffsetInBufferForCommand(distanceToCommand);
- materialBuffer->update(uboBuffer->data(), localOffsetIntoBuffer);
+ materialBuffer->update(uboBuffer->data(), int(localOffsetIntoBuffer));
}
// ShaderData -> convenience for filling a struct member of a UBO
diff --git a/src/plugins/renderers/rhi/renderer/renderer.cpp b/src/plugins/renderers/rhi/renderer/renderer.cpp
index 0fe6cd348..1aa15e46d 100644
--- a/src/plugins/renderers/rhi/renderer/renderer.cpp
+++ b/src/plugins/renderers/rhi/renderer/renderer.cpp
@@ -1400,7 +1400,7 @@ Renderer::prepareCommandsSubmission(const std::vector<RenderView *> &renderViews
if (!shader)
return;
- updateComputePipeline(command, rv, i);
+ updateComputePipeline(command, rv, int(i));
}
});
}
@@ -1732,7 +1732,7 @@ bool Renderer::prepareGeometryInputBindings(const Geometry *geometry, const RHIS
&& binding.attributeDivisor == a.attributeDivisor;
});
- int bindingIndex = uniqueBindings.size();
+ int bindingIndex = int(uniqueBindings.size());
if (it == uniqueBindings.end())
uniqueBindings.push_back(binding);
else
@@ -1761,7 +1761,7 @@ bool Renderer::prepareGeometryInputBindings(const Geometry *geometry, const RHIS
}
inputBindings.resize(uniqueBindings.size());
- for (int i = 0, m = uniqueBindings.size(); i < m; ++i) {
+ for (int i = 0, m = int(uniqueBindings.size()); i < m; ++i) {
const BufferBinding binding = uniqueBindings.at(i);
/*
@@ -2068,9 +2068,9 @@ Renderer::submitRenderViews(const std::vector<RHIPassInfo> &rhiPassesInfo)
QSurface *previousSurface = nullptr;
QSurface *lastUsedSurface = nullptr;
- const int rhiPassesCount = rhiPassesInfo.size();
+ const size_t rhiPassesCount = rhiPassesInfo.size();
- for (int i = 0; i < rhiPassesCount; ++i) {
+ for (size_t i = 0; i < rhiPassesCount; ++i) {
// Initialize GraphicsContext for drawing
const RHIPassInfo &rhiPassInfo = rhiPassesInfo.at(i);
@@ -2323,7 +2323,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
const size_t fgBranchCount = m_frameGraphLeaves.size();
if (fgBranchCount > 1) {
- int workBranches = fgBranchCount;
+ int workBranches = int(fgBranchCount);
for (auto leaf: m_frameGraphLeaves)
if (leaf->nodeType() == FrameGraphNode::NoDraw)
--workBranches;
@@ -2334,7 +2334,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
for (size_t i = 0; i < fgBranchCount; ++i) {
FrameGraphNode *leaf = m_frameGraphLeaves.at(i);
- RenderViewBuilder builder(leaf, i, this);
+ RenderViewBuilder builder(leaf, int(i), this);
builder.setOptimalJobCount(leaf->nodeType() == FrameGraphNode::NoDraw ? 1 : idealThreadCount);
// If we have a new RV (wasn't in the cache before, then it contains no cached data)
@@ -2355,7 +2355,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
}
// Set target number of RenderViews
- m_renderQueue.setTargetRenderViewCount(fgBranchCount);
+ m_renderQueue.setTargetRenderViewCount(int(fgBranchCount));
} else {
// FilterLayerEntityJob is part of the RenderViewBuilder jobs and must be run later
// if none of those jobs are started this frame
@@ -2396,7 +2396,7 @@ bool Renderer::performCompute(QRhiCommandBuffer *cb, RenderCommand &command)
const std::vector<QRhiCommandBuffer::DynamicOffset> offsets = pipeline->uboSet()->offsets(command);
cb->setShaderResources(command.shaderResourceBindings,
- offsets.size(),
+ int(offsets.size()),
offsets.data());
cb->dispatch(command.m_workGroups[0], command.m_workGroups[1], command.m_workGroups[2]);
@@ -2580,7 +2580,7 @@ bool Renderer::setBindingAndShaderResourcesForCommand(QRhiCommandBuffer *cb,
const std::vector<QRhiCommandBuffer::DynamicOffset> offsets = uboSet->offsets(command);
cb->setShaderResources(command.shaderResourceBindings,
- offsets.size(),
+ int(offsets.size()),
offsets.data());
return true;
}
diff --git a/src/plugins/renderers/rhi/renderer/renderview.cpp b/src/plugins/renderers/rhi/renderer/renderview.cpp
index f0e6797a5..6a0622cf6 100644
--- a/src/plugins/renderers/rhi/renderer/renderview.cpp
+++ b/src/plugins/renderers/rhi/renderer/renderview.cpp
@@ -497,7 +497,7 @@ int advanceUntilNonAdjacent(const EntityRenderCommandDataView *view,
++i;
}
}
- return i;
+ return int(i);
}
@@ -700,7 +700,7 @@ void RenderView::sort()
assert(m_renderCommandDataView);
// Compares the bitsetKey of the RenderCommands
// Key[Depth | StateCost | Shader]
- sortCommandRange(m_renderCommandDataView.data(), 0, m_renderCommandDataView->size(), 0, m_sortingTypes);
+ sortCommandRange(m_renderCommandDataView.data(), 0, int(m_renderCommandDataView->size()), 0, m_sortingTypes);
// For RenderCommand with the same shader
// We compute the adjacent change cost
@@ -743,7 +743,7 @@ void RenderView::sort()
const UniformValue &refValue = cachedUniforms.value(uniformNameId);
const UniformValue &newValue = uniforms.values.at(u);
if (newValue == refValue) {
- uniforms.erase(u);
+ uniforms.erase(int(u));
} else {
// Record updated value so that subsequent comparison
// for the next command will be made againts latest
diff --git a/src/plugins/renderers/rhi/renderer/renderview_p.h b/src/plugins/renderers/rhi/renderer/renderview_p.h
index dad66d2d5..4119693e4 100644
--- a/src/plugins/renderers/rhi/renderer/renderview_p.h
+++ b/src/plugins/renderers/rhi/renderer/renderview_p.h
@@ -298,7 +298,7 @@ public:
m_renderCommandDataView->forEachCommand(func);
}
- inline int commandCount() const { return m_renderCommandDataView ? m_renderCommandDataView->size() : 0; }
+ inline int commandCount() const { return m_renderCommandDataView ? int(m_renderCommandDataView->size()) : 0; }
inline const RenderViewUBO *renderViewUBO() const { return &m_renderViewUBO; }
diff --git a/src/render/backend/attachmentpack.cpp b/src/render/backend/attachmentpack.cpp
index 834b82bed..2acd08585 100644
--- a/src/render/backend/attachmentpack.cpp
+++ b/src/render/backend/attachmentpack.cpp
@@ -92,7 +92,7 @@ int AttachmentPack::getDrawBufferIndex(QRenderTargetOutput::AttachmentPoint atta
{
for (size_t i = 0; i < m_drawBuffers.size(); i++)
if (m_drawBuffers.at(i) == (int)attachmentPoint)
- return i;
+ return int(i);
return -1;
}
diff --git a/src/render/backend/stringtoint.cpp b/src/render/backend/stringtoint.cpp
index b08d4336e..0114bcff3 100644
--- a/src/render/backend/stringtoint.cpp
+++ b/src/render/backend/stringtoint.cpp
@@ -85,7 +85,7 @@ int StringToInt::lookupId(const QString &str)
std::unique_lock writeLocker(cache.lock);
idx = cache.map.value(str, -1);
if (idx < 0) {
- idx = cache.reverseMap.size();
+ idx = int(cache.reverseMap.size());
Q_ASSERT(size_t(cache.map.size()) == cache.reverseMap.size());
cache.map.insert(str, idx);
cache.reverseMap.push_back(str);
diff --git a/src/render/jobs/rendersyncjobs_p.h b/src/render/jobs/rendersyncjobs_p.h
index 856126e24..2307e509f 100644
--- a/src/render/jobs/rendersyncjobs_p.h
+++ b/src/render/jobs/rendersyncjobs_p.h
@@ -112,8 +112,8 @@ public:
rv->setMaterialParameterTable(dataCacheForLeaf.materialParameterGatherer);
// Split among the ideal number of command builders
- const int jobCount = m_renderViewCommandBuilderJobs.size();
- const int entityCount = entities.size();
+ const int jobCount = int(m_renderViewCommandBuilderJobs.size());
+ const int entityCount = int(entities.size());
const int idealPacketSize = std::min(std::max(10, entityCount / jobCount), entityCount);
// Try to split work into an ideal number of workers
const int m = findIdealNumberOfWorkers(entityCount, idealPacketSize, jobCount);
@@ -319,7 +319,7 @@ public:
{
int totalCommandCount = 0;
for (const RenderViewCommandBuilderJobPtrAlias &renderViewCommandBuilder : qAsConst(m_renderViewCommandBuilderJobs))
- totalCommandCount += renderViewCommandBuilder->commandData().size();
+ totalCommandCount += int(renderViewCommandBuilder->commandData().size());
commandData.reserve(totalCommandCount);
for (const RenderViewCommandBuilderJobPtrAlias &renderViewCommandBuilder : qAsConst(m_renderViewCommandBuilderJobs))
commandData += std::move(renderViewCommandBuilder->commandData());
@@ -439,8 +439,8 @@ public:
}
// Split among the number of command updaters
- const int jobCount = m_renderViewCommandUpdaterJobs.size();
- const int commandCount = filteredCommandData->size();
+ const int jobCount = int(m_renderViewCommandUpdaterJobs.size());
+ const int commandCount = int(filteredCommandData->size());
const int idealPacketSize = std::min(std::max(10, commandCount), commandCount);
const int m = findIdealNumberOfWorkers(commandCount, idealPacketSize, jobCount);