mipgen: support generation of 4-band KTX files

This is useful because our Vulkan backend currently does not accept
3-band texture data. (although we intend to fix that soon)
This commit is contained in:
Philip Rideout
2018-12-07 15:21:12 -08:00
parent 76b15e895a
commit 8dda07bf2c
4 changed files with 60 additions and 28 deletions

View File

@@ -236,4 +236,12 @@ int compare(const LinearImage& a, const LinearImage& b, float epsilon) {
[epsilon](float x, float y) { return x < y - epsilon; });
}
void clearToValue(LinearImage& image, float value) {
const uint32_t nvals = image.getWidth() * image.getHeight() * image.getChannels();
float* data = image.getPixelRef();
for (uint32_t index = 0; index < nvals; ++index) {
data[index] = value;
}
}
} // namespace image