From 6182c005b9b1de0cd34dba3f27e37326871957bd Mon Sep 17 00:00:00 2001 From: akharlamov Date: Mon, 12 Nov 2018 13:27:23 -0800 Subject: [PATCH] Apply thumbnail resampling fix to d3d11. See CL fb4ec5c7e32905b4bc1c7a66a1074e1e8f8e59c8 for full description. --- renderdoc/driver/d3d11/d3d11_device.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index a15173a96..fb8ab5e92 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -1565,17 +1565,12 @@ bool WrappedID3D11Device::EndFrameCapture(void *dev, void *wnd) { byte *data = (byte *)mapped.pData; - float aspect = float(desc.Width) / float(desc.Height); - thwidth = (uint16_t)RDCMIN(maxSize, desc.Width); thwidth &= ~0x7; // align down to multiple of 8 - thheight = uint16_t(float(thwidth) / aspect); + thheight = uint16_t(thwidth * desc.Height / desc.Width); thpixels = new byte[3U * thwidth * thheight]; - float widthf = float(desc.Width); - float heightf = float(desc.Height); - uint32_t stride = fmt.compByteWidth * fmt.compCount; bool buf1010102 = false; @@ -1593,11 +1588,10 @@ bool WrappedID3D11Device::EndFrameCapture(void *dev, void *wnd) { for(uint32_t x = 0; x < thwidth; x++) { - float xf = float(x) / float(thwidth); - float yf = float(y) / float(thheight); + uint32_t xSource = x * desc.Width / thwidth; + uint32_t ySource = y * desc.Height / thheight; - byte *src = - &data[stride * uint32_t(xf * widthf) + mapped.RowPitch * uint32_t(yf * heightf)]; + byte *src = &data[stride * xSource + mapped.RowPitch * ySource]; if(buf1010102) {