From d0bd2e8da289035ad143e082774c1903fcaa6f76 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 7 May 2020 12:37:06 +0100 Subject: [PATCH] Fix calculation of number of rows in block DDS formats. Closes #1870 * The number of rows should be the ceiling of the 4-row number, since any overlap becomes a whole extra row of blocks. --- renderdoc/common/dds_readwrite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renderdoc/common/dds_readwrite.cpp b/renderdoc/common/dds_readwrite.cpp index 9fe3e29f9..9ac892219 100644 --- a/renderdoc/common/dds_readwrite.cpp +++ b/renderdoc/common/dds_readwrite.cpp @@ -1131,7 +1131,7 @@ dds_data load_dds_from_file(StreamReader *reader) // pitch/rows are in blocks, not pixels, for block formats. if(blockFormat) { - numRows = RDCMAX(1U, numRows / 4); + numRows = RDCMAX(1U, (numRows + 3) / 4); uint32_t blockSize = (ret.format.type == ResourceFormatType::BC1 || ret.format.type == ResourceFormatType::BC4)