From ad9ce72f61d77220ef5fca9ff19b931819aed53a Mon Sep 17 00:00:00 2001 From: Pei Jia Date: Sun, 8 May 2022 18:16:57 -0700 Subject: [PATCH] header files added, for compatibility of clang c++17. Don't forget to add -std=c++17. --- filament/backend/include/backend/Handle.h | 1 + filament/backend/include/private/backend/CommandStream.h | 1 + libs/image/src/ImageSampler.cpp | 6 +++--- libs/ktxreader/src/Ktx2Reader.cpp | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/filament/backend/include/backend/Handle.h b/filament/backend/include/backend/Handle.h index 5bbfaeab5e..7317e2c59b 100644 --- a/filament/backend/include/backend/Handle.h +++ b/filament/backend/include/backend/Handle.h @@ -26,6 +26,7 @@ #include #include +#include namespace filament::backend { diff --git a/filament/backend/include/private/backend/CommandStream.h b/filament/backend/include/private/backend/CommandStream.h index a2475f6b1d..1e2366d3bb 100644 --- a/filament/backend/include/private/backend/CommandStream.h +++ b/filament/backend/include/private/backend/CommandStream.h @@ -38,6 +38,7 @@ #include #include #include +#include #include #include diff --git a/libs/image/src/ImageSampler.cpp b/libs/image/src/ImageSampler.cpp index 98073c4894..6832483722 100644 --- a/libs/image/src/ImageSampler.cpp +++ b/libs/image/src/ImageSampler.cpp @@ -38,7 +38,7 @@ struct FilterFunction { bool rejectExternalSamples = true; }; -constexpr float M_PIf = float(filament::math::F_PI); +constexpr float MM_PIf = float(filament::math::F_PI); const FilterFunction Box { .fn = [](float t) { return t <= 0.5f ? 1.0f : 0.0f; }, @@ -50,7 +50,7 @@ const FilterFunction Nearest { Box.fn, 0.0f }; const FilterFunction Gaussian { .fn = [](float t) { if (t >= 2.0) return 0.0f; - const float scale = 1.0f / std::sqrt(0.5f * M_PIf); + const float scale = 1.0f / std::sqrt(0.5f * MM_PIf); return std::exp(-2.0f * t * t) * scale; }, .boundingRadius = 2 @@ -86,7 +86,7 @@ const FilterFunction Mitchell { // Not bothering with a fast approximation since we cache results for each row. float sinc(float t) { if (t <= 0.00001f) return 1.0f; - return std::sin(M_PIf * t) / (M_PIf * t); + return std::sin(MM_PIf * t) / (MM_PIf * t); } const FilterFunction Lanczos { diff --git a/libs/ktxreader/src/Ktx2Reader.cpp b/libs/ktxreader/src/Ktx2Reader.cpp index 7a50e1ed1d..2d2faa7f95 100644 --- a/libs/ktxreader/src/Ktx2Reader.cpp +++ b/libs/ktxreader/src/Ktx2Reader.cpp @@ -22,6 +22,7 @@ #include #include +#include #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warray-bounds"