diff options
Diffstat (limited to 'src/quick/scenegraph/coreapi')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgabstractrenderer.h | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 168 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h | 74 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.cpp | 21 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgmaterial.cpp | 7 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode.cpp | 91 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode.h | 45 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode_p.h | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnodeupdater.cpp | 6 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrenderer.cpp | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrenderer_p.h | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrendernode.cpp | 26 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrendernode.h | 2 |
14 files changed, 246 insertions, 218 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp index 3d4ce24716..fddac7ed71 100644 --- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp @@ -97,7 +97,7 @@ QT_BEGIN_NAMESPACE \internal */ QSGAbstractRendererPrivate::QSGAbstractRendererPrivate() - : m_root_node(0) + : m_root_node(nullptr) , m_clear_color(Qt::transparent) , m_clear_mode(QSGAbstractRenderer::ClearColorBuffer | QSGAbstractRenderer::ClearDepthBuffer) { diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.h b/src/quick/scenegraph/coreapi/qsgabstractrenderer.h index 304dc008d5..ab6fb4f317 100644 --- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.h +++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer.h @@ -62,7 +62,7 @@ public: }; Q_DECLARE_FLAGS(ClearMode, ClearModeBit) - virtual ~QSGAbstractRenderer(); + ~QSGAbstractRenderer() override; void setRootNode(QSGRootNode *node); QSGRootNode *rootNode() const; diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 0da35fba42..ba71551302 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -144,7 +144,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material) Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphContextFrame); QSGMaterialShader *s = material->createShader(); - QOpenGLContext *ctx = QOpenGLContext::currentContext(); + QOpenGLContext *ctx = context->openglContext(); QSurfaceFormat::OpenGLContextProfile profile = ctx->format().profile(); QOpenGLShaderProgram *p = s->program(); @@ -155,10 +155,10 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material) p->bindAttributeLocation(attr[i], i); } p->bindAttributeLocation("_qt_order", i); - context->compileShader(s, material, qsgShaderRewriter_insertZAttributes(s->vertexShader(), profile), 0); + context->compileShader(s, material, qsgShaderRewriter_insertZAttributes(s->vertexShader(), profile), nullptr); context->initializeShader(s); if (!p->isLinked()) - return 0; + return nullptr; shader = new Shader; shader->program = s; @@ -215,7 +215,7 @@ void ShaderManager::invalidated() qDeleteAll(rewrittenShaders); rewrittenShaders.clear(); delete blitProgram; - blitProgram = 0; + blitProgram = nullptr; } void qsg_dumpShadowRoots(BatchRootInfo *i, int indent) @@ -226,7 +226,7 @@ void qsg_dumpShadowRoots(BatchRootInfo *i, int indent) QByteArray ind(indent + extraIndent + 10, ' '); if (!i) { - qDebug() << ind.constData() << "- no info"; + qDebug("%s - no info", ind.constData()); } else { qDebug() << ind.constData() << "- parent:" << i->parentRoot << "orders" << i->firstOrder << "->" << i->lastOrder << ", avail:" << i->availableOrders; for (QSet<Node *>::const_iterator it = i->subRoots.constBegin(); @@ -280,7 +280,7 @@ Updater::Updater(Renderer *r) void Updater::updateStates(QSGNode *n) { - m_current_clip = 0; + m_current_clip = nullptr; m_added = 0; m_transformChange = 0; @@ -293,15 +293,15 @@ void Updater::updateStates(QSGNode *n) qsg_dumpShadowRoots(sn); if (Q_UNLIKELY(debug_build())) { - qDebug() << "Updater::updateStates()"; + qDebug("Updater::updateStates()"); if (sn->dirtyState & (QSGNode::DirtyNodeAdded << 16)) - qDebug() << " - nodes have been added"; + qDebug(" - nodes have been added"); if (sn->dirtyState & (QSGNode::DirtyMatrix << 16)) - qDebug() << " - transforms have changed"; + qDebug(" - transforms have changed"); if (sn->dirtyState & (QSGNode::DirtyOpacity << 16)) - qDebug() << " - opacity has changed"; + qDebug(" - opacity has changed"); if (uint(sn->dirtyState) & uint(QSGNode::DirtyForceUpdate << 16)) - qDebug() << " - forceupdate"; + qDebug(" - forceupdate"); } if (Q_UNLIKELY(renderer->m_visualizeMode == Renderer::VisualizeChanges)) @@ -347,7 +347,7 @@ void Updater::visitNode(Node *n) m_added = count; m_force_update = force; - n->dirtyState = 0; + n->dirtyState = nullptr; } void Updater::visitClipNode(Node *n) @@ -473,7 +473,7 @@ void Updater::visitGeometryNode(Node *n) if (e->root) { BatchRootInfo *info = renderer->batchRootInfo(e->root); - while (info != 0) { + while (info != nullptr) { info->availableOrders--; if (info->availableOrders < 0) { renderer->m_rebuild |= Renderer::BuildRenderLists; @@ -481,10 +481,10 @@ void Updater::visitGeometryNode(Node *n) renderer->m_rebuild |= Renderer::BuildRenderListsForTaggedRoots; renderer->m_taggedRoots << e->root; } - if (info->parentRoot != 0) + if (info->parentRoot != nullptr) info = renderer->batchRootInfo(info->parentRoot); else - info = 0; + info = nullptr; } } else { renderer->m_rebuild |= Renderer::FullRebuild; @@ -680,12 +680,12 @@ void Batch::invalidate() // the batch to do an early out.. cleanupRemovedElements(); Element *e = first; - first = 0; - root = 0; + first = nullptr; + root = nullptr; while (e) { - e->batch = 0; + e->batch = nullptr; Element *n = e->nextInBatch; - e->nextInBatch = 0; + e->nextInBatch = nullptr; e = n; } } @@ -756,7 +756,7 @@ Renderer::Renderer(QSGDefaultRenderContext *ctx) , m_alphaRenderList(64) , m_nextRenderOrder(0) , m_partialRebuild(false) - , m_partialRebuildRoot(0) + , m_partialRebuildRoot(nullptr) , m_useDepthBuffer(true) , m_opaqueBatches(16) , m_alphaBatches(16) @@ -768,17 +768,17 @@ Renderer::Renderer(QSGDefaultRenderContext *ctx) , m_zRange(0) , m_renderOrderRebuildLower(-1) , m_renderOrderRebuildUpper(-1) - , m_currentMaterial(0) - , m_currentShader(0) + , m_currentMaterial(nullptr) + , m_currentShader(nullptr) , m_currentStencilValue(0) , m_clipMatrixId(0) - , m_currentClip(0) + , m_currentClip(nullptr) , m_currentClipType(NoClip) , m_vertexUploadPool(256) #ifdef QSG_SEPARATE_INDEX_BUFFER , m_indexUploadPool(64) #endif - , m_vao(0) + , m_vao(nullptr) , m_visualizeMode(VisualizeNothing) { initializeOpenGLFunctions(); @@ -805,8 +805,11 @@ Renderer::Renderer(QSGDefaultRenderContext *ctx) m_batchVertexThreshold = qt_sg_envInt("QSG_RENDERER_BATCH_VERTEX_THRESHOLD", 1024); if (Q_UNLIKELY(debug_build() || debug_render())) { - qDebug() << "Batch thresholds: nodes:" << m_batchNodeThreshold << " vertices:" << m_batchVertexThreshold; - qDebug() << "Using buffer strategy:" << (m_bufferStrategy == GL_STATIC_DRAW ? "static" : (m_bufferStrategy == GL_DYNAMIC_DRAW ? "dynamic" : "stream")); + qDebug("Batch thresholds: nodes: %d vertices: %d", + m_batchNodeThreshold, m_batchVertexThreshold); + qDebug("Using buffer strategy: %s", + (m_bufferStrategy == GL_STATIC_DRAW + ? "static" : (m_bufferStrategy == GL_DYNAMIC_DRAW ? "dynamic" : "stream"))); } // If rendering with an OpenGL Core profile context, we need to create a VAO @@ -913,7 +916,7 @@ void Renderer::unmap(Buffer *buffer, bool isIndexBuf) glBufferData(target, buffer->size, buffer->data, m_bufferStrategy); if (!m_context->hasBrokenIndexBufferObjects() && m_visualizeMode == VisualizeNothing) { - buffer->data = 0; + buffer->data = nullptr; } } @@ -941,7 +944,7 @@ void Renderer::removeBatchRootFromParent(Node *childRoot) Q_ASSERT(parentInfo->subRoots.contains(childRoot)); parentInfo->subRoots.remove(childRoot); - childInfo->parentRoot = 0; + childInfo->parentRoot = nullptr; } void Renderer::registerBatchRoot(Node *subRoot, Node *parentRoot) @@ -1069,7 +1072,7 @@ void Renderer::nodeWasRemoved(Node *node) if (e) { e->removed = true; m_elementsToDelete.add(e); - e->node = 0; + e->node = nullptr; if (e->root) { BatchRootInfo *info = batchRootInfo(e->root); info->availableOrders++; @@ -1112,7 +1115,7 @@ void Renderer::nodeWasRemoved(Node *node) void Renderer::turnNodeIntoBatchRoot(Node *node) { - if (Q_UNLIKELY(debug_change())) qDebug() << " - new batch root"; + if (Q_UNLIKELY(debug_change())) qDebug(" - new batch root"); m_rebuild |= FullRebuild; node->isBatchRoot = true; node->becameBatchRoot = true; @@ -1182,7 +1185,7 @@ void Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state) return; } if (node == rootNode()) - nodeWasAdded(node, 0); + nodeWasAdded(node, nullptr); else nodeWasAdded(node, m_nodes.value(node->parent())); } @@ -1435,7 +1438,7 @@ void Renderer::buildRenderListsForTaggedRoots() } } m_partialRebuild = false; - m_partialRebuildRoot = 0; + m_partialRebuildRoot = nullptr; m_taggedRoots.clear(); m_nextRenderOrder = qMax(m_nextRenderOrder, maxRenderOrder); @@ -2032,7 +2035,7 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip) int vboSize = 0; bool useVBO = false; - QOpenGLContext *ctx = QOpenGLContext::currentContext(); + QOpenGLContext *ctx = m_context->openglContext(); QSurfaceFormat::OpenGLContextProfile profile = ctx->format().profile(); if (!ctx->isOpenGLES() && profile == QSurfaceFormat::CoreProfile) { @@ -2141,7 +2144,7 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip) glBufferSubData(GL_ARRAY_BUFFER, 0, vertexByteSize, g->vertexData()); } - pointer = 0; + pointer = nullptr; } glVertexAttribPointer(0, a->tupleSize, a->type, GL_FALSE, g->sizeOfVertex(), pointer); @@ -2183,7 +2186,7 @@ void Renderer::updateClip(const QSGClipNode *clipList, const Batch *batch) m_currentClip = clipList; // updateClip sets another program, so force-reactivate our own if (m_currentShader) - setActiveShader(0, 0); + setActiveShader(nullptr, nullptr); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); if (batch->isOpaque) @@ -2204,8 +2207,8 @@ void Renderer::updateClip(const QSGClipNode *clipList, const Batch *batch) */ void Renderer::setActiveShader(QSGMaterialShader *program, ShaderManager::Shader *shader) { - const char * const *c = m_currentProgram ? m_currentProgram->attributeNames() : 0; - const char * const *n = program ? program->attributeNames() : 0; + const char * const *c = m_currentProgram ? m_currentProgram->attributeNames() : nullptr; + const char * const *n = program ? program->attributeNames() : nullptr; int cza = m_currentShader ? m_currentShader->pos_order : -1; int nza = shader ? shader->pos_order : -1; @@ -2216,18 +2219,18 @@ void Renderer::setActiveShader(QSGMaterialShader *program, ShaderManager::Shader bool was = c; if (cza == i) { was = true; - c = 0; + c = nullptr; } else if (c && !c[i]) { // end of the attribute array names - c = 0; + c = nullptr; was = false; } bool is = n; if (nza == i) { is = true; - n = 0; + n = nullptr; } else if (n && !n[i]) { - n = 0; + n = nullptr; is = false; } @@ -2243,7 +2246,7 @@ void Renderer::setActiveShader(QSGMaterialShader *program, ShaderManager::Shader m_currentProgram->deactivate(); m_currentProgram = program; m_currentShader = shader; - m_currentMaterial = 0; + m_currentMaterial = nullptr; if (m_currentProgram) { m_currentProgram->program()->bind(); m_currentProgram->activate(); @@ -2295,7 +2298,7 @@ void Renderer::renderMergedBatch(const Batch *batch) glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id); - char *indexBase = 0; + char *indexBase = nullptr; #ifdef QSG_SEPARATE_INDEX_BUFFER const Buffer *indexBuf = &batch->ibo; #else @@ -2319,7 +2322,7 @@ void Renderer::renderMergedBatch(const Batch *batch) setActiveShader(program, sms); m_current_opacity = gn->inheritedOpacity(); - if (sms->lastOpacity != m_current_opacity) { + if (!qFuzzyCompare(sms->lastOpacity, float(m_current_opacity))) { dirty |= QSGMaterialShader::RenderState::DirtyOpacity; sms->lastOpacity = m_current_opacity; } @@ -2328,7 +2331,7 @@ void Renderer::renderMergedBatch(const Batch *batch) #ifndef QT_NO_DEBUG if (qsg_test_and_clear_material_failure()) { - qDebug() << "QSGMaterial::updateState triggered an error (merged), batch will be skipped:"; + qDebug("QSGMaterial::updateState triggered an error (merged), batch will be skipped:"); Element *ee = e; while (ee) { qDebug() << " -" << ee->node; @@ -2391,7 +2394,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch) updateClip(gn->clipList(), batch); glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id); - char *indexBase = 0; + char *indexBase = nullptr; #ifdef QSG_SEPARATE_INDEX_BUFFER const Buffer *indexBuf = &batch->ibo; #else @@ -2449,7 +2452,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch) #ifndef QT_NO_DEBUG if (qsg_test_and_clear_material_failure()) { - qDebug() << "QSGMaterial::updateState() triggered an error (unmerged), batch will be skipped:"; + qDebug("QSGMaterial::updateState() triggered an error (unmerged), batch will be skipped:"); qDebug() << " - offending node is" << e->node; QSGNodeDumper::dump(rootNode()); qFatal("Aborting: scene graph is invalid..."); @@ -2494,18 +2497,21 @@ void Renderer::updateLineWidth(QSGGeometry *g) if (g->drawingMode() == GL_LINE_STRIP || g->drawingMode() == GL_LINE_LOOP || g->drawingMode() == GL_LINES) glLineWidth(g->lineWidth()); #if !defined(QT_OPENGL_ES_2) - else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) { - QOpenGLFunctions_1_0 *gl1funcs = 0; - QOpenGLFunctions_3_2_Core *gl3funcs = 0; - if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile) - gl3funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>(); - else - gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>(); - Q_ASSERT(gl1funcs || gl3funcs); - if (gl1funcs) - gl1funcs->glPointSize(g->lineWidth()); - else - gl3funcs->glPointSize(g->lineWidth()); + else { + QOpenGLContext *ctx = m_context->openglContext(); + if (!ctx->isOpenGLES() && g->drawingMode() == GL_POINTS) { + QOpenGLFunctions_1_0 *gl1funcs = nullptr; + QOpenGLFunctions_3_2_Core *gl3funcs = nullptr; + if (ctx->format().profile() == QSurfaceFormat::CoreProfile) + gl3funcs = ctx->versionFunctions<QOpenGLFunctions_3_2_Core>(); + else + gl1funcs = ctx->versionFunctions<QOpenGLFunctions_1_0>(); + Q_ASSERT(gl1funcs || gl3funcs); + if (gl1funcs) + gl1funcs->glPointSize(g->lineWidth()); + else + gl3funcs->glPointSize(g->lineWidth()); + } } #endif } @@ -2540,10 +2546,10 @@ void Renderer::renderBatches() bindable()->clear(clearMode()); m_current_opacity = 1; - m_currentMaterial = 0; - m_currentShader = 0; - m_currentProgram = 0; - m_currentClip = 0; + m_currentMaterial = nullptr; + m_currentShader = nullptr; + m_currentProgram = nullptr; + m_currentClip = nullptr; bool renderOpaque = !debug_noopaque(); bool renderAlpha = !debug_noalpha(); @@ -2576,8 +2582,8 @@ void Renderer::renderBatches() } if (m_currentShader) - setActiveShader(0, 0); - updateStencilClip(0); + setActiveShader(nullptr, nullptr); + updateStencilClip(nullptr); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glDepthMask(true); @@ -2591,12 +2597,12 @@ void Renderer::deleteRemovedElements() for (int i=0; i<m_opaqueRenderList.size(); ++i) { Element **e = m_opaqueRenderList.data() + i; if (*e && (*e)->removed) - *e = 0; + *e = nullptr; } for (int i=0; i<m_alphaRenderList.size(); ++i) { Element **e = m_alphaRenderList.data() + i; if (*e && (*e)->removed) - *e = 0; + *e = nullptr; } for (int i=0; i<m_elementsToDelete.size(); ++i) { @@ -2611,6 +2617,8 @@ void Renderer::deleteRemovedElements() void Renderer::render() { + Q_ASSERT(m_context->openglContext() == QOpenGLContext::currentContext()); + if (Q_UNLIKELY(debug_dump())) { qDebug("\n"); QSGNodeDumper::dump(rootNode()); @@ -2655,12 +2663,12 @@ void Renderer::render() m_rebuild |= BuildBatches; if (Q_UNLIKELY(debug_build())) { - qDebug() << "Opaque render lists" << (complete ? "(complete)" : "(partial)") << ":"; + qDebug("Opaque render lists %s:", (complete ? "(complete)" : "(partial)")); for (int i=0; i<m_opaqueRenderList.size(); ++i) { Element *e = m_opaqueRenderList.at(i); qDebug() << " - element:" << e << " batch:" << e->batch << " node:" << e->node << " order:" << e->order; } - qDebug() << "Alpha render list:" << (complete ? "(complete)" : "(partial)") << ":"; + qDebug("Alpha render list %s:", complete ? "(complete)" : "(partial)"); for (int i=0; i<m_alphaRenderList.size(); ++i) { Element *e = m_alphaRenderList.at(i); qDebug() << " - element:" << e << " batch:" << e->batch << " node:" << e->node << " order:" << e->order; @@ -2685,7 +2693,7 @@ void Renderer::render() if (Q_UNLIKELY(debug_render())) timePrepareAlpha = timer.restart(); if (Q_UNLIKELY(debug_build())) { - qDebug() << "Opaque Batches:"; + qDebug("Opaque Batches:"); for (int i=0; i<m_opaqueBatches.size(); ++i) { Batch *b = m_opaqueBatches.at(i); qDebug() << " - Batch " << i << b << (b->needsUpload ? "upload" : "") << " root:" << b->root; @@ -2693,7 +2701,7 @@ void Renderer::render() qDebug() << " - element:" << e << " node:" << e->node << e->order; } } - qDebug() << "Alpha Batches:"; + qDebug("Alpha Batches:"); for (int i=0; i<m_alphaBatches.size(); ++i) { Batch *b = m_alphaBatches.at(i); qDebug() << " - Batch " << i << b << (b->needsUpload ? "upload" : "") << " root:" << b->root; @@ -2731,7 +2739,7 @@ void Renderer::render() int largestIBO = 0; #endif - if (Q_UNLIKELY(debug_upload())) qDebug() << "Uploading Opaque Batches:"; + if (Q_UNLIKELY(debug_upload())) qDebug("Uploading Opaque Batches:"); for (int i=0; i<m_opaqueBatches.size(); ++i) { Batch *b = m_opaqueBatches.at(i); largestVBO = qMax(b->vbo.size, largestVBO); @@ -2743,7 +2751,7 @@ void Renderer::render() if (Q_UNLIKELY(debug_render())) timeUploadOpaque = timer.restart(); - if (Q_UNLIKELY(debug_upload())) qDebug() << "Uploading Alpha Batches:"; + if (Q_UNLIKELY(debug_upload())) qDebug("Uploading Alpha Batches:"); for (int i=0; i<m_alphaBatches.size(); ++i) { Batch *b = m_alphaBatches.at(i); uploadBatch(b); @@ -2807,11 +2815,11 @@ void Renderer::renderRenderNode(Batch *batch) Q_ASSERT(batch->first->isRenderNode); RenderNodeElement *e = (RenderNodeElement *) batch->first; - setActiveShader(0, 0); + setActiveShader(nullptr, nullptr); QSGNode *clip = e->renderNode->parent(); QSGRenderNodePrivate *rd = QSGRenderNodePrivate::get(e->renderNode); - rd->m_clip_list = 0; + rd->m_clip_list = nullptr; while (clip != rootNode()) { if (clip->type() == QSGNode::ClipNodeType) { rd->m_clip_list = static_cast<QSGClipNode *>(clip); @@ -2875,8 +2883,8 @@ void Renderer::renderRenderNode(Batch *batch) e->renderNode->render(&state); - rd->m_matrix = 0; - rd->m_clip_list = 0; + rd->m_matrix = nullptr; + rd->m_clip_list = nullptr; if (changes & QSGRenderNode::ViewportState) { QRect r = viewportRect(); @@ -2891,7 +2899,7 @@ void Renderer::renderRenderNode(Batch *batch) if (changes & (QSGRenderNode::StencilState | QSGRenderNode::ScissorState)) { glDisable(GL_SCISSOR_TEST); - m_currentClip = 0; + m_currentClip = nullptr; m_currentClipType = NoClip; } @@ -3061,7 +3069,7 @@ void Renderer::visualizeChanges(Node *n) // This is because many changes don't propegate their dirty state to the // parent so the node updater will not unset these states. They are // not used for anything so, unsetting it should have no side effects. - n->dirtyState = 0; + n->dirtyState = nullptr; } SHADOWNODE_TRAVERSE(n) { @@ -3153,7 +3161,7 @@ void Renderer::visualizeOverdraw() visualizeOverdraw_helper(m_nodes.value(rootNode())); // Animate the view... - QSurface *surface = QOpenGLContext::currentContext()->surface(); + QSurface *surface = m_context->openglContext()->surface(); if (surface->surfaceClass() == QSurface::Window) if (QQuickWindow *window = qobject_cast<QQuickWindow *>(static_cast<QWindow *>(surface))) window->update(); diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index 5c39242029..918f3ce82c 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -125,7 +125,6 @@ template <typename Type, int PageSize> class Allocator { public: Allocator() - : m_freePage(0) { pages.push_back(new AllocatorPage<Type, PageSize>()); } @@ -209,7 +208,7 @@ public: } QVector<AllocatorPage<Type, PageSize> *> pages; - int m_freePage; + int m_freePage = 0; }; @@ -306,12 +305,7 @@ struct Buffer { struct Element { Element() - : node(0) - , batch(0) - , nextInBatch(0) - , root(0) - , order(0) - , boundsComputed(false) + : boundsComputed(false) , boundsOutsideFloatRange(false) , translateOnlyToRoot(false) , removed(false) @@ -332,14 +326,14 @@ struct Element { } void computeBounds(); - QSGGeometryNode *node; - Batch *batch; - Element *nextInBatch; - Node *root; + QSGGeometryNode *node = nullptr; + Batch *batch = nullptr; + Element *nextInBatch = nullptr; + Node *root = nullptr; Rect bounds; // in device coordinates - int order; + int order = 0; uint boundsComputed : 1; uint boundsOutsideFloatRange : 1; @@ -362,12 +356,12 @@ struct RenderNodeElement : public Element { }; struct BatchRootInfo { - BatchRootInfo() : parentRoot(0), lastOrder(-1), firstOrder(-1), availableOrders(0) { } + BatchRootInfo() {} QSet<Node *> subRoots; - Node *parentRoot; - int lastOrder; - int firstOrder; - int availableOrders; + Node *parentRoot = nullptr; + int lastOrder = -1; + int firstOrder = -1; + int availableOrders = 0; }; struct ClipBatchRootInfo : public BatchRootInfo @@ -381,14 +375,13 @@ struct DrawSet : vertices(v) , zorders(z) , indices(i) - , indexCount(0) { } - DrawSet() : vertices(0), zorders(0), indices(0), indexCount(0) {} - int vertices; - int zorders; - int indices; - int indexCount; + DrawSet() {} + int vertices = 0; + int zorders = 0; + int indices = 0; + int indexCount = 0; }; enum BatchCompatibility @@ -410,8 +403,8 @@ struct Batch // pseudo-constructor... void init() { - first = 0; - root = 0; + first = nullptr; + root = nullptr; vertexCount = 0; indexCount = 0; isOpaque = false; @@ -440,7 +433,9 @@ struct Batch mutable uint uploadedThisFrame : 1; // solely for debugging purposes Buffer vbo; +#ifdef QSG_SEPARATE_INDEX_BUFFER Buffer ibo; +#endif QDataBuffer<DrawSet> drawSets; }; @@ -461,9 +456,9 @@ struct Node void append(Node *child) { Q_ASSERT(child); Q_ASSERT(!hasChild(child)); - Q_ASSERT(child->m_parent == 0); - Q_ASSERT(child->m_next == 0); - Q_ASSERT(child->m_prev == 0); + Q_ASSERT(child->m_parent == nullptr); + Q_ASSERT(child->m_next == nullptr); + Q_ASSERT(child->m_prev == nullptr); if (!m_child) { child->m_next = child; @@ -484,27 +479,27 @@ struct Node // only child.. if (child->m_next == child) { - m_child = 0; + m_child = nullptr; } else { if (m_child == child) m_child = child->m_next; child->m_next->m_prev = child->m_prev; child->m_prev->m_next = child->m_next; } - child->m_next = 0; - child->m_prev = 0; - child->setParent(0); + child->m_next = nullptr; + child->m_prev = nullptr; + child->setParent(nullptr); } Node *firstChild() const { return m_child; } Node *sibling() const { Q_ASSERT(m_parent); - return m_next == m_parent->m_child ? 0 : m_next; + return m_next == m_parent->m_child ? nullptr : m_next; } void setParent(Node *p) { - Q_ASSERT(m_parent == 0 || p == 0); + Q_ASSERT(m_parent == nullptr || p == nullptr); m_parent = p; } @@ -589,7 +584,7 @@ public: float lastOpacity; }; - ShaderManager(QSGDefaultRenderContext *ctx) : visualizeProgram(0), blitProgram(0), context(ctx) { } + ShaderManager(QSGDefaultRenderContext *ctx) : visualizeProgram(nullptr), blitProgram(nullptr), context(ctx) { } ~ShaderManager() { qDeleteAll(rewrittenShaders); qDeleteAll(stockShaders); @@ -743,7 +738,9 @@ private: ClipType m_currentClipType; QDataBuffer<char> m_vertexUploadPool; +#ifdef QSG_SEPARATE_INDEX_BUFFER QDataBuffer<char> m_indexUploadPool; +#endif // For minimal OpenGL core profile support QOpenGLVertexArrayObject *m_vao; @@ -763,7 +760,10 @@ Batch *Renderer::newBatch() m_batchPool.resize(size - 1); } else { b = new Batch(); - memset(&b->vbo, 0, sizeof(Buffer) * 2); // Clear VBO & IBO + memset(&b->vbo, 0, sizeof(Buffer)); +#ifdef QSG_SEPARATE_INDEX_BUFFER + memset(&b->ibo, 0, sizeof(Buffer)); +#endif } b->init(); return b; diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 69a8c21ed2..226709094d 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -430,9 +430,9 @@ QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes, , m_index_count(0) , m_index_type(indexType) , m_attributes(attributes) - , m_data(0) + , m_data(nullptr) , m_index_data_offset(-1) - , m_server_data(0) + , m_server_data(nullptr) , m_owns_data(false) , m_index_usage_pattern(AlwaysUploadPattern) , m_vertex_usage_pattern(AlwaysUploadPattern) @@ -529,7 +529,7 @@ QSGGeometry::~QSGGeometry() void *QSGGeometry::indexData() { return m_index_data_offset < 0 - ? 0 + ? nullptr : ((char *) m_data + m_index_data_offset); } @@ -541,7 +541,7 @@ void *QSGGeometry::indexData() const void *QSGGeometry::indexData() const { return m_index_data_offset < 0 - ? 0 + ? nullptr : ((char *) m_data + m_index_data_offset); } @@ -768,6 +768,19 @@ void QSGGeometry::updateColoredRectGeometry(QSGGeometry *g, const QRectF &rect) v[3].y = rect.bottom(); } +/*! + \enum QSGGeometry::AttributeType + + This enum identifies several attribute types. + + \value UnknownAttribute Don't care + \value PositionAttribute Position + \value ColorAttribute Color + \value TexCoordAttribute Texture coordinate + \value TexCoord1Attribute Texture coordinate 1 + \value TexCoord2Attribute Texture coordinate 2 + + */ /*! \enum QSGGeometry::DataPattern diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp index 07dc87a643..8557de1b1f 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp @@ -443,7 +443,12 @@ void QSGMaterialShader::compile() otherwise returns \c false. */ +/*! + \fn bool QSGMaterialShader::RenderState::isCachedMaterialDataDirty() const + Returns \c true if the dirtyStates() contains the dirty cached material state, + otherwise returns \c false. + */ /*! \fn QSGMaterialShader::RenderState::DirtyStates QSGMaterialShader::RenderState::dirtyStates() const @@ -636,7 +641,7 @@ static void qt_print_material_count() */ QSGMaterial::QSGMaterial() - : m_flags(0) + : m_flags(nullptr) { Q_UNUSED(m_reserved); #ifndef QT_NO_DEBUG diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 22d57001fc..9717862baa 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -114,6 +114,10 @@ static void qt_print_node_count() \value DirtyOpacity The opacity of a QSGOpacityNode has changed. \value DirtySubtreeBlocked The subtree has been blocked. + \omitvalue DirtyForceUpdate + \omitvalue DirtyUsePreprocess + \omitvalue DirtyPropagationMask + \sa QSGNode::markDirty() */ @@ -135,6 +139,8 @@ static void qt_print_node_count() ownership over the opaque material and will delete it when the node is destroyed or a material is assigned. \value InternalReserved Reserved for internal use. + + \omitvalue IsVisitableNode */ /*! @@ -149,6 +155,8 @@ static void qt_print_node_count() \value OpacityNodeType The type of QSGOpacityNode \value RenderNodeType The type of QSGRenderNode + \omitvalue RootNodeType + \sa type() */ @@ -236,15 +244,8 @@ static void qt_print_node_count() * Constructs a new node */ QSGNode::QSGNode() - : m_parent(0) - , m_type(BasicNodeType) - , m_firstChild(0) - , m_lastChild(0) - , m_nextSibling(0) - , m_previousSibling(0) - , m_subtreeRenderableCount(0) - , m_nodeFlags(OwnedByParent) - , m_dirtyState(0) + : m_nodeFlags(OwnedByParent) + , m_dirtyState(nullptr) { init(); } @@ -255,15 +256,15 @@ QSGNode::QSGNode() * \internal */ QSGNode::QSGNode(NodeType type) - : m_parent(0) + : m_parent(nullptr) , m_type(type) - , m_firstChild(0) - , m_lastChild(0) - , m_nextSibling(0) - , m_previousSibling(0) + , m_firstChild(nullptr) + , m_lastChild(nullptr) + , m_nextSibling(nullptr) + , m_previousSibling(nullptr) , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0) , m_nodeFlags(OwnedByParent) - , m_dirtyState(0) + , m_dirtyState(nullptr) { init(); } @@ -274,15 +275,15 @@ QSGNode::QSGNode(NodeType type) * \internal */ QSGNode::QSGNode(QSGNodePrivate &dd, NodeType type) - : m_parent(0) + : m_parent(nullptr) , m_type(type) - , m_firstChild(0) - , m_lastChild(0) - , m_nextSibling(0) - , m_previousSibling(0) + , m_firstChild(nullptr) + , m_lastChild(nullptr) + , m_nextSibling(nullptr) + , m_previousSibling(nullptr) , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0) , m_nodeFlags(OwnedByParent) - , m_dirtyState(0) + , m_dirtyState(nullptr) , d_ptr(&dd) { init(); @@ -380,17 +381,17 @@ void QSGNode::destroy() { if (m_parent) { m_parent->removeChildNode(this); - Q_ASSERT(m_parent == 0); + Q_ASSERT(m_parent == nullptr); } while (m_firstChild) { QSGNode *child = m_firstChild; removeChildNode(child); - Q_ASSERT(child->m_parent == 0); + Q_ASSERT(child->m_parent == nullptr); if (child->flags() & OwnedByParent) delete child; } - Q_ASSERT(m_firstChild == 0 && m_lastChild == 0); + Q_ASSERT(m_firstChild == nullptr && m_lastChild == nullptr); } @@ -549,11 +550,11 @@ void QSGNode::removeChildNode(QSGNode *node) next->m_previousSibling = previous; else m_lastChild = previous; - node->m_previousSibling = 0; - node->m_nextSibling = 0; + node->m_previousSibling = nullptr; + node->m_nextSibling = nullptr; node->markDirty(DirtyNodeRemoved); - node->m_parent = 0; + node->m_parent = nullptr; } @@ -566,13 +567,13 @@ void QSGNode::removeAllChildNodes() while (m_firstChild) { QSGNode *node = m_firstChild; m_firstChild = node->m_nextSibling; - node->m_nextSibling = 0; + node->m_nextSibling = nullptr; if (m_firstChild) - m_firstChild->m_previousSibling = 0; + m_firstChild->m_previousSibling = nullptr; else - m_lastChild = 0; + m_lastChild = nullptr; node->markDirty(DirtyNodeRemoved); - node->m_parent = 0; + node->m_parent = nullptr; } } @@ -706,9 +707,9 @@ void qsgnode_set_description(QSGNode *node, const QString &description) */ QSGBasicGeometryNode::QSGBasicGeometryNode(NodeType type) : QSGNode(type) - , m_geometry(0) - , m_matrix(0) - , m_clip_list(0) + , m_geometry(nullptr) + , m_matrix(nullptr) + , m_clip_list(nullptr) { } @@ -718,9 +719,9 @@ QSGBasicGeometryNode::QSGBasicGeometryNode(NodeType type) */ QSGBasicGeometryNode::QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type) : QSGNode(dd, type) - , m_geometry(0) - , m_matrix(0) - , m_clip_list(0) + , m_geometry(nullptr) + , m_matrix(nullptr) + , m_clip_list(nullptr) { } @@ -862,10 +863,6 @@ void QSGBasicGeometryNode::setGeometry(QSGGeometry *geometry) QSGGeometryNode::QSGGeometryNode() : QSGBasicGeometryNode(GeometryNodeType) - , m_render_order(0) - , m_material(0) - , m_opaque_material(0) - , m_opacity(1) { } @@ -876,8 +873,8 @@ QSGGeometryNode::QSGGeometryNode() QSGGeometryNode::QSGGeometryNode(QSGGeometryNodePrivate &dd) : QSGBasicGeometryNode(dd, GeometryNodeType) , m_render_order(0) - , m_material(0) - , m_opaque_material(0) + , m_material(nullptr) + , m_opaque_material(nullptr) , m_opacity(1) { } @@ -971,7 +968,7 @@ void QSGGeometryNode::setMaterial(QSGMaterial *material) delete m_material; m_material = material; #ifndef QT_NO_DEBUG - if (m_material != 0 && m_opaque_material == m_material) + if (m_material != nullptr && m_opaque_material == m_material) qWarning("QSGGeometryNode: using same material for both opaque and translucent"); #endif markDirty(DirtyMaterial); @@ -1002,7 +999,7 @@ void QSGGeometryNode::setOpaqueMaterial(QSGMaterial *material) delete m_opaque_material; m_opaque_material = material; #ifndef QT_NO_DEBUG - if (m_opaque_material != 0 && m_opaque_material == m_material) + if (m_opaque_material != nullptr && m_opaque_material == m_material) qWarning("QSGGeometryNode: using same material for both opaque and translucent"); #endif @@ -1266,7 +1263,7 @@ QSGRootNode::QSGRootNode() QSGRootNode::~QSGRootNode() { while (!m_renderers.isEmpty()) - m_renderers.constLast()->setRootNode(0); + m_renderers.constLast()->setRootNode(nullptr); destroy(); // Must call destroy() here because markDirty() casts this to QSGRootNode. } @@ -1318,8 +1315,6 @@ void QSGRootNode::notifyNodeChange(QSGNode *node, DirtyState state) */ QSGOpacityNode::QSGOpacityNode() : QSGNode(OpacityNodeType) - , m_opacity(1) - , m_combined_opacity(1) { } diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h index f2708b2b96..854e284c9e 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.h +++ b/src/quick/scenegraph/coreapi/qsgnode.h @@ -77,9 +77,7 @@ public: TransformNodeType, ClipNodeType, OpacityNodeType, -#ifndef qdoc RootNodeType, -#endif RenderNodeType }; @@ -96,9 +94,8 @@ public: OwnsOpaqueMaterial = 0x00040000, // Uppermost 8 bits are reserved for internal use. -#ifndef qdoc IsVisitableNode = 0x01000000 -#else +#ifdef Q_CLANG_QDOC InternalReserved = 0x01000000 #endif }; @@ -113,7 +110,6 @@ public: DirtyMaterial = 0x2000, DirtyOpacity = 0x4000, -#ifndef qdoc DirtyForceUpdate = 0x8000, DirtyUsePreprocess = UsePreprocess, @@ -122,7 +118,6 @@ public: | DirtyNodeAdded | DirtyOpacity | DirtyForceUpdate -#endif }; Q_DECLARE_FLAGS(DirtyState, DirtyStateBit) @@ -173,13 +168,13 @@ private: void init(); void destroy(); - QSGNode *m_parent; - NodeType m_type; - QSGNode *m_firstChild; - QSGNode *m_lastChild; - QSGNode *m_nextSibling; - QSGNode *m_previousSibling; - int m_subtreeRenderableCount; + QSGNode *m_parent = nullptr; + NodeType m_type = BasicNodeType; + QSGNode *m_firstChild = nullptr; + QSGNode *m_lastChild = nullptr; + QSGNode *m_nextSibling = nullptr; + QSGNode *m_previousSibling = nullptr; + int m_subtreeRenderableCount = 0; Flags m_nodeFlags; DirtyState m_dirtyState; // Obsolete, remove in Qt 6 @@ -195,7 +190,7 @@ void Q_QUICK_EXPORT qsgnode_set_description(QSGNode *node, const QString &descri class Q_QUICK_EXPORT QSGBasicGeometryNode : public QSGNode { public: - ~QSGBasicGeometryNode(); + ~QSGBasicGeometryNode() override; void setGeometry(QSGGeometry *geometry); const QSGGeometry *geometry() const { return m_geometry; } @@ -229,7 +224,7 @@ class Q_QUICK_EXPORT QSGGeometryNode : public QSGBasicGeometryNode { public: QSGGeometryNode(); - ~QSGGeometryNode(); + ~QSGGeometryNode() override; void setMaterial(QSGMaterial *material); QSGMaterial *material() const { return m_material; } @@ -251,18 +246,18 @@ protected: private: friend class QSGNodeUpdater; - int m_render_order; - QSGMaterial *m_material; - QSGMaterial *m_opaque_material; + int m_render_order = 0; + QSGMaterial *m_material = nullptr; + QSGMaterial *m_opaque_material = nullptr; - qreal m_opacity; + qreal m_opacity = 1; }; class Q_QUICK_EXPORT QSGClipNode : public QSGBasicGeometryNode { public: QSGClipNode(); - ~QSGClipNode(); + ~QSGClipNode() override; void setIsRectangular(bool rectHint); bool isRectangular() const { return m_is_rectangular; } @@ -282,7 +277,7 @@ class Q_QUICK_EXPORT QSGTransformNode : public QSGNode { public: QSGTransformNode(); - ~QSGTransformNode(); + ~QSGTransformNode() override; void setMatrix(const QMatrix4x4 &matrix); const QMatrix4x4 &matrix() const { return m_matrix; } @@ -300,7 +295,7 @@ class Q_QUICK_EXPORT QSGRootNode : public QSGNode { public: QSGRootNode(); - ~QSGRootNode(); + ~QSGRootNode() override; private: void notifyNodeChange(QSGNode *node, DirtyState state); @@ -317,7 +312,7 @@ class Q_QUICK_EXPORT QSGOpacityNode : public QSGNode { public: QSGOpacityNode(); - ~QSGOpacityNode(); + ~QSGOpacityNode() override; void setOpacity(qreal opacity); qreal opacity() const { return m_opacity; } @@ -328,8 +323,8 @@ public: bool isSubtreeBlocked() const override; private: - qreal m_opacity; - qreal m_combined_opacity; + qreal m_opacity = 1; + qreal m_combined_opacity = 1; }; class Q_QUICK_EXPORT QSGNodeVisitor { diff --git a/src/quick/scenegraph/coreapi/qsgnode_p.h b/src/quick/scenegraph/coreapi/qsgnode_p.h index 84d5477085..f81128f51a 100644 --- a/src/quick/scenegraph/coreapi/qsgnode_p.h +++ b/src/quick/scenegraph/coreapi/qsgnode_p.h @@ -78,18 +78,14 @@ public: class QSGBasicGeometryNodePrivate : public QSGNodePrivate { public: - QSGBasicGeometryNodePrivate() - : QSGNodePrivate() - {} + QSGBasicGeometryNodePrivate() {} }; class QSGGeometryNodePrivate: public QSGBasicGeometryNodePrivate { public: - QSGGeometryNodePrivate() - : QSGBasicGeometryNodePrivate() - {} + QSGGeometryNodePrivate() {} }; QT_END_NAMESPACE diff --git a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp index d6d533307e..8bc9ded594 100644 --- a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp +++ b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QSGNodeUpdater::QSGNodeUpdater() : m_combined_matrix_stack(64) , m_opacity_stack(64) - , m_current_clip(0) + , m_current_clip(nullptr) , m_force_update(0) { m_opacity_stack.add(1); @@ -60,7 +60,7 @@ QSGNodeUpdater::~QSGNodeUpdater() void QSGNodeUpdater::updateStates(QSGNode *n) { - m_current_clip = 0; + m_current_clip = nullptr; m_force_update = 0; Q_ASSERT(m_opacity_stack.size() == 1); // The one we added in the constructr... @@ -82,7 +82,7 @@ void QSGNodeUpdater::updateStates(QSGNode *n) bool QSGNodeUpdater::isNodeBlocked(QSGNode *node, QSGNode *root) const { - while (node != root && node != 0) { + while (node != root && node != nullptr) { if (node->isSubtreeBlocked()) return true; node = node->parent(); diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index 3ae79a933f..e1ba001d2d 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -132,8 +132,8 @@ QSGRenderer::QSGRenderer(QSGRenderContext *context) , m_current_determinant(1) , m_device_pixel_ratio(1) , m_context(context) - , m_node_updater(0) - , m_bindable(0) + , m_node_updater(nullptr) + , m_bindable(nullptr) , m_changed_emitted(false) , m_is_rendering(false) , m_is_preprocessing(false) @@ -143,7 +143,7 @@ QSGRenderer::QSGRenderer(QSGRenderContext *context) QSGRenderer::~QSGRenderer() { - setRootNode(0); + setRootNode(nullptr); delete m_node_updater; } @@ -249,7 +249,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable) m_is_rendering = false; m_changed_emitted = false; - m_bindable = 0; + m_bindable = nullptr; qCDebug(QSG_LOG_TIME_RENDERER, "time in renderer: total=%dms, preprocess=%d, updates=%d, binding=%d, rendering=%d", diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h index ae8d9f75d2..8362ff54dc 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h @@ -168,12 +168,12 @@ class Q_QUICK_PRIVATE_EXPORT QSGNodeDumper : public QSGNodeVisitor { public: static void dump(QSGNode *n); - QSGNodeDumper() : m_indent(0) {} + QSGNodeDumper() {} void visitNode(QSGNode *n) override; void visitChildren(QSGNode *n) override; private: - int m_indent; + int m_indent = 0; }; diff --git a/src/quick/scenegraph/coreapi/qsgrendernode.cpp b/src/quick/scenegraph/coreapi/qsgrendernode.cpp index a8954848d6..df3fa16a32 100644 --- a/src/quick/scenegraph/coreapi/qsgrendernode.cpp +++ b/src/quick/scenegraph/coreapi/qsgrendernode.cpp @@ -74,8 +74,8 @@ QSGRenderNode::~QSGRenderNode() } QSGRenderNodePrivate::QSGRenderNodePrivate() - : m_matrix(0) - , m_clip_list(0) + : m_matrix(nullptr) + , m_clip_list(nullptr) , m_opacity(1) { } @@ -119,7 +119,7 @@ QSGRenderNodePrivate::QSGRenderNodePrivate() */ QSGRenderNode::StateFlags QSGRenderNode::changedStates() const { - return 0; + return nullptr; } /*! @@ -213,6 +213,22 @@ void QSGRenderNode::releaseResources() } /*! + \enum QSGRenderNode::StateFlag + + This enum is a bit mask identifying several states. + + \value DepthState Depth + \value StencilState Stencil + \value ScissorState Scissor + \value ColorState Color + \value BlendState Blend + \value CullState Cull + \value ViewportState View poirt + \value RenderTargetState Render target + + */ + +/*! \enum QSGRenderNode::RenderingFlag Possible values for the bitmask returned from flags(). @@ -251,7 +267,7 @@ void QSGRenderNode::releaseResources() */ QSGRenderNode::RenderingFlags QSGRenderNode::flags() const { - return 0; + return nullptr; } /*! @@ -354,7 +370,7 @@ QSGRenderNode::RenderState::~RenderState() */ /*! - \fn const QRegion *QSGRenderNode::clipRegion() const + \fn const QRegion *QSGRenderNode::RenderState::clipRegion() const \return the current clip region or null for backends where clipping is implemented via stencil or scissoring. diff --git a/src/quick/scenegraph/coreapi/qsgrendernode.h b/src/quick/scenegraph/coreapi/qsgrendernode.h index f6bc40d3ee..0fb83b080c 100644 --- a/src/quick/scenegraph/coreapi/qsgrendernode.h +++ b/src/quick/scenegraph/coreapi/qsgrendernode.h @@ -80,7 +80,7 @@ public: }; QSGRenderNode(); - ~QSGRenderNode(); + ~QSGRenderNode() override; virtual StateFlags changedStates() const; virtual void render(const RenderState *state) = 0; |