From 96c487c8c0234f910cbf9589f87b6b0112648ced Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 2 Feb 2018 17:29:12 +0000 Subject: [PATCH] Use absolute dimensions of viewport to calculate aspect ratio. Refs #856 * On vulkan the viewport height could be negative to flip the NDC, but we don't care about its sign only its magnitude to calculate the aspect ratio. --- qrenderdoc/Windows/BufferViewer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index bda92a77b..ea5868460 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -2283,8 +2283,11 @@ void BufferViewer::configureMeshColumns() Viewport vp = m_Ctx.CurPipelineState().GetViewport(0); + float vpWidth = qAbs(vp.width); + float vpHeight = qAbs(vp.height); + m_Config.fov = ui->fovGuess->value(); - m_Config.aspect = (vp.width > 0.0f && vp.height > 0.0f) ? (vp.width / vp.height) : 1.0f; + m_Config.aspect = (vpWidth > 0.0f && vpHeight > 0.0f) ? (vpWidth / vpHeight) : 1.0f; m_Config.highlightVert = 0; if(ui->aspectGuess->value() > 0.0)