| 2349 | } |
| 2350 | |
| 2351 | void TextureViewer::OpenResourceContextMenu(ResourceId id, bool input, |
| 2352 | const rdcarray<EventUsage> &usage) |
| 2353 | { |
| 2354 | QMenu contextMenu(this); |
| 2355 | |
| 2356 | QAction openLockedTab(tr("Open new Locked Tab"), this); |
| 2357 | QAction openResourceInspector(tr("Open in Resource Inspector"), this); |
| 2358 | QAction usageTitle(tr("Used:"), this); |
| 2359 | QAction imageLayout(this); |
| 2360 | |
| 2361 | openLockedTab.setIcon(Icons::action_hover()); |
| 2362 | openResourceInspector.setIcon(Icons::link()); |
| 2363 | |
| 2364 | if(m_Ctx.CurPipelineState().SupportsBarriers()) |
| 2365 | { |
| 2366 | imageLayout.setText(tr("Image is in layout ") + m_Ctx.CurPipelineState().GetResourceLayout(id)); |
| 2367 | contextMenu.addAction(&imageLayout); |
| 2368 | contextMenu.addSeparator(); |
| 2369 | } |
| 2370 | |
| 2371 | if(id != ResourceId()) |
| 2372 | { |
| 2373 | contextMenu.addAction(&openLockedTab); |
| 2374 | contextMenu.addAction(&openResourceInspector); |
| 2375 | |
| 2376 | contextMenu.addSeparator(); |
| 2377 | m_Ctx.Extensions().MenuDisplaying(input ? ContextMenu::TextureViewer_InputThumbnail |
| 2378 | : ContextMenu::TextureViewer_OutputThumbnail, |
| 2379 | &contextMenu, {{"resourceId", id}}); |
| 2380 | |
| 2381 | contextMenu.addSeparator(); |
| 2382 | contextMenu.addAction(&usageTitle); |
| 2383 | |
| 2384 | openLockedTab.setProperty("id", QVariant::fromValue(id)); |
| 2385 | |
| 2386 | QObject::connect(&openLockedTab, &QAction::triggered, this, |
| 2387 | &TextureViewer::texContextItem_triggered); |
| 2388 | |
| 2389 | QObject::connect(&openResourceInspector, &QAction::triggered, [this, id]() { |
| 2390 | m_Ctx.ShowResourceInspector(); |
| 2391 | |
| 2392 | m_Ctx.GetResourceInspector()->Inspect(id); |
| 2393 | }); |
| 2394 | |
| 2395 | CombineUsageEvents(m_Ctx, usage, false, |
| 2396 | [this, &contextMenu](uint32_t start, uint32_t end, ResourceUsage use) { |
| 2397 | AddResourceUsageEntry(contextMenu, start, end, use); |
| 2398 | }); |
| 2399 | |
| 2400 | RDDialog::show(&contextMenu, QCursor::pos()); |
| 2401 | } |
| 2402 | else |
| 2403 | { |
| 2404 | m_Ctx.Extensions().MenuDisplaying(input ? ContextMenu::TextureViewer_InputThumbnail |
| 2405 | : ContextMenu::TextureViewer_OutputThumbnail, |
| 2406 | &contextMenu, {}); |
| 2407 | |
| 2408 | RDDialog::show(&contextMenu, QCursor::pos()); |
nothing calls this directly
no test coverage detected