| 1624 | } |
| 1625 | |
| 1626 | void 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")); |
nothing calls this directly
no test coverage detected