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) {