forked from qt-creator/qt-creator
Show scene graph events in correct thread for non-threaded render loop
If no polishAndSync event is ever seen we can be sure the application is doing non-threaded rendering. In that case all other events belong to the GUI thread rather than the render thread. Change-Id: Ib5d0cbcdc7c45bff6303a1b4bfb1f5333830c7f7 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -46,8 +46,8 @@ enum SceneGraphEventType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum SceneGraphCategoryType {
|
enum SceneGraphCategoryType {
|
||||||
SceneGraphRenderThread,
|
|
||||||
SceneGraphGUIThread,
|
SceneGraphGUIThread,
|
||||||
|
SceneGraphRenderThread,
|
||||||
|
|
||||||
MaximumSceneGraphCategoryType
|
MaximumSceneGraphCategoryType
|
||||||
};
|
};
|
||||||
@@ -59,6 +59,7 @@ class SceneGraphTimelineModel::SceneGraphTimelineModelPrivate :
|
|||||||
public:
|
public:
|
||||||
void addVP(QVariantList &l, QString label, qint64 time) const;
|
void addVP(QVariantList &l, QString label, qint64 time) const;
|
||||||
private:
|
private:
|
||||||
|
bool seenPolishAndSync;
|
||||||
Q_DECLARE_PUBLIC(SceneGraphTimelineModel)
|
Q_DECLARE_PUBLIC(SceneGraphTimelineModel)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -67,25 +68,28 @@ SceneGraphTimelineModel::SceneGraphTimelineModel(QObject *parent)
|
|||||||
QLatin1String("SceneGraphTimeLineModel"), tr("Scene Graph"),
|
QLatin1String("SceneGraphTimeLineModel"), tr("Scene Graph"),
|
||||||
QmlDebug::SceneGraphFrame, QmlDebug::MaximumRangeType, parent)
|
QmlDebug::SceneGraphFrame, QmlDebug::MaximumRangeType, parent)
|
||||||
{
|
{
|
||||||
|
Q_D(SceneGraphTimelineModel);
|
||||||
|
d->seenPolishAndSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SceneGraphTimelineModel::rowCount() const
|
int SceneGraphTimelineModel::rowCount() const
|
||||||
{
|
{
|
||||||
|
Q_D(const SceneGraphTimelineModel);
|
||||||
if (isEmpty())
|
if (isEmpty())
|
||||||
return 1;
|
return 1;
|
||||||
return 3;
|
return d->seenPolishAndSync ? 3 : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SceneGraphTimelineModel::getEventRow(int index) const
|
int SceneGraphTimelineModel::getEventRow(int index) const
|
||||||
{
|
{
|
||||||
Q_D(const SceneGraphTimelineModel);
|
Q_D(const SceneGraphTimelineModel);
|
||||||
return d->range(index).sgEventType + 1;
|
return d->seenPolishAndSync ? d->range(index).sgEventType + 1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SceneGraphTimelineModel::getEventId(int index) const
|
int SceneGraphTimelineModel::getEventId(int index) const
|
||||||
{
|
{
|
||||||
Q_D(const SceneGraphTimelineModel);
|
Q_D(const SceneGraphTimelineModel);
|
||||||
return d->range(index).sgEventType;
|
return d->seenPolishAndSync ? d->range(index).sgEventType : SceneGraphGUIThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor SceneGraphTimelineModel::getColor(int index) const
|
QColor SceneGraphTimelineModel::getColor(int index) const
|
||||||
@@ -121,13 +125,22 @@ const QVariantList SceneGraphTimelineModel::getLabels() const
|
|||||||
Q_D(const SceneGraphTimelineModel);
|
Q_D(const SceneGraphTimelineModel);
|
||||||
QVariantList result;
|
QVariantList result;
|
||||||
|
|
||||||
if (d->expanded && !isEmpty()) {
|
static QVariant renderThreadLabel(labelForSGType(SceneGraphRenderThread));
|
||||||
for (int i = 0; i < MaximumSceneGraphCategoryType; i++) {
|
static QVariant guiThreadLabel(labelForSGType(SceneGraphGUIThread));
|
||||||
QVariantMap element;
|
|
||||||
|
|
||||||
element.insert(QLatin1String("displayName"), QVariant(labelForSGType(i)));
|
if (d->expanded && !isEmpty()) {
|
||||||
element.insert(QLatin1String("description"), QVariant(labelForSGType(i)));
|
{
|
||||||
element.insert(QLatin1String("id"), QVariant(i));
|
QVariantMap element;
|
||||||
|
element.insert(QLatin1String("displayName"), guiThreadLabel);
|
||||||
|
element.insert(QLatin1String("description"), guiThreadLabel);
|
||||||
|
element.insert(QLatin1String("id"), SceneGraphGUIThread);
|
||||||
|
result << element;
|
||||||
|
}
|
||||||
|
if (d->seenPolishAndSync) {
|
||||||
|
QVariantMap element;
|
||||||
|
element.insert(QLatin1String("displayName"), renderThreadLabel);
|
||||||
|
element.insert(QLatin1String("description"), renderThreadLabel);
|
||||||
|
element.insert(QLatin1String("id"), SceneGraphRenderThread);
|
||||||
result << element;
|
result << element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +168,8 @@ const QVariantList SceneGraphTimelineModel::getEventDetails(int index) const
|
|||||||
|
|
||||||
{
|
{
|
||||||
QVariantMap res;
|
QVariantMap res;
|
||||||
res.insert(QLatin1String("title"), QVariant(labelForSGType(ev->sgEventType)));
|
res.insert(QLatin1String("title"), QVariant(labelForSGType(
|
||||||
|
d->seenPolishAndSync ? ev->sgEventType : SceneGraphGUIThread)));
|
||||||
result << res;
|
result << res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +266,7 @@ void SceneGraphTimelineModel::loadData()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SceneGraphPolishAndSync: {
|
case SceneGraphPolishAndSync: {
|
||||||
|
d->seenPolishAndSync = true;
|
||||||
// GUI thread
|
// GUI thread
|
||||||
SceneGraphEvent newEvent;
|
SceneGraphEvent newEvent;
|
||||||
newEvent.sgEventType = SceneGraphGUIThread;
|
newEvent.sgEventType = SceneGraphGUIThread;
|
||||||
@@ -294,6 +309,7 @@ void SceneGraphTimelineModel::clear()
|
|||||||
{
|
{
|
||||||
Q_D(SceneGraphTimelineModel);
|
Q_D(SceneGraphTimelineModel);
|
||||||
d->clear();
|
d->clear();
|
||||||
|
d->seenPolishAndSync = false;
|
||||||
d->expanded = false;
|
d->expanded = false;
|
||||||
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user