From ba8d16ea1ccb96e502dc1161e3ac5c31f672c90f Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 31 Oct 2019 14:35:45 +0000 Subject: [PATCH] Add y-flipping for GL in image viewer * Conventionally images have an origin at the top left, opposite to GL, so we want to flip the same as the replay proxy using GL as a proxy renderer for a non-GL API. --- renderdoc/core/image_viewer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index 32565753b..fde1224d4 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -113,6 +113,13 @@ public: void PickPixel(ResourceId texture, uint32_t x, uint32_t y, const Subresource &sub, CompType typeCast, float pixel[4]) { + if(m_Props.localRenderer == GraphicsAPI::OpenGL) + { + TextureDescription tex = m_Proxy->GetTexture(texture); + uint32_t mipHeight = RDCMAX(1U, tex.height >> sub.mip); + y = (mipHeight - 1) - y; + } + m_Proxy->PickPixel(m_TextureID, x, y, sub, typeCast, pixel); } bool GetMinMax(ResourceId texid, const Subresource &sub, CompType typeCast, float *minval, @@ -129,6 +136,10 @@ public: { if(cfg.resourceId != m_TextureID && cfg.resourceId != m_CustomTexID) cfg.resourceId = m_TextureID; + + if(m_Props.localRenderer == GraphicsAPI::OpenGL) + cfg.flipY = !cfg.flipY; + return m_Proxy->RenderTexture(cfg); } uint32_t PickVertex(uint32_t eventId, int32_t width, int32_t height, const MeshDisplay &cfg,