From: Timo Röhling Date: Mon, 7 Feb 2022 09:30:35 +0000 (+0100) Subject: Avoid mips as identifier because it fails on mips* arch X-Git-Tag: archive/raspbian/1.9.25+dfsg2-6+rpi1~1^2^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=03bf61e0035f4bdbf2a4f8235e1d37eeb8a8e295;p=filament.git Avoid mips as identifier because it fails on mips* arch Gbp-Pq: Name 0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch --- diff --git a/libs/image/src/ImageSampler.cpp b/libs/image/src/ImageSampler.cpp index 53c68e8..80ae4b7 100644 --- a/libs/image/src/ImageSampler.cpp +++ b/libs/image/src/ImageSampler.cpp @@ -339,11 +339,11 @@ void computeSingleSample(const LinearImage& source, float x, float y, SingleSamp // Unlike traditional mipmap generation, our implementation generates all levels from the original // image, under the premise that this produces a higher quality result. -void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mips) { - mips = std::min(mips, getMipmapCount(source)); +void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mipCount) { + mipCount = std::min(mipCount, getMipmapCount(source)); uint32_t width = source.getWidth(); uint32_t height = source.getHeight(); - for (uint32_t n = 0; n < mips; ++n) { + for (uint32_t n = 0; n < mipCount; ++n) { width = std::max(width >> 1u, 1u); height = std::max(height >> 1u, 1u); result[n] = resampleImage(source, width, height, filter); diff --git a/libs/image/tests/test_image.cpp b/libs/image/tests/test_image.cpp index 963515a..7ceb323 100644 --- a/libs/image/tests/test_image.cpp +++ b/libs/image/tests/test_image.cpp @@ -342,11 +342,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT "44444 41014 40704 41014 44444 44444 41014 40704 41014 44444"); uint32_t count = getMipmapCount(src); ASSERT_EQ(count, 3); - vector mips(count); - generateMipmaps(src, filter, mips.data(), count); + vector mipmaps(count); + generateMipmaps(src, filter, mipmaps.data(), count); updateOrCompare(src, "mip0_5x10.png"); for (uint32_t index = 0; index < count; ++index) { - updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_5x10.png"); + updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_5x10.png"); } // Test color space with a classic RED => GREEN color gradient. @@ -354,11 +354,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT src = resampleImage(src, 200, 100, Filter::NEAREST); count = getMipmapCount(src); ASSERT_EQ(count, 7); - mips.resize(count); - generateMipmaps(src, filter, mips.data(), count); + mipmaps.resize(count); + generateMipmaps(src, filter, mipmaps.data(), count); updateOrCompare(src, "mip0_200x100.png"); for (uint32_t index = 0; index < count; ++index) { - updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_200x100.png"); + updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_200x100.png"); } }