Avoid mips as identifier because it fails on mips* arch
authorTimo Röhling <roehling@debian.org>
Mon, 7 Feb 2022 09:31:37 +0000 (10:31 +0100)
committerTimo Röhling <roehling@debian.org>
Mon, 7 Feb 2022 09:31:37 +0000 (10:31 +0100)
debian/patches/0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch b/debian/patches/0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch
new file mode 100644 (file)
index 0000000..2dcc85e
--- /dev/null
@@ -0,0 +1,62 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Mon, 7 Feb 2022 10:30:35 +0100
+Subject: Avoid mips as identifier because it fails on mips* arch
+
+---
+ libs/image/src/ImageSampler.cpp |  6 +++---
+ libs/image/tests/test_image.cpp | 12 ++++++------
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+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<LinearImage> mips(count);
+-    generateMipmaps(src, filter, mips.data(), count);
++    vector<LinearImage> 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");
+     }
+ }
index 62d7085bcd9d929b1f94c4e922eb94d7b0c85518..6fa49128d9b8beb970fb6b6d853fafab49729806 100644 (file)
@@ -11,3 +11,4 @@
 0011-Replace-BlueGL-with-GLEW.patch
 0012-Use-system-spirv-cross.patch
 0013-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch
+0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch