diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-28 17:01:59 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-29 07:54:25 +0100 |
commit | 05767abb7ef1b3c9c84633e53c29483510ba746d (patch) | |
tree | ca298afa76d6f7850f6253d728f615ae5a1da903 /src/plugins/renderers/opengl/graphicshelpers | |
parent | 429f1094bc6774dba608b5ef0e5194a7b6869aed (diff) | |
download | qt3d-05767abb7ef1b3c9c84633e53c29483510ba746d.tar.gz |
Fix a number of MSVC int conversion warnings
- Port the qHash() functions to size_t
- Add some casts
- Adapt some types
Pick-to: 6.0
Change-Id: Ib889d46dd56c1a1c4bf6b87ae1f756c188069180
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/plugins/renderers/opengl/graphicshelpers')
4 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp index ad6fde8bb..287dfffe5 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp @@ -350,7 +350,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 e3542c98a..0ef8f31c3 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -890,7 +890,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 |