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 {
|
||||
SceneGraphRenderThread,
|
||||
SceneGraphGUIThread,
|
||||
SceneGraphRenderThread,
|
||||
|
||||
MaximumSceneGraphCategoryType
|
||||
};
|
||||
@@ -59,6 +59,7 @@ class SceneGraphTimelineModel::SceneGraphTimelineModelPrivate :
|
||||
public:
|
||||
void addVP(QVariantList &l, QString label, qint64 time) const;
|
||||
private:
|
||||
bool seenPolishAndSync;
|
||||
Q_DECLARE_PUBLIC(SceneGraphTimelineModel)
|
||||
};
|
||||
|
||||
@@ -67,25 +68,28 @@ SceneGraphTimelineModel::SceneGraphTimelineModel(QObject *parent)
|
||||
QLatin1String("SceneGraphTimeLineModel"), tr("Scene Graph"),
|
||||
QmlDebug::SceneGraphFrame, QmlDebug::MaximumRangeType, parent)
|
||||
{
|
||||
Q_D(SceneGraphTimelineModel);
|
||||
d->seenPolishAndSync = false;
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::rowCount() const
|
||||
{
|
||||
Q_D(const SceneGraphTimelineModel);
|
||||
if (isEmpty())
|
||||
return 1;
|
||||
return 3;
|
||||
return d->seenPolishAndSync ? 3 : 2;
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::getEventRow(int index) const
|
||||
{
|
||||
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
|
||||
{
|
||||
Q_D(const SceneGraphTimelineModel);
|
||||
return d->range(index).sgEventType;
|
||||
return d->seenPolishAndSync ? d->range(index).sgEventType : SceneGraphGUIThread;
|
||||
}
|
||||
|
||||
QColor SceneGraphTimelineModel::getColor(int index) const
|
||||
@@ -121,13 +125,22 @@ const QVariantList SceneGraphTimelineModel::getLabels() const
|
||||
Q_D(const SceneGraphTimelineModel);
|
||||
QVariantList result;
|
||||
|
||||
if (d->expanded && !isEmpty()) {
|
||||
for (int i = 0; i < MaximumSceneGraphCategoryType; i++) {
|
||||
QVariantMap element;
|
||||
static QVariant renderThreadLabel(labelForSGType(SceneGraphRenderThread));
|
||||
static QVariant guiThreadLabel(labelForSGType(SceneGraphGUIThread));
|
||||
|
||||
element.insert(QLatin1String("displayName"), QVariant(labelForSGType(i)));
|
||||
element.insert(QLatin1String("description"), QVariant(labelForSGType(i)));
|
||||
element.insert(QLatin1String("id"), QVariant(i));
|
||||
if (d->expanded && !isEmpty()) {
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -155,7 +168,8 @@ const QVariantList SceneGraphTimelineModel::getEventDetails(int index) const
|
||||
|
||||
{
|
||||
QVariantMap res;
|
||||
res.insert(QLatin1String("title"), QVariant(labelForSGType(ev->sgEventType)));
|
||||
res.insert(QLatin1String("title"), QVariant(labelForSGType(
|
||||
d->seenPolishAndSync ? ev->sgEventType : SceneGraphGUIThread)));
|
||||
result << res;
|
||||
}
|
||||
|
||||
@@ -252,6 +266,7 @@ void SceneGraphTimelineModel::loadData()
|
||||
break;
|
||||
}
|
||||
case SceneGraphPolishAndSync: {
|
||||
d->seenPolishAndSync = true;
|
||||
// GUI thread
|
||||
SceneGraphEvent newEvent;
|
||||
newEvent.sgEventType = SceneGraphGUIThread;
|
||||
@@ -294,6 +309,7 @@ void SceneGraphTimelineModel::clear()
|
||||
{
|
||||
Q_D(SceneGraphTimelineModel);
|
||||
d->clear();
|
||||
d->seenPolishAndSync = false;
|
||||
d->expanded = false;
|
||||
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user