Rename 'name' member of ActionDescription to 'customName'

* This is a deliberate break of compatibility since the field is now often
  empty, for non-markers. This means code will get a more explicit error when
  the name is being referenced, so it can be updated to fetch the name it needs
  as needed.
This commit is contained in:
baldurk
2021-07-01 15:15:05 +01:00
parent 7149302680
commit d0accc409b
36 changed files with 373 additions and 275 deletions
+12
View File
@@ -297,6 +297,18 @@ If no capture is loaded or the EID doesn't correspond to a known event, ``None``
)");
virtual const ActionDescription *GetActionForEID(uint32_t eventId) = 0;
DOCUMENT(R"(Returns the formatted name of an event according to the current settings, whether
that be a custom name or an auto-generated name with/without parameter names.
If no capture is loaded or the EID doesn't correspond to a known event, an empty string will be
returned.
:param int eventId: The EID to look up.
:return: The formatted name of the specified event, or ``None`` if no such EID exists.
:rtype: str
)");
virtual rdcstr GetEventName(uint32_t eventId) = 0;
DOCUMENT(R"(Determines if a given EID is visible with the current filters applied to the event
browser.
+5 -6
View File
@@ -215,9 +215,11 @@ void RGPInterop::EventSelected(RGPInteropEvent event)
const ActionDescription *action = m_Ctx.GetAction(eventId);
if(action && QString(action->name) != event.eventname)
const SDFile &file = m_Ctx.GetStructuredFile();
if(action && QString(file.chunks[action->events.back().chunkIndex]->name) != event.eventname)
qWarning() << "Action name mismatch. Expected " << event.eventname << " but got "
<< QString(action->name);
<< QString(file.chunks[action->events.back().chunkIndex]->name);
m_Ctx.SetEventID({}, eventId, eventId);
@@ -265,10 +267,7 @@ void RGPInterop::CreateMapping(const rdcarray<ActionDescription> &actions)
if(m_EventNames.contains(chunk->name, Qt::CaseSensitive))
{
m_Event2RGP[ev.eventId].interoplinearid = (uint32_t)m_RGP2Event.size();
if(ev.eventId == action.eventId)
m_Event2RGP[ev.eventId].eventname = action.name;
else
m_Event2RGP[ev.eventId].eventname = chunk->name;
m_Event2RGP[ev.eventId].eventname = chunk->name;
m_RGP2Event.push_back(ev.eventId);
}
+2 -2
View File
@@ -278,7 +278,7 @@ void MarkerBreadcrumbs::ConfigurePathMenu(QMenu *menu, const ActionDescription *
if((child.flags & ActionFlags::PushMarker) &&
m_Ctx.GetEventBrowser()->IsAPIEventVisible(child.eventId))
{
QAction *menuAction = new QAction(child.name, menu);
QAction *menuAction = new QAction(child.customName, menu);
uint32_t eid = child.eventId;
@@ -318,7 +318,7 @@ void MarkerBreadcrumbs::elidedItemsClicked()
void MarkerBreadcrumbs::AddPathButton(const ActionDescription *action)
{
RDToolButton *b = new RDToolButton();
b->setText(action ? QString(action->name) : QString());
b->setText(action ? QString(action->customName) : QString());
if(!action)
{
b->setIcon(Icons::house());
+1 -1
View File
@@ -212,7 +212,7 @@ void APIInspector::fillAPIView()
{
if(action->IsFakeMarker())
{
RDTreeWidgetItem *root = new RDTreeWidgetItem({lit("---"), QString(action->name)});
RDTreeWidgetItem *root = new RDTreeWidgetItem({lit("---"), QString(action->customName)});
root->setBold(true);
ui->apiEvents->addTopLevelItem(root);
ui->apiEvents->setSelectedItem(root);
+19 -5
View File
@@ -514,13 +514,22 @@ struct EventItemModel : public QAbstractItemModel
return NULL;
}
rdcstr GetEventName(uint32_t eid)
{
if(eid < m_Actions.size())
return RichResourceTextFormat(m_Ctx, GetCachedEIDName(eid));
return rdcstr();
}
rdcarray<rdcstr> GetMarkerList() const
{
rdcarray<rdcstr> ret;
for(auto it = m_Nodes.begin(); it != m_Nodes.end(); ++it)
if(it.value().action && (it.value().action->flags & ActionFlags::PushMarker))
ret.push_back(it.value().action->name);
if(it.value().action && (it.value().action->flags & ActionFlags::PushMarker) &&
!it.value().action->customName.isEmpty())
ret.push_back(it.value().action->customName);
return ret;
}
@@ -1080,14 +1089,14 @@ private:
{
if(m_UseCustomActionNames)
{
name = action->name;
name = action->customName;
}
else
{
if((action->flags & (ActionFlags::SetMarker | ActionFlags::PushMarker)) &&
!(action->flags & (ActionFlags::CommandBufferBoundary | ActionFlags::PassBoundary |
ActionFlags::CmdList | ActionFlags::MultiAction)))
name = action->name;
name = action->customName;
}
}
@@ -2564,7 +2573,7 @@ nesting level.
const SDChunk *, const ActionDescription *action, const rdcstr &) {
while(action->parent)
{
if(QString(action->parent->name).contains(markerName, Qt::CaseInsensitive))
if(QString(action->parent->customName).contains(markerName, Qt::CaseInsensitive))
return true;
action = action->parent;
@@ -5234,6 +5243,11 @@ const ActionDescription *EventBrowser::GetActionForEID(uint32_t eid)
return m_Model->GetActionForEID(eid);
}
rdcstr EventBrowser::GetEventName(uint32_t eid)
{
return m_Model->GetEventName(eid);
}
bool EventBrowser::IsAPIEventVisible(uint32_t eid)
{
return m_FilterModel->mapFromSource(m_Model->GetIndexForEID(eid)).isValid();
+1
View File
@@ -124,6 +124,7 @@ public:
void UpdateDurationColumn() override;
APIEvent GetAPIEventForEID(uint32_t eid) override;
const ActionDescription *GetActionForEID(uint32_t eid) override;
rdcstr GetEventName(uint32_t eventId) override;
bool IsAPIEventVisible(uint32_t eid) override;
bool RegisterEventFilterFunction(const rdcstr &name, const rdcstr &description,
EventFilterCallback filter, FilterParseCallback parser,
@@ -501,11 +501,12 @@ div.stage table tr td { border-right: 1px solid #AAAAAA; background-color: #EEEE
for(const ActionDescription *d : actionstack)
{
context += QFormatStr(" > %1").arg(d->name);
context += QFormatStr(" > %1").arg(d->customName);
}
if(action)
context += QFormatStr(" => %1").arg(action->name);
context +=
QFormatStr(" => %1").arg(m_Ctx.GetEventBrowser()->GetEventName(action->eventId));
else
context += tr(" => Capture Start");
+5 -5
View File
@@ -209,7 +209,7 @@ public:
if(!actionstack.isEmpty())
{
ret += lit("> ") + actionstack.back()->name;
ret += lit("> ") + actionstack.back()->customName;
if(actionstack.count() > 3)
ret += lit(" ...");
@@ -217,9 +217,9 @@ public:
ret += lit("\n");
if(actionstack.count() > 2)
ret += lit("> ") + actionstack[1]->name + lit("\n");
ret += lit("> ") + actionstack[1]->customName + lit("\n");
if(actionstack.count() > 1)
ret += lit("> ") + actionstack[0]->name + lit("\n");
ret += lit("> ") + actionstack[0]->customName + lit("\n");
ret += lit("\n");
}
@@ -231,7 +231,7 @@ public:
{
ret += tr("EID %1\n%2\nBound as UAV or copy - potential modification")
.arg(mods.front().eventId)
.arg(action->name);
.arg(m_Ctx.GetEventBrowser()->GetEventName(action->eventId));
if(mods[0].preMod.col.uintValue == mods[0].postMod.col.uintValue)
{
@@ -249,7 +249,7 @@ public:
ret += tr("EID %1\n%2%3\n%4 Fragments touching pixel\n")
.arg(mods.front().eventId)
.arg(action->name)
.arg(m_Ctx.GetEventBrowser()->GetEventName(action->eventId))
.arg(failure)
.arg(mods.count());
}
+2 -1
View File
@@ -418,7 +418,8 @@ ShaderMessageViewer::ShaderMessageViewer(ICaptureContext &ctx, ShaderStageMask s
ui->label->setText(tr("Shader messages from @%1 - %2")
.arg(m_EID)
.arg(m_Action ? m_Action->name : rdcstr("Unknown action")));
.arg(m_Action ? m_Ctx.GetEventBrowser()->GetEventName(m_Action->eventId)
: rdcstr("Unknown action")));
setWindowTitle(tr("Shader messages at @%1").arg(m_EID));
+1 -1
View File
@@ -1048,7 +1048,7 @@ uint32_t TimelineBar::processActions(QVector<Marker> &markers, QVector<uint32_t>
markers.push_back(Marker());
Marker &m = markers.back();
m.name = a.name;
m.name = a.customName;
m.eidStart = a.eventId;
m.eidEnd = processActions(m.children, m.actions, a.children);