diff options
Diffstat (limited to 'src/plugins')
34 files changed, 154 insertions, 145 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index 4c104f01de..029004ffd1 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -191,22 +191,18 @@ QQmlEngineDebugServiceImpl::propertyData(QObject *obj, int propIdx) if (binding) rv.binding = binding->expression(); - if (QQmlValueTypeFactory::isValueType(prop.userType())) { - rv.type = QQmlObjectProperty::Basic; - } else if (QQmlMetaType::isQObject(prop.userType())) { + rv.value = valueContents(prop.read(obj)); + + if (QQmlMetaType::isQObject(prop.userType())) { rv.type = QQmlObjectProperty::Object; } else if (QQmlMetaType::isList(prop.userType())) { rv.type = QQmlObjectProperty::List; } else if (prop.userType() == QMetaType::QVariant) { rv.type = QQmlObjectProperty::Variant; + } else if (rv.value.isValid()) { + rv.type = QQmlObjectProperty::Basic; } - QVariant value; - if (rv.type != QQmlObjectProperty::Unknown && prop.userType() != 0) { - value = prop.read(obj); - } - rv.value = valueContents(value); - return rv; } @@ -233,11 +229,9 @@ QVariant QQmlEngineDebugServiceImpl::valueContents(QVariant value) const if (value.type() == QVariant::Map) { QVariantMap contents; - QMapIterator<QString, QVariant> i(value.toMap()); - while (i.hasNext()) { - i.next(); + const auto map = value.toMap(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) contents.insert(i.key(), valueContents(i.value())); - } return contents; } @@ -271,10 +265,10 @@ QVariant QQmlEngineDebugServiceImpl::valueContents(QVariant value) const return s; } } - - if (isSaveable(value)) - return value; } + + if (isSaveable(value)) + return value; } if (QQmlMetaType::isQObject(userType)) { @@ -496,7 +490,7 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) QQmlDebugPacket ds(message); QByteArray type; - int queryId; + qint32 queryId; ds >> type >> queryId; QQmlDebugPacket rs; @@ -509,13 +503,13 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) QJSEngine *engine = m_engines.at(ii); QString engineName = engine->objectName(); - int engineId = QQmlDebugService::idForObject(engine); + qint32 engineId = QQmlDebugService::idForObject(engine); rs << engineName << engineId; } } else if (type == "LIST_OBJECTS") { - int engineId = -1; + qint32 engineId = -1; ds >> engineId; QQmlEngine *engine = @@ -538,7 +532,7 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) } } else if (type == "FETCH_OBJECT") { - int objectId; + qint32 objectId; bool recurse; bool dumpProperties = true; @@ -556,8 +550,8 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) } else if (type == "FETCH_OBJECTS_FOR_LOCATION") { QString file; - int lineNumber; - int columnNumber; + qint32 lineNumber; + qint32 columnNumber; bool recurse; bool dumpProperties = true; @@ -575,7 +569,7 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) } } else if (type == "WATCH_OBJECT") { - int objectId; + qint32 objectId; ds >> objectId; bool ok = m_watch->addWatch(queryId, objectId); @@ -583,7 +577,7 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) rs << QByteArray("WATCH_OBJECT_R") << queryId << ok; } else if (type == "WATCH_PROPERTY") { - int objectId; + qint32 objectId; QByteArray property; ds >> objectId >> property; @@ -592,7 +586,7 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) rs << QByteArray("WATCH_PROPERTY_R") << queryId << ok; } else if (type == "WATCH_EXPR_OBJECT") { - int debugId; + qint32 debugId; QString expr; ds >> debugId >> expr; @@ -606,11 +600,11 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) rs << QByteArray("NO_WATCH_R") << queryId << ok; } else if (type == "EVAL_EXPRESSION") { - int objectId; + qint32 objectId; QString expr; ds >> objectId >> expr; - int engineId = -1; + qint32 engineId = -1; if (!ds.atEnd()) ds >> engineId; @@ -638,12 +632,12 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) rs << QByteArray("EVAL_EXPRESSION_R") << queryId << result; } else if (type == "SET_BINDING") { - int objectId; + qint32 objectId; QString propertyName; QVariant expr; bool isLiteralValue; QString filename; - int line; + qint32 line; ds >> objectId >> propertyName >> expr >> isLiteralValue >> filename >> line; bool ok = setBinding(objectId, propertyName, expr, isLiteralValue, @@ -652,7 +646,7 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) rs << QByteArray("SET_BINDING_R") << queryId << ok; } else if (type == "RESET_BINDING") { - int objectId; + qint32 objectId; QString propertyName; ds >> objectId >> propertyName; bool ok = resetBinding(objectId, propertyName); @@ -660,7 +654,7 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) rs << QByteArray("RESET_BINDING_R") << queryId << ok; } else if (type == "SET_METHOD_BODY") { - int objectId; + qint32 objectId; QString methodName; QString methodBody; ds >> objectId >> methodName >> methodBody; @@ -823,7 +817,8 @@ bool QQmlEngineDebugServiceImpl::setMethodBody(int objectId, const QString &meth return true; } -void QQmlEngineDebugServiceImpl::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value) +void QQmlEngineDebugServiceImpl::propertyChanged( + qint32 id, qint32 objectId, const QMetaProperty &property, const QVariant &value) { QQmlDebugPacket rs; rs << QByteArray("UPDATE_WATCH") << id << objectId << QByteArray(property.name()) << valueContents(value); @@ -854,14 +849,14 @@ void QQmlEngineDebugServiceImpl::objectCreated(QJSEngine *engine, QObject *objec if (!m_engines.contains(engine)) return; - int engineId = QQmlDebugService::idForObject(engine); - int objectId = QQmlDebugService::idForObject(object); - int parentId = QQmlDebugService::idForObject(object->parent()); + qint32 engineId = QQmlDebugService::idForObject(engine); + qint32 objectId = QQmlDebugService::idForObject(object); + qint32 parentId = QQmlDebugService::idForObject(object->parent()); QQmlDebugPacket rs; //unique queryId -1 - rs << QByteArray("OBJECT_CREATED") << -1 << engineId << objectId << parentId; + rs << QByteArray("OBJECT_CREATED") << qint32(-1) << engineId << objectId << parentId; emit messageToClient(name(), rs.data()); } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h index c0c24058eb..741768cd00 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h @@ -111,7 +111,8 @@ private: friend class QQmlDebuggerServiceFactory; void processMessage(const QByteArray &msg); - void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value); + void propertyChanged(qint32 id, qint32 objectId, const QMetaProperty &property, + const QVariant &value); void prepareDeferredObjects(QObject *); void buildObjectList(QDataStream &, QQmlContext *, diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp index 86571e6cbe..8caa5ac23e 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp @@ -109,12 +109,7 @@ QQmlWatchProxy::QQmlWatchProxy(int id, void QQmlWatchProxy::notifyValueChanged() { - QVariant v; - if (m_expr) - v = m_expr->evaluate(); - else if (QQmlValueTypeFactory::isValueType(m_property.userType())) - v = m_property.read(m_object); - + const QVariant v = m_expr ? m_expr->evaluate() : m_property.read(m_object); emit m_watch->propertyChanged(m_id, m_debugId, m_property, v); } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index 8c92b4b170..506ecb64bb 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -125,7 +125,7 @@ const QV4::Object *collectProperty(const QV4::ScopedValue &value, QV4::Execution QJsonObject &dict) { QV4::Scope scope(engine); - QV4::ScopedValue typeString(scope, QV4::Runtime::method_typeofValue(engine, value)); + QV4::ScopedValue typeString(scope, QV4::Runtime::TypeofValue::call(engine, value)); dict.insert(QStringLiteral("type"), typeString->toQStringNoThrow()); const QLatin1String valueKey("value"); diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp index b424ef9f6c..61fea96e2f 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp @@ -264,7 +264,7 @@ GatherSourcesJob::GatherSourcesJob(QV4::ExecutionEngine *engine) void GatherSourcesJob::run() { - for (QV4::CompiledData::CompilationUnit *unit : engine->compilationUnits) { + for (QV4::ExecutableCompilationUnit *unit : engine->compilationUnits) { QString fileName = unit->fileName(); if (!fileName.isEmpty()) sources.append(fileName); diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp index 5866163ca6..07db5234bf 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp @@ -44,7 +44,6 @@ #include <private/qv4engine_p.h> #include <private/qv4function_p.h> #include <private/qqmldebugconnector_p.h> -#include <private/qv8engine_p.h> #include <private/qversionedpacket_p.h> #include <QtCore/QJsonArray> diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp index bac4e01df1..012730902b 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp @@ -48,6 +48,7 @@ #include <private/qversionedpacket_p.h> #include <QtGui/qwindow.h> +#include <QtCore/qregularexpression.h> //INSPECTOR SERVICE PROTOCOL // <HEADER><COMMAND><DATA> @@ -273,8 +274,10 @@ QString GlobalInspector::titleForItem(QQuickItem *item) const QString className = QLatin1String(item->metaObject()->className()); QString objectStringId = idStringForObject(item); - className.remove(QRegExp(QLatin1String("_QMLTYPE_\\d+"))); - className.remove(QRegExp(QLatin1String("_QML_\\d+"))); +#if QT_CONFIG(regularexpression) + className.remove(QRegularExpression(QLatin1String("_QMLTYPE_\\d+"))); + className.remove(QRegularExpression(QLatin1String("_QML_\\d+"))); +#endif if (className.startsWith(QLatin1String("QQuick"))) className = className.mid(6); diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp index a5c2f40420..dceaab9f6d 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp @@ -41,7 +41,6 @@ #include <private/qqmldebugconnector_p.h> #include <private/qv4debugging_p.h> -#include <private/qv8engine_p.h> #include <private/qv4engine_p.h> #include <private/qv4debugging_p.h> #include <private/qv4script_p.h> @@ -378,7 +377,7 @@ void Collector::collect(QJsonArray *out, const QString &parentIName, const QStri dict.insert(QStringLiteral("iname"), iname); dict.insert(QStringLiteral("name"), nonEmptyName); - QV4::ScopedValue typeString(scope, QV4::Runtime::method_typeofValue(m_engine, value)); + QV4::ScopedValue typeString(scope, QV4::Runtime::TypeofValue::call(m_engine, value)); dict.insert(QStringLiteral("type"), typeString->toQStringNoThrow()); switch (value.type()) { diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h index 4b4661be2f..86f2e31d60 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h @@ -42,7 +42,6 @@ #include <private/qqmldebugconnector_p.h> #include <private/qv4debugging_p.h> -#include <private/qv8engine_p.h> #include <private/qv4engine_p.h> #include <private/qv4debugging_p.h> #include <private/qv4script_p.h> diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp index 9927089e5e..bb43f75c63 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp @@ -40,6 +40,8 @@ #include "qqmlpreviewfileloader.h" #include "qqmlpreviewservice.h" +#include <QtQml/qqmlfile.h> + #include <QtCore/qlibraryinfo.h> #include <QtCore/qstandardpaths.h> diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp index 5d2684b510..8bb3b95e48 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp @@ -93,7 +93,9 @@ QQmlPreviewHandler::QQmlPreviewHandler(QObject *parent) : QObject(parent) QQmlPreviewHandler::~QQmlPreviewHandler() { +#if QT_CONFIG(translation) removeTranslators(); +#endif clear(); } @@ -223,6 +225,7 @@ void QQmlPreviewHandler::doZoom() m_lastPosition.initLastSavedWindowPosition(m_currentWindow); } +#if QT_CONFIG(translation) void QQmlPreviewHandler::removeTranslators() { if (!m_qtTranslator.isNull()) { @@ -255,6 +258,7 @@ void QQmlPreviewHandler::language(const QUrl &context, const QLocale &locale) for (QQmlEngine *engine : qAsConst(m_engines)) engine->retranslate(); } +#endif void QQmlPreviewHandler::clear() { diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.h b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.h index 47491b9d8f..f7f343a4ee 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.h +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.h @@ -81,7 +81,9 @@ public: void loadUrl(const QUrl &url); void rerun(); void zoom(qreal newFactor); +#if QT_CONFIG(translation) void language(const QUrl &context, const QLocale &locale); +#endif void clear(); @@ -115,7 +117,9 @@ private: void frameSwapped(); void fpsTimerHit(); +#if QT_CONFIG(translation) void removeTranslators(); +#endif QScopedPointer<QQuickItem> m_dummyItem; QList<QQmlEngine *> m_engines; @@ -145,8 +149,10 @@ private: FrameTime m_rendering; FrameTime m_synchronizing; +#if QT_CONFIG(translation) QScopedPointer<QTranslator> m_qtTranslator; QScopedPointer<QTranslator> m_qmlTranslator; +#endif }; QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp index 2e2224df47..2e6aaa5858 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp @@ -64,7 +64,9 @@ QQmlPreviewServiceImpl::QQmlPreviewServiceImpl(QObject *parent) : connect(this, &QQmlPreviewServiceImpl::load, &m_handler, &QQmlPreviewHandler::loadUrl); connect(this, &QQmlPreviewServiceImpl::rerun, &m_handler, &QQmlPreviewHandler::rerun); connect(this, &QQmlPreviewServiceImpl::zoom, &m_handler, &QQmlPreviewHandler::zoom); +#if QT_CONFIG(translation) connect(this, &QQmlPreviewServiceImpl::language, &m_handler, &QQmlPreviewHandler::language); +#endif connect(&m_handler, &QQmlPreviewHandler::error, this, &QQmlPreviewServiceImpl::forwardError, Qt::DirectConnection); connect(&m_handler, &QQmlPreviewHandler::fps, this, &QQmlPreviewServiceImpl::forwardFps, @@ -135,6 +137,7 @@ void QQmlPreviewServiceImpl::messageReceived(const QByteArray &data) emit zoom(static_cast<qreal>(factor)); break; } +#if QT_CONFIG(translation) case Language: { QUrl context; QString locale; @@ -143,6 +146,7 @@ void QQmlPreviewServiceImpl::messageReceived(const QByteArray &data) locale.isEmpty() ? QLocale() : QLocale(locale)); break; } +#endif default: forwardError(QString::fromLatin1("Invalid command: %1").arg(command)); break; diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.h b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.h index 7bdc87ec59..de50e6fc61 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.h +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.h @@ -99,7 +99,9 @@ signals: void rerun(); void clearCache(); void zoom(qreal factor); +#if QT_CONFIG(translation) void language(const QUrl &context, const QLocale &locale); +#endif private: QScopedPointer<QQmlPreviewFileEngineHandler> m_fileEngine; diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index 8293e88038..cc663cd6b3 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -355,14 +355,12 @@ void QQmlDebugServerImpl::parseArguments() if (argsNext == argsItEnd) break; if (ok) { - const QString nextArgument = argsNext->toString(); - - // Don't use QStringLiteral here. QRegExp has a global cache and will save an implicitly - // shared copy of the passed string. That copy isn't properly detached when the library - // is unloaded if the original string lives in the library's .rodata - if (nextArgument.contains(QRegExp(QLatin1String("^\\s*\\d+\\s*$")))) { - portTo = nextArgument.toInt(&ok); + portTo = argsNext->toString().toInt(&ok); + if (ok) { ++argsIt; + } else { + portTo = portFrom; + ok = true; } } } else if (strArgument.startsWith(QLatin1String("host:"))) { @@ -508,7 +506,7 @@ void QQmlDebugServerImpl::receiveMessage() in >> m_clientPlugins; for (DebugServiceConstIt iter = m_plugins.constBegin(), cend = m_plugins.constEnd(); iter != cend; ++iter) { - const QString pluginName = iter.key(); + const QString &pluginName = iter.key(); QQmlDebugService::State newState = QQmlDebugService::Unavailable; if (m_clientPlugins.contains(pluginName)) newState = QQmlDebugService::Enabled; diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp index 9b88af995d..f9bd04aa54 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp @@ -61,8 +61,9 @@ QSGInternalRectangleNode *QSGD3D12Context::createInternalRectangleNode() return new QSGD3D12InternalRectangleNode; } -QSGInternalImageNode *QSGD3D12Context::createInternalImageNode() +QSGInternalImageNode *QSGD3D12Context::createInternalImageNode(QSGRenderContext *renderContext) { + Q_UNUSED(renderContext); return new QSGD3D12InternalImageNode; } diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h index 70cc606b52..382183fef6 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h +++ b/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h @@ -62,7 +62,7 @@ public: QSGRenderContext *createRenderContext() override; QSGInternalRectangleNode *createInternalRectangleNode() override; - QSGInternalImageNode *createInternalImageNode() override; + QSGInternalImageNode *createInternalImageNode(QSGRenderContext *renderContext) override; QSGPainterNode *createPainterNode(QQuickPaintedItem *item) override; QSGGlyphNode *createGlyphNode(QSGRenderContext *renderContext, bool preferNativeGlyphNode) override; QSGLayer *createLayer(QSGRenderContext *renderContext) override; diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp index faa6f7566a..b9d3a180cf 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp @@ -53,7 +53,8 @@ QT_BEGIN_NAMESPACE DECLARE_DEBUG_VAR(render) QSGD3D12Layer::QSGD3D12Layer(QSGD3D12RenderContext *rc) - : m_rc(rc) + : QSGLayer(*(new QSGD3D12LayerPrivate)), + m_rc(rc) { if (Q_UNLIKELY(debug_render())) qDebug("new layer %p", this); @@ -74,6 +75,12 @@ int QSGD3D12Layer::textureId() const return m_rt; // not a texture id per se but will do } +int QSGD3D12LayerPrivate::comparisonKey() const +{ + Q_Q(const QSGD3D12Layer); + return q->m_rt; +} + QSize QSGD3D12Layer::textureSize() const { return m_size; diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h index f828843227..42a56877cf 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h +++ b/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h @@ -52,13 +52,16 @@ // #include <private/qsgadaptationlayer_p.h> +#include <private/qsgtexture_p.h> QT_BEGIN_NAMESPACE class QSGD3D12RenderContext; +class QSGD3D12LayerPrivate; class QSGD3D12Layer : public QSGLayer { + Q_DECLARE_PRIVATE(QSGD3D12Layer) Q_OBJECT public: @@ -114,6 +117,13 @@ private: bool m_updateContentPending = false; }; +class QSGD3D12LayerPrivate : public QSGTexturePrivate +{ + Q_DECLARE_PUBLIC(QSGD3D12Layer) +public: + int comparisonKey() const override; +}; + QT_END_NAMESPACE #endif // QSGD3D12LAYER_P_H diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp index 4ee4656e63..48693207c6 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp @@ -64,7 +64,7 @@ bool QSGD3D12RenderContext::isValid() const return m_engine != nullptr; } -void QSGD3D12RenderContext::initialize(void *) +void QSGD3D12RenderContext::initialize(const InitParams *) { if (m_initialized) return; diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h index 35aca100f4..c555c0808e 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h +++ b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h @@ -63,7 +63,7 @@ class QSGD3D12RenderContext : public QSGRenderContext, public QSGRendererInterfa public: QSGD3D12RenderContext(QSGContext *ctx); bool isValid() const override; - void initialize(void *context) override; + void initialize(const InitParams *params) override; void invalidate() override; void renderNextFrame(QSGRenderer *renderer, uint fbo) override; QSGTexture *createTexture(const QImage &image, uint flags) const override; diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp index 0d501f48c0..4a6894e69e 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp @@ -148,7 +148,7 @@ void QSGD3D12RenderLoop::windowDestroyed(QQuickWindow *window) delete rc; delete engine; - delete wd->animationController; + wd->animationController.reset(); } void QSGD3D12RenderLoop::exposeWindow(QQuickWindow *window) diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp index b4fb721a8b..1f574a9802 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp @@ -78,32 +78,6 @@ void QSGD3D12ShaderLinker::reset(const QByteArray &vertBlob, const QByteArray &f textureNameMap.clear(); } -void QSGD3D12ShaderLinker::feedVertexInput(const QSGShaderEffectNode::ShaderData &shader) -{ - bool foundPos = false, foundTexCoord = false; - - for (const auto &ip : qAsConst(shader.shaderInfo.inputParameters)) { - if (ip.semanticName == QByteArrayLiteral("POSITION")) - foundPos = true; - else if (ip.semanticName == QByteArrayLiteral("TEXCOORD")) - foundTexCoord = true; - } - - if (!foundPos) { - qWarning("ShaderEffect: No POSITION input found."); - error = true; - } - if (!foundTexCoord) { - qWarning("ShaderEffect: No TEXCOORD input found."); - error = true; - } - - // Nothing else to do here, the QSGGeometry::AttributeSet decides anyway - // and that is already generated by QQuickShaderEffectMesh via - // QSGGeometry::defaultAttributes_TexturedPoint2D() and has the semantics - // so it will just work. -} - void QSGD3D12ShaderLinker::feedConstants(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices) { Q_ASSERT(shader.shaderInfo.variables.count() == shader.varData.count()); @@ -634,19 +608,12 @@ void QSGD3D12ShaderEffectNode::syncMaterial(SyncData *syncData) m_material.linker.reset(vertBlob, fragBlob); if (m_material.hasCustomVertexShader) { - m_material.linker.feedVertexInput(*syncData->vertex.shader); m_material.linker.feedConstants(*syncData->vertex.shader); } else { QSGShaderEffectNode::ShaderData defaultSD; defaultSD.shaderInfo.blob = vertBlob; defaultSD.shaderInfo.type = QSGGuiThreadShaderEffectManager::ShaderInfo::TypeVertex; - QSGGuiThreadShaderEffectManager::ShaderInfo::InputParameter ip; - ip.semanticName = QByteArrayLiteral("POSITION"); - defaultSD.shaderInfo.inputParameters.append(ip); - ip.semanticName = QByteArrayLiteral("TEXCOORD"); - defaultSD.shaderInfo.inputParameters.append(ip); - // { float4x4 qt_Matrix; float qt_Opacity; } where only the matrix is used QSGGuiThreadShaderEffectManager::ShaderInfo::Variable v; v.name = QByteArrayLiteral("qt_Matrix"); @@ -656,10 +623,7 @@ void QSGD3D12ShaderEffectNode::syncMaterial(SyncData *syncData) QSGShaderEffectNode::VariableData vd; vd.specialType = QSGShaderEffectNode::VariableData::Matrix; defaultSD.varData.append(vd); - defaultSD.shaderInfo.constantDataSize = (16 + 1) * sizeof(float); - - m_material.linker.feedVertexInput(defaultSD); m_material.linker.feedConstants(defaultSD); } @@ -943,20 +907,6 @@ bool QSGD3D12GuiThreadShaderEffectManager::reflect(ShaderInfo *result) qDebug("Shader reflection size %d type %d v%u.%u input elems %d cbuffers %d boundres %d", result->blob.size(), result->type, major, minor, ieCount, cbufferCount, boundResCount); - for (int i = 0; i < ieCount; ++i) { - D3D12_SIGNATURE_PARAMETER_DESC desc; - if (FAILED(reflector->GetInputParameterDesc(i, &desc))) { - qWarning("D3D reflection: Failed to query input parameter %d", i); - return false; - } - if (desc.SystemValueType != D3D_NAME_UNDEFINED) - continue; - ShaderInfo::InputParameter param; - param.semanticName = QByteArray(desc.SemanticName); - param.semanticIndex = desc.SemanticIndex; - result->inputParameters.append(param); - } - for (int i = 0; i < boundResCount; ++i) { D3D12_SHADER_INPUT_BIND_DESC desc; if (FAILED(reflector->GetResourceBindingDesc(i, &desc))) { @@ -1036,10 +986,8 @@ bool QSGD3D12GuiThreadShaderEffectManager::reflect(ShaderInfo *result) } } - if (Q_UNLIKELY(debug_shader())) { - qDebug() << "Input:" << result->inputParameters; + if (Q_UNLIKELY(debug_shader())) qDebug() << "Variables:" << result->variables << "cbuffer size" << result->constantDataSize; - } return true; } diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h index ee17e59130..dec85fd782 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h +++ b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h @@ -67,7 +67,6 @@ class QSGD3D12ShaderLinker public: void reset(const QByteArray &vertBlob, const QByteArray &fragBlob); - void feedVertexInput(const QSGShaderEffectNode::ShaderData &shader); void feedConstants(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices = nullptr); void feedSamplers(const QSGShaderEffectNode::ShaderData &shader); void feedTextures(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices = nullptr); diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp index a5f3eb7a31..b49b851c23 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp @@ -69,6 +69,12 @@ void QSGD3D12Texture::create(const QImage &image, uint flags) m_createPending = true; } +QSGD3D12Texture::QSGD3D12Texture(QSGD3D12Engine *engine) + : QSGTexture(*(new QSGD3D12TexturePrivate)), + m_engine(engine) +{ +} + QSGD3D12Texture::~QSGD3D12Texture() { if (m_id) @@ -80,6 +86,12 @@ int QSGD3D12Texture::textureId() const return m_id; } +int QSGD3D12TexturePrivate::comparisonKey() const +{ + Q_Q(const QSGD3D12Texture); + return q->m_id; +} + QSize QSGD3D12Texture::textureSize() const { return m_image.size(); diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h index 3d0e226ddb..f6a5257773 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h +++ b/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h @@ -51,17 +51,19 @@ // We mean it. // -#include <qsgtexture.h> +#include <private/qsgtexture_p.h> #include <basetsd.h> QT_BEGIN_NAMESPACE class QSGD3D12Engine; +class QSGD3D12TexturePrivate; class QSGD3D12Texture : public QSGTexture { + Q_DECLARE_PRIVATE(QSGD3D12Texture) public: - QSGD3D12Texture(QSGD3D12Engine *engine) : m_engine(engine) { } + QSGD3D12Texture(QSGD3D12Engine *engine); ~QSGD3D12Texture(); void create(const QImage &image, uint flags); @@ -82,6 +84,13 @@ protected: bool m_alphaWanted = false; }; +class QSGD3D12TexturePrivate : public QSGTexturePrivate +{ + Q_DECLARE_PUBLIC(QSGD3D12Texture) +public: + int comparisonKey() const override; +}; + QT_END_NAMESPACE #endif diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp index 120a84566f..4302a9119b 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp @@ -121,10 +121,6 @@ const QEvent::Type WM_Obscure = QEvent::Type(QEvent::User + 1); // Passed from the RL to RT when GUI has been locked, waiting for sync. const QEvent::Type WM_RequestSync = QEvent::Type(QEvent::User + 2); -// Passed by the RT to itself to trigger another render pass. This is typically -// a result of QQuickWindow::update(). -const QEvent::Type WM_RequestRepaint = QEvent::Type(QEvent::User + 3); - // Passed by the RL to the RT to maybe release resource if no windows are // rendering. const QEvent::Type WM_TryRelease = QEvent::Type(QEvent::User + 4); @@ -377,7 +373,7 @@ bool QSGD3D12RenderThread::event(QEvent *e) QCoreApplication::processEvents(); QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); if (wme->destroying) - delete wd->animationController; + wd->animationController.reset(); } if (wme->destroying) active = false; @@ -436,14 +432,6 @@ bool QSGD3D12RenderThread::event(QEvent *e) return true; } - case WM_RequestRepaint: - if (Q_UNLIKELY(debug_loop())) - qDebug("RT - WM_RequestPaint"); - // When GUI posts this event, it is followed by a polishAndSync, so we - // must not exit the event loop yet. - pendingUpdate |= RepaintRequest; - break; - default: break; } @@ -1018,7 +1006,7 @@ void QSGD3D12ThreadedRenderLoop::handleExposure(QQuickWindow *window) if (Q_UNLIKELY(debug_loop())) qDebug("starting render thread"); // Push a few things to the render thread. - QQuickAnimatorController *controller = QQuickWindowPrivate::get(w->window)->animationController; + QQuickAnimatorController *controller = QQuickWindowPrivate::get(w->window)->animationController.data(); if (controller->thread() != w->thread) controller->moveToThread(w->thread); if (w->thread->thread() == QThread::currentThread()) { diff --git a/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp b/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp index e4acda1ffd..a5231e15d1 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgcontext.cpp @@ -68,10 +68,14 @@ QSGOpenVGRenderContext::QSGOpenVGRenderContext(QSGContext *context) } -void QSGOpenVGRenderContext::initialize(void *context) +void QSGOpenVGRenderContext::initialize(const QSGRenderContext::InitParams *params) { - m_vgContext = static_cast<QOpenVGContext*>(context); - QSGRenderContext::initialize(context); + const InitParams *vgparams = static_cast<const InitParams *>(params); + if (vgparams->sType != INIT_PARAMS_MAGIC) + qFatal("Invalid OpenVG render context parameters"); + + m_vgContext = vgparams->context; + QSGRenderContext::initialize(params); emit initialized(); } @@ -162,7 +166,7 @@ QSGInternalRectangleNode *QSGOpenVGContext::createInternalRectangleNode() return new QSGOpenVGInternalRectangleNode(); } -QSGInternalImageNode *QSGOpenVGContext::createInternalImageNode() +QSGInternalImageNode *QSGOpenVGContext::createInternalImageNode(QSGRenderContext *) { return new QSGOpenVGInternalImageNode(); } diff --git a/src/plugins/scenegraph/openvg/qsgopenvgcontext_p.h b/src/plugins/scenegraph/openvg/qsgopenvgcontext_p.h index 31a1e8643f..15d0b3f344 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgcontext_p.h +++ b/src/plugins/scenegraph/openvg/qsgopenvgcontext_p.h @@ -57,7 +57,13 @@ class QSGOpenVGRenderContext : public QSGRenderContext, public QSGRendererInterf public: QSGOpenVGRenderContext(QSGContext *context); - void initialize(void *context) override; + static const int INIT_PARAMS_MAGIC = 0x51E; + struct InitParams : public QSGRenderContext::InitParams { + int sType = INIT_PARAMS_MAGIC; + QOpenVGContext *context = nullptr; + }; + + void initialize(const QSGRenderContext::InitParams *params) override; void invalidate() override; void renderNextFrame(QSGRenderer *renderer, uint fboId) override; QSGTexture *createTexture(const QImage &image, uint flags) const override; @@ -94,7 +100,7 @@ public: QSGLayer *createLayer(QSGRenderContext *renderContext) override; QSurfaceFormat defaultSurfaceFormat() const override; QSGInternalRectangleNode *createInternalRectangleNode() override; - QSGInternalImageNode *createInternalImageNode() override; + QSGInternalImageNode *createInternalImageNode(QSGRenderContext *renderContext) override; #if QT_CONFIG(quick_sprite) QSGSpriteNode *createSpriteNode() override; #endif diff --git a/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h b/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h index 107ec0c892..40d67761bf 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h +++ b/src/plugins/scenegraph/openvg/qsgopenvgfontglyphcache.h @@ -42,7 +42,6 @@ #include <QtGui/QGlyphRun> #include <QtCore/QSet> -#include <QtCore/QLinkedList> #include <VG/openvg.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/scenegraph/openvg/qsgopenvglayer.cpp b/src/plugins/scenegraph/openvg/qsgopenvglayer.cpp index 047539d431..b03168b334 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvglayer.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvglayer.cpp @@ -44,7 +44,8 @@ QT_BEGIN_NAMESPACE QSGOpenVGLayer::QSGOpenVGLayer(QSGRenderContext *renderContext) - : m_item(nullptr) + : QSGLayer(*(new QSGOpenVGLayerPrivate)) + , m_item(nullptr) , m_renderer(nullptr) , m_device_pixel_ratio(1) , m_mirrorHorizontal(false) @@ -312,4 +313,9 @@ void QSGOpenVGLayer::grab() markDirtyTexture(); // Continuously update if 'live' and 'recursive'. } +int QSGOpenVGLayerPrivate::comparisonKey() const +{ + return 0; +} + QT_END_NAMESPACE diff --git a/src/plugins/scenegraph/openvg/qsgopenvglayer.h b/src/plugins/scenegraph/openvg/qsgopenvglayer.h index 8deedc3347..f2763463cd 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvglayer.h +++ b/src/plugins/scenegraph/openvg/qsgopenvglayer.h @@ -42,6 +42,7 @@ #include <private/qsgadaptationlayer_p.h> #include <private/qsgcontext_p.h> +#include <private/qsgtexture_p.h> #include "qopenvgcontext_p.h" #include "qopenvgoffscreensurface.h" @@ -50,9 +51,11 @@ QT_BEGIN_NAMESPACE class QSGOpenVGRenderer; class QSGOpenVGRenderContext; +class QSGOpenVGLayerPrivate; class QSGOpenVGLayer : public QSGLayer { + Q_DECLARE_PRIVATE(QSGOpenVGLayer) public: QSGOpenVGLayer(QSGRenderContext *renderContext); ~QSGOpenVGLayer(); @@ -109,6 +112,13 @@ private: QOpenVGOffscreenSurface *m_secondaryOffscreenSurface; }; +class QSGOpenVGLayerPrivate : public QSGTexturePrivate +{ + Q_DECLARE_PUBLIC(QSGOpenVGLayer) +public: + int comparisonKey() const override; +}; + QT_END_NAMESPACE #endif // QSGOPENVGLAYER_H diff --git a/src/plugins/scenegraph/openvg/qsgopenvgpainternode.cpp b/src/plugins/scenegraph/openvg/qsgopenvgpainternode.cpp index fb68ebf2bc..74f30f8189 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgpainternode.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgpainternode.cpp @@ -39,6 +39,7 @@ #include "qsgopenvgpainternode.h" #include "qsgopenvgtexture.h" +#include <private/qsgcontext_p.h> #include <qmath.h> #include <QtGui/QPainter> diff --git a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp index 994ac251e3..85651ece9d 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp @@ -96,7 +96,7 @@ void QSGOpenVGRenderLoop::windowDestroyed(QQuickWindow *window) vg->doneCurrent(); } - delete d->animationController; + d->animationController.reset(); } void QSGOpenVGRenderLoop::exposureChanged(QQuickWindow *window) @@ -176,7 +176,9 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window) if (vg == nullptr) { vg = new QOpenVGContext(window); vg->makeCurrent(); - cd->context->initialize(vg); + QSGOpenVGRenderContext::InitParams params; + params.context = vg; + cd->context->initialize(¶ms); } else { vg->makeCurrent(); } |