Adjust pitch calculation in saved DDS files to match spec. Closes #2189

* The spec is not particularly clear but this matches the DirectXTex behaviour
  which is as close to 'official' as we'll get most likely.
This commit is contained in:
baldurk
2021-02-22 17:03:12 +00:00
parent 14983a76cd
commit 04e533742f
+2 -1
View File
@@ -774,7 +774,8 @@ bool write_dds_to_file(FILE *f, const write_dds_data &data)
(data.format.type == ResourceFormatType::BC1 || data.format.type == ResourceFormatType::BC4)
? 8
: 16;
header.dwPitchOrLinearSize = RDCMAX(1U, ((header.dwWidth + 3) / 4)) * blockSize;
header.dwPitchOrLinearSize =
RDCMAX(1U, ((header.dwWidth + 3) / 4)) * blockSize * RDCMAX(1U, data.height / 4);
}
else
{