diff --git a/examples/DeferredShading/main.cpp b/examples/DeferredShading/main.cpp index 3175d43d9..987c7bb4b 100644 --- a/examples/DeferredShading/main.cpp +++ b/examples/DeferredShading/main.cpp @@ -98,7 +98,7 @@ int main(int argc, char* argv[]) std::shared_ptr spaceship = Nz::Mesh::LoadFromFile(resourceDir / "Spaceship/spaceship.obj", meshParams); if (!spaceship) { - NazaraError("Failed to load model"); + NazaraError("failed to load model"); return __LINE__; } diff --git a/examples/Particles/LogoDemo.cpp b/examples/Particles/LogoDemo.cpp index 23698cd66..975593a86 100644 --- a/examples/Particles/LogoDemo.cpp +++ b/examples/Particles/LogoDemo.cpp @@ -128,7 +128,7 @@ ParticleDemo("Logo", sharedData) m_logo = Nz::Image::LoadFromFile("E:/Twitch/avatar_interested.png", params); if (!m_logo) - NazaraError("Failed to load logo!"); + NazaraError("failed to load logo!"); unsigned int width = m_logo->GetWidth(); unsigned int height = m_logo->GetHeight(); diff --git a/examples/PhysicsDemo/main.cpp b/examples/PhysicsDemo/main.cpp index b1a6513a0..6f2d38cc7 100644 --- a/examples/PhysicsDemo/main.cpp +++ b/examples/PhysicsDemo/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char* argv[]) std::shared_ptr spaceshipMesh = Nz::Mesh::LoadFromFile(resourceDir / "Spaceship/spaceship.obj", meshParams); if (!spaceshipMesh) { - NazaraError("Failed to load model"); + NazaraError("failed to load model"); return __LINE__; } diff --git a/examples/PhysicsPlayground/main.cpp b/examples/PhysicsPlayground/main.cpp index 5ab44a72f..550071186 100644 --- a/examples/PhysicsPlayground/main.cpp +++ b/examples/PhysicsPlayground/main.cpp @@ -251,7 +251,7 @@ int main(int argc, char* argv[]) std::shared_ptr spaceshipMesh = fs.Load("assets/Spaceship/spaceship.obj", meshParams); if (!spaceshipMesh) { - NazaraError("Failed to load model"); + NazaraError("failed to load model"); return __LINE__; } diff --git a/examples/Showcase/main.cpp b/examples/Showcase/main.cpp index ee3965f73..b4d94e091 100644 --- a/examples/Showcase/main.cpp +++ b/examples/Showcase/main.cpp @@ -106,7 +106,6 @@ int main(int argc, char* argv[]) //cameraNode.SetParent(playerRotNode); auto& cameraComponent = playerCamera.emplace(&windowSwapchain); - cameraComponent.EnableFramePipelinePasses(Nz::FramePipelineExtraPass::GammaCorrection); cameraComponent.UpdateZNear(0.2f); cameraComponent.UpdateZFar(10000.f); cameraComponent.UpdateRenderMask(1); diff --git a/include/Nazara/Core/AppFilesystemComponent.inl b/include/Nazara/Core/AppFilesystemComponent.inl index 36688b195..e980c007f 100644 --- a/include/Nazara/Core/AppFilesystemComponent.inl +++ b/include/Nazara/Core/AppFilesystemComponent.inl @@ -105,7 +105,7 @@ namespace Nz using Param = std::decay_t; if constexpr (std::is_base_of_v) { - NazaraError("{} is a directory", assetPath); + NazaraErrorFmt("{} is a directory", assetPath); return false; } else if constexpr (std::is_same_v) @@ -136,7 +136,7 @@ namespace Nz using Param = std::decay_t; if constexpr (std::is_base_of_v) { - NazaraError("{} is a directory", assetPath); + NazaraErrorFmt("{} is a directory", assetPath); return false; } else if constexpr (std::is_same_v) diff --git a/include/Nazara/Core/ByteStream.inl b/include/Nazara/Core/ByteStream.inl index 7c3f73ccf..116f5d837 100644 --- a/include/Nazara/Core/ByteStream.inl +++ b/include/Nazara/Core/ByteStream.inl @@ -171,7 +171,7 @@ namespace Nz OnEmptyStream(); if (!Unserialize(m_context, &value)) - NazaraError("Failed to serialize value"); + NazaraError("failed to serialize value"); return *this; } @@ -192,7 +192,7 @@ namespace Nz OnEmptyStream(); if (!Serialize(m_context, value)) - NazaraError("Failed to serialize value"); + NazaraError("failed to serialize value"); return *this; } diff --git a/include/Nazara/Core/Error.hpp b/include/Nazara/Core/Error.hpp index bdffc1700..846bef0fd 100644 --- a/include/Nazara/Core/Error.hpp +++ b/include/Nazara/Core/Error.hpp @@ -14,14 +14,18 @@ #include #if NAZARA_CORE_ENABLE_ASSERTS || defined(NAZARA_DEBUG) - #define NazaraAssert(a, ...) if NAZARA_UNLIKELY(!(a)) Nz::Error::Trigger(Nz::ErrorType::AssertFailed, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, __VA_ARGS__) + #define NazaraAssert(a, err) if NAZARA_UNLIKELY(!(a)) Nz::Error::Trigger(Nz::ErrorType::AssertFailed, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, err) + #define NazaraAssertFmt(a, fmt, ...) if NAZARA_UNLIKELY(!(a)) Nz::Error::Trigger(Nz::ErrorType::AssertFailed, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, Nz::Format(NAZARA_FORMAT(fmt), __VA_ARGS__)) #else - #define NazaraAssert(a, ...) for (;;) break + #define NazaraAssertFmt(a, fmt, ...) for (;;) break #endif -#define NazaraError(...) Nz::Error::Trigger(Nz::ErrorType::Normal, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, __VA_ARGS__) -#define NazaraInternalError(...) Nz::Error::Trigger(Nz::ErrorType::Internal, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, __VA_ARGS__) -#define NazaraWarning(...) Nz::Error::Trigger(Nz::ErrorType::Warning, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, __VA_ARGS__) +#define NazaraError(err) Nz::Error::Trigger(Nz::ErrorType::Normal, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, err) +#define NazaraErrorFmt(fmt, ...) Nz::Error::Trigger(Nz::ErrorType::Normal, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, Nz::Format(NAZARA_FORMAT(fmt), __VA_ARGS__)) +#define NazaraInternalError(err) Nz::Error::Trigger(Nz::ErrorType::Internal, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, err) +#define NazaraInternalErrorFmt(fmt, ...) Nz::Error::Trigger(Nz::ErrorType::Internal, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, Nz::Format(NAZARA_FORMAT(fmt), __VA_ARGS__)) +#define NazaraWarning(err) Nz::Error::Trigger(Nz::ErrorType::Warning, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, err) +#define NazaraWarningFmt(fmt, ...) Nz::Error::Trigger(Nz::ErrorType::Warning, __LINE__, __FILE__, NAZARA_PRETTY_FUNCTION, Nz::Format(NAZARA_FORMAT(fmt), __VA_ARGS__)) namespace Nz { @@ -41,8 +45,8 @@ namespace Nz static ErrorModeFlags SetFlags(ErrorModeFlags flags); - template static void Trigger(ErrorType type, std::string_view error, Args&&... args); - template static void Trigger(ErrorType type, unsigned int line, std::string_view file, std::string_view function, std::string_view error, Args&&... args); + static inline void Trigger(ErrorType type, std::string error); + static inline void Trigger(ErrorType type, unsigned int line, std::string_view file, std::string_view function, std::string error); private: static void TriggerInternal(ErrorType type, std::string error, unsigned int line, std::string_view file, std::string_view function); diff --git a/include/Nazara/Core/Error.inl b/include/Nazara/Core/Error.inl index 6566e3565..f7e90234f 100644 --- a/include/Nazara/Core/Error.inl +++ b/include/Nazara/Core/Error.inl @@ -15,15 +15,13 @@ namespace Nz return file; } - template - void Error::Trigger(ErrorType type, std::string_view error, Args&&... args) + inline void Error::Trigger(ErrorType type, std::string error) { - return TriggerInternal(type, Format(error, std::forward(args)...), 0, {}, {}); + return TriggerInternal(type, std::move(error), 0, {}, {}); } - template - void Error::Trigger(ErrorType type, unsigned int line, std::string_view file, std::string_view function, std::string_view error, Args&&... args) + inline void Error::Trigger(ErrorType type, unsigned int line, std::string_view file, std::string_view function, std::string error) { - return TriggerInternal(type, Format(error, std::forward(args)...), line, GetCurrentFileRelativeToEngine(file), function); + return TriggerInternal(type, std::move(error), line, GetCurrentFileRelativeToEngine(file), function); } } diff --git a/include/Nazara/Core/Format.hpp b/include/Nazara/Core/Format.hpp index 65d460cc7..7ba5d1ed1 100644 --- a/include/Nazara/Core/Format.hpp +++ b/include/Nazara/Core/Format.hpp @@ -11,9 +11,29 @@ #include #include +#ifdef NAZARA_BUILD + +#include +#include +#include + +#define NAZARA_FORMAT(s) FMT_STRING(s) + +#else + +#define NAZARA_FORMAT(s) s + +#endif + namespace Nz { - template std::string Format(std::string_view str, Args&&... args); +#ifdef NAZARA_BUILD + template using FormatString = fmt::format_string; +#else + template using FormatString = std::string_view; +#endif + + template std::string Format(FormatString str, Args&&... args); } #include diff --git a/include/Nazara/Core/Format.inl b/include/Nazara/Core/Format.inl index ab8c3e179..bdabb66e1 100644 --- a/include/Nazara/Core/Format.inl +++ b/include/Nazara/Core/Format.inl @@ -2,11 +2,6 @@ // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp -#ifdef NAZARA_BUILD -#include -#include -#endif - #include namespace Nz @@ -23,8 +18,8 @@ namespace Nz NAZARA_CORE_API std::string FormatFromStore(std::string_view str); } - template - std::string Format(std::string_view str, Args&&... args) + template + std::string Format(FormatString str, Args&&... args) { #ifdef NAZARA_BUILD return fmt::format(str, std::forward(args)...); diff --git a/include/Nazara/Core/ObjectLibrary.inl b/include/Nazara/Core/ObjectLibrary.inl index de63ca7d0..c5b2c58e0 100644 --- a/include/Nazara/Core/ObjectLibrary.inl +++ b/include/Nazara/Core/ObjectLibrary.inl @@ -35,7 +35,7 @@ namespace Nz { std::shared_ptr ref = Query(name); if (!ref) - NazaraError("Object \"{}\" is not present", name); + NazaraErrorFmt("Object \"{}\" is not present", name); return ref; } diff --git a/include/Nazara/Core/ResourceLoader.inl b/include/Nazara/Core/ResourceLoader.inl index 91e490655..3c70fba2b 100644 --- a/include/Nazara/Core/ResourceLoader.inl +++ b/include/Nazara/Core/ResourceLoader.inl @@ -61,12 +61,12 @@ namespace Nz template std::shared_ptr ResourceLoader::LoadFromFile(const std::filesystem::path& filePath, const Parameters& parameters) const { - NazaraAssert(parameters.IsValid(), "Invalid parameters"); + NazaraAssert(parameters.IsValid(), "invalid parameters"); std::string ext = ToLower(PathToString(filePath.extension())); if (ext.empty()) { - NazaraError("failed to get file extension from \"{0}\"", filePath); + NazaraErrorFmt("failed to get file extension from \"{0}\"", filePath); return nullptr; } @@ -93,7 +93,7 @@ namespace Nz { if (!file.Open(OpenMode::ReadOnly)) { - NazaraError("failed to load resource: unable to open \"{0}\"", filePath); + NazaraErrorFmt("failed to load resource: unable to open \"{0}\"", filePath); return nullptr; } } @@ -121,9 +121,9 @@ namespace Nz } if (found) - NazaraError("failed to load resource from file \"{0}}\": all loaders failed", filePath); + NazaraErrorFmt("failed to load resource from file \"{0}\": all loaders failed", filePath); else - NazaraError("failed to load resource from file \"{0}}\": no loader found for extension \"{1}\"", filePath, ext); + NazaraErrorFmt("failed to load resource from file \"{0}\": no loader found for extension \"{1}\"", filePath, ext); return nullptr; } @@ -196,8 +196,8 @@ namespace Nz template std::shared_ptr ResourceLoader::LoadFromStream(Stream& stream, const Parameters& parameters) const { - NazaraAssert(stream.GetCursorPos() < stream.GetSize(), "No data to load"); - NazaraAssert(parameters.IsValid(), "Invalid parameters"); + NazaraAssert(stream.GetCursorPos() < stream.GetSize(), "no data to load"); + NazaraAssert(parameters.IsValid(), "invalid parameters"); // Retrieve extension from stream (if any) std::string ext = ToLower(PathToString(stream.GetPath().extension())); @@ -236,7 +236,7 @@ namespace Nz if (found) NazaraError("failed to load resource from stream: all loaders failed"); else - NazaraError("Failed to load resource from from stream: no loader found"); + NazaraError("failed to load resource from from stream: no loader found"); return nullptr; } diff --git a/include/Nazara/Core/ResourceManager.inl b/include/Nazara/Core/ResourceManager.inl index f8f9b7de4..85b13779d 100644 --- a/include/Nazara/Core/ResourceManager.inl +++ b/include/Nazara/Core/ResourceManager.inl @@ -50,7 +50,7 @@ namespace Nz std::shared_ptr resource = m_loader.LoadFromFile(absolutePath, GetDefaultParameters()); if (!resource) { - NazaraError("failed to load resource from file: {0}", absolutePath); + NazaraErrorFmt("failed to load resource from file: {0}", absolutePath); return std::shared_ptr(); } diff --git a/include/Nazara/Core/ResourceSaver.inl b/include/Nazara/Core/ResourceSaver.inl index 5466bd616..2904c0b1f 100644 --- a/include/Nazara/Core/ResourceSaver.inl +++ b/include/Nazara/Core/ResourceSaver.inl @@ -69,7 +69,7 @@ namespace Nz std::string extension = ToLower(PathToString(filePath.extension())); if (extension.empty()) { - NazaraError("failed to get file extension from \"{0}\"", filePath); + NazaraErrorFmt("failed to get file extension from \"{0}\"", filePath); return false; } @@ -93,7 +93,7 @@ namespace Nz if (!file.Open(OpenMode::WriteOnly | OpenMode::Truncate)) { - NazaraError("failed to save to file: unable to open \"{0}\" in write mode", filePath); + NazaraErrorFmt("failed to save to file: unable to open \"{0}\" in write mode", filePath); return false; } @@ -107,7 +107,7 @@ namespace Nz if (found) NazaraError("failed to save resource: all savers failed"); else - NazaraError("failed to save resource: no saver found for extension \"extension\"", extension); + NazaraErrorFmt("failed to save resource: no saver found for extension \"extension\"", extension); return false; } @@ -152,7 +152,7 @@ namespace Nz if (found) NazaraError("failed to save resource: all savers failed"); else - NazaraError("failed to save resource: no saver found for format \"{0}\"", format); + NazaraErrorFmt("failed to save resource: no saver found for format \"{0}\"", format); return false; } diff --git a/include/Nazara/Graphics/Material.inl b/include/Nazara/Graphics/Material.inl index a2a72e0b2..e5cb9d420 100644 --- a/include/Nazara/Graphics/Material.inl +++ b/include/Nazara/Graphics/Material.inl @@ -73,7 +73,7 @@ namespace Nz case nzsl::ImageType::Cubemap: return ImageType::Cubemap; } - NazaraError("invalid image type 0x{0}", NumberToString(UnderlyingCast(imageType), 16)); + NazaraErrorFmt("invalid image type {0:#x}", UnderlyingCast(imageType)); return ImageType::E2D; } } diff --git a/include/Nazara/Graphics/MaterialInstance.inl b/include/Nazara/Graphics/MaterialInstance.inl index 5febd8e57..559dc4052 100644 --- a/include/Nazara/Graphics/MaterialInstance.inl +++ b/include/Nazara/Graphics/MaterialInstance.inl @@ -53,7 +53,7 @@ namespace Nz std::size_t propertyIndex = FindTextureProperty(propertyName); if (propertyIndex == MaterialSettings::InvalidPropertyIndex) { - NazaraError("material has no texture property named \"{0}\"", propertyName); + NazaraErrorFmt("material has no texture property named \"{0}\"", propertyName); return nullptr; } @@ -79,7 +79,7 @@ namespace Nz std::size_t propertyIndex = FindTextureProperty(propertyName); if (propertyIndex == MaterialSettings::InvalidPropertyIndex) { - NazaraError("material has no texture property named \"{0}\"", propertyName); + NazaraErrorFmt("material has no texture property named \"{0}\"", propertyName); return nullptr; } @@ -97,7 +97,7 @@ namespace Nz std::size_t propertyIndex = FindValueProperty(propertyName); if (propertyIndex == MaterialSettings::InvalidPropertyIndex) { - NazaraError("material has no value property named \"{0}\"", propertyName); + NazaraErrorFmt("material has no value property named \"{0}\"", propertyName); return nullptr; } @@ -128,7 +128,7 @@ namespace Nz std::size_t propertyIndex = FindTextureProperty(propertyName); if (propertyIndex == MaterialSettings::InvalidPropertyIndex) { - NazaraError("material has no texture property named \"{0}\"", propertyName); + NazaraErrorFmt("material has no texture property named \"{0}\"", propertyName); return; } @@ -140,7 +140,7 @@ namespace Nz std::size_t propertyIndex = FindTextureProperty(propertyName); if (propertyIndex == MaterialSettings::InvalidPropertyIndex) { - NazaraError("material has no texture property named \"{0}\"", propertyName); + NazaraErrorFmt("material has no texture property named \"{0}\"", propertyName); return; } @@ -152,7 +152,7 @@ namespace Nz std::size_t propertyIndex = FindTextureProperty(propertyName); if (propertyIndex == MaterialSettings::InvalidPropertyIndex) { - NazaraError("material has no texture property named \"{0}\"", propertyName); + NazaraErrorFmt("material has no texture property named \"{0}\"", propertyName); return; } @@ -164,7 +164,7 @@ namespace Nz std::size_t propertyIndex = FindValueProperty(propertyName); if (propertyIndex == MaterialSettings::InvalidPropertyIndex) { - NazaraError("material has no value property named \"{0}\"", propertyName); + NazaraErrorFmt("material has no value property named \"{0}\"", propertyName); return; } diff --git a/include/Nazara/Math/BoundingVolume.inl b/include/Nazara/Math/BoundingVolume.inl index 814f60aca..34ad88c06 100644 --- a/include/Nazara/Math/BoundingVolume.inl +++ b/include/Nazara/Math/BoundingVolume.inl @@ -363,7 +363,7 @@ namespace Nz } // If we arrive here, the extent is invalid - NazaraError("invalid extent type (From) ({0:#x})", UnderlyingCast(from.extent)); + NazaraErrorFmt("invalid extent type (From) ({0:#x})", UnderlyingCast(from.extent)); return Null(); } @@ -390,13 +390,13 @@ namespace Nz } // If we arrive here, the extent is invalid - NazaraError("invalid extent type (From) ({0:#x})", UnderlyingCast(from.extent)); + NazaraErrorFmt("invalid extent type (From) ({0:#x})", UnderlyingCast(from.extent)); return Null(); } } // If we arrive here, the extent is invalid - NazaraError("Invalid extent type (To) ({0:#x})", UnderlyingCast(to.extent)); + NazaraErrorFmt("invalid extent type (To) ({0:#x})", UnderlyingCast(to.extent)); return Null(); } diff --git a/include/Nazara/Math/Box.inl b/include/Nazara/Math/Box.inl index 2bf9a09b6..824d7db97 100644 --- a/include/Nazara/Math/Box.inl +++ b/include/Nazara/Math/Box.inl @@ -305,7 +305,7 @@ namespace Nz return Vector3(x + width, y + height, z + depth); } - NazaraError("Corner not handled ({0:#x})", UnderlyingCast(corner)); + NazaraErrorFmt("Corner not handled ({0:#x})", UnderlyingCast(corner)); return Vector3(); } diff --git a/include/Nazara/Math/Frustum.inl b/include/Nazara/Math/Frustum.inl index 88a060cc5..060bad6af 100644 --- a/include/Nazara/Math/Frustum.inl +++ b/include/Nazara/Math/Frustum.inl @@ -131,7 +131,7 @@ namespace Nz return false; } - NazaraError("Invalid intersection side ({0:#x})", UnderlyingCast(side)); + NazaraErrorFmt("invalid intersection side ({0:#x})", UnderlyingCast(side)); return false; } @@ -142,7 +142,7 @@ namespace Nz return false; } - NazaraError("Invalid extent type ({0:#x})", UnderlyingCast(volume.extent)); + NazaraErrorFmt("invalid extent type ({0:#x})", UnderlyingCast(volume.extent)); return false; } @@ -312,7 +312,7 @@ namespace Nz return IntersectionSide::Outside; } - NazaraError("Invalid intersection side ({0:#x})", UnderlyingCast(side)); + NazaraErrorFmt("invalid intersection side ({0:#x})", UnderlyingCast(side)); return IntersectionSide::Outside; } @@ -323,7 +323,7 @@ namespace Nz return IntersectionSide::Outside; } - NazaraError("Invalid extent type ({0:#x})", UnderlyingCast(volume.extent)); + NazaraErrorFmt("invalid extent type ({0:#x})", UnderlyingCast(volume.extent)); return IntersectionSide::Outside; } diff --git a/include/Nazara/Math/Matrix4.inl b/include/Nazara/Math/Matrix4.inl index 1931268c5..32d95fb53 100644 --- a/include/Nazara/Math/Matrix4.inl +++ b/include/Nazara/Math/Matrix4.inl @@ -693,7 +693,7 @@ namespace Nz #ifdef NAZARA_DEBUG if (!dest) { - NazaraError("Destination matrix must be valid"); + NazaraError("destination matrix must be valid"); return; } #endif diff --git a/include/Nazara/Math/Ray.inl b/include/Nazara/Math/Ray.inl index 412eb666b..7eb227e1d 100644 --- a/include/Nazara/Math/Ray.inl +++ b/include/Nazara/Math/Ray.inl @@ -200,7 +200,7 @@ namespace Nz return false; } - NazaraError("Invalid extent type ({0:#x})", UnderlyingCast(volume.extent)); + NazaraErrorFmt("invalid extent type ({0:#x})", UnderlyingCast(volume.extent)); return false; } diff --git a/include/Nazara/Math/Rect.inl b/include/Nazara/Math/Rect.inl index 724049ac8..7eb765b81 100644 --- a/include/Nazara/Math/Rect.inl +++ b/include/Nazara/Math/Rect.inl @@ -246,7 +246,7 @@ namespace Nz return Vector2(x + width, y); } - NazaraError("Corner not handled ({0:#x})", UnderlyingCast(corner)); + NazaraErrorFmt("corner not handled ({0:#x})", UnderlyingCast(corner)); return Vector2(); } diff --git a/include/Nazara/OpenGLRenderer/Utils.inl b/include/Nazara/OpenGLRenderer/Utils.inl index 1836ea1e6..42a0a2e87 100644 --- a/include/Nazara/OpenGLRenderer/Utils.inl +++ b/include/Nazara/OpenGLRenderer/Utils.inl @@ -42,7 +42,7 @@ namespace Nz default: break; } - NazaraError("unhandled PixelFormat {0:#x})", UnderlyingCast(pixelFormat)); + NazaraErrorFmt("unhandled PixelFormat {0:#x})", UnderlyingCast(pixelFormat)); return {}; } @@ -57,7 +57,7 @@ namespace Nz case BlendEquation::Subtract: return GL_FUNC_SUBTRACT; } - NazaraError("unhandled BlendEquation {0:#x})", UnderlyingCast(blendEquation)); + NazaraErrorFmt("unhandled BlendEquation {0:#x})", UnderlyingCast(blendEquation)); return {}; } @@ -81,7 +81,7 @@ namespace Nz case BlendFunc::Zero: return GL_ZERO; } - NazaraError("unhandled BlendFunc {0:#x})", UnderlyingCast(blendFunc)); + NazaraErrorFmt("unhandled BlendFunc {0:#x})", UnderlyingCast(blendFunc)); return {}; } @@ -94,7 +94,7 @@ namespace Nz case FaceFilling::Point: return GL_POINT; } - NazaraError("unhandled FaceFilling {0:#x})", UnderlyingCast(side)); + NazaraErrorFmt("unhandled FaceFilling {0:#x})", UnderlyingCast(side)); return {}; } @@ -110,7 +110,7 @@ namespace Nz case FaceCulling::FrontAndBack: return GL_FRONT_AND_BACK; } - NazaraError("unhandled FaceSide {0:#x})", UnderlyingCast(side)); + NazaraErrorFmt("unhandled FaceSide {0:#x})", UnderlyingCast(side)); return {}; } @@ -122,7 +122,7 @@ namespace Nz case FrontFace::CounterClockwise: return GL_CCW; } - NazaraError("unhandled FrontFace {0:#x})", UnderlyingCast(face)); + NazaraErrorFmt("unhandled FrontFace {0:#x})", UnderlyingCast(face)); return {}; } @@ -135,7 +135,7 @@ namespace Nz case IndexType::U32: return GL_UNSIGNED_INT; } - NazaraError("unhandled IndexType {0:#x})", UnderlyingCast(indexType)); + NazaraErrorFmt("unhandled IndexType {0:#x})", UnderlyingCast(indexType)); return {}; } @@ -151,7 +151,7 @@ namespace Nz case PrimitiveMode::TriangleFan: return GL_TRIANGLE_FAN; } - NazaraError("unhandled PrimitiveMode {0:#x})", UnderlyingCast(primitiveMode)); + NazaraErrorFmt("unhandled PrimitiveMode {0:#x})", UnderlyingCast(primitiveMode)); return {}; } @@ -169,7 +169,7 @@ namespace Nz case RendererComparison::NotEqual: return GL_NOTEQUAL; } - NazaraError("unhandled RendererComparison {0:#x})", UnderlyingCast(comparison)); + NazaraErrorFmt("unhandled RendererComparison {0:#x})", UnderlyingCast(comparison)); return {}; } @@ -181,7 +181,7 @@ namespace Nz case SamplerFilter::Nearest: return GL_NEAREST; } - NazaraError("unhandled SamplerFilter {0:#x})", UnderlyingCast(filter)); + NazaraErrorFmt("unhandled SamplerFilter {0:#x})", UnderlyingCast(filter)); return {}; } @@ -197,7 +197,7 @@ namespace Nz case SamplerMipmapMode::Nearest: return GL_LINEAR_MIPMAP_NEAREST; } - NazaraError("unhandled SamplerFilter {0:#x})", UnderlyingCast(mipmapFilter)); + NazaraErrorFmt("unhandled SamplerFilter {0:#x})", UnderlyingCast(mipmapFilter)); return {}; } @@ -209,12 +209,12 @@ namespace Nz case SamplerMipmapMode::Nearest: return GL_NEAREST_MIPMAP_NEAREST; } - NazaraError("unhandled SamplerFilter {0:#x})", UnderlyingCast(mipmapFilter)); + NazaraErrorFmt("unhandled SamplerFilter {0:#x})", UnderlyingCast(mipmapFilter)); return {}; } } - NazaraError("unhandled SamplerFilter {0:#x})", UnderlyingCast(minFilter)); + NazaraErrorFmt("unhandled SamplerFilter {0:#x})", UnderlyingCast(minFilter)); return {}; } @@ -227,7 +227,7 @@ namespace Nz case SamplerWrap::Repeat: return GL_REPEAT; } - NazaraError("unhandled SamplerWrap {0:#x})", UnderlyingCast(wrapMode)); + NazaraErrorFmt("unhandled SamplerWrap {0:#x})", UnderlyingCast(wrapMode)); return {}; } @@ -240,7 +240,7 @@ namespace Nz case nzsl::ShaderStageType::Vertex: return GL_VERTEX_SHADER; } - NazaraError("unhandled nzsl::ShaderStageType {0:#x})", UnderlyingCast(stageType)); + NazaraErrorFmt("unhandled nzsl::ShaderStageType {0:#x})", UnderlyingCast(stageType)); return {}; } @@ -258,7 +258,7 @@ namespace Nz case StencilOperation::Zero: return GL_ZERO; } - NazaraError("unhandled StencilOperation {0:#x})", UnderlyingCast(stencilOp)); + NazaraErrorFmt("unhandled StencilOperation {0:#x})", UnderlyingCast(stencilOp)); return {}; } @@ -271,7 +271,7 @@ namespace Nz case TextureAccess::WriteOnly: return GL_WRITE_ONLY; } - NazaraError("unhandled TextureAccess {0:#x})", UnderlyingCast(textureAccess)); + NazaraErrorFmt("unhandled TextureAccess {0:#x})", UnderlyingCast(textureAccess)); return {}; } @@ -290,7 +290,7 @@ namespace Nz case GL::BufferTarget::Uniform: return GL_UNIFORM_BUFFER; } - NazaraError("unhandled GL::BufferTarget {0:#x})", UnderlyingCast(bufferTarget)); + NazaraErrorFmt("unhandled GL::BufferTarget {0:#x})", UnderlyingCast(bufferTarget)); return {}; } @@ -310,7 +310,7 @@ namespace Nz case GL::TextureTarget::Target3D: return GL_TEXTURE_3D; } - NazaraError("unhandled GL::TextureTarget {0:#x})", UnderlyingCast(textureTarget)); + NazaraErrorFmt("unhandled GL::TextureTarget {0:#x})", UnderlyingCast(textureTarget)); return {}; } } diff --git a/include/Nazara/OpenGLRenderer/Wrapper/ContextObject.inl b/include/Nazara/OpenGLRenderer/Wrapper/ContextObject.inl index 5712d349e..1631ce4f0 100644 --- a/include/Nazara/OpenGLRenderer/Wrapper/ContextObject.inl +++ b/include/Nazara/OpenGLRenderer/Wrapper/ContextObject.inl @@ -34,7 +34,7 @@ namespace Nz::GL m_objectId = C::CreateHelper(*m_context, args...); if (m_objectId == InvalidObject) { - NazaraError("Failed to create OpenGL object"); //< TODO: Handle error message + NazaraError("failed to create OpenGL object"); //< TODO: Handle error message return false; } diff --git a/include/Nazara/OpenGLRenderer/Wrapper/DeviceObject.inl b/include/Nazara/OpenGLRenderer/Wrapper/DeviceObject.inl index 4f78ea9d3..f273a5626 100644 --- a/include/Nazara/OpenGLRenderer/Wrapper/DeviceObject.inl +++ b/include/Nazara/OpenGLRenderer/Wrapper/DeviceObject.inl @@ -35,7 +35,7 @@ namespace Nz::GL m_objectId = C::CreateHelper(*m_device, context, args...); if (m_objectId == InvalidObject) { - NazaraError("Failed to create OpenGL object"); //< TODO: Handle error message + NazaraError("failed to create OpenGL object"); //< TODO: Handle error message return false; } diff --git a/include/Nazara/Utility/BufferMapper.inl b/include/Nazara/Utility/BufferMapper.inl index 89d07dabb..e8e49bc98 100644 --- a/include/Nazara/Utility/BufferMapper.inl +++ b/include/Nazara/Utility/BufferMapper.inl @@ -20,7 +20,7 @@ namespace Nz m_buffer(nullptr) { if (!Map(buffer, offset, length)) - NazaraError("Failed to map buffer"); ///TODO: Unexpected + NazaraError("failed to map buffer"); ///TODO: Unexpected } template @@ -51,7 +51,7 @@ namespace Nz m_ptr = buffer.Map(offset, length); if (!m_ptr) { - NazaraError("Failed to map buffer"); ///TODO: Unexpected + NazaraError("failed to map buffer"); ///TODO: Unexpected return false; } diff --git a/include/Nazara/Utility/Formats/MTLParser.inl b/include/Nazara/Utility/Formats/MTLParser.inl index 591955759..f0163149c 100644 --- a/include/Nazara/Utility/Formats/MTLParser.inl +++ b/include/Nazara/Utility/Formats/MTLParser.inl @@ -53,7 +53,7 @@ namespace Nz inline void MTLParser::Error(const std::string& message) { - NazaraError("{0} at line #{1}", message, m_lineCount); + NazaraErrorFmt("{0} at line #{1}", message, m_lineCount); } inline void MTLParser::Flush() const @@ -64,7 +64,7 @@ namespace Nz inline void MTLParser::Warning(const std::string& message) { - NazaraWarning("{0} at line #{1}", message, m_lineCount); + NazaraWarningFmt("{0} at line #{1}", message, m_lineCount); } inline void MTLParser::UnrecognizedLine(bool error) diff --git a/include/Nazara/Utility/Formats/OBJParser.inl b/include/Nazara/Utility/Formats/OBJParser.inl index 5ce686dc2..10b07cd0e 100644 --- a/include/Nazara/Utility/Formats/OBJParser.inl +++ b/include/Nazara/Utility/Formats/OBJParser.inl @@ -153,7 +153,7 @@ namespace Nz inline void OBJParser::Error(const std::string& message) { - NazaraError("{0} at line #{1}", message, m_lineCount); + NazaraErrorFmt("{0} at line #{1}", message, m_lineCount); } inline void OBJParser::Flush() const @@ -164,7 +164,7 @@ namespace Nz inline void OBJParser::Warning(const std::string& message) { - NazaraWarning("{0} at line #{1}", message, m_lineCount); + NazaraWarningFmt("{0} at line #{1}", message, m_lineCount); } inline bool OBJParser::UnrecognizedLine(bool error) @@ -180,7 +180,7 @@ namespace Nz if (m_errorCount > 10 && (m_errorCount * 100 / m_lineCount) > 50) { - NazaraError("Aborting parsing because of error percentage"); + NazaraError("aborting parsing because of error percentage"); return false; //< Abort parsing if error percentage is too high } diff --git a/include/Nazara/Utility/Node.inl b/include/Nazara/Utility/Node.inl index 75260ead3..82bb36ada 100644 --- a/include/Nazara/Utility/Node.inl +++ b/include/Nazara/Utility/Node.inl @@ -159,7 +159,7 @@ namespace Nz return m_position; } - NazaraError("Coordinate system out of enum ({0:#x})", UnderlyingCast(coordSys)); + NazaraErrorFmt("Coordinate system out of enum ({0:#x})", UnderlyingCast(coordSys)); return Vector3f(); } @@ -181,7 +181,7 @@ namespace Nz return m_rotation; } - NazaraError("Coordinate system out of enum ({0:#x})", UnderlyingCast(coordSys)); + NazaraErrorFmt("Coordinate system out of enum ({0:#x})", UnderlyingCast(coordSys)); return Quaternionf(); } @@ -197,7 +197,7 @@ namespace Nz return m_scale; } - NazaraError("Coordinate system out of enum ({0:#x})", UnderlyingCast(coordSys)); + NazaraErrorFmt("Coordinate system out of enum ({0:#x})", UnderlyingCast(coordSys)); return Vector3f(); } diff --git a/include/Nazara/Utility/PixelFormat.inl b/include/Nazara/Utility/PixelFormat.inl index ba42ebd2c..a52c04097 100644 --- a/include/Nazara/Utility/PixelFormat.inl +++ b/include/Nazara/Utility/PixelFormat.inl @@ -156,7 +156,7 @@ namespace Nz return (((width + 3) / 4) * ((height + 3) / 4) * ((format == PixelFormat::DXT1) ? 8 : 16)) * depth; default: - NazaraError("Unsupported format"); + NazaraError("unsupported format"); return 0; } } @@ -175,13 +175,13 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (IsCompressed(srcFormat)) { - NazaraError("Cannot convert single pixel from compressed format"); + NazaraError("cannot convert single pixel from compressed format"); return false; } if (IsCompressed(dstFormat)) { - NazaraError("Cannot convert single pixel to compressed format"); + NazaraError("cannot convert single pixel to compressed format"); return false; } #endif @@ -200,13 +200,13 @@ namespace Nz ConvertFunction func = s_convertFunctions[srcFormat][dstFormat]; if (!func) { - NazaraError("pixel format conversion from {0} to {1} is not supported", GetName(srcFormat), GetName(dstFormat)); + NazaraErrorFmt("pixel format conversion from {0} to {1} is not supported", GetName(srcFormat), GetName(dstFormat)); return false; } if (!func(reinterpret_cast(start), reinterpret_cast(end), reinterpret_cast(dst))) { - NazaraError("pixel format conversion from {0} to {1} failed", GetName(srcFormat), GetName(dstFormat)); + NazaraErrorFmt("pixel format conversion from {0} to {1} failed", GetName(srcFormat), GetName(dstFormat)); return false; } diff --git a/include/Nazara/VulkanRenderer/Utils.inl b/include/Nazara/VulkanRenderer/Utils.inl index b7879335d..d46a5f79f 100644 --- a/include/Nazara/VulkanRenderer/Utils.inl +++ b/include/Nazara/VulkanRenderer/Utils.inl @@ -55,7 +55,7 @@ namespace Nz case AttachmentLoadOp::Load: return VK_ATTACHMENT_LOAD_OP_LOAD; } - NazaraError("unhandled AttachmentLoadOp {0:#x})", UnderlyingCast(loadOp)); + NazaraErrorFmt("unhandled AttachmentLoadOp {0:#x})", UnderlyingCast(loadOp)); return {}; } @@ -67,7 +67,7 @@ namespace Nz case AttachmentStoreOp::Store: return VK_ATTACHMENT_STORE_OP_STORE; } - NazaraError("unhandled AttachmentStoreOp {0:#x})", UnderlyingCast(storeOp)); + NazaraErrorFmt("unhandled AttachmentStoreOp {0:#x})", UnderlyingCast(storeOp)); return {}; } @@ -82,7 +82,7 @@ namespace Nz case BlendEquation::Subtract: return VK_BLEND_OP_SUBTRACT; } - NazaraError("unhandled BlendEquation {0:#x})", UnderlyingCast(blendEquation)); + NazaraErrorFmt("unhandled BlendEquation {0:#x})", UnderlyingCast(blendEquation)); return {}; } @@ -106,7 +106,7 @@ namespace Nz case BlendFunc::Zero: return VK_BLEND_FACTOR_ZERO; } - NazaraError("unhandled BlendFunc {0:#x})", UnderlyingCast(blendFunc)); + NazaraErrorFmt("unhandled BlendFunc {0:#x})", UnderlyingCast(blendFunc)); return {}; } @@ -121,7 +121,7 @@ namespace Nz case BufferType::Upload: return VK_BUFFER_USAGE_TRANSFER_SRC_BIT; } - NazaraError("unhandled BufferType {0:#x})", UnderlyingCast(bufferType)); + NazaraErrorFmt("unhandled BufferType {0:#x})", UnderlyingCast(bufferType)); return 0; } @@ -144,7 +144,7 @@ namespace Nz case ComponentType::Int4: return VK_FORMAT_R32G32B32A32_SINT; } - NazaraError("unhandled ComponentType {0:#x})", UnderlyingCast(componentType)); + NazaraErrorFmt("unhandled ComponentType {0:#x})", UnderlyingCast(componentType)); return VK_FORMAT_UNDEFINED; } @@ -158,7 +158,7 @@ namespace Nz case FaceCulling::FrontAndBack: return VK_CULL_MODE_FRONT_AND_BACK; } - NazaraError("unhandled FaceSide {0:#x})", UnderlyingCast(faceSide)); + NazaraErrorFmt("unhandled FaceSide {0:#x})", UnderlyingCast(faceSide)); return VK_CULL_MODE_BACK_BIT; } @@ -171,7 +171,7 @@ namespace Nz case FaceFilling::Point: return VK_POLYGON_MODE_POINT; } - NazaraError("unhandled FaceFilling {0:#x})", UnderlyingCast(faceFilling)); + NazaraErrorFmt("unhandled FaceFilling {0:#x})", UnderlyingCast(faceFilling)); return VK_POLYGON_MODE_FILL; } @@ -183,7 +183,7 @@ namespace Nz case FrontFace::CounterClockwise: return VK_FRONT_FACE_COUNTER_CLOCKWISE; } - NazaraError("unhandled FrontFace {0:#x})", UnderlyingCast(frontFace)); + NazaraErrorFmt("unhandled FrontFace {0:#x})", UnderlyingCast(frontFace)); return {}; } @@ -196,7 +196,7 @@ namespace Nz case IndexType::U32: return VK_INDEX_TYPE_UINT32; } - NazaraError("unhandled IndexType {0:#x})", UnderlyingCast(indexType)); + NazaraErrorFmt("unhandled IndexType {0:#x})", UnderlyingCast(indexType)); return {}; } @@ -222,7 +222,7 @@ namespace Nz case MemoryAccess::VertexBufferRead: return VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT; } - NazaraError("unhandled MemoryAccess {0:#x})", UnderlyingCast(memoryAccess)); + NazaraErrorFmt("unhandled MemoryAccess {0:#x})", UnderlyingCast(memoryAccess)); return {}; } @@ -256,7 +256,7 @@ namespace Nz case PipelineStage::BottomOfPipe: return VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; } - NazaraError("unhandled PipelineStage {0:#x})", UnderlyingCast(pipelineStage)); + NazaraErrorFmt("unhandled PipelineStage {0:#x})", UnderlyingCast(pipelineStage)); return {}; } @@ -299,7 +299,7 @@ namespace Nz default: break; } - NazaraError("unhandled PixelFormat {0:#x})", UnderlyingCast(pixelFormat)); + NazaraErrorFmt("unhandled PixelFormat {0:#x})", UnderlyingCast(pixelFormat)); return VK_FORMAT_UNDEFINED; } @@ -316,7 +316,7 @@ namespace Nz case PixelFormatContent::Stencil: return VK_IMAGE_ASPECT_STENCIL_BIT; } - NazaraError("unhandled PixelFormatContent {0:#x})", UnderlyingCast(pixelFormatContent)); + NazaraErrorFmt("unhandled PixelFormatContent {0:#x})", UnderlyingCast(pixelFormatContent)); return VK_IMAGE_ASPECT_COLOR_BIT; } @@ -330,7 +330,7 @@ namespace Nz case PresentMode::VerticalSync: return VK_PRESENT_MODE_FIFO_KHR; } - NazaraError("unhandled PresentMode {0:#x})", UnderlyingCast(presentMode)); + NazaraErrorFmt("unhandled PresentMode {0:#x})", UnderlyingCast(presentMode)); return VK_PRESENT_MODE_FIFO_KHR; } @@ -346,7 +346,7 @@ namespace Nz case PrimitiveMode::TriangleFan: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN; } - NazaraError("unhandled PrimitiveMode {0:#x})", UnderlyingCast(primitiveMode)); + NazaraErrorFmt("unhandled PrimitiveMode {0:#x})", UnderlyingCast(primitiveMode)); return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; } @@ -364,7 +364,7 @@ namespace Nz case RendererComparison::Always: return VK_COMPARE_OP_ALWAYS; } - NazaraError("unhandled RendererComparison {0:#x})", UnderlyingCast(comparison)); + NazaraErrorFmt("unhandled RendererComparison {0:#x})", UnderlyingCast(comparison)); return VK_COMPARE_OP_NEVER; } @@ -376,7 +376,7 @@ namespace Nz case SamplerFilter::Nearest: return VK_FILTER_NEAREST; } - NazaraError("unhandled SamplerFilter {0:#x})", UnderlyingCast(samplerFilter)); + NazaraErrorFmt("unhandled SamplerFilter {0:#x})", UnderlyingCast(samplerFilter)); return VK_FILTER_NEAREST; } @@ -388,7 +388,7 @@ namespace Nz case SamplerMipmapMode::Nearest: return VK_SAMPLER_MIPMAP_MODE_NEAREST; } - NazaraError("unhandled SamplerMipmapMode {0:#x})", UnderlyingCast(samplerMipmap)); + NazaraErrorFmt("unhandled SamplerMipmapMode {0:#x})", UnderlyingCast(samplerMipmap)); return VK_SAMPLER_MIPMAP_MODE_NEAREST; } @@ -401,7 +401,7 @@ namespace Nz case SamplerWrap::Repeat: return VK_SAMPLER_ADDRESS_MODE_REPEAT; } - NazaraError("unhandled SamplerWrap {0:#x})", UnderlyingCast(samplerWrap)); + NazaraErrorFmt("unhandled SamplerWrap {0:#x})", UnderlyingCast(samplerWrap)); return VK_SAMPLER_ADDRESS_MODE_REPEAT; } @@ -415,7 +415,7 @@ namespace Nz case ShaderBindingType::UniformBuffer: return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; } - NazaraError("unhandled ShaderBindingType {0:#x})", UnderlyingCast(bindingType)); + NazaraErrorFmt("unhandled ShaderBindingType {0:#x})", UnderlyingCast(bindingType)); return VK_DESCRIPTOR_TYPE_SAMPLER; } @@ -428,7 +428,7 @@ namespace Nz case nzsl::ShaderStageType::Vertex: return VK_SHADER_STAGE_VERTEX_BIT; } - NazaraError("unhandled nzsl::ShaderStageType {0:#x})", UnderlyingCast(stageType)); + NazaraErrorFmt("unhandled nzsl::ShaderStageType {0:#x})", UnderlyingCast(stageType)); return {}; } @@ -455,7 +455,7 @@ namespace Nz case StencilOperation::Zero: return VK_STENCIL_OP_ZERO; } - NazaraError("unhandled StencilOperation {0:#x})", UnderlyingCast(stencilOp)); + NazaraErrorFmt("unhandled StencilOperation {0:#x})", UnderlyingCast(stencilOp)); return {}; } @@ -474,7 +474,7 @@ namespace Nz case TextureLayout::Undefined: return VK_IMAGE_LAYOUT_UNDEFINED; } - NazaraError("unhandled TextureLayout {0:#x})", UnderlyingCast(textureLayout)); + NazaraErrorFmt("unhandled TextureLayout {0:#x})", UnderlyingCast(textureLayout)); return {}; } @@ -491,7 +491,7 @@ namespace Nz case TextureUsage::TransferDestination: return VK_IMAGE_USAGE_TRANSFER_DST_BIT; } - NazaraError("unhandled TextureUsage {0:#x})", UnderlyingCast(textureLayout)); + NazaraErrorFmt("unhandled TextureUsage {0:#x})", UnderlyingCast(textureLayout)); return {}; } @@ -512,7 +512,7 @@ namespace Nz case VertexInputRate::Vertex: return VK_VERTEX_INPUT_RATE_VERTEX; } - NazaraError("unhandled VertexInputRate {0:#x})", UnderlyingCast(inputRate)); + NazaraErrorFmt("unhandled VertexInputRate {0:#x})", UnderlyingCast(inputRate)); return {}; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/Buffer.inl b/include/Nazara/VulkanRenderer/Wrapper/Buffer.inl index 6f654182c..a7cab6540 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/Buffer.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/Buffer.inl @@ -13,7 +13,7 @@ namespace Nz m_lastErrorCode = m_device->vkBindBufferMemory(*m_device, m_handle, memory, offset); if (m_lastErrorCode != VK_SUCCESS) { - NazaraError("Failed to bind buffer memory"); + NazaraError("failed to bind buffer memory"); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/CommandBuffer.inl b/include/Nazara/VulkanRenderer/Wrapper/CommandBuffer.inl index e1a8edd57..87631c290 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/CommandBuffer.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/CommandBuffer.inl @@ -36,7 +36,7 @@ namespace Nz m_lastErrorCode = m_pool->GetDevice()->vkBeginCommandBuffer(m_handle, &info); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to begin command buffer: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to begin command buffer: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -321,7 +321,7 @@ namespace Nz m_lastErrorCode = m_pool->GetDevice()->vkEndCommandBuffer(m_handle); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to end command buffer: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to end command buffer: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/Device.inl b/include/Nazara/VulkanRenderer/Wrapper/Device.inl index 9d373f777..b164498a4 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/Device.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/Device.inl @@ -23,7 +23,7 @@ namespace Nz::Vk inline const Device::QueueList& Device::GetEnabledQueues(UInt32 familyQueue) const { - NazaraAssert(familyQueue < m_enabledQueuesInfos.size(), "invalid family queue {0}", familyQueue); + NazaraAssertFmt(familyQueue < m_enabledQueuesInfos.size(), "invalid family queue {0}", familyQueue); return *m_queuesByFamily[familyQueue]; } @@ -71,7 +71,7 @@ namespace Nz::Vk if (allowInstanceFallback) return m_instance.GetProcAddr(name); - NazaraError("failed to get {0} address", name); + NazaraErrorFmt("failed to get {0} address", name); } return func; @@ -126,7 +126,7 @@ namespace Nz::Vk m_lastErrorCode = vkDeviceWaitIdle(m_device); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to wait for device idle: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to wait for device idle: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/DeviceMemory.inl b/include/Nazara/VulkanRenderer/Wrapper/DeviceMemory.inl index 7fa18e838..9210825cb 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/DeviceMemory.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/DeviceMemory.inl @@ -40,7 +40,7 @@ namespace Nz typeMask <<= 1; } - NazaraError("failed to find a memory type suitable for typeBits: {0} and properties: 0x{1}", typeBits, NumberToString(properties, 16)); + NazaraErrorFmt("failed to find a memory type suitable for typeBits: {0} and properties: 0x{1}", typeBits, NumberToString(properties, 16)); return false; } @@ -62,7 +62,7 @@ namespace Nz m_lastErrorCode = m_device->vkFlushMappedMemoryRanges(*m_device, 1, &memoryRange); if (m_lastErrorCode != VK_SUCCESS) { - NazaraError("failed to flush memory: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to flush memory: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -85,7 +85,7 @@ namespace Nz m_lastErrorCode = m_device->vkMapMemory(*m_device, m_handle, offset, size, flags, &mappedPtr); if (m_lastErrorCode != VK_SUCCESS) { - NazaraError("failed to map device memory: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to map device memory: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/DeviceObject.inl b/include/Nazara/VulkanRenderer/Wrapper/DeviceObject.inl index 745617af7..b35f78c17 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/DeviceObject.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/DeviceObject.inl @@ -40,7 +40,7 @@ namespace Nz::Vk m_lastErrorCode = C::CreateHelper(*m_device, &createInfo, allocator, &m_handle); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to create Vulkan device object: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to create Vulkan device object: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/Fence.inl b/include/Nazara/VulkanRenderer/Wrapper/Fence.inl index ce0cdcc52..4bbb862e8 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/Fence.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/Fence.inl @@ -25,7 +25,7 @@ namespace Nz m_lastErrorCode = m_device->vkResetFences(*m_device, 1U, &m_handle); if (m_lastErrorCode != VK_SUCCESS) { - NazaraError("failed to reset fence: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to reset fence: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -42,7 +42,7 @@ namespace Nz m_lastErrorCode = m_device->vkWaitForFences(*m_device, 1U, &m_handle, VK_TRUE, timeout); if (m_lastErrorCode != VK_SUCCESS && m_lastErrorCode != VK_TIMEOUT) { - NazaraError("failed to wait for fence: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to wait for fence: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/Image.inl b/include/Nazara/VulkanRenderer/Wrapper/Image.inl index 23feaaffe..f4aca303c 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/Image.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/Image.inl @@ -14,7 +14,7 @@ namespace Nz m_lastErrorCode = m_device->vkBindImageMemory(*m_device, m_handle, memory, offset); if (m_lastErrorCode != VK_SUCCESS) { - NazaraError("failed to bind image memory: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to bind image memory: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/Instance.inl b/include/Nazara/VulkanRenderer/Wrapper/Instance.inl index e4ebaf6d1..91dab37bb 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/Instance.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/Instance.inl @@ -50,7 +50,7 @@ namespace Nz::Vk { PFN_vkVoidFunction func = vkGetDeviceProcAddr(device, name); if (!func) - NazaraError("failed to get {0} address", name); + NazaraErrorFmt("failed to get {0} address", name); return func; } @@ -69,7 +69,7 @@ namespace Nz::Vk { PFN_vkVoidFunction func = Loader::GetInstanceProcAddr(m_instance, name); if (!func) - NazaraError("failed to get {0} address", name); + NazaraErrorFmt("failed to get {0} address", name); return func; } @@ -120,7 +120,7 @@ namespace Nz::Vk m_lastErrorCode = vkGetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, imageFormatProperties); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to get physical device image format properties: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to get physical device image format properties: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/InstanceObject.inl b/include/Nazara/VulkanRenderer/Wrapper/InstanceObject.inl index f36c15174..450fef1d1 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/InstanceObject.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/InstanceObject.inl @@ -39,7 +39,7 @@ namespace Nz m_lastErrorCode = C::CreateHelper(*m_instance, &createInfo, allocator, &m_handle); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to create Vulkan instance object: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to create Vulkan instance object: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/Pipeline.inl b/include/Nazara/VulkanRenderer/Wrapper/Pipeline.inl index 58bda07ec..e22eae152 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/Pipeline.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/Pipeline.inl @@ -74,7 +74,7 @@ namespace Nz m_lastErrorCode = result; if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to create Vulkan pipeline: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to create Vulkan pipeline: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/QueueHandle.inl b/include/Nazara/VulkanRenderer/Wrapper/QueueHandle.inl index 2b2bc7b49..049531c55 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/QueueHandle.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/QueueHandle.inl @@ -135,7 +135,7 @@ namespace Nz m_lastErrorCode = m_device->vkQueueSubmit(m_handle, submitCount, submits, signalFence); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to submit queue: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to submit queue: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -147,7 +147,7 @@ namespace Nz m_lastErrorCode = m_device->vkQueueWaitIdle(m_handle); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to wait for queue: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to wait for queue: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/Surface.inl b/include/Nazara/VulkanRenderer/Wrapper/Surface.inl index 14e0cd6b8..6f2f95bb6 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/Surface.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/Surface.inl @@ -177,7 +177,7 @@ namespace Nz::Vk m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, m_surface, surfaceCapabilities); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to query surface capabilities: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query surface capabilities: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -191,7 +191,7 @@ namespace Nz::Vk m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_surface, &surfaceCount, nullptr); if (m_lastErrorCode != VkResult::VK_SUCCESS || surfaceCount == 0) { - NazaraError("failed to query format count: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query format count: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -200,7 +200,7 @@ namespace Nz::Vk m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_surface, &surfaceCount, surfaceFormats->data()); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to query formats: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query formats: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -214,7 +214,7 @@ namespace Nz::Vk m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, m_surface, &presentModeCount, nullptr); if (m_lastErrorCode != VkResult::VK_SUCCESS || presentModeCount == 0) { - NazaraError("Failed to query present mode count"); + NazaraError("failed to query present mode count"); return false; } @@ -223,7 +223,7 @@ namespace Nz::Vk m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, m_surface, &presentModeCount, presentModes->data()); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to query present modes: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query present modes: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -236,7 +236,7 @@ namespace Nz::Vk m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, m_surface, &presentationSupported); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to query surface capabilities: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query surface capabilities: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -291,7 +291,7 @@ namespace Nz::Vk { if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to create Vulkan surface: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to create Vulkan surface: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/include/Nazara/VulkanRenderer/Wrapper/Swapchain.inl b/include/Nazara/VulkanRenderer/Wrapper/Swapchain.inl index 2a3e6a58d..234b115e8 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/Swapchain.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/Swapchain.inl @@ -22,7 +22,7 @@ namespace Nz default: { - NazaraError("failed to acquire next swapchain image: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to acquire next swapchain image: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } } @@ -37,7 +37,7 @@ namespace Nz m_lastErrorCode = m_device->vkGetSwapchainImagesKHR(*m_device, m_handle, &imageCount, nullptr); if (m_lastErrorCode != VkResult::VK_SUCCESS || imageCount == 0) { - NazaraError("failed to query swapchain image count: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query swapchain image count: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -45,7 +45,7 @@ namespace Nz m_lastErrorCode = m_device->vkGetSwapchainImagesKHR(*m_device, m_handle, &imageCount, images.data()); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to query swapchain images: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query swapchain images: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -78,7 +78,7 @@ namespace Nz if (!m_images[i].view.Create(*m_device, imageViewCreateInfo)) { - NazaraError("failed to create image view for image #{0}", i); + NazaraErrorFmt("failed to create image view for image #{0}", i); return false; } } diff --git a/plugins/Assimp/CustomStream.cpp b/plugins/Assimp/CustomStream.cpp index ada065793..31577db17 100644 --- a/plugins/Assimp/CustomStream.cpp +++ b/plugins/Assimp/CustomStream.cpp @@ -107,7 +107,7 @@ aiFile* StreamOpener(aiFileIO* fileIO, const char* filePath, const char* openMod } else { - NazaraError("unhandled/invalid openmode: {0} for file {1}", openMode, filePath); + NazaraErrorFmt("unhandled/invalid openmode: {0} for file {1}", openMode, filePath); return nullptr; } diff --git a/plugins/Assimp/Plugin.cpp b/plugins/Assimp/Plugin.cpp index 1a16c2a1c..a6aa786a5 100644 --- a/plugins/Assimp/Plugin.cpp +++ b/plugins/Assimp/Plugin.cpp @@ -157,7 +157,7 @@ bool FindSkeletonRoot(SceneInfo& sceneInfo, const aiNode* node) auto range = sceneInfo.nodeByName.equal_range(node->mName.C_Str()); if (std::distance(range.first, range.second) != 1) { - NazaraError("failed to identify skeleton root node: {0} node(s) matched", std::distance(range.first, range.second)); + NazaraErrorFmt("failed to identify skeleton root node: {0} node(s) matched", std::distance(range.first, range.second)); return false; } @@ -265,7 +265,7 @@ Nz::Result, Nz::ResourceLoadingError> LoadAnimati if (!scene) { - NazaraError("Assimp failed to import file: {0}", aiGetErrorString()); + NazaraErrorFmt("Assimp failed to import file: {0}", aiGetErrorString()); return Nz::Err(Nz::ResourceLoadingError::DecodingError); } @@ -308,7 +308,7 @@ Nz::Result, Nz::ResourceLoadingError> LoadAnimati std::size_t jointIndex = parameters.skeleton->GetJointIndex(nodeAnim->mNodeName.C_Str()); if (jointIndex == Nz::Skeleton::InvalidJointIndex) { - NazaraError("animation references joint {0} which is not part of the skeleton", nodeAnim->mNodeName.C_Str()); + NazaraErrorFmt("animation references joint {0} which is not part of the skeleton", nodeAnim->mNodeName.C_Str()); continue; } @@ -815,7 +815,7 @@ Nz::Result, Nz::ResourceLoadingError> LoadMesh(Nz::Str if (!scene) { - NazaraError("Assimp failed to import file: {0}", aiGetErrorString()); + NazaraErrorFmt("Assimp failed to import file: {0}", aiGetErrorString()); return Nz::Err(Nz::ResourceLoadingError::DecodingError); } diff --git a/plugins/FFmpeg/Plugin.cpp b/plugins/FFmpeg/Plugin.cpp index 7d1a7d415..1969f3246 100644 --- a/plugins/FFmpeg/Plugin.cpp +++ b/plugins/FFmpeg/Plugin.cpp @@ -98,13 +98,13 @@ namespace if (int errCode = avformat_open_input(&m_formatContext, "", nullptr, nullptr); errCode != 0) { - NazaraError("failed to open input: {0}", ErrorToString(errCode)); + NazaraErrorFmt("failed to open input: {0}", ErrorToString(errCode)); return Nz::Err(Nz::ResourceLoadingError::Unrecognized); } if (int errCode = avformat_find_stream_info(m_formatContext, nullptr); errCode != 0) { - NazaraError("failed to find stream info: {0}", ErrorToString(errCode)); + NazaraErrorFmt("failed to find stream info: {0}", ErrorToString(errCode)); return Nz::Err(Nz::ResourceLoadingError::Unrecognized); } @@ -150,7 +150,7 @@ namespace return false; } - NazaraError("failed to read frame: {0}", ErrorToString(errCode)); + NazaraErrorFmt("failed to read frame: {0}", ErrorToString(errCode)); return false; } @@ -159,7 +159,7 @@ namespace if (int errCode = avcodec_send_packet(m_codecContext, &packet); errCode < 0) { - NazaraError("failed to send packet: {0}", ErrorToString(errCode)); + NazaraErrorFmt("failed to send packet: {0}", ErrorToString(errCode)); return false; } @@ -168,7 +168,7 @@ namespace if (errCode == AVERROR(EAGAIN)) continue; - NazaraError("failed to receive frame: {0}", ErrorToString(errCode)); + NazaraErrorFmt("failed to receive frame: {0}", ErrorToString(errCode)); return false; } @@ -236,13 +236,13 @@ namespace if (int errCode = avcodec_parameters_to_context(m_codecContext, codecParameters); errCode < 0) { - NazaraError("failed to copy codec params to codec context: {0}", ErrorToString(errCode)); + NazaraErrorFmt("failed to copy codec params to codec context: {0}", ErrorToString(errCode)); return Nz::Err(Nz::ResourceLoadingError::Internal); } if (int errCode = avcodec_open2(m_codecContext, m_codec, nullptr); errCode < 0) { - NazaraError("could not open codec: {0}", ErrorToString(errCode)); + NazaraErrorFmt("could not open codec: {0}", ErrorToString(errCode)); return Nz::Err(Nz::ResourceLoadingError::Internal); } @@ -260,7 +260,7 @@ namespace if (int errCode = av_frame_get_buffer(m_rgbaFrame, 0); errCode < 0) { - NazaraError("failed to open input: {0}", ErrorToString(errCode)); + NazaraErrorFmt("failed to open input: {0}", ErrorToString(errCode)); return Nz::Err(Nz::ResourceLoadingError::Internal); } @@ -286,7 +286,7 @@ namespace std::unique_ptr file = std::make_unique(); if (!file->Open(filePath, Nz::OpenMode::ReadOnly)) { - NazaraError("failed to open stream from file: {0}", Nz::Error::GetLastError()); + NazaraErrorFmt("failed to open stream from file: {0}", Nz::Error::GetLastError()); return false; } m_ownedStream = std::move(file); diff --git a/src/Nazara/Audio/Audio.cpp b/src/Nazara/Audio/Audio.cpp index 4fefc36e3..05946542a 100644 --- a/src/Nazara/Audio/Audio.cpp +++ b/src/Nazara/Audio/Audio.cpp @@ -72,7 +72,7 @@ namespace Nz if (!config.allowDummyDevice) throw; - NazaraError("failed to open default OpenAL device: {0}", e.what()); + NazaraErrorFmt("failed to open default OpenAL device: {0}", e.what()); } } diff --git a/src/Nazara/Audio/Formats/drwavLoader.cpp b/src/Nazara/Audio/Formats/drwavLoader.cpp index 967128040..8daea23b4 100644 --- a/src/Nazara/Audio/Formats/drwavLoader.cpp +++ b/src/Nazara/Audio/Formats/drwavLoader.cpp @@ -65,7 +65,7 @@ namespace Nz std::optional formatOpt = GuessAudioFormat(wav.channels); if (!formatOpt) { - NazaraError("unexpected channel count: {0}", wav.channels); + NazaraErrorFmt("unexpected channel count: {0}", wav.channels); return Err(ResourceLoadingError::Unsupported); } @@ -138,7 +138,7 @@ namespace Nz std::unique_ptr file = std::make_unique(); if (!file->Open(filePath, OpenMode::ReadOnly)) { - NazaraError("failed to open stream from file: {0}", Error::GetLastError()); + NazaraErrorFmt("failed to open stream from file: {0}", Error::GetLastError()); return Err(ResourceLoadingError::FailedToOpenFile); } @@ -166,7 +166,7 @@ namespace Nz std::optional formatOpt = GuessAudioFormat(m_decoder.channels); if (!formatOpt) { - NazaraError("unexpected channel count: {0}", m_decoder.channels); + NazaraErrorFmt("unexpected channel count: {0}", m_decoder.channels); return Err(ResourceLoadingError::Unsupported); } diff --git a/src/Nazara/Audio/Formats/libflacLoader.cpp b/src/Nazara/Audio/Formats/libflacLoader.cpp index 174cd3673..487e63cde 100644 --- a/src/Nazara/Audio/Formats/libflacLoader.cpp +++ b/src/Nazara/Audio/Formats/libflacLoader.cpp @@ -229,7 +229,7 @@ namespace Nz std::optional formatOpt = GuessAudioFormat(channelCount); if (!formatOpt) { - NazaraError("unexpected channel count: {0}", channelCount); + NazaraErrorFmt("unexpected channel count: {0}", channelCount); return Err(ResourceLoadingError::Unsupported); } @@ -298,7 +298,7 @@ namespace Nz std::unique_ptr file = std::make_unique(); if (!file->Open(filePath, OpenMode::ReadOnly)) { - NazaraError("failed to open stream from file: {0}", Error::GetLastError()); + NazaraErrorFmt("failed to open stream from file: {0}", Error::GetLastError()); return Err(ResourceLoadingError::FailedToOpenFile); } @@ -351,7 +351,7 @@ namespace Nz std::optional formatOpt = GuessAudioFormat(m_channelCount); if (!formatOpt) { - NazaraError("unexpected channel count: {0}", m_channelCount); + NazaraErrorFmt("unexpected channel count: {0}", m_channelCount); return Err(ResourceLoadingError::Unrecognized); } diff --git a/src/Nazara/Audio/Formats/libvorbisLoader.cpp b/src/Nazara/Audio/Formats/libvorbisLoader.cpp index 537feceaf..7ee97f2a8 100644 --- a/src/Nazara/Audio/Formats/libvorbisLoader.cpp +++ b/src/Nazara/Audio/Formats/libvorbisLoader.cpp @@ -103,7 +103,7 @@ namespace Nz if (readBytes < 0) { - NazaraError("an error occurred while reading file: {0}", VorbisErrToString(readBytes)); + NazaraErrorFmt("an error occurred while reading file: {0}", VorbisErrToString(readBytes)); return 0; } @@ -139,7 +139,7 @@ namespace Nz std::optional formatOpt = GuessAudioFormat(info->channels); if (!formatOpt) { - NazaraError("unexpected channel count: {0}", info->channels); + NazaraErrorFmt("unexpected channel count: {0}", info->channels); return Err(ResourceLoadingError::Unsupported); } @@ -217,7 +217,7 @@ namespace Nz std::unique_ptr file = std::make_unique(); if (!file->Open(filePath, OpenMode::ReadOnly)) { - NazaraError("failed to open stream from file: {0}", Error::GetLastError()); + NazaraErrorFmt("failed to open stream from file: {0}", Error::GetLastError()); return Err(ResourceLoadingError::FailedToOpenFile); } @@ -249,7 +249,7 @@ namespace Nz std::optional formatOpt = GuessAudioFormat(info->channels); if (!formatOpt) { - NazaraError("unexpected channel count: {0}", info->channels); + NazaraErrorFmt("unexpected channel count: {0}", info->channels); return Err(ResourceLoadingError::Unsupported); } diff --git a/src/Nazara/Audio/Formats/minimp3Loader.cpp b/src/Nazara/Audio/Formats/minimp3Loader.cpp index 0466bf0e5..f5efa4796 100644 --- a/src/Nazara/Audio/Formats/minimp3Loader.cpp +++ b/src/Nazara/Audio/Formats/minimp3Loader.cpp @@ -96,7 +96,7 @@ namespace Nz std::optional formatOpt = GuessAudioFormat(info.channels); if (!formatOpt) { - NazaraError("unexpected channel count: {0}", info.channels); + NazaraErrorFmt("unexpected channel count: {0}", info.channels); return Err(ResourceLoadingError::Unsupported); } @@ -163,7 +163,7 @@ namespace Nz std::unique_ptr file = std::make_unique(); if (!file->Open(filePath, OpenMode::ReadOnly)) { - NazaraError("failed to open stream from file: {0}", Error::GetLastError()); + NazaraErrorFmt("failed to open stream from file: {0}", Error::GetLastError()); return Err(ResourceLoadingError::FailedToOpenFile); } @@ -208,7 +208,7 @@ namespace Nz std::optional formatOpt = GuessAudioFormat(m_decoder.info.channels); if (!formatOpt) { - NazaraError("unexpected channel count: {0}", m_decoder.info.channels); + NazaraErrorFmt("unexpected channel count: {0}", m_decoder.info.channels); return Err(ResourceLoadingError::Unsupported); } diff --git a/src/Nazara/Audio/OpenALBuffer.cpp b/src/Nazara/Audio/OpenALBuffer.cpp index 10a37430b..0f61edd2b 100644 --- a/src/Nazara/Audio/OpenALBuffer.cpp +++ b/src/Nazara/Audio/OpenALBuffer.cpp @@ -78,7 +78,7 @@ namespace Nz if (ALenum lastError = m_library.alGetError(); lastError != AL_NO_ERROR) { - NazaraError("failed to reset OpenAL buffer: {0}", std::to_string(lastError)); + NazaraErrorFmt("failed to reset OpenAL buffer: {0}", std::to_string(lastError)); return false; } diff --git a/src/Nazara/Audio/Sound.cpp b/src/Nazara/Audio/Sound.cpp index dfd56ea7c..2eaf1f5c6 100644 --- a/src/Nazara/Audio/Sound.cpp +++ b/src/Nazara/Audio/Sound.cpp @@ -147,7 +147,7 @@ namespace Nz std::shared_ptr buffer = SoundBuffer::LoadFromFile(filePath, params); if (!buffer) { - NazaraError("Failed to load buffer from file ({0})", filePath); + NazaraErrorFmt("failed to load buffer from file ({0})", filePath); return false; } @@ -170,7 +170,7 @@ namespace Nz std::shared_ptr buffer = SoundBuffer::LoadFromMemory(data, size, params); if (!buffer) { - NazaraError("failed to load buffer from memory ({0})", PointerToString(data)); + NazaraErrorFmt("failed to load buffer from memory ({0})", PointerToString(data)); return false; } @@ -192,7 +192,7 @@ namespace Nz std::shared_ptr buffer = SoundBuffer::LoadFromStream(stream, params); if (!buffer) { - NazaraError("Failed to load buffer from stream"); + NazaraError("failed to load buffer from stream"); return false; } diff --git a/src/Nazara/BulletPhysics3D/BulletCollider3D.cpp b/src/Nazara/BulletPhysics3D/BulletCollider3D.cpp index 463ebb1d3..18aafd365 100644 --- a/src/Nazara/BulletPhysics3D/BulletCollider3D.cpp +++ b/src/Nazara/BulletPhysics3D/BulletCollider3D.cpp @@ -108,7 +108,7 @@ namespace Nz return std::make_shared(primitive.sphere.size); } - NazaraError("Primitive type not handled ({0:#x})", UnderlyingCast(primitive.type)); + NazaraErrorFmt("Primitive type not handled ({0:#x})", UnderlyingCast(primitive.type)); return std::shared_ptr(); } diff --git a/src/Nazara/Core/AbstractHash.cpp b/src/Nazara/Core/AbstractHash.cpp index 86a4b61e5..0784d38f5 100644 --- a/src/Nazara/Core/AbstractHash.cpp +++ b/src/Nazara/Core/AbstractHash.cpp @@ -76,7 +76,7 @@ namespace Nz return std::make_unique(); } - NazaraInternalError("Hash type not handled ({0:#x})", UnderlyingCast(type)); + NazaraInternalErrorFmt("Hash type not handled ({0:#x})", UnderlyingCast(type)); return nullptr; } } diff --git a/src/Nazara/Core/ByteStream.cpp b/src/Nazara/Core/ByteStream.cpp index 8b7a537c8..53c40298c 100644 --- a/src/Nazara/Core/ByteStream.cpp +++ b/src/Nazara/Core/ByteStream.cpp @@ -119,6 +119,6 @@ namespace Nz void ByteStream::OnEmptyStream() { - NazaraError("No stream"); + NazaraError("no stream"); } } diff --git a/src/Nazara/Core/DynLib.cpp b/src/Nazara/Core/DynLib.cpp index 2a7f84652..a34bda35e 100644 --- a/src/Nazara/Core/DynLib.cpp +++ b/src/Nazara/Core/DynLib.cpp @@ -76,7 +76,7 @@ namespace Nz auto impl = std::make_unique(); if (!impl->Load(libraryPath, &m_lastError)) { - NazaraError("failed to load library: {0}", m_lastError); + NazaraErrorFmt("failed to load library: {0}", m_lastError); return false; } diff --git a/src/Nazara/Core/File.cpp b/src/Nazara/Core/File.cpp index fc8da89ca..0f8c7696d 100644 --- a/src/Nazara/Core/File.cpp +++ b/src/Nazara/Core/File.cpp @@ -192,7 +192,7 @@ namespace Nz if (!impl->Open(m_filePath, openMode)) { ErrorFlags flags(ErrorMode::Silent); // Silent by default - NazaraError("failed to open \"{0}\": {1}", m_filePath, Error::GetLastSystemError()); + NazaraErrorFmt("failed to open \"{0}\": {1}", m_filePath, Error::GetLastSystemError()); return false; } @@ -243,7 +243,7 @@ namespace Nz std::unique_ptr impl = std::make_unique(this); if (!impl->Open(filePath, m_openMode)) { - NazaraError("failed to open new file; {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to open new file; {0}", Error::GetLastSystemError()); return false; } @@ -268,8 +268,8 @@ namespace Nz if (!CheckFileOpening()) return false; - NazaraAssert(IsOpen(), "File is not open"); - NazaraAssert(IsWritable(), "File is not writable"); + NazaraAssert(IsOpen(), "file is not open"); + NazaraAssert(IsWritable(), "file is not writable"); return m_impl->SetSize(size); } @@ -281,7 +281,7 @@ namespace Nz File file(path); if (!file.Open(OpenMode::ReadOnly | OpenMode::Unbuffered)) //< unbuffered since we will read all the file at once { - NazaraError("failed to open \"{0}\"", path); + NazaraErrorFmt("failed to open \"{0}\"", path); return std::nullopt; } @@ -301,7 +301,7 @@ namespace Nz File file(path); if (!file.Open(OpenMode::WriteOnly | OpenMode::Unbuffered)) //< unbuffered since we will write all the file at once { - NazaraError("failed to open \"{0}\"", path); + NazaraErrorFmt("failed to open \"{0}\"", path); return false; } @@ -455,7 +455,7 @@ namespace Nz File file(originalFile.GetPath()); if (!file.Open(OpenMode::ReadOnly)) { - NazaraError("Unable to open file"); + NazaraError("unable to open file"); return false; } @@ -467,7 +467,7 @@ namespace Nz std::size_t size = std::min(static_cast(remainingSize), NAZARA_CORE_FILE_BUFFERSIZE); if (file.Read(&buffer[0], size) != size) { - NazaraError("Unable to read file"); + NazaraError("unable to read file"); return false; } diff --git a/src/Nazara/Core/FileLogger.cpp b/src/Nazara/Core/FileLogger.cpp index f18691b59..a6aad2f5f 100644 --- a/src/Nazara/Core/FileLogger.cpp +++ b/src/Nazara/Core/FileLogger.cpp @@ -113,7 +113,7 @@ namespace Nz m_outputFile.open(m_outputPath, std::ios_base::trunc | std::ios_base::out); if (!m_outputFile.is_open()) { - NazaraError("Failed to open output file"); + NazaraError("failed to open output file"); return; } } diff --git a/src/Nazara/Core/GuillotineBinPack.cpp b/src/Nazara/Core/GuillotineBinPack.cpp index 3f8ae2e96..33af9e7db 100644 --- a/src/Nazara/Core/GuillotineBinPack.cpp +++ b/src/Nazara/Core/GuillotineBinPack.cpp @@ -613,7 +613,7 @@ namespace Nz break; default: - NazaraError("Split heuristic out of enum ({0:#x})", UnderlyingCast(method)); + NazaraErrorFmt("split heuristic out of enum ({0:#x})", UnderlyingCast(method)); splitHorizontal = true; } @@ -658,7 +658,7 @@ namespace Nz return ScoreWorstShortSideFit(width, height, freeRect); } - NazaraError("Rect choice heuristic out of enum ({0:#x})", UnderlyingCast(rectChoice)); + NazaraErrorFmt("Rect choice heuristic out of enum ({0:#x})", UnderlyingCast(rectChoice)); return std::numeric_limits::max(); } } diff --git a/src/Nazara/Core/Posix/FileImpl.cpp b/src/Nazara/Core/Posix/FileImpl.cpp index ab151d769..bb07a5efa 100644 --- a/src/Nazara/Core/Posix/FileImpl.cpp +++ b/src/Nazara/Core/Posix/FileImpl.cpp @@ -46,7 +46,7 @@ namespace Nz void FileImpl::Flush() { if (fsync(m_fileDescriptor) == -1) - NazaraError("Unable to flush file: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("unable to flush file: {0}", Error::GetLastSystemError()); } UInt64 FileImpl::GetCursorPos() const @@ -81,7 +81,7 @@ namespace Nz int fileDescriptor = Open_def(filePath.generic_u8string().data(), flags, permissions); if (fileDescriptor == -1) { - NazaraError("Failed to open \"{0}\": {1}", filePath, Error::GetLastSystemError()); + NazaraErrorFmt("failed to open \"{0}\": {1}", filePath, Error::GetLastSystemError()); return false; } @@ -101,14 +101,14 @@ namespace Nz if (fcntl(fileDescriptor, F_GETLK, &lock) == -1) { close(fileDescriptor); - NazaraError("Unable to detect presence of lock on the file"); + NazaraError("unable to detect presence of lock on the file"); return false; } if (lock.l_type != F_UNLCK) { close(fileDescriptor); - NazaraError("A lock is present on the file"); + NazaraError("a lock is present on the file"); return false; } @@ -119,7 +119,7 @@ namespace Nz if (fcntl(fileDescriptor, F_SETLK, &lock) == -1) { close(fileDescriptor); - NazaraError("Unable to place a lock on the file"); + NazaraError("unable to place a lock on the file"); return false; } } @@ -161,7 +161,7 @@ namespace Nz break; default: - NazaraInternalError("Cursor position not handled ({0:#x})", UnderlyingCast(pos)); + NazaraInternalErrorFmt("cursor position not handled ({0:#x})", UnderlyingCast(pos)); return false; } diff --git a/src/Nazara/Core/Posix/TaskSchedulerImpl.cpp b/src/Nazara/Core/Posix/TaskSchedulerImpl.cpp index 8cbed28b5..59bf9afbe 100644 --- a/src/Nazara/Core/Posix/TaskSchedulerImpl.cpp +++ b/src/Nazara/Core/Posix/TaskSchedulerImpl.cpp @@ -20,7 +20,7 @@ namespace Nz #if NAZARA_CORE_SAFE if (workerCount == 0) { - NazaraError("Invalid worker count ! (0)"); + NazaraError("invalid worker count ! (0)"); return false; } #endif @@ -74,7 +74,7 @@ namespace Nz #ifdef NAZARA_CORE_SAFE if (s_workerCount == 0) { - NazaraError("Task scheduler is not initialized"); + NazaraError("task scheduler is not initialized"); return; } #endif @@ -106,7 +106,7 @@ namespace Nz #ifdef NAZARA_CORE_SAFE if (s_workerCount == 0) { - NazaraError("Task scheduler is not initialized"); + NazaraError("task scheduler is not initialized"); return; } #endif diff --git a/src/Nazara/Core/RefCounted.cpp b/src/Nazara/Core/RefCounted.cpp index 72c770c00..c4939a5fa 100644 --- a/src/Nazara/Core/RefCounted.cpp +++ b/src/Nazara/Core/RefCounted.cpp @@ -82,7 +82,7 @@ namespace Nz #if NAZARA_CORE_SAFE if (m_referenceCount == 0) { - NazaraError("Impossible to remove reference (Ref. counter is already 0)"); + NazaraError("impossible to remove reference (Ref. counter is already 0)"); return false; } #endif diff --git a/src/Nazara/Core/Stream.cpp b/src/Nazara/Core/Stream.cpp index c3a381e2d..3520a0e18 100644 --- a/src/Nazara/Core/Stream.cpp +++ b/src/Nazara/Core/Stream.cpp @@ -278,7 +278,7 @@ namespace Nz void* Stream::GetMemoryMappedPointer() const { - NazaraError("Stream set the MemoryMapped option but did not implement GetMemoryMappedPointer"); + NazaraError("stream set the MemoryMapped option but did not implement GetMemoryMappedPointer"); return nullptr; } diff --git a/src/Nazara/Core/StringExt.cpp b/src/Nazara/Core/StringExt.cpp index e1bd3b710..75b4fcebd 100644 --- a/src/Nazara/Core/StringExt.cpp +++ b/src/Nazara/Core/StringExt.cpp @@ -202,7 +202,7 @@ namespace Nz } catch (utf8::exception& e) { - NazaraError("UTF-8 error: {0}", e.what()); + NazaraErrorFmt("UTF-8 error: {0}", e.what()); } catch (std::exception& e) { diff --git a/src/Nazara/Core/TaskScheduler.cpp b/src/Nazara/Core/TaskScheduler.cpp index 65cb4938c..74d55554e 100644 --- a/src/Nazara/Core/TaskScheduler.cpp +++ b/src/Nazara/Core/TaskScheduler.cpp @@ -62,7 +62,7 @@ namespace Nz { if (!Initialize()) { - NazaraError("Failed to initialize Task Scheduler"); + NazaraError("failed to initialize Task Scheduler"); return; } @@ -86,7 +86,7 @@ namespace Nz #ifdef NAZARA_CORE_SAFE if (TaskSchedulerImpl::IsInitialized()) { - NazaraError("Worker count cannot be set while initialized"); + NazaraError("worker count cannot be set while initialized"); return; } #endif @@ -114,7 +114,7 @@ namespace Nz { if (!Initialize()) { - NazaraError("Failed to initialize Task Scheduler"); + NazaraError("failed to initialize Task Scheduler"); return; } @@ -134,7 +134,7 @@ namespace Nz { if (!Initialize()) { - NazaraError("Failed to initialize Task Scheduler"); + NazaraError("failed to initialize Task Scheduler"); return; } diff --git a/src/Nazara/Core/Win32/FileImpl.cpp b/src/Nazara/Core/Win32/FileImpl.cpp index 7661ce577..d46d96da4 100644 --- a/src/Nazara/Core/Win32/FileImpl.cpp +++ b/src/Nazara/Core/Win32/FileImpl.cpp @@ -43,7 +43,7 @@ namespace Nz void FileImpl::Flush() { if (!FlushFileBuffers(m_handle)) - NazaraError("Unable to flush file: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("Unable to flush file: {0}", Error::GetLastSystemError()); } UInt64 FileImpl::GetCursorPos() const @@ -153,7 +153,7 @@ namespace Nz break; default: - NazaraInternalError("Cursor position not handled ({0:#x})", UnderlyingCast(pos)); + NazaraInternalErrorFmt("cursor position not handled ({0:#x})", UnderlyingCast(pos)); return false; } @@ -172,18 +172,18 @@ namespace Nz CallOnExit resetCursor([this, cursorPos] () { if (!SetCursorPos(CursorPosition::AtBegin, cursorPos)) - NazaraWarning("Failed to reset cursor position to previous position: " + Error::GetLastSystemError()); + NazaraWarningFmt("Failed to reset cursor position to previous position: {0}", Error::GetLastSystemError()); }); if (!SetCursorPos(CursorPosition::AtBegin, size)) { - NazaraError("failed to set file size: failed to move cursor position: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to set file size: failed to move cursor position: {0}", Error::GetLastSystemError()); return false; } if (!SetEndOfFile(m_handle)) { - NazaraError("failed to set file size: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to set file size: {0}", Error::GetLastSystemError()); return false; } diff --git a/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp b/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp index 48fa5580b..4e68fd9ce 100644 --- a/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp +++ b/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp @@ -19,7 +19,7 @@ namespace Nz #if NAZARA_CORE_SAFE if (workerCount == 0) { - NazaraError("Invalid worker count ! (0)"); + NazaraError("invalid worker count ! (0)"); return false; } #endif @@ -90,7 +90,7 @@ namespace Nz #ifdef NAZARA_CORE_SAFE if (s_workerCount == 0) { - NazaraError("Task scheduler is not initialized"); + NazaraError("task scheduler is not initialized"); return; } #endif @@ -137,7 +137,7 @@ namespace Nz #ifdef NAZARA_CORE_SAFE if (s_workerCount == 0) { - NazaraError("Task scheduler is not initialized"); + NazaraError("task scheduler is not initialized"); return; } #endif diff --git a/src/Nazara/Graphics/GuillotineTextureAtlas.cpp b/src/Nazara/Graphics/GuillotineTextureAtlas.cpp index 50d895759..e7f8c0cf7 100644 --- a/src/Nazara/Graphics/GuillotineTextureAtlas.cpp +++ b/src/Nazara/Graphics/GuillotineTextureAtlas.cpp @@ -51,7 +51,7 @@ namespace Nz } catch (const std::exception& e) { - NazaraError("failed to instantiate texture: {0}", e.what()); + NazaraErrorFmt("failed to instantiate texture: {0}", e.what()); return nullptr; } diff --git a/src/Nazara/Graphics/PropertyHandler/TexturePropertyHandler.cpp b/src/Nazara/Graphics/PropertyHandler/TexturePropertyHandler.cpp index 6bb91adfd..66771c52d 100644 --- a/src/Nazara/Graphics/PropertyHandler/TexturePropertyHandler.cpp +++ b/src/Nazara/Graphics/PropertyHandler/TexturePropertyHandler.cpp @@ -35,7 +35,7 @@ namespace Nz if (textureProperty.type != textureData.imageType) { // TODO: Use EnumToString to show image type as string - NazaraError("unmatching texture type: material property is of type {0} but shader sampler is of type {1}", UnderlyingCast(textureProperty.type), UnderlyingCast(textureData.imageType)); + NazaraErrorFmt("unmatching texture type: material property is of type {0} but shader sampler is of type {1}", UnderlyingCast(textureProperty.type), UnderlyingCast(textureData.imageType)); return; } @@ -50,7 +50,7 @@ namespace Nz m_optionHash = optionData->hash; } else - NazaraError("option {0} is not a boolean option (got {1})", m_optionName, nzsl::Ast::ToString(optionData->type)); + NazaraErrorFmt("option {0} is not a boolean option (got {1})", m_optionName, nzsl::Ast::ToString(optionData->type)); } } diff --git a/src/Nazara/Graphics/UberShader.cpp b/src/Nazara/Graphics/UberShader.cpp index afc0af085..1428530ba 100644 --- a/src/Nazara/Graphics/UberShader.cpp +++ b/src/Nazara/Graphics/UberShader.cpp @@ -31,7 +31,7 @@ namespace Nz } catch (const std::exception& e) { - NazaraError("failed to compile ubershader {0}: {1}", moduleName, e.what()); + NazaraErrorFmt("failed to compile ubershader {0}: {1}", moduleName, e.what()); throw; } @@ -43,7 +43,7 @@ namespace Nz nzsl::Ast::ModulePtr newShaderModule = resolver->Resolve(name); if (!newShaderModule) { - NazaraError("failed to retrieve updated shader module {0}", name); + NazaraErrorFmt("failed to retrieve updated shader module {0}", name); return; } @@ -53,7 +53,7 @@ namespace Nz } catch (const std::exception& e) { - NazaraError("failed to retrieve updated shader module {0}: {1}", name, e.what()); + NazaraErrorFmt("failed to retrieve updated shader module {0}: {1}", name, e.what()); return; } @@ -76,7 +76,7 @@ namespace Nz } catch (const std::exception& e) { - NazaraError("failed to compile ubershader: {0}", e.what()); + NazaraErrorFmt("failed to compile ubershader: {0}", e.what()); throw; } } @@ -98,6 +98,7 @@ namespace Nz }, optionValue); } states.shaderModuleResolver = Graphics::Instance()->GetShaderModuleResolver(); + states.debugLevel = nzsl::DebugLevel::Regular; std::shared_ptr stage = Graphics::Instance()->GetRenderDevice()->InstantiateShaderModule(m_shaderStages, *m_shaderModule, std::move(states)); diff --git a/src/Nazara/JoltPhysics3D/JoltCollider3D.cpp b/src/Nazara/JoltPhysics3D/JoltCollider3D.cpp index ad34ee882..cc1cfe432 100644 --- a/src/Nazara/JoltPhysics3D/JoltCollider3D.cpp +++ b/src/Nazara/JoltPhysics3D/JoltCollider3D.cpp @@ -101,7 +101,7 @@ namespace Nz return std::make_shared(primitive.sphere.size); } - NazaraError("Primitive type not handled ({0:#x})", UnderlyingCast(primitive.type)); + NazaraErrorFmt("Primitive type not handled ({0:#x})", UnderlyingCast(primitive.type)); return std::shared_ptr(); } @@ -333,10 +333,10 @@ namespace Nz unsigned int vertexCount = shape->GetFaceVertices(i, maxVerticesInFace, faceVertices.data()); if NAZARA_LIKELY(vertexCount >= 2) { - for (unsigned int i = 1; i < vertexCount; ++i) + for (unsigned int j = 1; j < vertexCount; ++j) { - indices.push_back(InsertVertex(faceVertices[i - 1])); - indices.push_back(InsertVertex(faceVertices[i])); + indices.push_back(InsertVertex(faceVertices[j - 1])); + indices.push_back(InsertVertex(faceVertices[j])); } if NAZARA_LIKELY(vertexCount > 2) diff --git a/src/Nazara/Network/AbstractSocket.cpp b/src/Nazara/Network/AbstractSocket.cpp index d33d41a16..ca8a00fd2 100644 --- a/src/Nazara/Network/AbstractSocket.cpp +++ b/src/Nazara/Network/AbstractSocket.cpp @@ -179,7 +179,7 @@ namespace Nz { SocketError errorCode; if (!SocketImpl::SetBlocking(m_handle, m_isBlockingEnabled, &errorCode)) - NazaraWarning("failed to set socket blocking mode ({0:#x})", UnderlyingCast(errorCode)); + NazaraWarningFmt("failed to set socket blocking mode ({0:#x})", UnderlyingCast(errorCode)); } /*! @@ -201,7 +201,7 @@ namespace Nz { SocketImpl::Close(handle); - NazaraError("failed to open a dual-stack socket: {0}", std::string(ErrorToString(m_lastError))); + NazaraErrorFmt("failed to open a dual-stack socket: {0}", ErrorToString(m_lastError)); return false; } diff --git a/src/Nazara/Network/CurlLibrary.cpp b/src/Nazara/Network/CurlLibrary.cpp index 0d17595f1..f660c71b0 100644 --- a/src/Nazara/Network/CurlLibrary.cpp +++ b/src/Nazara/Network/CurlLibrary.cpp @@ -39,7 +39,7 @@ namespace Nz if (!m_library.IsLoaded()) { - NazaraError("failed to load libcurl: {0}", m_library.GetLastError()); + NazaraErrorFmt("failed to load libcurl: {0}", m_library.GetLastError()); return false; } diff --git a/src/Nazara/Network/ENetHost.cpp b/src/Nazara/Network/ENetHost.cpp index 847350d94..49a848336 100644 --- a/src/Nazara/Network/ENetHost.cpp +++ b/src/Nazara/Network/ENetHost.cpp @@ -168,7 +168,7 @@ namespace Nz if (peerCount > ENetConstants::ENetProtocol_MaximumPeerId) { - NazaraError("peer count exceeds maximum peer count supported by protocol ({0})", UnderlyingCast(ENetConstants::ENetProtocol_MaximumPeerId)); + NazaraErrorFmt("peer count exceeds maximum peer count supported by protocol ({0})", UnderlyingCast(ENetConstants::ENetProtocol_MaximumPeerId)); return false; } @@ -245,7 +245,7 @@ namespace Nz return 1; case -1: - NazaraError("Error sending outgoing packets"); + NazaraError("error sending outgoing packets"); return -1; default: @@ -262,7 +262,7 @@ namespace Nz return 1; case -1: - //NazaraError("Error receiving incoming packets"); + //NazaraError("error receiving incoming packets"); return -1; default: @@ -275,7 +275,7 @@ namespace Nz return 1; case -1: - NazaraError("Error sending outgoing packets"); + NazaraError("error sending outgoing packets"); return -1; @@ -338,7 +338,7 @@ namespace Nz { if (m_socket.Bind(address) != SocketState::Bound) { - NazaraError("failed to bind address {0}", address.ToString()); + NazaraErrorFmt("failed to bind address {0}", address.ToString()); return false; } } diff --git a/src/Nazara/Network/IpAddress.cpp b/src/Nazara/Network/IpAddress.cpp index c2daab607..d38f2973b 100644 --- a/src/Nazara/Network/IpAddress.cpp +++ b/src/Nazara/Network/IpAddress.cpp @@ -94,7 +94,7 @@ namespace Nz return m_ipv6 == LoopbackIpV6.m_ipv6; // Only compare the ip value } - NazaraInternalError("Invalid protocol for IpAddress ({0:#x})", UnderlyingCast(m_protocol)); + NazaraInternalErrorFmt("invalid protocol for IpAddress ({0:#x})", UnderlyingCast(m_protocol)); return false; } diff --git a/src/Nazara/Network/Linux/SocketPollerImpl.cpp b/src/Nazara/Network/Linux/SocketPollerImpl.cpp index e496ad5c9..f11a06e92 100644 --- a/src/Nazara/Network/Linux/SocketPollerImpl.cpp +++ b/src/Nazara/Network/Linux/SocketPollerImpl.cpp @@ -61,7 +61,7 @@ namespace Nz if (epoll_ctl(m_handle, EPOLL_CTL_ADD, socket, &entry) != 0) { - NazaraError("failed to add socket to epoll structure (errno {0}: {1})", errno, Error::GetLastSystemError()); + NazaraErrorFmt("failed to add socket to epoll structure (errno {0}: {1})", errno, Error::GetLastSystemError()); return false; } diff --git a/src/Nazara/Network/NetPacket.cpp b/src/Nazara/Network/NetPacket.cpp index 73746803f..0e0ef7d69 100644 --- a/src/Nazara/Network/NetPacket.cpp +++ b/src/Nazara/Network/NetPacket.cpp @@ -46,7 +46,7 @@ namespace Nz std::size_t size = m_buffer->GetSize(); if (!EncodeHeader(m_buffer->GetBuffer(), static_cast(size), m_netCode)) { - NazaraError("Failed to encode packet header"); + NazaraError("failed to encode packet header"); return nullptr; } diff --git a/src/Nazara/Network/Posix/IpAddressImpl.cpp b/src/Nazara/Network/Posix/IpAddressImpl.cpp index 5777c9cfd..d9ad9a534 100644 --- a/src/Nazara/Network/Posix/IpAddressImpl.cpp +++ b/src/Nazara/Network/Posix/IpAddressImpl.cpp @@ -178,12 +178,12 @@ namespace Nz } default: - NazaraInternalError("Unhandled ip protocol ({0:#x})", UnderlyingCast(ipAddress.GetProtocol())); + NazaraInternalErrorFmt("unhandled ip protocol ({0:#x})", UnderlyingCast(ipAddress.GetProtocol())); break; } } - NazaraError("Invalid ip address"); + NazaraError("invalid ip address"); return 0; } diff --git a/src/Nazara/Network/SocketPoller.cpp b/src/Nazara/Network/SocketPoller.cpp index f82135ce5..169c4982e 100644 --- a/src/Nazara/Network/SocketPoller.cpp +++ b/src/Nazara/Network/SocketPoller.cpp @@ -198,7 +198,7 @@ namespace Nz if (waitError != SocketError::NoError) { if (waitError != SocketError::Interrupted) //< Do not log interrupted error - NazaraError("SocketPoller encountered an error (code: {0:#x}): {1}", UnderlyingCast(waitError), ErrorToString(waitError)); + NazaraErrorFmt("SocketPoller encountered an error (code: {0:#x}): {1}", UnderlyingCast(waitError), ErrorToString(waitError)); return 0; } diff --git a/src/Nazara/Network/TcpClient.cpp b/src/Nazara/Network/TcpClient.cpp index 2f60f8b21..d338e5031 100644 --- a/src/Nazara/Network/TcpClient.cpp +++ b/src/Nazara/Network/TcpClient.cpp @@ -187,7 +187,7 @@ namespace Nz break; } - NazaraInternalError("Unexpected socket state ({0:#x})", UnderlyingCast(m_state)); + NazaraInternalErrorFmt("unexpected socket state ({0:#x})", UnderlyingCast(m_state)); return m_state; } @@ -426,7 +426,7 @@ namespace Nz if (!ptr) { m_lastError = SocketError::Packet; - NazaraError("Failed to prepare packet"); + NazaraError("failed to prepare packet"); return false; } @@ -479,7 +479,7 @@ namespace Nz break; } - NazaraInternalError("Unhandled socket state ({0:#x})", UnderlyingCast(m_state)); + NazaraInternalErrorFmt("unhandled socket state ({0:#x})", UnderlyingCast(m_state)); return m_state; } @@ -516,10 +516,10 @@ namespace Nz SocketError errorCode; if (!SocketImpl::SetNoDelay(m_handle, m_isLowDelayEnabled, &errorCode)) - NazaraWarning("failed to set socket no delay mode ({0:#x})", UnderlyingCast(errorCode)); + NazaraWarningFmt("failed to set socket no delay mode ({0:#x})", UnderlyingCast(errorCode)); if (!SocketImpl::SetKeepAlive(m_handle, m_isKeepAliveEnabled, m_keepAliveTime, m_keepAliveInterval, &errorCode)) - NazaraWarning("failed to set socket keep alive mode ({0:#x})", UnderlyingCast(errorCode)); + NazaraWarningFmt("failed to set socket keep alive mode ({0:#x})", UnderlyingCast(errorCode)); m_peerAddress = IpAddress::Invalid; m_openMode = OpenMode_ReadWrite; diff --git a/src/Nazara/Network/UdpSocket.cpp b/src/Nazara/Network/UdpSocket.cpp index 1d38063b2..15465522b 100644 --- a/src/Nazara/Network/UdpSocket.cpp +++ b/src/Nazara/Network/UdpSocket.cpp @@ -275,7 +275,7 @@ namespace Nz if (!ptr) { m_lastError = SocketError::Packet; - NazaraError("Failed to prepare packet"); + NazaraError("failed to prepare packet"); return false; } diff --git a/src/Nazara/Network/Win32/IpAddressImpl.cpp b/src/Nazara/Network/Win32/IpAddressImpl.cpp index 84e90be69..3eb95c708 100644 --- a/src/Nazara/Network/Win32/IpAddressImpl.cpp +++ b/src/Nazara/Network/Win32/IpAddressImpl.cpp @@ -277,7 +277,7 @@ namespace Nz } } - NazaraError("Invalid ip address"); + NazaraError("invalid ip address"); return 0; } diff --git a/src/Nazara/Network/Win32/SocketImpl.cpp b/src/Nazara/Network/Win32/SocketImpl.cpp index 04cb92319..bc323c779 100644 --- a/src/Nazara/Network/Win32/SocketImpl.cpp +++ b/src/Nazara/Network/Win32/SocketImpl.cpp @@ -160,7 +160,7 @@ namespace Nz int errorCode = WSAStartup(MAKEWORD(2, 2), &s_WSA); if (errorCode != 0) { - NazaraError("failed to initialize Windows Socket 2.2: {0}", Error::GetLastSystemError(errorCode)); + NazaraErrorFmt("failed to initialize Windows Socket 2.2: {0}", Error::GetLastSystemError(errorCode)); return false; } diff --git a/src/Nazara/Network/Win32/SocketPollerImpl.cpp b/src/Nazara/Network/Win32/SocketPollerImpl.cpp index f2cf88fb3..095821c87 100644 --- a/src/Nazara/Network/Win32/SocketPollerImpl.cpp +++ b/src/Nazara/Network/Win32/SocketPollerImpl.cpp @@ -91,7 +91,7 @@ namespace Nz fd_set& targetSet = (i == 0) ? m_readSockets : m_writeSockets; if (targetSet.fd_count > FD_SETSIZE) { - NazaraError("Socket count exceeding hard-coded FD_SETSIZE ({0})", FD_SETSIZE); + NazaraErrorFmt("socket count exceeding hard-coded FD_SETSIZE ({0})", FD_SETSIZE); return false; } diff --git a/src/Nazara/OpenGLRenderer/OpenGLRenderer.cpp b/src/Nazara/OpenGLRenderer/OpenGLRenderer.cpp index 9e45a6069..2a2b9242e 100644 --- a/src/Nazara/OpenGLRenderer/OpenGLRenderer.cpp +++ b/src/Nazara/OpenGLRenderer/OpenGLRenderer.cpp @@ -50,7 +50,7 @@ namespace Nz std::unique_ptr loader = SelectLoader(config); if (!loader) { - NazaraError("Failed to initialize OpenGL loader"); + NazaraError("failed to initialize OpenGL loader"); return false; } diff --git a/src/Nazara/OpenGLRenderer/Wrapper/Context.cpp b/src/Nazara/OpenGLRenderer/Wrapper/Context.cpp index e83deaf61..08354185a 100644 --- a/src/Nazara/OpenGLRenderer/Wrapper/Context.cpp +++ b/src/Nazara/OpenGLRenderer/Wrapper/Context.cpp @@ -369,13 +369,13 @@ namespace Nz::GL // Validate framebuffer completeness if (GLenum checkResult = m_blitFramebuffers->drawFBO.Check(); checkResult != GL_FRAMEBUFFER_COMPLETE) { - NazaraError("Blit draw FBO is incomplete: {0}", TranslateOpenGLError(checkResult)); + NazaraErrorFmt("blit draw FBO is incomplete: {0}", TranslateOpenGLError(checkResult)); return false; } if (GLenum checkResult = m_blitFramebuffers->readFBO.Check(); checkResult != GL_FRAMEBUFFER_COMPLETE) { - NazaraError("Blit read FBO is incomplete: {0}", TranslateOpenGLError(checkResult)); + NazaraErrorFmt("blit read FBO is incomplete: {0}", TranslateOpenGLError(checkResult)); return false; } @@ -628,14 +628,14 @@ namespace Nz::GL unsigned int maxTextureUnits = GetInteger(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS); if (maxTextureUnits < 32) //< OpenGL ES 3.0 requires at least 32 textures units - NazaraWarning("GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS is " + std::to_string(maxTextureUnits) + ", expected >= 32"); + NazaraWarningFmt("GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS is {0}, expected >= 32", maxTextureUnits); assert(maxTextureUnits > 0); m_state.textureUnits.resize(maxTextureUnits); unsigned int maxUniformBufferUnits = GetInteger(GL_MAX_UNIFORM_BUFFER_BINDINGS); if (maxUniformBufferUnits < 24) //< OpenGL ES 3.0 requires at least 24 uniform buffers units - NazaraWarning("GL_MAX_UNIFORM_BUFFER_BINDINGS is " + std::to_string(maxUniformBufferUnits) + ", expected >= 24"); + NazaraWarningFmt("GL_MAX_UNIFORM_BUFFER_BINDINGS is {0}, expected >= 24", maxUniformBufferUnits); assert(maxUniformBufferUnits > 0); m_state.uboUnits.resize(maxUniformBufferUnits); @@ -651,7 +651,7 @@ namespace Nz::GL { unsigned int maxStorageBufferUnits = GetInteger(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS); if (maxStorageBufferUnits < 8) //< OpenGL ES 3.1 requires at least 8 storage buffers units - NazaraWarning("GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS is " + std::to_string(maxUniformBufferUnits) + ", expected >= 8"); + NazaraWarningFmt("GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS is {0}, expected >= 8", maxUniformBufferUnits); assert(maxStorageBufferUnits > 0); m_state.storageUnits.resize(maxStorageBufferUnits); @@ -710,7 +710,7 @@ namespace Nz::GL { hasAnyError = true; - NazaraError("OpenGL error: {0}", TranslateOpenGLError(lastError)); + NazaraErrorFmt("OpenGL error: {0}", TranslateOpenGLError(lastError)); } m_didCollectErrors = true; diff --git a/src/Nazara/OpenGLRenderer/Wrapper/EGL/EGLContextBase.cpp b/src/Nazara/OpenGLRenderer/Wrapper/EGL/EGLContextBase.cpp index c9b2cb8a4..ea84003d2 100644 --- a/src/Nazara/OpenGLRenderer/Wrapper/EGL/EGLContextBase.cpp +++ b/src/Nazara/OpenGLRenderer/Wrapper/EGL/EGLContextBase.cpp @@ -53,7 +53,7 @@ namespace Nz::GL bool EGLContextBase::Create(const ContextParams& /*params*/, WindowHandle /*window*/, const EGLContextBase* /*shareContext*/) { - NazaraError("Unexpected context creation call"); + NazaraError("unexpected context creation call"); return false; } @@ -166,7 +166,7 @@ namespace Nz::GL EGLint numConfig = 0; if (m_loader.eglChooseConfig(m_display, configAttributes, configs, EGLint(maxConfigCount), &numConfig) != GL_TRUE) { - NazaraError("failed to retrieve compatible EGL configurations: {0}", EGLLoader::TranslateError(m_loader.eglGetError())); + NazaraErrorFmt("failed to retrieve compatible EGL configurations: {0}", EGLLoader::TranslateError(m_loader.eglGetError())); return false; } @@ -267,7 +267,7 @@ namespace Nz::GL if (!m_handle) { - NazaraError("failed to create EGL context: {0}", EGLLoader::TranslateError(m_loader.eglGetError())); + NazaraErrorFmt("failed to create EGL context: {0}", EGLLoader::TranslateError(m_loader.eglGetError())); return false; } diff --git a/src/Nazara/OpenGLRenderer/Wrapper/WGL/WGLContext.cpp b/src/Nazara/OpenGLRenderer/Wrapper/WGL/WGLContext.cpp index c33408fc6..2c340b0f3 100644 --- a/src/Nazara/OpenGLRenderer/Wrapper/WGL/WGLContext.cpp +++ b/src/Nazara/OpenGLRenderer/Wrapper/WGL/WGLContext.cpp @@ -25,7 +25,7 @@ namespace Nz::GL HWNDHandle window(::CreateWindowA("STATIC", nullptr, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, GetModuleHandle(nullptr), nullptr)); if (!window) { - NazaraError("failed to create dummy window: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to create dummy window: {0}", Error::GetLastSystemError()); return false; } @@ -34,7 +34,7 @@ namespace Nz::GL m_deviceContext = ::GetDC(window.get()); if (!m_deviceContext) { - NazaraError("failed to retrieve dummy window device context: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to retrieve dummy window device context: {0}", Error::GetLastSystemError()); return false; } @@ -54,7 +54,7 @@ namespace Nz::GL m_deviceContext = ::GetDC(static_cast(window.windows.window)); if (!m_deviceContext) { - NazaraError("failed to retrieve window device context: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to retrieve window device context: {0}", Error::GetLastSystemError()); return false; } @@ -208,7 +208,7 @@ namespace Nz::GL if (!m_handle) { - NazaraError("failed to create WGL context: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to create WGL context: {0}", Error::GetLastSystemError()); return false; } } @@ -217,7 +217,7 @@ namespace Nz::GL m_handle = m_loader.wglCreateContext(m_deviceContext); if (!m_handle) { - NazaraError("failed to create WGL context: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to create WGL context: {0}", Error::GetLastSystemError()); return false; } @@ -225,7 +225,7 @@ namespace Nz::GL { if (!m_loader.wglShareLists(shareContext->m_handle, m_handle)) { - NazaraError("failed to share context objects: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to share context objects: {0}", Error::GetLastSystemError()); return false; } } @@ -268,7 +268,7 @@ namespace Nz::GL bool succeeded = m_loader.wglMakeCurrent(m_deviceContext, m_handle); if (!succeeded) { - NazaraError("failed to activate context: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to activate context: {0}", Error::GetLastSystemError()); return false; } @@ -389,14 +389,14 @@ namespace Nz::GL pixelFormat = m_loader.ChoosePixelFormat(m_deviceContext, &descriptor); if (pixelFormat == 0) { - NazaraError("failed to choose pixel format: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to choose pixel format: {0}", Error::GetLastSystemError()); return false; } } if (!m_loader.SetPixelFormat(m_deviceContext, pixelFormat, &descriptor)) { - NazaraError("failed to choose pixel format: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to choose pixel format: {0}", Error::GetLastSystemError()); return false; } diff --git a/src/Nazara/OpenGLRenderer/Wrapper/Web/WebContext.cpp b/src/Nazara/OpenGLRenderer/Wrapper/Web/WebContext.cpp index 91602c5f4..2743122ea 100644 --- a/src/Nazara/OpenGLRenderer/Wrapper/Web/WebContext.cpp +++ b/src/Nazara/OpenGLRenderer/Wrapper/Web/WebContext.cpp @@ -132,7 +132,7 @@ namespace Nz::GL if (m_handle <= 0) { - NazaraError("failed to create Web context: {0}", WebLoader::TranslateError(static_cast(m_handle))); + NazaraErrorFmt("failed to create Web context: {0}", WebLoader::TranslateError(static_cast(m_handle))); return false; } diff --git a/src/Nazara/OpenGLRenderer/Wrapper/Win32/EGLContextWin32.cpp b/src/Nazara/OpenGLRenderer/Wrapper/Win32/EGLContextWin32.cpp index ff392e81b..d1599160e 100644 --- a/src/Nazara/OpenGLRenderer/Wrapper/Win32/EGLContextWin32.cpp +++ b/src/Nazara/OpenGLRenderer/Wrapper/Win32/EGLContextWin32.cpp @@ -14,7 +14,7 @@ namespace Nz::GL HWNDHandle window(::CreateWindowA("STATIC", nullptr, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, GetModuleHandle(nullptr), nullptr)); if (!window) { - NazaraError("failed to create dummy window: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to create dummy window: {0}", Error::GetLastSystemError()); return false; } @@ -47,7 +47,7 @@ namespace Nz::GL /*HDC deviceContext = ::GetDC(windowHandle); if (!deviceContext) { - NazaraError("failed to retrieve window device context: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to retrieve window device context: {0}", Error::GetLastSystemError()); return false; } diff --git a/src/Nazara/Platform/SDL2/CursorImpl.cpp b/src/Nazara/Platform/SDL2/CursorImpl.cpp index 9da774bc6..61e27e0a5 100644 --- a/src/Nazara/Platform/SDL2/CursorImpl.cpp +++ b/src/Nazara/Platform/SDL2/CursorImpl.cpp @@ -43,7 +43,7 @@ namespace Nz m_cursorImage = cursor; if (!m_cursorImage.Convert(PixelFormat::BGRA8)) - NazaraError("Failed to convert icon to BGRA8"); + NazaraError("failed to convert icon to BGRA8"); m_surface = SDL_CreateRGBSurfaceWithFormatFrom( m_cursorImage.GetPixels(), @@ -55,7 +55,7 @@ namespace Nz ); if (!m_surface) - NazaraError("failed to create SDL Surface for cursor: {0}", std::string(SDL_GetError())); + NazaraErrorFmt("failed to create SDL Surface for cursor: {0}", SDL_GetError()); m_cursor = SDL_CreateColorCursor(m_surface, hotSpot.x, hotSpot.y); if (!m_cursor) @@ -63,7 +63,7 @@ namespace Nz if (m_surface) //< Just in case exceptions were disabled SDL_FreeSurface(m_surface); - NazaraError("failed to create SDL cursor: {0}", std::string(SDL_GetError())); + NazaraErrorFmt("failed to create SDL cursor: {0}", SDL_GetError()); } } @@ -77,7 +77,7 @@ namespace Nz { m_cursor = SDL_CreateSystemCursor(s_systemCursorIds[cursor]); if (!m_cursor) - NazaraError("failed to create SDL cursor: {0}", std::string(SDL_GetError())); + NazaraErrorFmt("failed to create SDL cursor: {0}", SDL_GetError()); } } diff --git a/src/Nazara/Platform/SDL2/IconImpl.cpp b/src/Nazara/Platform/SDL2/IconImpl.cpp index 3194f360e..c7990e5d5 100644 --- a/src/Nazara/Platform/SDL2/IconImpl.cpp +++ b/src/Nazara/Platform/SDL2/IconImpl.cpp @@ -16,7 +16,7 @@ namespace Nz m_iconImage = icon; if (!m_iconImage.Convert(PixelFormat::BGRA8)) - NazaraError("Failed to convert icon to BGRA8"); + NazaraError("failed to convert icon to BGRA8"); m_icon = SDL_CreateRGBSurfaceWithFormatFrom( m_iconImage.GetPixels(), @@ -28,7 +28,7 @@ namespace Nz ); if (!m_icon) - NazaraError("failed to create SDL Surface for icon: {0}", std::string(SDL_GetError())); + NazaraErrorFmt("failed to create SDL Surface for icon: {0}", SDL_GetError()); } IconImpl::~IconImpl() diff --git a/src/Nazara/Platform/SDL2/InputImpl.cpp b/src/Nazara/Platform/SDL2/InputImpl.cpp index 07bfab864..7ab3a4b82 100644 --- a/src/Nazara/Platform/SDL2/InputImpl.cpp +++ b/src/Nazara/Platform/SDL2/InputImpl.cpp @@ -122,7 +122,7 @@ namespace Nz if (handle) SDL_WarpMouseInWindow(handle, x, y); else - NazaraError("Invalid window handle"); + NazaraError("invalid window handle"); } void InputImpl::StartTextInput() diff --git a/src/Nazara/Platform/SDL2/WindowImpl.cpp b/src/Nazara/Platform/SDL2/WindowImpl.cpp index 78382e345..c884b6247 100644 --- a/src/Nazara/Platform/SDL2/WindowImpl.cpp +++ b/src/Nazara/Platform/SDL2/WindowImpl.cpp @@ -91,7 +91,7 @@ namespace Nz m_handle = SDL_CreateWindow(title.c_str(), x, y, width, height, winStyle); if (!m_handle) { - NazaraError("failed to create window: {0}", Error::GetLastSystemError()); + NazaraErrorFmt("failed to create window: {0}", Error::GetLastSystemError()); return false; } @@ -133,7 +133,7 @@ namespace Nz m_handle = SDL_CreateWindowFrom(systemHandle); if (!m_handle) { - NazaraError("Invalid handle"); + NazaraError("invalid handle"); return false; } @@ -213,7 +213,7 @@ namespace Nz { #ifndef NAZARA_PLATFORM_WEB ErrorFlags flags(ErrorMode::ThrowException); - NazaraError("failed to retrieve window manager info: {0}", SDL_GetError()); + NazaraErrorFmt("failed to retrieve window manager info: {0}", SDL_GetError()); #endif } @@ -556,7 +556,7 @@ namespace Nz } catch (...) // Don't let any exceptions go through C calls { - NazaraError("An unknown error happened"); + NazaraError("an unknown error happened"); } return 0; diff --git a/src/Nazara/Platform/Window.cpp b/src/Nazara/Platform/Window.cpp index 412987d62..f4bc7ceb9 100644 --- a/src/Nazara/Platform/Window.cpp +++ b/src/Nazara/Platform/Window.cpp @@ -60,7 +60,7 @@ namespace Nz m_impl = std::make_unique(this); if (!m_impl->Create(mode, title, style)) { - NazaraError("Failed to create window implementation"); + NazaraError("failed to create window implementation"); return false; } @@ -97,7 +97,7 @@ namespace Nz m_impl = std::make_unique(this); if (!m_impl->Create(handle)) { - NazaraError("Unable to create window implementation"); + NazaraError("unable to create window implementation"); m_impl.reset(); return false; } @@ -174,7 +174,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return false; } #endif @@ -187,7 +187,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return false; } #endif @@ -200,7 +200,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return false; } #endif @@ -222,7 +222,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -244,7 +244,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -257,7 +257,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -270,7 +270,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -283,7 +283,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -296,7 +296,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -309,7 +309,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -322,7 +322,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -335,7 +335,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -348,7 +348,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -361,7 +361,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -374,7 +374,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif @@ -429,7 +429,7 @@ namespace Nz #if NAZARA_PLATFORM_SAFE if (!m_impl) { - NazaraError("Window not created"); + NazaraError("window not created"); return; } #endif diff --git a/src/Nazara/Renderer/RenderDevice.cpp b/src/Nazara/Renderer/RenderDevice.cpp index 144a69608..adc354a52 100644 --- a/src/Nazara/Renderer/RenderDevice.cpp +++ b/src/Nazara/Renderer/RenderDevice.cpp @@ -16,7 +16,7 @@ namespace Nz File file(sourcePath); if (!file.Open(OpenMode::ReadOnly | OpenMode::Text)) { - NazaraError("Failed to open \"{0}\"", sourcePath); + NazaraErrorFmt("failed to open \"{0}\"", sourcePath); return {}; } @@ -25,7 +25,7 @@ namespace Nz std::vector source(length); if (file.Read(&source[0], length) != length) { - NazaraError("Failed to read program file"); + NazaraError("failed to read program file"); return {}; } diff --git a/src/Nazara/Renderer/Renderer.cpp b/src/Nazara/Renderer/Renderer.cpp index 7d973dae7..4e71f831b 100644 --- a/src/Nazara/Renderer/Renderer.cpp +++ b/src/Nazara/Renderer/Renderer.cpp @@ -189,7 +189,7 @@ namespace Nz #endif if (!impl || !impl->Prepare(config)) { - NazaraError("Failed to create renderer implementation"); + NazaraError("failed to create renderer implementation"); continue; } @@ -235,7 +235,7 @@ namespace Nz if (auto it = renderAPIStr.find(value); it != renderAPIStr.end()) preferredAPI = it->second; else - NazaraError("unknown render API \"{0}\"", value); + NazaraErrorFmt("unknown render API \"{0}\"", value); } if (parameters.GetParameter("render-api-validation", &value)) @@ -251,7 +251,7 @@ namespace Nz if (auto it = validationStr.find(value); it != validationStr.end()) validationLevel = it->second; else - NazaraError("unknown validation level \"{0}\"", value); + NazaraErrorFmt("unknown validation level \"{0}\"", value); } } } diff --git a/src/Nazara/Utility/Animation.cpp b/src/Nazara/Utility/Animation.cpp index 5b89748de..b7c76dae3 100644 --- a/src/Nazara/Utility/Animation.cpp +++ b/src/Nazara/Utility/Animation.cpp @@ -30,13 +30,13 @@ namespace Nz { if (startFrame > endFrame) { - NazaraError("Start frame index must be smaller than end frame index"); + NazaraError("start frame index must be smaller than end frame index"); return false; } if (!skeleton) { - NazaraError("You must set a valid skeleton to load an animation"); + NazaraError("you must set a valid skeleton to load an animation"); return false; } @@ -68,7 +68,7 @@ namespace Nz auto it = m_impl->sequenceMap.find(sequence.name); if (it != m_impl->sequenceMap.end()) { - NazaraError("sequence name \"{0}\" is already in use", sequence.name); + NazaraErrorFmt("sequence name \"{0}\" is already in use", sequence.name); return false; } #endif @@ -152,7 +152,7 @@ namespace Nz auto it = m_impl->sequenceMap.find(sequenceName); if (it == m_impl->sequenceMap.end()) { - NazaraError("Sequence not found"); + NazaraError("sequence not found"); return nullptr; } @@ -174,7 +174,7 @@ namespace Nz auto it = m_impl->sequenceMap.find(sequenceName); if (it == m_impl->sequenceMap.end()) { - NazaraError("Sequence not found"); + NazaraError("sequence not found"); return nullptr; } @@ -203,7 +203,7 @@ namespace Nz auto it = m_impl->sequenceMap.find(sequenceName); if (it == m_impl->sequenceMap.end()) { - NazaraError("Sequence not found"); + NazaraError("sequence not found"); return 0xFFFFFFFF; } @@ -266,7 +266,7 @@ namespace Nz auto it = m_impl->sequenceMap.find(identifier); if (it == m_impl->sequenceMap.end()) { - NazaraError("Sequence not found"); + NazaraError("sequence not found"); return; } diff --git a/src/Nazara/Utility/Components/NodeComponent.cpp b/src/Nazara/Utility/Components/NodeComponent.cpp index 29824fa9b..f7b23222d 100644 --- a/src/Nazara/Utility/Components/NodeComponent.cpp +++ b/src/Nazara/Utility/Components/NodeComponent.cpp @@ -29,7 +29,7 @@ namespace Nz std::size_t jointIndex = skeletonComponent->FindJointByName(jointName); if (jointIndex == Skeleton::InvalidJointIndex) { - NazaraError("skeleton has no joint \"{0}\"", jointName); + NazaraErrorFmt("skeleton has no joint \"{0}\"", jointName); return; } diff --git a/src/Nazara/Utility/Font.cpp b/src/Nazara/Utility/Font.cpp index 5d1b5c1d1..48cb80835 100644 --- a/src/Nazara/Utility/Font.cpp +++ b/src/Nazara/Utility/Font.cpp @@ -109,7 +109,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (!IsValid()) { - NazaraError("Invalid font"); + NazaraError("invalid font"); return false; } #endif @@ -146,8 +146,8 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (!IsValid()) { - NazaraError("Invalid font"); - return std::string("Invalid font"); + NazaraError("invalid font"); + return std::string("invalid font"); } #endif @@ -159,7 +159,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (!IsValid()) { - NazaraError("Invalid font"); + NazaraError("invalid font"); return 0; } #endif @@ -202,7 +202,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (!IsValid()) { - NazaraError("Invalid font"); + NazaraError("invalid font"); static SizeInfo dummy; return dummy; @@ -237,8 +237,8 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (!IsValid()) { - NazaraError("Invalid font"); - return std::string("Invalid font"); + NazaraError("invalid font"); + return std::string("invalid font"); } #endif @@ -331,7 +331,7 @@ namespace Nz { s_defaultFont = Font::OpenFromMemory(r_sansationRegular, sizeof(r_sansationRegular)); if (!s_defaultFont) - NazaraError("Failed to open default font"); + NazaraError("failed to open default font"); } return s_defaultFont; @@ -455,7 +455,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (!m_atlas) { - NazaraError("Font has no atlas"); + NazaraError("font has no atlas"); return glyph; } #endif @@ -511,7 +511,7 @@ namespace Nz if (!m_atlas->Insert(fontGlyph.image, &glyph.atlasRect, &glyph.flipped, &glyph.layerIndex)) { - NazaraError("Failed to insert glyph into atlas"); + NazaraError("failed to insert glyph into atlas"); return glyph; } diff --git a/src/Nazara/Utility/Formats/DDSLoader.cpp b/src/Nazara/Utility/Formats/DDSLoader.cpp index 83a38813a..78f3a485c 100644 --- a/src/Nazara/Utility/Formats/DDSLoader.cpp +++ b/src/Nazara/Utility/Formats/DDSLoader.cpp @@ -83,7 +83,7 @@ namespace Nz if (byteStream.Read(ptr, byteCount) != byteCount) { - NazaraError("failed to read level #{0}", NumberToString(i)); + NazaraErrorFmt("failed to read level #{0}", i); return Nz::Err(ResourceLoadingError::DecodingError); } @@ -111,7 +111,7 @@ namespace Nz { if (header.ddsCaps[1] & DDSCAPS2_CUBEMAP) { - NazaraError("Cubemap arrays are not yet supported, sorry"); + NazaraError("cubemap arrays are not yet supported, sorry"); return false; } else if (header.flags & DDSD_HEIGHT) @@ -125,7 +125,7 @@ namespace Nz { if ((header.ddsCaps[1] & DDSCAPS2_CUBEMAP_ALLFACES) != DDSCAPS2_CUBEMAP_ALLFACES) { - NazaraError("Partial cubemap are not yet supported, sorry"); + NazaraError("partial cubemap are not yet supported, sorry"); return false; } @@ -133,7 +133,7 @@ namespace Nz } else if (headerExt.resourceDimension == D3D10_RESOURCE_DIMENSION_BUFFER) { - NazaraError("Texture buffers are not yet supported, sorry"); + NazaraError("texture buffers are not yet supported, sorry"); return false; } else if (headerExt.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE1D) @@ -234,7 +234,7 @@ namespace Nz buf[3] = (header.format.fourCC >> 24) & 255; buf[4] = '\0'; - NazaraError("unhandled format \"{0}\"", buf); + NazaraErrorFmt("unhandled format \"{0}\"", buf); return false; } } diff --git a/src/Nazara/Utility/Formats/FreeTypeLoader.cpp b/src/Nazara/Utility/Formats/FreeTypeLoader.cpp index 685b17301..6282985d7 100644 --- a/src/Nazara/Utility/Formats/FreeTypeLoader.cpp +++ b/src/Nazara/Utility/Formats/FreeTypeLoader.cpp @@ -75,7 +75,7 @@ namespace Nz { if (FT_Stroker_New(s_freetypeLibrary, &s_freetypeStroker) != 0) { - NazaraWarning("Failed to load FreeType stroker, outline will not be possible"); + NazaraWarning("failed to load FreeType stroker, outline will not be possible"); s_freetypeStroker = nullptr; //< Just in case } } @@ -114,7 +114,7 @@ namespace Nz #ifdef NAZARA_DEBUG if (!dst) { - NazaraError("Glyph destination cannot be null"); + NazaraError("glyph destination cannot be null"); return false; } #endif @@ -123,7 +123,7 @@ namespace Nz if (FT_Load_Char(m_face, character, FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_NORMAL) != 0) { - NazaraError("Failed to load character"); + NazaraError("failed to load character"); return false; } @@ -132,7 +132,7 @@ namespace Nz FT_Glyph glyph; if (FT_Get_Glyph(glyphSlot, &glyph) != 0) { - NazaraError("Failed to extract glyph"); + NazaraError("failed to extract glyph"); return false; } CallOnExit destroyGlyph([&]() { FT_Done_Glyph(glyph); }); @@ -152,7 +152,7 @@ namespace Nz FT_OutlineGlyph outlineGlyph = reinterpret_cast(glyph); if (FT_Outline_Embolden(&outlineGlyph->outline, boldStrength) != 0) { - NazaraError("Failed to embolden glyph"); + NazaraError("failed to embolden glyph"); return false; } } @@ -162,7 +162,7 @@ namespace Nz FT_Stroker_Set(s_freetypeStroker, static_cast(s_freetypeScaleFactor * outlineThickness), FT_STROKER_LINECAP_ROUND, FT_STROKER_LINEJOIN_ROUND, 0); if (FT_Glyph_Stroke(&glyph, s_freetypeStroker, 1) != 0) { - NazaraError("Failed to outline glyph"); + NazaraError("failed to outline glyph"); return false; } } @@ -170,7 +170,7 @@ namespace Nz if (FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, nullptr, 1) != 0) { - NazaraError("Failed to convert glyph to bitmap"); + NazaraError("failed to convert glyph to bitmap"); return false; } @@ -320,7 +320,7 @@ namespace Nz std::unique_ptr file = std::make_unique(); if (!file->Open(filePath, OpenMode::ReadOnly)) { - NazaraError("failed to open stream from file: {0}", Error::GetLastError()); + NazaraErrorFmt("failed to open stream from file: {0}", Error::GetLastError()); return false; } m_ownedStream = std::move(file); @@ -392,7 +392,7 @@ namespace Nz std::unique_ptr face = std::make_unique(); if (!face->SetFile(filePath)) { - NazaraError("Failed to open file"); + NazaraError("failed to open file"); return Err(ResourceLoadingError::FailedToOpenFile); } diff --git a/src/Nazara/Utility/Formats/GIFLoader.cpp b/src/Nazara/Utility/Formats/GIFLoader.cpp index 612f18c41..7e42e357b 100644 --- a/src/Nazara/Utility/Formats/GIFLoader.cpp +++ b/src/Nazara/Utility/Formats/GIFLoader.cpp @@ -339,7 +339,7 @@ namespace Nz } else if (!hasGlobalColorTable) { - NazaraError("corrupt gif (no color table for image #{0}", m_frames.size() - 1); + NazaraErrorFmt("corrupt gif (no color table for image #{0}", m_frames.size() - 1); return Err(ResourceLoadingError::DecodingError); } @@ -347,7 +347,7 @@ namespace Nz m_byteStream >> minimumCodeSize; if (minimumCodeSize > 12) { - NazaraError("unexpected LZW Minimum Code Size ({0})", minimumCodeSize); + NazaraErrorFmt("unexpected LZW Minimum Code Size ({0})", minimumCodeSize); return Err(ResourceLoadingError::DecodingError); } @@ -410,7 +410,7 @@ namespace Nz break; default: - NazaraWarning("unrecognized extension label (unknown tag {0:#x})", label); + NazaraWarningFmt("unrecognized extension label (unknown tag {0:#x})", label); break; } @@ -419,7 +419,7 @@ namespace Nz } default: - NazaraError("corrupt gif (unknown tag {0:#x})", tag); + NazaraErrorFmt("corrupt gif (unknown tag {0:#x})", tag); return Err(ResourceLoadingError::DecodingError); } } @@ -450,7 +450,7 @@ namespace Nz std::unique_ptr file = std::make_unique(); if (!file->Open(filePath, OpenMode::ReadOnly)) { - NazaraError("failed to open stream from file: {0}", Error::GetLastError()); + NazaraErrorFmt("failed to open stream from file: {0}", Error::GetLastError()); return false; } m_ownedStream = std::move(file); diff --git a/src/Nazara/Utility/Formats/MD2Loader.cpp b/src/Nazara/Utility/Formats/MD2Loader.cpp index df4b06e8d..8d58a2ff9 100644 --- a/src/Nazara/Utility/Formats/MD2Loader.cpp +++ b/src/Nazara/Utility/Formats/MD2Loader.cpp @@ -64,7 +64,7 @@ namespace Nz if (stream.GetSize() < header.offset_end) { - NazaraError("Incomplete MD2 file"); + NazaraError("incomplete MD2 file"); return Err(ResourceLoadingError::DecodingError); } diff --git a/src/Nazara/Utility/Formats/MD5AnimParser.cpp b/src/Nazara/Utility/Formats/MD5AnimParser.cpp index c3fcda613..26381059e 100644 --- a/src/Nazara/Utility/Formats/MD5AnimParser.cpp +++ b/src/Nazara/Utility/Formats/MD5AnimParser.cpp @@ -221,7 +221,7 @@ namespace Nz if (m_frameIndex != frameCount) { - NazaraError("missing frame infos: [{0},{1}]", m_frameIndex, frameCount); + NazaraErrorFmt("missing frame infos: [{0},{1}]", m_frameIndex, frameCount); return false; } @@ -264,7 +264,7 @@ namespace Nz void MD5AnimParser::Error(const std::string& message) { - NazaraError("{0} at line #{1}", message, m_lineCount); + NazaraErrorFmt("{0} at line #{1}", message, m_lineCount); } bool MD5AnimParser::ParseBaseframe() diff --git a/src/Nazara/Utility/Formats/MD5MeshParser.cpp b/src/Nazara/Utility/Formats/MD5MeshParser.cpp index f5988af27..2878b8d3f 100644 --- a/src/Nazara/Utility/Formats/MD5MeshParser.cpp +++ b/src/Nazara/Utility/Formats/MD5MeshParser.cpp @@ -119,7 +119,7 @@ namespace Nz if (!ParseMesh()) { - NazaraError("Failed to parse mesh"); + NazaraError("failed to parse mesh"); return false; } @@ -211,7 +211,7 @@ namespace Nz void MD5MeshParser::Error(const std::string& message) { - NazaraError("{0} at line #1", message, m_lineCount); + NazaraErrorFmt("{0} at line #1", message, m_lineCount); } bool MD5MeshParser::ParseJoints() @@ -237,7 +237,7 @@ namespace Nz if (pos >= 64) { - NazaraError("Joint name is too long (>= 64 characters)"); + NazaraError("joint name is too long (>= 64 characters)"); return false; } @@ -420,19 +420,19 @@ namespace Nz if (m_meshes[m_meshIndex].triangles.empty()) { - NazaraError("Mesh has no triangles"); + NazaraError("mesh has no triangles"); return false; } if (m_meshes[m_meshIndex].vertices.empty()) { - NazaraError("Mesh has no vertices"); + NazaraError("mesh has no vertices"); return false; } if (m_meshes[m_meshIndex].weights.empty()) { - NazaraError("Mesh has no weights"); + NazaraError("mesh has no weights"); return false; } diff --git a/src/Nazara/Utility/Formats/OBJLoader.cpp b/src/Nazara/Utility/Formats/OBJLoader.cpp index ad572bc27..d07dc45ac 100644 --- a/src/Nazara/Utility/Formats/OBJLoader.cpp +++ b/src/Nazara/Utility/Formats/OBJLoader.cpp @@ -32,7 +32,7 @@ namespace Nz File file(filePath); if (!file.Open(OpenMode::ReadOnly | OpenMode::Text)) { - NazaraError("failed to open MTL file ({0})", file.GetPath()); + NazaraErrorFmt("failed to open MTL file ({0})", file.GetPath()); return false; } @@ -51,7 +51,7 @@ namespace Nz const MTLParser::Material* mtlMat = materialParser.GetMaterial(matName); if (!mtlMat) { - NazaraWarning("MTL has no material \"{0}\"", matName); + NazaraWarningFmt("MTL has no material \"{0}\"", matName); continue; } diff --git a/src/Nazara/Utility/Formats/OBJParser.cpp b/src/Nazara/Utility/Formats/OBJParser.cpp index fc03ecb33..3090f8234 100644 --- a/src/Nazara/Utility/Formats/OBJParser.cpp +++ b/src/Nazara/Utility/Formats/OBJParser.cpp @@ -478,7 +478,7 @@ namespace Nz if (m_meshes.empty()) { - NazaraError("No meshes"); + NazaraError("no meshes"); return false; } diff --git a/src/Nazara/Utility/Formats/OBJSaver.cpp b/src/Nazara/Utility/Formats/OBJSaver.cpp index 94c1f3b82..b487bd104 100644 --- a/src/Nazara/Utility/Formats/OBJSaver.cpp +++ b/src/Nazara/Utility/Formats/OBJSaver.cpp @@ -71,7 +71,7 @@ namespace Nz if (mesh.IsAnimable()) { - NazaraError("an animated mesh cannot be saved to {0} format", format); + NazaraErrorFmt("an animated mesh cannot be saved to {0} format", format); return false; } diff --git a/src/Nazara/Utility/Formats/PCXLoader.cpp b/src/Nazara/Utility/Formats/PCXLoader.cpp index 1cc2cbde5..3c287cdf1 100644 --- a/src/Nazara/Utility/Formats/PCXLoader.cpp +++ b/src/Nazara/Utility/Formats/PCXLoader.cpp @@ -76,7 +76,7 @@ namespace Nz std::shared_ptr image = std::make_shared(); if (!image->Create(ImageType::E2D, PixelFormat::RGB8, width, height, 1, (parameters.levelCount > 0) ? parameters.levelCount : 1)) { - NazaraError("Failed to create image"); + NazaraError("failed to create image"); return Err(ResourceLoadingError::Internal); } @@ -101,7 +101,7 @@ namespace Nz { if (!stream.Read(&rleValue, 1)) { - NazaraError("failed to read stream (byte {0})", stream.GetCursorPos()); + NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos()); return Err(ResourceLoadingError::DecodingError); } @@ -112,7 +112,7 @@ namespace Nz rleCount = rleValue - 0xc0; if (!stream.Read(&rleValue, 1)) { - NazaraError("failed to read stream (byte {0})", stream.GetCursorPos()); + NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos()); return Err(ResourceLoadingError::DecodingError); } } @@ -156,7 +156,7 @@ namespace Nz { if (!stream.Read(&rleValue, 1)) { - NazaraError("failed to read stream (byte {0})", stream.GetCursorPos()); + NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos()); return Err(ResourceLoadingError::DecodingError); } @@ -167,7 +167,7 @@ namespace Nz rleCount = rleValue - 0xc0; if (!stream.Read(&rleValue, 1)) { - NazaraError("failed to read stream (byte {0})", stream.GetCursorPos()); + NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos()); return Err(ResourceLoadingError::DecodingError); } } @@ -207,21 +207,21 @@ namespace Nz UInt8 magic; if (!stream.Read(&magic, 1)) { - NazaraError("failed to read stream (byte {0})", stream.GetCursorPos()); + NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos()); return Err(ResourceLoadingError::DecodingError); } /* first byte must be equal to 0x0c (12) */ if (magic != 0x0c) { - NazaraError("Colormap's first byte must be 0x0c ({0:#x})", magic); + NazaraErrorFmt("Colormap's first byte must be 0x0c ({0:#x})", magic); return Err(ResourceLoadingError::DecodingError); } /* read palette */ if (stream.Read(palette, 768) != 768) { - NazaraError("Failed to read palette"); + NazaraError("failed to read palette"); return Err(ResourceLoadingError::DecodingError); } @@ -240,7 +240,7 @@ namespace Nz { if (!stream.Read(&rleValue, 1)) { - NazaraError("failed to read stream (byte {0})", stream.GetCursorPos()); + NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos()); return Err(ResourceLoadingError::DecodingError); } @@ -251,7 +251,7 @@ namespace Nz rleCount = rleValue - 0xc0; if (!stream.Read(&rleValue, 1)) { - NazaraError("failed to read stream (byte {0})", stream.GetCursorPos()); + NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos()); return Err(ResourceLoadingError::DecodingError); } } @@ -284,7 +284,7 @@ namespace Nz { if (!stream.Read(&rleValue, 1)) { - NazaraError("failed to read stream (byte {0})", stream.GetCursorPos()); + NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos()); return Err(ResourceLoadingError::DecodingError); } @@ -295,7 +295,7 @@ namespace Nz rleCount = rleValue - 0xc0; if (!stream.Read(&rleValue, 1)) { - NazaraError("failed to read stream (byte {0})", stream.GetCursorPos()); + NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos()); return Err(ResourceLoadingError::DecodingError); } } @@ -311,7 +311,7 @@ namespace Nz } default: - NazaraError("unsupported {0} bitcount for pcx files", bitCount); + NazaraErrorFmt("unsupported {0} bitcount for pcx files", bitCount); return Err(ResourceLoadingError::DecodingError); } diff --git a/src/Nazara/Utility/Formats/STBLoader.cpp b/src/Nazara/Utility/Formats/STBLoader.cpp index ce5a70ee3..e5d67b000 100644 --- a/src/Nazara/Utility/Formats/STBLoader.cpp +++ b/src/Nazara/Utility/Formats/STBLoader.cpp @@ -64,7 +64,7 @@ namespace Nz UInt8* ptr = stbi_load_from_callbacks(&s_stbiCallbacks, &stream, &width, &height, &bpp, STBI_rgb_alpha); if (!ptr) { - NazaraError("failed to load image: {0}", std::string(stbi_failure_reason())); + NazaraErrorFmt("failed to load image: {0}", std::string(stbi_failure_reason())); return Err(ResourceLoadingError::DecodingError); } @@ -76,7 +76,7 @@ namespace Nz std::shared_ptr image = std::make_shared(); if (!image->Create(ImageType::E2D, PixelFormat::RGBA8, width, height, 1, (parameters.levelCount > 0) ? parameters.levelCount : 1)) { - NazaraError("Failed to create image"); + NazaraError("failed to create image"); return Err(ResourceLoadingError::Internal); } @@ -88,7 +88,7 @@ namespace Nz { if (!image->Convert(parameters.loadFormat)) { - NazaraError("Failed to convert image to required format"); + NazaraError("failed to convert image to required format"); return Err(ResourceLoadingError::Internal); } } diff --git a/src/Nazara/Utility/Formats/STBSaver.cpp b/src/Nazara/Utility/Formats/STBSaver.cpp index 9133ec337..f7fcfa72c 100644 --- a/src/Nazara/Utility/Formats/STBSaver.cpp +++ b/src/Nazara/Utility/Formats/STBSaver.cpp @@ -101,7 +101,7 @@ namespace Nz { Stream* stream = static_cast(userdata); if (stream->Write(data, size) != static_cast(size)) - throw std::runtime_error("Failed to write to stream"); + throw std::runtime_error("failed to write to stream"); } bool SaveBMP(const Image& image, const ImageParams& parameters, Stream& stream) @@ -140,7 +140,7 @@ namespace Nz long long imageQuality = parameters.custom.GetIntegerParameter("JPEGQuality").GetValueOr(100); if (imageQuality <= 0 || imageQuality > 100) { - NazaraError("NativeJPEGSaver_Quality value ({0}) does not fit in bounds ]0, 100], clamping...", imageQuality); + NazaraErrorFmt("NativeJPEGSaver_Quality value ({0}) does not fit in bounds ]0, 100], clamping...", imageQuality); imageQuality = Nz::Clamp(imageQuality, 1LL, 100LL); } @@ -162,13 +162,13 @@ namespace Nz int componentCount = ConvertToFloatFormat(tempImage); if (componentCount == 0) { - NazaraError("Failed to convert image to suitable format"); + NazaraError("failed to convert image to suitable format"); return false; } if (!stbi_write_hdr_to_func(&WriteToStream, &stream, tempImage.GetWidth(), tempImage.GetHeight(), componentCount, reinterpret_cast(tempImage.GetConstPixels()))) { - NazaraError("Failed to write HDR to stream"); + NazaraError("failed to write HDR to stream"); return false; } @@ -184,13 +184,13 @@ namespace Nz int componentCount = ConvertToIntegerFormat(tempImage); if (componentCount == 0) { - NazaraError("Failed to convert image to suitable format"); + NazaraError("failed to convert image to suitable format"); return false; } if (!stbi_write_png_to_func(&WriteToStream, &stream, tempImage.GetWidth(), tempImage.GetHeight(), componentCount, tempImage.GetConstPixels(), 0)) { - NazaraError("Failed to write PNG to stream"); + NazaraError("failed to write PNG to stream"); return false; } @@ -206,13 +206,13 @@ namespace Nz int componentCount = ConvertToIntegerFormat(tempImage); if (componentCount == 0) { - NazaraError("Failed to convert image to suitable format"); + NazaraError("failed to convert image to suitable format"); return false; } if (!stbi_write_tga_to_func(&WriteToStream, &stream, tempImage.GetWidth(), tempImage.GetHeight(), componentCount, tempImage.GetConstPixels())) { - NazaraError("Failed to write TGA to stream"); + NazaraError("failed to write TGA to stream"); return false; } @@ -241,14 +241,14 @@ namespace Nz if (!image.IsValid()) { - NazaraError("Invalid image"); + NazaraError("invalid image"); return false; } ImageType type = image.GetType(); if (type != ImageType::E1D && type != ImageType::E2D) { - NazaraError("Image type {0:#x}) is not in a supported format", UnderlyingCast(type)); + NazaraErrorFmt("Image type {0:#x}) is not in a supported format", UnderlyingCast(type)); return false; } diff --git a/src/Nazara/Utility/GuillotineImageAtlas.cpp b/src/Nazara/Utility/GuillotineImageAtlas.cpp index 7d15beee4..838a8bb69 100644 --- a/src/Nazara/Utility/GuillotineImageAtlas.cpp +++ b/src/Nazara/Utility/GuillotineImageAtlas.cpp @@ -63,7 +63,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (layerIndex >= m_layers.size()) { - NazaraError("layer index out of range ({0} >= {1})", layerIndex, m_layers.size()); + NazaraErrorFmt("layer index out of range ({0} >= {1})", layerIndex, m_layers.size()); return nullptr; } #endif @@ -139,7 +139,7 @@ namespace Nz if (!ResizeLayer(newLayer, newSize)) { // Impossible d'allouer une nouvelle couche, nous manquons probablement de mémoire (ou le glyphe est trop grand) - NazaraError("Failed to allocate new layer, we are probably out of memory"); + NazaraError("failed to allocate new layer, we are probably out of memory"); return false; } diff --git a/src/Nazara/Utility/Image.cpp b/src/Nazara/Utility/Image.cpp index 0c82e7d2c..f4c78266a 100644 --- a/src/Nazara/Utility/Image.cpp +++ b/src/Nazara/Utility/Image.cpp @@ -82,19 +82,19 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return false; } if (!PixelFormatInfo::IsValid(newFormat)) { - NazaraError("Invalid pixel format"); + NazaraError("invalid pixel format"); return false; } if (!PixelFormatInfo::IsConversionSupported(m_sharedImage->format, newFormat)) { - NazaraError("Conversion from {0} to {1} is not supported", PixelFormatInfo::GetName(m_sharedImage->format), PixelFormatInfo::GetName(newFormat)); + NazaraErrorFmt("conversion from {0} to {1} is not supported", PixelFormatInfo::GetName(m_sharedImage->format), PixelFormatInfo::GetName(newFormat)); return false; } #endif @@ -124,7 +124,7 @@ namespace Nz { if (!PixelFormatInfo::Convert(m_sharedImage->format, newFormat, src, &src[srcStride], dst)) { - NazaraError("Failed to convert image"); + NazaraError("failed to convert image"); return false; } @@ -160,7 +160,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (!srcPtr) { - NazaraError("Failed to access pixels"); + NazaraError("failed to access pixels"); return; } #endif @@ -178,25 +178,25 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (!PixelFormatInfo::IsValid(format)) { - NazaraError("Invalid pixel format"); + NazaraError("invalid pixel format"); return false; } if (width == 0) { - NazaraError("Width must be at least 1 (0)"); + NazaraError("width must be at least 1 (0)"); return false; } if (height == 0) { - NazaraError("Height must be at least 1 (0)"); + NazaraError("height must be at least 1 (0)"); return false; } if (depth == 0) { - NazaraError("Depth must be at least 1 (0)"); + NazaraError("depth must be at least 1 (0)"); return false; } @@ -232,13 +232,13 @@ namespace Nz case ImageType::Cubemap: if (depth > 1) { - NazaraError("Cubemaps must be 1 deep"); + NazaraError("cubemaps must be 1 deep"); return false; } if (width != height) { - NazaraError("Cubemaps must have square dimensions"); + NazaraError("cubemaps must have square dimensions"); return false; } break; @@ -275,7 +275,7 @@ namespace Nz } catch (const std::exception& e) { - NazaraError("Failed to allocate image's level {0} ({1})", i, e.what()); + NazaraErrorFmt("failed to allocate image's level {0} ({1})", i, e.what()); return false; } } @@ -298,13 +298,13 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return false; } if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { - NazaraError("Cannot access pixels from compressed image"); + NazaraError("cannot access pixels from compressed image"); return false; } #endif @@ -313,7 +313,7 @@ namespace Nz std::unique_ptr colorBuffer(new UInt8[bpp]); if (!PixelFormatInfo::Convert(PixelFormat::RGBA8, m_sharedImage->format, &color.r, colorBuffer.get())) { - NazaraError("failed to convert RGBA8 to {0}", std::string(PixelFormatInfo::GetName(m_sharedImage->format))); + NazaraErrorFmt("failed to convert RGBA8 to {0}", PixelFormatInfo::GetName(m_sharedImage->format)); return false; } @@ -362,25 +362,25 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return false; } if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { - NazaraError("Cannot access pixels from compressed image"); + NazaraError("cannot access pixels from compressed image"); return false; } if (!box.IsValid()) { - NazaraError("Invalid rectangle"); + NazaraError("invalid rectangle"); return false; } if (box.x+box.width > m_sharedImage->width || box.y+box.height > m_sharedImage->height || box.z+box.depth > m_sharedImage->depth) { - NazaraError("Box dimensions are out of bounds"); + NazaraError("box dimensions are out of bounds"); return false; } #endif @@ -391,7 +391,7 @@ namespace Nz std::unique_ptr colorBuffer(new UInt8[bpp]); if (!PixelFormatInfo::Convert(PixelFormat::RGBA8, m_sharedImage->format, &color.r, colorBuffer.get())) { - NazaraError("failed to convert RGBA8 to {0}", std::string(PixelFormatInfo::GetName(m_sharedImage->format))); + NazaraErrorFmt("failed to convert RGBA8 to {0}", PixelFormatInfo::GetName(m_sharedImage->format)); return false; } @@ -427,32 +427,32 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return false; } if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { - NazaraError("Cannot access pixels from compressed image"); + NazaraError("cannot access pixels from compressed image"); return false; } if (!rect.IsValid()) { - NazaraError("Invalid rectangle"); + NazaraError("invalid rectangle"); return false; } if (rect.x + rect.width > m_sharedImage->width || rect.y + rect.height > m_sharedImage->height) { - NazaraError("Rectangle dimensions are out of bounds"); + NazaraError("rectangle dimensions are out of bounds"); return false; } unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : m_sharedImage->depth; if (z >= depth) { - NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth)); + NazaraErrorFmt("z value exceeds depth ({0} >= {1})", z, depth); return false; } #endif @@ -463,7 +463,7 @@ namespace Nz std::unique_ptr colorBuffer(new UInt8[bpp]); if (!PixelFormatInfo::Convert(PixelFormat::RGBA8, m_sharedImage->format, &color.r, colorBuffer.get())) { - NazaraError("failed to convert RGBA8 to {0}", std::string(PixelFormatInfo::GetName(m_sharedImage->format))); + NazaraErrorFmt("failed to convert RGBA8 to {0}", PixelFormatInfo::GetName(m_sharedImage->format)); return false; } @@ -492,7 +492,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return false; } #endif @@ -507,7 +507,7 @@ namespace Nz UInt8* ptr = level.get(); if (!PixelFormatInfo::Flip(PixelFlipping::Horizontally, m_sharedImage->format, width, height, depth, ptr, ptr)) { - NazaraError("Failed to flip image"); + NazaraError("failed to flip image"); return false; } @@ -529,13 +529,13 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return false; } if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { - NazaraError("Cannot flip compressed image"); + NazaraError("cannot flip compressed image"); return false; } #endif @@ -550,7 +550,7 @@ namespace Nz UInt8* ptr = level.get(); if (!PixelFormatInfo::Flip(PixelFlipping::Vertically, m_sharedImage->format, width, height, depth, ptr, ptr)) { - NazaraError("Failed to flip image"); + NazaraError("failed to flip image"); return false; } @@ -572,13 +572,13 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return nullptr; } if (level >= m_sharedImage->levels.size()) { - NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size())); + NazaraErrorFmt("level out of bounds ({0} >= {1})", level, m_sharedImage->levels.size()); return nullptr; } #endif @@ -587,7 +587,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (x >= width) { - NazaraError("X value exceeds width ({0} >= {1})", NumberToString(x), NumberToString(width)); + NazaraErrorFmt("x value exceeds width ({0} >= {1})", x, width); return nullptr; } #endif @@ -596,14 +596,14 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (y >= height) { - NazaraError("Y value exceeds height ({0} >= {1})", NumberToString(y), NumberToString(height)); + NazaraErrorFmt("y value exceeds height ({0} >= {1})", y, height); return nullptr; } unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : GetImageLevelSize(m_sharedImage->depth, level); if (z >= depth) { - NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth)); + NazaraErrorFmt("z value exceeds depth ({0} >= {1})", z, depth); return nullptr; } #endif @@ -616,7 +616,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (level >= m_sharedImage->levels.size()) { - NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size())); + NazaraErrorFmt("level out of bounds ({0} >= {1})", level, m_sharedImage->levels.size()); return 0; } #endif @@ -634,7 +634,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (level >= m_sharedImage->levels.size()) { - NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size())); + NazaraErrorFmt("level out of bounds ({0} >= {1})", level, m_sharedImage->levels.size()); return 0; } #endif @@ -689,32 +689,32 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return Color(); } if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { - NazaraError("Cannot access pixels from compressed image"); + NazaraError("cannot access pixels from compressed image"); return Color(); } if (x >= m_sharedImage->width) { - NazaraError("X value exceeds width ({0} >= {1})", NumberToString(x), NumberToString(m_sharedImage->width)); + NazaraErrorFmt("x value exceeds width ({0} >= {1})", x, m_sharedImage->width); return Color(); } if (y >= m_sharedImage->height) { - NazaraError("Y value exceeds height ({0} >= {1})", NumberToString(y), NumberToString(m_sharedImage->height)); + NazaraErrorFmt("y value exceeds height ({0} >= {1})", y, m_sharedImage->height); return Color(); } unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : m_sharedImage->depth; if (z >= depth) { - NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth)); + NazaraErrorFmt("z value exceeds depth ({0} >= {1})", z, depth); return Color(); } #endif @@ -723,7 +723,7 @@ namespace Nz Color color; if (!PixelFormatInfo::Convert(m_sharedImage->format, PixelFormat::RGBA32F, pixel, &color.r)) - NazaraError("Failed to convert image's format to RGBA8"); + NazaraError("failed to convert image's format to RGBA8"); return color; } @@ -733,13 +733,13 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return nullptr; } if (level >= m_sharedImage->levels.size()) { - NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size())); + NazaraErrorFmt("level out of bounds ({0} >= {1})", level, m_sharedImage->levels.size()); return nullptr; } #endif @@ -748,7 +748,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (x >= width) { - NazaraError("X value exceeds width ({0} >= {1})", NumberToString(x), NumberToString(width)); + NazaraErrorFmt("x value exceeds width ({0} >= {1})", x, width); return nullptr; } #endif @@ -757,20 +757,20 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (y >= height) { - NazaraError("Y value exceeds height ({0} >= {1})", NumberToString(y), NumberToString(height)); + NazaraErrorFmt("y value exceeds height ({0} >= {1})", y, height); return nullptr; } unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : GetImageLevelSize(m_sharedImage->depth, level); if (z >= depth) { - NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth)); + NazaraErrorFmt("z value exceeds depth ({0} >= {1})", z, depth); return nullptr; } if (level >= m_sharedImage->levels.size()) { - NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size())); + NazaraErrorFmt("level out of bounds ({0} >= {1})", level, m_sharedImage->levels.size()); return nullptr; } #endif @@ -785,7 +785,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (level >= m_sharedImage->levels.size()) { - NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size())); + NazaraErrorFmt("level out of bounds ({0} >= {1})", level, m_sharedImage->levels.size()); return Vector3ui::Zero(); } #endif @@ -803,7 +803,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (level >= m_sharedImage->levels.size()) { - NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size())); + NazaraErrorFmt("level out of bounds ({0} >= {1})", level, m_sharedImage->levels.size()); return 0; } #endif @@ -859,7 +859,7 @@ namespace Nz std::shared_ptr image = Image::LoadFromFile(filePath, imageParams); if (!image) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return nullptr; } @@ -868,18 +868,18 @@ namespace Nz std::shared_ptr Image::LoadFromImage(const Image& image, const Vector2ui& atlasSize) { - NazaraAssert(image.IsValid(), "Invalid image"); + NazaraAssert(image.IsValid(), "invalid image"); #if NAZARA_UTILITY_SAFE if (atlasSize.x == 0) { - NazaraError("Atlas width must be over zero"); + NazaraError("atlas width must be over zero"); return nullptr; } if (atlasSize.y == 0) { - NazaraError("Atlas height must be over zero"); + NazaraError("atlas height must be over zero"); return nullptr; } #endif @@ -889,7 +889,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (type != ImageType::E1D && type != ImageType::E2D) { - NazaraError("Image type not handled ({0:#x})", UnderlyingCast(type)); + NazaraErrorFmt("image type not handled ({0:#x})", UnderlyingCast(type)); return nullptr; } #endif @@ -897,14 +897,10 @@ namespace Nz Vector2ui imageSize(image.GetWidth(), image.GetHeight()); if (imageSize.x % atlasSize.x != 0) - { - NazaraWarning("Image width is not divisible by atlas width (" + NumberToString(imageSize.x) + " mod " + NumberToString(atlasSize.x) + " != 0)"); - } + NazaraWarningFmt("Image width is not divisible by atlas width ({0} mod {1} != 0)", imageSize.x, atlasSize.x); if (imageSize.y % atlasSize.y != 0) - { - NazaraWarning("Image height is not divisible by atlas height (" + NumberToString(imageSize.y) + " mod " + NumberToString(atlasSize.y) + " != 0)"); - } + NazaraWarningFmt("Image height is not divisible by atlas height ({0} mod {1} != 0)", imageSize.y, atlasSize.y); Vector2ui faceSize = imageSize/atlasSize; @@ -919,7 +915,7 @@ namespace Nz if (!arrayImage->IsValid()) { - NazaraError("Failed to create image"); + NazaraError("failed to create image"); return nullptr; } @@ -936,7 +932,7 @@ namespace Nz std::shared_ptr image = Image::LoadFromMemory(data, size, imageParams); if (!image) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return nullptr; } @@ -948,7 +944,7 @@ namespace Nz std::shared_ptr image = Image::LoadFromStream(stream, imageParams); if (!image) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return nullptr; } @@ -960,7 +956,7 @@ namespace Nz std::shared_ptr image = Image::LoadFromFile(filePath, imageParams); if (!image) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return nullptr; } @@ -969,13 +965,13 @@ namespace Nz std::shared_ptr Image::LoadFromImage(const Image& image, const CubemapParams& params) { - NazaraAssert(image.IsValid(), "Invalid image"); + NazaraAssert(image.IsValid(), "invalid image"); #if NAZARA_UTILITY_SAFE ImageType type = image.GetType(); if (type != ImageType::E2D) { - NazaraError("Image type not handled ({0:#x})", UnderlyingCast(type)); + NazaraErrorFmt("image type not handled ({0:#x})", UnderlyingCast(type)); return nullptr; } #endif @@ -987,7 +983,7 @@ namespace Nz // Sans cette vérification, celles des rectangles pourrait réussir via un overflow if (width < faceSize || height < faceSize) { - NazaraError("Image is too small for this face size"); + NazaraError("image is too small for this face size"); return nullptr; } @@ -998,49 +994,49 @@ namespace Nz Vector2ui backPos = params.backPosition * faceSize; if (backPos.x > limitX || backPos.y > limitY) { - NazaraError("Back rectangle is out of image"); + NazaraError("back rectangle is out of image"); return nullptr; } Vector2ui downPos = params.downPosition * faceSize; if (downPos.x > limitX || downPos.y > limitY) { - NazaraError("Down rectangle is out of image"); + NazaraError("down rectangle is out of image"); return nullptr; } Vector2ui forwardPos = params.forwardPosition * faceSize; if (forwardPos.x > limitX || forwardPos.y > limitY) { - NazaraError("Forward rectangle is out of image"); + NazaraError("forward rectangle is out of image"); return nullptr; } Vector2ui leftPos = params.leftPosition * faceSize; if (leftPos.x > limitX || leftPos.y > limitY) { - NazaraError("Left rectangle is out of image"); + NazaraError("left rectangle is out of image"); return nullptr; } Vector2ui rightPos = params.rightPosition * faceSize; if (rightPos.x > limitX || rightPos.y > limitY) { - NazaraError("Right rectangle is out of image"); + NazaraError("right rectangle is out of image"); return nullptr; } Vector2ui upPos = params.upPosition * faceSize; if (upPos.x > limitX || upPos.y > limitY) { - NazaraError("Up rectangle is out of image"); + NazaraError("up rectangle is out of image"); return nullptr; } std::shared_ptr cubemap = std::make_shared(); if (!cubemap->Create(ImageType::Cubemap, image.GetFormat(), faceSize, faceSize)) { - NazaraError("Failed to create cubemap"); + NazaraError("failed to create cubemap"); return nullptr; } @@ -1059,7 +1055,7 @@ namespace Nz std::shared_ptr image = Image::LoadFromMemory(data, size, imageParams); if (!image) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return nullptr; } @@ -1071,7 +1067,7 @@ namespace Nz std::shared_ptr image = Image::LoadFromStream(stream, imageParams); if (!image) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return nullptr; } @@ -1083,7 +1079,7 @@ namespace Nz std::shared_ptr image = Image::LoadFromFile(filePath, params); if (!image) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return false; } @@ -1097,7 +1093,7 @@ namespace Nz unsigned int faceSize = GetWidth(); if (image.GetWidth() != faceSize || image.GetHeight() != faceSize) { - NazaraError("Image size must match cubemap face size"); + NazaraError("image size must match cubemap face size"); return false; } @@ -1106,7 +1102,7 @@ namespace Nz if (!convertedImage.Convert(GetFormat())) { - NazaraError("Failed to convert image to cubemap format"); + NazaraError("failed to convert image to cubemap format"); return false; } @@ -1119,7 +1115,7 @@ namespace Nz std::shared_ptr image = Image::LoadFromMemory(data, size, params); if (!image) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return false; } @@ -1131,7 +1127,7 @@ namespace Nz std::shared_ptr image = Image::LoadFromStream(stream, params); if (!image) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return false; } @@ -1190,32 +1186,32 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return false; } if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { - NazaraError("Cannot access pixels from compressed image"); + NazaraError("cannot access pixels from compressed image"); return false; } if (x >= m_sharedImage->width) { - NazaraError("X value exceeds width ({0} >= {1})", NumberToString(x), NumberToString(m_sharedImage->width)); + NazaraErrorFmt("x value exceeds width ({0} >= {1})", x, m_sharedImage->width); return false; } if (y >= m_sharedImage->height) { - NazaraError("Y value exceeds height ({0} >= {1})", NumberToString(y), NumberToString(m_sharedImage->height)); + NazaraErrorFmt("y value exceeds height ({0} >= {1})", y, m_sharedImage->height); return false; } unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : m_sharedImage->depth; if (z >= depth) { - NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth)); + NazaraErrorFmt("z value exceeds depth ({0} >= {1})", z, depth); return false; } #endif @@ -1224,7 +1220,7 @@ namespace Nz if (!PixelFormatInfo::Convert(PixelFormat::RGBA8, m_sharedImage->format, &color.r, pixel)) { - NazaraError("Failed to convert RGBA8 to image's format"); + NazaraError("failed to convert RGBA8 to image's format"); return false; } @@ -1236,19 +1232,19 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) { - NazaraError("Image must be valid"); + NazaraError("image must be valid"); return false; } if (!pixels) { - NazaraError("Invalid pixel source"); + NazaraError("invalid pixel source"); return false; } if (level >= m_sharedImage->levels.size()) { - NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size())); + NazaraErrorFmt("level out of bounds ({0} >= {1})", level, m_sharedImage->levels.size()); return false; } #endif @@ -1259,15 +1255,15 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (!box.IsValid()) { - NazaraError("Invalid box"); + NazaraError("invalid box"); return false; } unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : GetImageLevelSize(m_sharedImage->depth, level); if (box.x+box.width > width || box.y+box.height > height || box.z+box.depth > depth || - (m_sharedImage->type == ImageType::Cubemap && box.depth > 1)) // Nous n'autorisons pas de modifier plus d'une face du cubemap à la fois + (m_sharedImage->type == ImageType::Cubemap && box.depth > 1)) // We don't allow to update more than one face of the cubemap at once { - NazaraError("Box dimensions are out of bounds"); + NazaraError("box dimensions are out of bounds"); return false; } #endif @@ -1300,11 +1296,11 @@ namespace Nz { #if NAZARA_UTILITY_SAFE if (width == 0) - NazaraError("Width must be greater than zero"); + NazaraError("width must be greater than zero"); if (height == 0) - NazaraError("Height must be greater than zero"); + NazaraError("height must be greater than zero"); if (depth == 0) - NazaraError("Depth must be greater than zero"); + NazaraError("depth must be greater than zero"); #endif if (dstWidth == 0) @@ -1372,7 +1368,7 @@ namespace Nz return GetMaxLevel(width, height, depth); } - NazaraError("Image type not handled ({0:#x})", UnderlyingCast(type)); + NazaraErrorFmt("Image type not handled ({0:#x})", UnderlyingCast(type)); return 0; } diff --git a/src/Nazara/Utility/IndexMapper.cpp b/src/Nazara/Utility/IndexMapper.cpp index beecd6be2..2c81daa39 100644 --- a/src/Nazara/Utility/IndexMapper.cpp +++ b/src/Nazara/Utility/IndexMapper.cpp @@ -66,7 +66,7 @@ namespace Nz NAZARA_USE_ANONYMOUS_NAMESPACE if (!m_mapper.Map(indexBuffer, 0, m_indexCount)) - NazaraError("Failed to map buffer"); ///TODO: Unexcepted + NazaraError("failed to map buffer"); ///TODO: Unexcepted Getter rightGetter = nullptr; Setter rightSetter = nullptr; diff --git a/src/Nazara/Utility/Mesh.cpp b/src/Nazara/Utility/Mesh.cpp index 7f44f1d86..549ccc588 100644 --- a/src/Nazara/Utility/Mesh.cpp +++ b/src/Nazara/Utility/Mesh.cpp @@ -27,13 +27,13 @@ namespace Nz { if (!vertexDeclaration) { - NazaraError("The vertex declaration can't be null"); + NazaraError("the vertex declaration can't be null"); return false; } if (!vertexDeclaration->HasComponent(VertexComponent::Position)) { - NazaraError("Vertex declaration must contains a vertex position"); + NazaraError("vertex declaration must contains a vertex position"); return false; } @@ -263,7 +263,7 @@ namespace Nz m_jointCount = jointCount; if (!m_skeleton.Create(jointCount)) { - NazaraError("Failed to create skeleton"); + NazaraError("failed to create skeleton"); return false; } diff --git a/src/Nazara/Utility/Node.cpp b/src/Nazara/Utility/Node.cpp index 562df5699..6ba5bf25b 100644 --- a/src/Nazara/Utility/Node.cpp +++ b/src/Nazara/Utility/Node.cpp @@ -113,7 +113,7 @@ namespace Nz { if (parentNode == this) { - NazaraError("A node cannot be it's own parent"); + NazaraError("a node cannot be it's own parent"); return; } diff --git a/src/Nazara/Utility/PixelFormat.cpp b/src/Nazara/Utility/PixelFormat.cpp index e6c56ade1..2458576b7 100644 --- a/src/Nazara/Utility/PixelFormat.cpp +++ b/src/Nazara/Utility/PixelFormat.cpp @@ -1391,7 +1391,7 @@ namespace Nz #if NAZARA_UTILITY_SAFE if (IsCompressed(format)) { - NazaraError("No function to flip compressed format"); + NazaraError("no function to flip compressed format"); return false; } #endif @@ -1558,7 +1558,7 @@ namespace Nz for (auto&& [pixelFormat, pixelFormatInfo] : s_pixelFormatInfos.iter_kv()) { if (!pixelFormatInfo.Validate()) - NazaraWarning("Pixel format {0:#x} {1} failed validation tests", UnderlyingCast(pixelFormat), GetName(pixelFormat)); + NazaraWarningFmt("Pixel format {0:#x} {1} failed validation tests", UnderlyingCast(pixelFormat), GetName(pixelFormat)); } /***********************************A8************************************/ diff --git a/src/Nazara/Utility/SubMesh.cpp b/src/Nazara/Utility/SubMesh.cpp index 3b7b8c97a..17816f157 100644 --- a/src/Nazara/Utility/SubMesh.cpp +++ b/src/Nazara/Utility/SubMesh.cpp @@ -185,7 +185,7 @@ namespace Nz return indexCount - 2; } - NazaraError("Primitive mode not handled ({0:#x})", UnderlyingCast(m_primitiveMode)); + NazaraErrorFmt("primitive mode not handled ({0:#x})", UnderlyingCast(m_primitiveMode)); return 0; } diff --git a/src/Nazara/Utility/VertexDeclaration.cpp b/src/Nazara/Utility/VertexDeclaration.cpp index 1ddbf9820..b73eaa652 100644 --- a/src/Nazara/Utility/VertexDeclaration.cpp +++ b/src/Nazara/Utility/VertexDeclaration.cpp @@ -53,7 +53,7 @@ namespace Nz for (const Component& component : m_components) { if (component.component == entry.component && component.componentIndex == entry.componentIndex) - NazaraError("Duplicate component type found"); + NazaraError("duplicate component type found"); } } @@ -89,7 +89,7 @@ namespace Nz return true; } - NazaraError("Component type not handled ({0:#x})", UnderlyingCast(type)); + NazaraErrorFmt("Component type not handled ({0:#x})", UnderlyingCast(type)); return false; } @@ -337,7 +337,7 @@ namespace Nz } catch (const std::exception& e) { - NazaraError("failed to initialize vertex declaration: {0}", std::string(e.what())); + NazaraErrorFmt("failed to initialize vertex declaration: {0}", e.what()); return false; } diff --git a/src/Nazara/Utility/VertexMapper.cpp b/src/Nazara/Utility/VertexMapper.cpp index f1e80593a..d4db513bf 100644 --- a/src/Nazara/Utility/VertexMapper.cpp +++ b/src/Nazara/Utility/VertexMapper.cpp @@ -36,7 +36,7 @@ namespace Nz if (!buffer) { - NazaraInternalError("Animation type not handled ({0:#x})", UnderlyingCast(subMesh.GetAnimationType())); + NazaraInternalErrorFmt("animation type not handled ({0:#x})", UnderlyingCast(subMesh.GetAnimationType())); } m_mapper.Map(*buffer, 0, buffer->GetVertexCount()); diff --git a/src/Nazara/VulkanRenderer/Vulkan.cpp b/src/Nazara/VulkanRenderer/Vulkan.cpp index d1f3b712f..4205fc0b6 100644 --- a/src/Nazara/VulkanRenderer/Vulkan.cpp +++ b/src/Nazara/VulkanRenderer/Vulkan.cpp @@ -92,7 +92,7 @@ namespace Nz break; default: - NazaraWarning("Device {0} has handled device type ({1:#x})", deviceInfo.name, UnderlyingCast(physDevice.properties.deviceType)); + NazaraWarningFmt("Device {0} has handled device type ({1:#x})", deviceInfo.name, UnderlyingCast(physDevice.properties.deviceType)); [[fallthrough]]; case VK_PHYSICAL_DEVICE_TYPE_OTHER: deviceInfo.type = RenderDeviceType::Unknown; @@ -121,7 +121,7 @@ namespace Nz } // This cannot happen if physDevice is valid, as we retrieved every physical device - NazaraInternalError("Invalid physical device: {0}", static_cast(physDevice)); + NazaraInternalErrorFmt("Invalid physical device: {0}", static_cast(physDevice)); static Vk::PhysicalDevice dummy; return dummy; @@ -206,7 +206,7 @@ namespace Nz enabledLayers.push_back(additionalLayers.back().c_str()); } else - NazaraWarning("missing parameter {0}", parameterName); + NazaraWarningFmt("missing parameter {0}", parameterName); } } @@ -269,7 +269,7 @@ namespace Nz enabledExtensions.push_back(additionalExtensions.back().c_str()); } else - NazaraWarning("missing parameter {0}", parameterName); + NazaraWarningFmt("missing parameter {0}", parameterName); } } @@ -323,7 +323,7 @@ namespace Nz if (!s_instance.Create(validationLevel, instanceInfo)) { - NazaraError("failed to create instance: {0}", TranslateVulkanError(s_instance.GetLastErrorCode())); + NazaraErrorFmt("failed to create instance: {0}", TranslateVulkanError(s_instance.GetLastErrorCode())); return false; } @@ -340,7 +340,7 @@ namespace Nz Vk::PhysicalDevice deviceInfo; if (!s_instance.GetPhysicalDeviceQueueFamilyProperties(physDevice, &deviceInfo.queueFamilies)) { - NazaraWarning("failed to query physical device queue family properties for {0} ({1:#x})", deviceInfo.properties.deviceName, deviceInfo.properties.deviceID); + NazaraWarningFmt("failed to query physical device queue family properties for {0} ({1:#x})", deviceInfo.properties.deviceName, deviceInfo.properties.deviceID); continue; } @@ -357,7 +357,7 @@ namespace Nz deviceInfo.extensions.emplace(extProperty.extensionName); } else - NazaraWarning("failed to query physical device extensions for {0} ({1:#x})", deviceInfo.properties.deviceName, deviceInfo.properties.deviceID); + NazaraWarningFmt("failed to query physical device extensions for {0} ({1:#x})", deviceInfo.properties.deviceName, deviceInfo.properties.deviceID); s_physDevices.emplace_back(std::move(deviceInfo)); } @@ -430,7 +430,7 @@ namespace Nz { bool supportPresentation = false; if (!surface.GetSupportPresentation(deviceInfo.physDevice, i, &supportPresentation)) - NazaraWarning("failed to get presentation support of queue family #{0}", i); + NazaraWarningFmt("failed to get presentation support of queue family #{0}", i); if (deviceInfo.queueFamilies[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) { @@ -540,7 +540,7 @@ namespace Nz enabledLayers.push_back(additionalLayers.back().c_str()); } else - NazaraWarning("missing parameter {0}", parameterName); + NazaraWarningFmt("missing parameter {0}", parameterName); } } @@ -577,7 +577,7 @@ namespace Nz enabledExtensions.push_back(additionalExtensions.back().c_str()); } else - NazaraWarning("missing parameter {0}", parameterName); + NazaraWarningFmt("missing parameter {0}", parameterName); } } @@ -607,7 +607,7 @@ namespace Nz std::shared_ptr device = std::make_shared(s_instance, enabledFeatures, BuildRenderDeviceInfo(deviceInfo)); if (!device->Create(deviceInfo, createInfo)) { - NazaraError("failed to create Vulkan Device: {0}", TranslateVulkanError(device->GetLastErrorCode())); + NazaraErrorFmt("failed to create Vulkan Device: {0}", TranslateVulkanError(device->GetLastErrorCode())); return {}; } diff --git a/src/Nazara/VulkanRenderer/VulkanBuffer.cpp b/src/Nazara/VulkanRenderer/VulkanBuffer.cpp index 00e76c963..06ee66301 100644 --- a/src/Nazara/VulkanRenderer/VulkanBuffer.cpp +++ b/src/Nazara/VulkanRenderer/VulkanBuffer.cpp @@ -79,7 +79,7 @@ namespace Nz VkResult result = vmaMapMemory(m_device.GetMemoryAllocator(), m_allocation, &mappedPtr); if (result != VK_SUCCESS) { - NazaraError("failed to map buffer: {0}", TranslateVulkanError(result)); + NazaraErrorFmt("failed to map buffer: {0}", TranslateVulkanError(result)); return nullptr; } @@ -101,7 +101,7 @@ namespace Nz VkResult result = vmaCreateBuffer(m_device.GetMemoryAllocator(), &createInfo, &allocInfo, &m_stagingBuffer, &m_stagingAllocation, &allocationInfo); if (result != VK_SUCCESS) { - NazaraError("failed to allocate staging buffer: {0}", TranslateVulkanError(result)); + NazaraErrorFmt("failed to allocate staging buffer: {0}", TranslateVulkanError(result)); return nullptr; } diff --git a/src/Nazara/VulkanRenderer/VulkanSwapchain.cpp b/src/Nazara/VulkanRenderer/VulkanSwapchain.cpp index 4bf09b9f5..b8f09a849 100644 --- a/src/Nazara/VulkanRenderer/VulkanSwapchain.cpp +++ b/src/Nazara/VulkanRenderer/VulkanSwapchain.cpp @@ -274,13 +274,13 @@ namespace Nz { if (!SetupSwapchain(m_device.GetPhysicalDeviceInfo())) { - NazaraError("Failed to create swapchain"); + NazaraError("failed to create swapchain"); return false; } if (m_depthStencilFormat != VK_FORMAT_MAX_ENUM && !SetupDepthBuffer()) { - NazaraError("Failed to create depth buffer"); + NazaraError("failed to create depth buffer"); return false; } @@ -402,20 +402,20 @@ namespace Nz if (!m_depthBuffer.Create(m_device, imageCreateInfo)) { - NazaraError("Failed to create depth buffer"); + NazaraError("failed to create depth buffer"); return false; } VkMemoryRequirements memoryReq = m_depthBuffer.GetMemoryRequirements(); if (!m_depthBufferMemory.Create(m_device, memoryReq.size, memoryReq.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) { - NazaraError("Failed to allocate depth buffer memory"); + NazaraError("failed to allocate depth buffer memory"); return false; } if (!m_depthBuffer.BindImageMemory(m_depthBufferMemory)) { - NazaraError("Failed to bind depth buffer to buffer"); + NazaraError("failed to bind depth buffer to buffer"); return false; } @@ -451,7 +451,7 @@ namespace Nz if (!m_depthBufferView.Create(m_device, imageViewCreateInfo)) { - NazaraError("Failed to create depth buffer view"); + NazaraError("failed to create depth buffer view"); return false; } @@ -484,7 +484,7 @@ namespace Nz if (!framebuffer.Create(*m_swapchain.GetDevice(), frameBufferCreate)) { - NazaraError("failed to create framebuffer for image #{0}: {1}", i, TranslateVulkanError(framebuffer.GetLastErrorCode())); + NazaraErrorFmt("failed to create framebuffer for image #{0}: {1}", i, TranslateVulkanError(framebuffer.GetLastErrorCode())); return false; } @@ -499,7 +499,7 @@ namespace Nz std::optional colorFormat = FromVulkan(m_surfaceFormat.format); if (!colorFormat) { - NazaraError("unhandled vulkan pixel format ({0:#x})", UnderlyingCast(m_surfaceFormat.format)); + NazaraErrorFmt("unhandled vulkan pixel format ({0:#x})", UnderlyingCast(m_surfaceFormat.format)); return false; } @@ -509,7 +509,7 @@ namespace Nz depthStencilFormat = FromVulkan(m_depthStencilFormat); if (!depthStencilFormat) { - NazaraError("unhandled vulkan pixel format ({0:#x})", UnderlyingCast(m_depthStencilFormat)); + NazaraErrorFmt("unhandled vulkan pixel format ({0:#x})", UnderlyingCast(m_depthStencilFormat)); return false; } } @@ -580,7 +580,7 @@ namespace Nz if (!success) { - NazaraError("failed to create Vulkan surface: {0}", TranslateVulkanError(m_surface.GetLastErrorCode())); + NazaraErrorFmt("failed to create Vulkan surface: {0}", TranslateVulkanError(m_surface.GetLastErrorCode())); return false; } @@ -592,7 +592,7 @@ namespace Nz VkSurfaceCapabilitiesKHR surfaceCapabilities; if (!m_surface.GetCapabilities(deviceInfo.physDevice, &surfaceCapabilities)) { - NazaraError("Failed to query surface capabilities"); + NazaraError("failed to query surface capabilities"); return false; } @@ -641,7 +641,7 @@ namespace Nz Vk::Swapchain newSwapchain; if (!newSwapchain.Create(m_device, swapchainInfo)) { - NazaraError("failed to create swapchain: {0}", TranslateVulkanError(newSwapchain.GetLastErrorCode())); + NazaraErrorFmt("failed to create swapchain: {0}", TranslateVulkanError(newSwapchain.GetLastErrorCode())); return false; } diff --git a/src/Nazara/VulkanRenderer/Wrapper/Device.cpp b/src/Nazara/VulkanRenderer/Wrapper/Device.cpp index 0e8d881ea..dc7b7e23f 100644 --- a/src/Nazara/VulkanRenderer/Wrapper/Device.cpp +++ b/src/Nazara/VulkanRenderer/Wrapper/Device.cpp @@ -57,7 +57,7 @@ namespace Nz m_lastErrorCode = m_instance.vkCreateDevice(deviceInfo.physDevice, &createInfo, allocator, &m_device); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to create Vulkan device: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to create Vulkan device: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -103,7 +103,7 @@ namespace Nz } catch (const std::exception& e) { - NazaraError("Failed to query device function: {0}", e.what()); + NazaraErrorFmt("Failed to query device function: {0}", e.what()); return false; } @@ -173,7 +173,7 @@ namespace Nz Vk::CommandPool& commandPool = m_internalData->commandPools[queueType]; if (!commandPool.Create(*this, m_defaultQueues[queueType], VK_COMMAND_POOL_CREATE_TRANSIENT_BIT)) { - NazaraError("failed to create command pool: {0}", TranslateVulkanError(commandPool.GetLastErrorCode())); + NazaraErrorFmt("failed to create command pool: {0}", TranslateVulkanError(commandPool.GetLastErrorCode())); return false; } } @@ -237,7 +237,7 @@ namespace Nz m_lastErrorCode = vmaCreateAllocator(&allocatorInfo, &m_memAllocator); if (m_lastErrorCode != VK_SUCCESS) { - NazaraError("failed to initialize Vulkan Memory Allocator (VMA): {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to initialize Vulkan Memory Allocator (VMA): {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/src/Nazara/VulkanRenderer/Wrapper/Instance.cpp b/src/Nazara/VulkanRenderer/Wrapper/Instance.cpp index 08070d8e7..9fa4483fc 100644 --- a/src/Nazara/VulkanRenderer/Wrapper/Instance.cpp +++ b/src/Nazara/VulkanRenderer/Wrapper/Instance.cpp @@ -131,7 +131,7 @@ namespace Nz::Vk m_lastErrorCode = Loader::vkCreateInstance(&createInfo, allocator, &m_instance); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to create Vulkan instance: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to create Vulkan instance: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -173,7 +173,7 @@ namespace Nz::Vk } catch (const std::exception& e) { - NazaraError("Failed to query instance function: {0}", e.what()); + NazaraErrorFmt("Failed to query instance function: {0}", e.what()); return false; } @@ -192,7 +192,7 @@ namespace Nz::Vk m_lastErrorCode = vkEnumeratePhysicalDevices(m_instance, &deviceCount, nullptr); if (m_lastErrorCode != VkResult::VK_SUCCESS || deviceCount == 0) { - NazaraError("failed to query physical device count: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query physical device count: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -201,7 +201,7 @@ namespace Nz::Vk m_lastErrorCode = vkEnumeratePhysicalDevices(m_instance, &deviceCount, devices->data()); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to query physical devices: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query physical devices: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -217,7 +217,7 @@ namespace Nz::Vk m_lastErrorCode = vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionPropertyCount, nullptr); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to query extension properties count: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query extension properties count: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } @@ -229,7 +229,7 @@ namespace Nz::Vk m_lastErrorCode = vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionPropertyCount, extensionProperties->data()); if (m_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to query extension properties count: {0}", TranslateVulkanError(m_lastErrorCode)); + NazaraErrorFmt("failed to query extension properties count: {0}", TranslateVulkanError(m_lastErrorCode)); return false; } diff --git a/src/Nazara/VulkanRenderer/Wrapper/Loader.cpp b/src/Nazara/VulkanRenderer/Wrapper/Loader.cpp index 400138d2b..09bc2d289 100644 --- a/src/Nazara/VulkanRenderer/Wrapper/Loader.cpp +++ b/src/Nazara/VulkanRenderer/Wrapper/Loader.cpp @@ -21,7 +21,7 @@ namespace Nz s_lastErrorCode = vkEnumerateInstanceExtensionProperties(layerName, &propertyCount, nullptr); if (s_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to get instance extension properties count: {0}", TranslateVulkanError(s_lastErrorCode)); + NazaraErrorFmt("failed to get instance extension properties count: {0}", TranslateVulkanError(s_lastErrorCode)); return false; } @@ -30,7 +30,7 @@ namespace Nz s_lastErrorCode = vkEnumerateInstanceExtensionProperties(layerName, &propertyCount, properties->data()); if (s_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to enumerate instance extension properties: {0}", TranslateVulkanError(s_lastErrorCode)); + NazaraErrorFmt("failed to enumerate instance extension properties: {0}", TranslateVulkanError(s_lastErrorCode)); return false; } @@ -46,7 +46,7 @@ namespace Nz s_lastErrorCode = vkEnumerateInstanceLayerProperties(&propertyCount, nullptr); if (s_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to get instance layer properties count: {0}", TranslateVulkanError(s_lastErrorCode)); + NazaraErrorFmt("failed to get instance layer properties count: {0}", TranslateVulkanError(s_lastErrorCode)); return false; } @@ -55,7 +55,7 @@ namespace Nz s_lastErrorCode = vkEnumerateInstanceLayerProperties(&propertyCount, properties->data()); if (s_lastErrorCode != VkResult::VK_SUCCESS) { - NazaraError("failed to enumerate instance layer properties: {0}", TranslateVulkanError(s_lastErrorCode)); + NazaraErrorFmt("failed to enumerate instance layer properties: {0}", TranslateVulkanError(s_lastErrorCode)); return false; } @@ -97,7 +97,7 @@ namespace Nz vkGetInstanceProcAddr = reinterpret_cast(s_vulkanLib.GetSymbol("vkGetInstanceProcAddr")); if (!vkGetInstanceProcAddr) { - NazaraError("Failed to get symbol \"vkGetInstanceProcAddr\": {0}", s_vulkanLib.GetLastError()); + NazaraErrorFmt("Failed to get symbol \"vkGetInstanceProcAddr\": {0}", s_vulkanLib.GetLastError()); continue; } @@ -105,7 +105,7 @@ namespace Nz { PFN_vkVoidFunction func = vkGetInstanceProcAddr(nullptr, name); if (!func && !opt) - NazaraError("Failed to get {0} address", name); + NazaraErrorFmt("Failed to get {0} address", name); return func; }; @@ -123,7 +123,7 @@ namespace Nz } catch (const std::exception& e) { - NazaraError("Failed to query device function: {0}", e.what()); + NazaraErrorFmt("Failed to query device function: {0}", e.what()); return false; } } diff --git a/tests/GraphicsTest/main.cpp b/tests/GraphicsTest/main.cpp index 703a1646f..40f6e0ef6 100644 --- a/tests/GraphicsTest/main.cpp +++ b/tests/GraphicsTest/main.cpp @@ -43,7 +43,7 @@ int main() std::shared_ptr spaceshipMesh = Nz::Mesh::LoadFromFile(resourceDir / "Spaceship/spaceship.obj", meshParams); if (!spaceshipMesh) { - NazaraError("Failed to load model"); + NazaraError("failed to load model"); return __LINE__; } @@ -53,7 +53,7 @@ int main() std::shared_ptr diffuseImage = Nz::Image::LoadFromFile(resourceDir / "Spaceship/Texture/diffuse.png"); if (!diffuseImage || !diffuseImage->Convert(Nz::PixelFormat::RGBA8_SRGB)) { - NazaraError("Failed to load image"); + NazaraError("failed to load image"); return __LINE__; } diff --git a/tests/RenderTest/main.cpp b/tests/RenderTest/main.cpp index 93afe4624..59c605168 100644 --- a/tests/RenderTest/main.cpp +++ b/tests/RenderTest/main.cpp @@ -132,7 +132,7 @@ int main() std::shared_ptr spaceship = Nz::Mesh::LoadFromFile(resourceDir / "Spaceship/spaceship.obj", meshParams); if (!spaceship) { - NazaraError("Failed to load model"); + NazaraError("failed to load model"); return __LINE__; } diff --git a/tests/UnitTests/Engine/Core/ErrorTest.cpp b/tests/UnitTests/Engine/Core/ErrorTest.cpp index 8a8da8c76..79c95ab11 100644 --- a/tests/UnitTests/Engine/Core/ErrorTest.cpp +++ b/tests/UnitTests/Engine/Core/ErrorTest.cpp @@ -12,14 +12,14 @@ SCENARIO("Error", "[CORE][ERROR]") { THEN("These errors should be written in the log file") { - Nz::Error::Trigger(Nz::ErrorType::Internal, "ErrorType::{0}", "Internal"); - Nz::Error::Trigger(Nz::ErrorType::Internal, 2, "Error.cpp", "2nd place Internal", "ErrorType::{0}", "Internal"); + Nz::Error::Trigger(Nz::ErrorType::Internal, Nz::Format("ErrorType::{0}", "Internal")); + Nz::Error::Trigger(Nz::ErrorType::Internal, 2, "Error.cpp", "2nd place Internal", Nz::Format("ErrorType::{0}", "Internal")); REQUIRE("ErrorType::Internal" == Nz::Error::GetLastError()); - Nz::Error::Trigger(Nz::ErrorType::Normal, "ErrorType::{1}{0}", "mal", "Nor"); - Nz::Error::Trigger(Nz::ErrorType::Normal, 2, "Error.cpp", "2nd place Normal", "ErrorType::{1}{0}", "mal", "Nor"); + Nz::Error::Trigger(Nz::ErrorType::Normal, Nz::Format("ErrorType::{1}{0}", "mal", "Nor")); + Nz::Error::Trigger(Nz::ErrorType::Normal, 2, "Error.cpp", "2nd place Normal", Nz::Format("ErrorType::{1}{0}", "mal", "Nor")); REQUIRE("ErrorType::Normal" == Nz::Error::GetLastError()); Nz::Error::Trigger(Nz::ErrorType::Warning, "ErrorType::Warning"); - Nz::Error::Trigger(Nz::ErrorType::Warning, "ErrorType::Warning", 2, "Error.cpp", "2nd place Warning"); + Nz::Error::Trigger(Nz::ErrorType::Warning, Nz::Format("ErrorType::Warning", 2, "Error.cpp", "2nd place Warning")); REQUIRE("ErrorType::Normal" == Nz::Error::GetLastError()); //< Warning are not captured by GetLastError } }