From e12d789a83be712d7876323722c60762787c8845 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 11 Jul 2016 18:54:22 +0200 Subject: [PATCH] Fix incorrect use of texture height instead of mip. Refs #300 --- renderdocui/Windows/TextureViewer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/renderdocui/Windows/TextureViewer.cs b/renderdocui/Windows/TextureViewer.cs index 5babca332..9b9cb067a 100644 --- a/renderdocui/Windows/TextureViewer.cs +++ b/renderdocui/Windows/TextureViewer.cs @@ -2000,10 +2000,13 @@ namespace renderdocui.Windows } int y = m_CurHoverPixel.Y >> (int)m_TexDisplay.mip; + + uint mipHeight = Math.Max(1, tex.height >> (int)m_TexDisplay.mip); + if (m_Core.APIProps.pipelineType == APIPipelineStateType.OpenGL) - y = (int)(tex.height - 1) - y; + y = (int)(mipHeight - 1) - y; if (m_TexDisplay.FlipY) - y = (int)(tex.height - 1) - y; + y = (int)(mipHeight - 1) - y; y = Math.Max(0, y);