From 11e8bdb209bbcae29c727200eb66548bbacc9594 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 22 Apr 2019 16:16:17 +0100 Subject: [PATCH] Display default 'viewed as' for typeless textures. Closes #1351 * Typeless textures must be interpreted as some kind of format, so without a better hint we use UNORM as a default. Ensure that this is listed explicitly --- qrenderdoc/Windows/TextureViewer.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 5d36b013b..1d28d2c95 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -1078,11 +1078,23 @@ void TextureViewer::UI_UpdateTextureDetails() current.format.type == ResourceFormatType::YUV12 || current.format.type == ResourceFormatType::YUV16); + CompType viewCast = CompType::Typeless; + if(current.format.compType != m_TexDisplay.typeHint && m_TexDisplay.typeHint != CompType::Typeless && !yuv) { - status += tr(" Viewed as %1").arg(ToQStr(m_TexDisplay.typeHint)); + viewCast = m_TexDisplay.typeHint; } + else if(current.format.compType == CompType::Typeless && + m_TexDisplay.typeHint == CompType::Typeless && !yuv) + { + // if it's a typeless texture and we don't have a hint, ensure the user knows it's being viewed + // as unorm as a fallback + viewCast = CompType::UNorm; + } + + if(viewCast != CompType::Typeless) + status += tr(" Viewed as %1").arg(ToQStr(viewCast)); ui->texStatusDim->setText(status); }