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

Method UI_UpdateChannels

qrenderdoc/Windows/TextureViewer.cpp:1626–1868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1624}
1625
1626void TextureViewer::UI_UpdateChannels()
1627{
1628 TextureDescription *tex = GetCurrentTexture();
1629
1630#define SHOW(widget) widget->setVisible(true)
1631#define HIDE(widget) widget->setVisible(false)
1632#define ENABLE(widget) widget->setEnabled(true)
1633#define DISABLE(widget) widget->setEnabled(false)
1634
1635 if(tex != NULL && (tex->creationFlags & TextureCategory::SwapBuffer))
1636 {
1637 // swapbuffer is always srgb for 8-bit types, linear for 16-bit types
1638 DISABLE(ui->gammaDisplay);
1639
1640 if(tex->format.compByteWidth == 2 && tex->format.type == ResourceFormatType::Regular)
1641 m_TexDisplay.linearDisplayAsGamma = false;
1642 else
1643 m_TexDisplay.linearDisplayAsGamma = true;
1644 }
1645 else
1646 {
1647 if(tex != NULL && !tex->format.SRGBCorrected())
1648 ENABLE(ui->gammaDisplay);
1649 else
1650 DISABLE(ui->gammaDisplay);
1651
1652 m_TexDisplay.linearDisplayAsGamma =
1653 !ui->gammaDisplay->isEnabled() || ui->gammaDisplay->isChecked();
1654 }
1655
1656 if(tex != NULL && tex->format.SRGBCorrected())
1657 m_TexDisplay.linearDisplayAsGamma = false;
1658
1659 bool dsv = false;
1660 if(tex != NULL)
1661 dsv = (tex->creationFlags & TextureCategory::DepthTarget) ||
1662 (tex->format.compType == CompType::Depth);
1663
1664 bool yuv = false;
1665 if(tex != NULL)
1666 yuv = (tex->format.type == ResourceFormatType::YUV8 ||
1667 tex->format.type == ResourceFormatType::YUV10 ||
1668 tex->format.type == ResourceFormatType::YUV12 ||
1669 tex->format.type == ResourceFormatType::YUV16);
1670
1671 const bool defaultDisplay = ui->channels->currentIndex() == 0;
1672 const bool rgbmDisplay = ui->channels->currentIndex() == 1;
1673 const bool yuvDecodeDisplay = ui->channels->currentIndex() == 2;
1674 const bool customDisplay = ui->channels->currentIndex() == 3;
1675
1676 if(customDisplay && m_NeedCustomReload)
1677 {
1678 m_NeedCustomReload = false;
1679
1680 reloadCustomShaders(QString());
1681 }
1682
1683 ui->channels->setItemText(0, yuv ? lit("YUVA") : lit("RGBA"));

Callers

nothing calls this directly

Calls 7

isEnabledMethod · 0.80
toUpperMethod · 0.80
QStringFunction · 0.50
ResourceIdFunction · 0.50
setTextMethod · 0.45
IsCaptureLoadedMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected