MCPcopy Create free account
hub / github.com/baldurk/renderdoc / InitResourcePreview

Method InitResourcePreview

qrenderdoc/Windows/TextureViewer.cpp:2412–2473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2410}
2411
2412void TextureViewer::InitResourcePreview(ResourcePreview *prev, Descriptor res, bool force,
2413 Following &follow, const QString &bindName,
2414 const QString &slotName)
2415{
2416 Subresource sub = {0, 0, ~0U};
2417 if(res.resource != ResourceId() || force)
2418 {
2419 QString fullname = bindName;
2420 if(!m_Ctx.IsAutogeneratedName(res.resource))
2421 {
2422 if(!fullname.isEmpty())
2423 fullname += lit(" = ");
2424 fullname += m_Ctx.GetResourceName(res.resource);
2425 }
2426 if(fullname.isEmpty())
2427 fullname = m_Ctx.GetResourceName(res.resource);
2428
2429 prev->setResourceName(fullname);
2430
2431 prev->setProperty("f", QVariant::fromValue(follow));
2432 prev->setSlotName(slotName);
2433 prev->setActive(true);
2434 prev->setSelected(m_Following == follow);
2435
2436 if(m_Ctx.GetTexture(res.resource))
2437 {
2438 if(res.firstMip >= 0)
2439 sub.mip = res.firstMip;
2440 if(res.firstSlice >= 0)
2441 sub.slice = res.firstSlice;
2442 }
2443 else
2444 {
2445 res.resource = ResourceId();
2446 res.format = ResourceFormat();
2447 }
2448 }
2449 else if(m_Following == follow)
2450 {
2451 prev->setResourceName(tr("Unused"));
2452 prev->setActive(true);
2453 prev->setSelected(true);
2454
2455 res.resource = ResourceId();
2456 res.format = ResourceFormat();
2457 }
2458 else
2459 {
2460 prev->setResourceName(QString());
2461 prev->setActive(false);
2462 prev->setSelected(false);
2463
2464 return;
2465 }
2466
2467 prev->setProperty("id", QVariant::fromValue(res.resource));
2468 prev->setProperty("mip", sub.mip);
2469 prev->setProperty("slice", sub.slice);

Callers

nothing calls this directly

Calls 14

fromValueFunction · 0.85
setResourceNameMethod · 0.80
setPropertyMethod · 0.80
setSlotNameMethod · 0.80
ResourceIdFunction · 0.50
ResourceFormatClass · 0.50
trFunction · 0.50
QStringFunction · 0.50
IsAutogeneratedNameMethod · 0.45
isEmptyMethod · 0.45
GetResourceNameMethod · 0.45
setActiveMethod · 0.45

Tested by

no test coverage detected