HomeWildfire Games

Use all three color channels when loading heightmaps following rP21113, refs…

Description

Use all three color channels when loading heightmaps following rP21113, refs #5018.

Removes wrong debug leftover line from rP21113 and unneeded clamp from rP12308.

Differential Revision: https://code.wildfiregames.com/D1816
Patch By: Angen
Comments By: Vladislav

Event Timeline

wraitii raised a concern with this commit.Jul 30 2021, 5:45 PM
wraitii added a subscriber: wraitii.

Removing the 'debug' L90 breaks the code for grayscale images (which are all our height maps at the moment). The reason is subtle and annoying: the code attempts to convert to uncompressed BGRA, so presumably a bytesPP of 4. However, for grayscale images, this conversion fails silently with a CODEC_CANNOT_HANDLE when it tries to add the alpha channel (it would fail loudly when converting to BGR). Thus the image retains a bytesPP of 1. Thus the code is invalid: mapdata[offset] is OK, but the other two are reading other pixels, and in the case of the bottom-right pixels, they're actually reading random garbage.

This is non-deterministic, and it ended up being reported at #6261.
I'll upload a fix shortly.

This commit now has outstanding concerns.Jul 30 2021, 5:45 PM
wraitii resigned from this commit.Jul 31 2021, 7:55 PM

Fixed in rP25843

This commit no longer requires audit.Jul 31 2021, 7:55 PM