Utility: Switch static unordered_set to constexpr

This commit is contained in:
SirLynix 2022-04-07 08:42:10 +02:00
parent 6171125d21
commit ad80f3e0ec
2 changed files with 6 additions and 4 deletions

View File

@ -8,7 +8,8 @@
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Stream.hpp>
#include <Nazara/Utility/Image.hpp>
#include <unordered_set>
#include <frozen/string.h>
#include <frozen/unordered_set.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
#include <Nazara/Utility/Debug.hpp>
@ -37,10 +38,11 @@ namespace Nz
static stbi_io_callbacks s_stbiCallbacks = { StbiRead, StbiSkip, StbiEof };
constexpr auto s_supportedExtensions = frozen::make_unordered_set<frozen::string>({ "bmp", "gif", "hdr", "jpg", "jpeg", "pic", "png", "ppm", "pgm", "psd", "tga" });
bool IsSTBSupported(const std::string_view& extension)
{
static std::unordered_set<std::string_view> supportedExtensions = {"bmp", "gif", "hdr", "jpg", "jpeg", "pic", "png", "ppm", "pgm", "psd", "tga"};
return supportedExtensions.find(extension) != supportedExtensions.end();
return s_supportedExtensions.find(extension) != s_supportedExtensions.end();
}
Ternary CheckSTB(Stream& stream, const ImageParams& parameters)

View File

@ -89,7 +89,7 @@ local modules = {
},
Utility = {
Deps = {"NazaraCore"},
Packages = {"entt", "freetype", "stb"}
Packages = {"entt", "freetype", "frozen", "stb"}
},
VulkanRenderer = {
Deps = {"NazaraRenderer"},