diff options
Diffstat (limited to 'src/quick/scenegraph/coreapi')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 28 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.cpp | 31 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.h | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgmaterialshader.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgtexture.cpp | 4 |
7 files changed, 46 insertions, 28 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index df7575a33e..29d507a8fb 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -272,14 +272,14 @@ void ShaderManager::invalidated() void ShaderManager::clearCachedRendererData() { - for (ShaderManager::Shader *sms : qAsConst(stockShaders)) { + for (ShaderManager::Shader *sms : std::as_const(stockShaders)) { QSGMaterialShader *s = sms->programRhi.program; if (s) { QSGMaterialShaderPrivate *sd = QSGMaterialShaderPrivate::get(s); sd->clearCachedRendererData(); } } - for (ShaderManager::Shader *sms : qAsConst(rewrittenShaders)) { + for (ShaderManager::Shader *sms : std::as_const(rewrittenShaders)) { QSGMaterialShader *s = sms->programRhi.program; if (s) { QSGMaterialShaderPrivate *sd = QSGMaterialShaderPrivate::get(s); @@ -915,8 +915,14 @@ Renderer::~Renderer() qsg_wipeBatch(m_batchPool.at(i)); } - for (Node *n : qAsConst(m_nodes)) + for (Node *n : std::as_const(m_nodes)) { + if (n->type() == QSGNode::GeometryNodeType) { + Element *e = n->element(); + if (!e->removed) + m_elementsToDelete.add(e); + } m_nodeAllocator.release(n); + } // Remaining elements... for (int i=0; i<m_elementsToDelete.size(); ++i) @@ -1980,7 +1986,7 @@ void Renderer::uploadBatch(Batch *b) bool canMerge = (g->drawingMode() == QSGGeometry::DrawTriangles || g->drawingMode() == QSGGeometry::DrawTriangleStrip || g->drawingMode() == QSGGeometry::DrawLines || g->drawingMode() == QSGGeometry::DrawPoints) && b->positionAttribute >= 0 - && g->indexType() == QSGGeometry::UnsignedShortType + && (g->indexType() == QSGGeometry::UnsignedShortType && g->indexCount() > 0) && (flags & (QSGMaterial::NoBatching | QSGMaterial_FullMatrix)) == 0 && ((flags & QSGMaterial::RequiresFullMatrixExceptTranslate) == 0 || b->isTranslateOnlyToRoot()) && b->isSafeToBatch(); @@ -2869,11 +2875,11 @@ void Renderer::updateMaterialDynamicData(ShaderManager::Shader *sms, pd->samplerBindingTable[binding] = samplers; // does not own } - if (pd->textureBindingTable[binding].count() == pd->samplerBindingTable[binding].count()) { + if (pd->textureBindingTable[binding].size() == pd->samplerBindingTable[binding].size()) { QVarLengthArray<QRhiShaderResourceBinding::TextureAndSampler, 4> textureSamplers; - for (int i = 0; i < pd->textureBindingTable[binding].count(); ++i) { + for (int i = 0; i < pd->textureBindingTable[binding].size(); ++i) { QRhiTexture *texture = pd->textureBindingTable[binding].at(i)->rhiTexture(); @@ -2960,7 +2966,7 @@ void Renderer::updateMaterialDynamicData(ShaderManager::Shader *sms, // with increasing binding points afterwards, so the list is already sorted based // on the binding points, thus we can save some time by telling the QRhi backend // not to sort again. - if (pd->ubufBinding <= 0 || bindings.count() <= 1) + if (pd->ubufBinding <= 0 || bindings.size() <= 1) flags |= QRhiShaderResourceBindings::BindingsAreSorted; e->srb->updateResources(flags); @@ -3440,7 +3446,7 @@ void Renderer::releaseElement(Element *e, bool inDestructor) } else { if (e->srb) { if (!inDestructor) { - if (m_shaderManager->srbPool.count() < m_srbPoolThreshold) + if (m_shaderManager->srbPool.size() < m_srbPoolThreshold) m_shaderManager->srbPool.insert(e->srb->serializedLayoutDescription(), e->srb); else delete e->srb; @@ -3783,7 +3789,7 @@ void Renderer::recordRenderPass(RenderPassContext *ctx) QRhiCommandBuffer *cb = commandBuffer(); cb->debugMarkBegin(QByteArrayLiteral("Qt Quick scene render")); - for (int i = 0, ie = ctx->opaqueRenderBatches.count(); i != ie; ++i) { + for (int i = 0, ie = ctx->opaqueRenderBatches.size(); i != ie; ++i) { PreparedRenderBatch *renderBatch = &ctx->opaqueRenderBatches[i]; if (renderBatch->batch->merged) renderMergedBatch(renderBatch); @@ -3791,7 +3797,7 @@ void Renderer::recordRenderPass(RenderPassContext *ctx) renderUnmergedBatch(renderBatch); } - for (int i = 0, ie = ctx->alphaRenderBatches.count(); i != ie; ++i) { + for (int i = 0, ie = ctx->alphaRenderBatches.size(); i != ie; ++i) { PreparedRenderBatch *renderBatch = &ctx->alphaRenderBatches[i]; if (renderBatch->batch->merged) renderMergedBatch(renderBatch); @@ -3803,7 +3809,7 @@ void Renderer::recordRenderPass(RenderPassContext *ctx) if (m_renderMode == QSGRendererInterface::RenderMode3D) { // depth post-pass - for (int i = 0, ie = ctx->alphaRenderBatches.count(); i != ie; ++i) { + for (int i = 0, ie = ctx->alphaRenderBatches.size(); i != ie; ++i) { PreparedRenderBatch *renderBatch = &ctx->alphaRenderBatches[i]; if (renderBatch->batch->merged) renderMergedBatch(renderBatch, true); diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index 06771d2686..5b0c024466 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -115,7 +115,7 @@ public: // one. when an item is released, we'll reset m_freePage anyway. if (!p) { p = new AllocatorPage<Type, PageSize>(); - m_freePage = pages.count(); + m_freePage = pages.size(); pages.push_back(p); } uint pos = p->blocks[PageSize - p->available]; diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index bd082a8d79..9541107b78 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -370,8 +370,10 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D() Geometry objects are constructed by default with DrawTriangleStrip as the drawing mode. - The attribute structure is assumed to be POD and the geometry object - assumes this will not go away. There is no memory management involved. + \note \a attributes and the \l Attribute objects referenced by it must + stay valid for the entire lifetime of the QSGGeometry. + QSGGeometry stores a reference to \a attributes and does not delete + the \l Attribute objects. */ QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes, @@ -494,13 +496,18 @@ const void *QSGGeometry::indexData() const Specifies the drawing mode, also called primitive topology. + \note Starting with Qt 6 the scene graph only exposes topologies that are + supported across all the supported 3D graphics APIs. As a result, the + values \c DrawLineLoop and \c DrawTriangleFan are no longer supported at + run time in Qt 6, even though the enum values themselves are still present. + \value DrawPoints \value DrawLines - \value DrawLineLoop + \omitvalue DrawLineLoop \value DrawLineStrip \value DrawTriangles \value DrawTriangleStrip - \value DrawTriangleFan + \omitvalue DrawTriangleFan */ /*! @@ -534,10 +541,10 @@ void QSGGeometry::setDrawingMode(unsigned int mode) } /*! - Gets the current line or point width or to be used for this - geometry. This property only applies to line width when the drawingMode - is DrawLines, DarwLineStrip, or DrawLineLoop. When supported, it also - applies to point size when the drawingMode is DrawPoints. + Gets the current line or point width or to be used for this geometry. This + property only applies to line width when the drawingMode is DrawLines or + DrawLineStrip. When supported, it also applies to point size when the + drawingMode is DrawPoints. The default value is \c 1.0 @@ -556,10 +563,10 @@ float QSGGeometry::lineWidth() const } /*! - Sets the line or point width to be used for this geometry to \a - width. This property only applies to line width when the drawingMode is - DrawLines, DrawLineStrip, or DrawLineLoop. When supported, it also - applies to point size when the drawingMode is DrawPoints. + Sets the line or point width to be used for this geometry to \a width. This + property only applies to line width when the drawingMode is DrawLines or + DrawLineStrip. When supported, it also applies to point size when the + drawingMode is DrawPoints. \note Support for point and line drawing may be limited at run time, depending on the platform and graphics API. For example, some APIs do diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h index 1583bfd5b2..4392070b6e 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.h +++ b/src/quick/scenegraph/coreapi/qsggeometry.h @@ -165,6 +165,7 @@ public: void setLineWidth(float w); private: + Q_DISABLE_COPY_MOVE(QSGGeometry) friend class QSGGeometryData; int m_drawing_mode; diff --git a/src/quick/scenegraph/coreapi/qsgmaterialshader.cpp b/src/quick/scenegraph/coreapi/qsgmaterialshader.cpp index e1edbc2445..a3e8b179b3 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterialshader.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterialshader.cpp @@ -247,7 +247,7 @@ void QSGMaterialShaderPrivate::prepare(QShader::Variant vertexShaderVariant) const QShaderDescription desc = it->shader.description(); const QVector<QShaderDescription::UniformBlock> ubufs = desc.uniformBlocks(); - const int ubufCount = ubufs.count(); + const int ubufCount = ubufs.size(); if (ubufCount > 1) { qWarning("Multiple uniform blocks found in shader. " "This should be avoided as Qt Quick supports only one."); @@ -272,7 +272,7 @@ void QSGMaterialShaderPrivate::prepare(QShader::Variant vertexShaderVariant) } const QVector<QShaderDescription::InOutVariable> imageSamplers = desc.combinedImageSamplers(); - const int imageSamplersCount = imageSamplers.count(); + const int imageSamplersCount = imageSamplers.size(); for (int i = 0; i < imageSamplersCount; ++i) { const QShaderDescription::InOutVariable &var(imageSamplers[i]); diff --git a/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp b/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp index 4352b9e795..9183de29d9 100644 --- a/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp @@ -275,7 +275,7 @@ QRhiGraphicsPipeline *RhiVisualizer::PipelineCache::pipeline(RhiVisualizer *visu quint32 vertexStride, bool blendOneOne) { - for (int i = 0, ie = pipelines.count(); i != ie; ++i) { + for (int i = 0, ie = pipelines.size(); i != ie; ++i) { const Pipeline &p(pipelines.at(i)); if (p.topology == topology && p.format == vertexFormat && p.stride == vertexStride) return p.ps; @@ -316,7 +316,7 @@ QRhiGraphicsPipeline *RhiVisualizer::PipelineCache::pipeline(RhiVisualizer *visu void RhiVisualizer::PipelineCache::releaseResources() { - for (int i = 0, ie = pipelines.count(); i != ie; ++i) + for (int i = 0, ie = pipelines.size(); i != ie; ++i) delete pipelines.at(i).ps; pipelines.clear(); diff --git a/src/quick/scenegraph/coreapi/qsgtexture.cpp b/src/quick/scenegraph/coreapi/qsgtexture.cpp index 15167f8ae5..f9c1f86436 100644 --- a/src/quick/scenegraph/coreapi/qsgtexture.cpp +++ b/src/quick/scenegraph/coreapi/qsgtexture.cpp @@ -686,6 +686,7 @@ namespace QNativeInterface { \inmodule QtQuick \ingroup native-interfaces \ingroup native-interfaces-qsgtexture + \inheaderfile QSGTexture \brief Provides access to and enables adopting OpenGL texture objects. \since 6.0 */ @@ -786,6 +787,7 @@ namespace QNativeInterface { \inmodule QtQuick \ingroup native-interfaces \ingroup native-interfaces-qsgtexture + \inheaderfile QSGTexture \brief Provides access to and enables adopting Direct3D 11 texture objects. \since 6.0 */ @@ -846,6 +848,7 @@ namespace QNativeInterface { \inmodule QtQuick \ingroup native-interfaces \ingroup native-interfaces-qsgtexture + \inheaderfile QSGTexture \brief Provides access to and enables adopting Metal texture objects. \since 6.0 */ @@ -893,6 +896,7 @@ namespace QNativeInterface { \inmodule QtQuick \ingroup native-interfaces \ingroup native-interfaces-qsgtexture + \inheaderfile QSGTexture \brief Provides access to and enables adopting Vulkan image objects. \since 6.0 */ |