Split error macro into two versions (format vs non-formating) to allow format checking at compile-time

This commit is contained in:
SirLynix 2023-11-02 15:18:03 +01:00
parent 8fb53f467b
commit 4b8a475bbd
133 changed files with 570 additions and 557 deletions

View File

@ -98,7 +98,7 @@ int main(int argc, char* argv[])
std::shared_ptr<Nz::Mesh> spaceship = Nz::Mesh::LoadFromFile(resourceDir / "Spaceship/spaceship.obj", meshParams);
if (!spaceship)
{
NazaraError("Failed to load model");
NazaraError("failed to load model");
return __LINE__;
}

View File

@ -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();

View File

@ -47,7 +47,7 @@ int main(int argc, char* argv[])
std::shared_ptr<Nz::Mesh> spaceshipMesh = Nz::Mesh::LoadFromFile(resourceDir / "Spaceship/spaceship.obj", meshParams);
if (!spaceshipMesh)
{
NazaraError("Failed to load model");
NazaraError("failed to load model");
return __LINE__;
}

View File

@ -251,7 +251,7 @@ int main(int argc, char* argv[])
std::shared_ptr<Nz::Mesh> spaceshipMesh = fs.Load<Nz::Mesh>("assets/Spaceship/spaceship.obj", meshParams);
if (!spaceshipMesh)
{
NazaraError("Failed to load model");
NazaraError("failed to load model");
return __LINE__;
}

View File

@ -106,7 +106,6 @@ int main(int argc, char* argv[])
//cameraNode.SetParent(playerRotNode);
auto& cameraComponent = playerCamera.emplace<Nz::CameraComponent>(&windowSwapchain);
cameraComponent.EnableFramePipelinePasses(Nz::FramePipelineExtraPass::GammaCorrection);
cameraComponent.UpdateZNear(0.2f);
cameraComponent.UpdateZFar(10000.f);
cameraComponent.UpdateRenderMask(1);

View File

@ -105,7 +105,7 @@ namespace Nz
using Param = std::decay_t<decltype(arg)>;
if constexpr (std::is_base_of_v<VirtualDirectory::DirectoryEntry, Param>)
{
NazaraError("{} is a directory", assetPath);
NazaraErrorFmt("{} is a directory", assetPath);
return false;
}
else if constexpr (std::is_same_v<Param, VirtualDirectory::FileEntry>)
@ -136,7 +136,7 @@ namespace Nz
using Param = std::decay_t<decltype(arg)>;
if constexpr (std::is_base_of_v<VirtualDirectory::DirectoryEntry, Param>)
{
NazaraError("{} is a directory", assetPath);
NazaraErrorFmt("{} is a directory", assetPath);
return false;
}
else if constexpr (std::is_same_v<Param, VirtualDirectory::FileEntry>)

View File

@ -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;
}

View File

@ -14,14 +14,18 @@
#include <string>
#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<typename... Args> static void Trigger(ErrorType type, std::string_view error, Args&&... args);
template<typename... Args> 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);

View File

@ -15,15 +15,13 @@ namespace Nz
return file;
}
template<typename... Args>
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>(args)...), 0, {}, {});
return TriggerInternal(type, std::move(error), 0, {}, {});
}
template<typename... Args>
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>(args)...), line, GetCurrentFileRelativeToEngine(file), function);
return TriggerInternal(type, std::move(error), line, GetCurrentFileRelativeToEngine(file), function);
}
}

View File

@ -11,9 +11,29 @@
#include <Nazara/Core/Config.hpp>
#include <string>
#ifdef NAZARA_BUILD
#include <fmt/compile.h>
#include <fmt/format.h>
#include <fmt/std.h>
#define NAZARA_FORMAT(s) FMT_STRING(s)
#else
#define NAZARA_FORMAT(s) s
#endif
namespace Nz
{
template<typename... Args> std::string Format(std::string_view str, Args&&... args);
#ifdef NAZARA_BUILD
template<typename... Args> using FormatString = fmt::format_string<Args...>;
#else
template<typename... Args> using FormatString = std::string_view;
#endif
template<typename... Args> std::string Format(FormatString<Args...> str, Args&&... args);
}
#include <Nazara/Core/Format.inl>

View File

@ -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 <fmt/format.h>
#include <fmt/std.h>
#endif
#include <Nazara/Core/Debug.hpp>
namespace Nz
@ -23,8 +18,8 @@ namespace Nz
NAZARA_CORE_API std::string FormatFromStore(std::string_view str);
}
template<typename ...Args>
std::string Format(std::string_view str, Args&&... args)
template<typename... Args>
std::string Format(FormatString<Args...> str, Args&&... args)
{
#ifdef NAZARA_BUILD
return fmt::format(str, std::forward<Args>(args)...);

View File

@ -35,7 +35,7 @@ namespace Nz
{
std::shared_ptr<Type> ref = Query(name);
if (!ref)
NazaraError("Object \"{}\" is not present", name);
NazaraErrorFmt("Object \"{}\" is not present", name);
return ref;
}

View File

@ -61,12 +61,12 @@ namespace Nz
template<typename Type, typename Parameters>
std::shared_ptr<Type> ResourceLoader<Type, Parameters>::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<typename Type, typename Parameters>
std::shared_ptr<Type> ResourceLoader<Type, Parameters>::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;
}

View File

@ -50,7 +50,7 @@ namespace Nz
std::shared_ptr<Type> 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<Type>();
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -305,7 +305,7 @@ namespace Nz
return Vector3<T>(x + width, y + height, z + depth);
}
NazaraError("Corner not handled ({0:#x})", UnderlyingCast(corner));
NazaraErrorFmt("Corner not handled ({0:#x})", UnderlyingCast(corner));
return Vector3<T>();
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -246,7 +246,7 @@ namespace Nz
return Vector2<T>(x + width, y);
}
NazaraError("Corner not handled ({0:#x})", UnderlyingCast(corner));
NazaraErrorFmt("corner not handled ({0:#x})", UnderlyingCast(corner));
return Vector2<T>();
}

View File

@ -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 {};
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<typename T>
@ -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;
}

View File

@ -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)

View File

@ -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
}

View File

@ -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();
}

View File

@ -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<const UInt8*>(start), reinterpret_cast<const UInt8*>(end), reinterpret_cast<UInt8*>(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;
}

View File

@ -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 {};
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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<std::shared_ptr<Nz::Animation>, 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<std::shared_ptr<Nz::Animation>, 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<std::shared_ptr<Nz::Mesh>, 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);
}

View File

@ -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<Nz::File> file = std::make_unique<Nz::File>();
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);

View File

@ -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());
}
}

View File

@ -65,7 +65,7 @@ namespace Nz
std::optional<AudioFormat> 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> file = std::make_unique<File>();
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<AudioFormat> 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);
}

View File

@ -229,7 +229,7 @@ namespace Nz
std::optional<AudioFormat> 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> file = std::make_unique<File>();
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<AudioFormat> formatOpt = GuessAudioFormat(m_channelCount);
if (!formatOpt)
{
NazaraError("unexpected channel count: {0}", m_channelCount);
NazaraErrorFmt("unexpected channel count: {0}", m_channelCount);
return Err(ResourceLoadingError::Unrecognized);
}

View File

@ -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<AudioFormat> 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> file = std::make_unique<File>();
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<AudioFormat> formatOpt = GuessAudioFormat(info->channels);
if (!formatOpt)
{
NazaraError("unexpected channel count: {0}", info->channels);
NazaraErrorFmt("unexpected channel count: {0}", info->channels);
return Err(ResourceLoadingError::Unsupported);
}

View File

@ -96,7 +96,7 @@ namespace Nz
std::optional<AudioFormat> 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> file = std::make_unique<File>();
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<AudioFormat> 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);
}

View File

@ -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;
}

View File

@ -147,7 +147,7 @@ namespace Nz
std::shared_ptr<SoundBuffer> 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<SoundBuffer> 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<SoundBuffer> buffer = SoundBuffer::LoadFromStream(stream, params);
if (!buffer)
{
NazaraError("Failed to load buffer from stream");
NazaraError("failed to load buffer from stream");
return false;
}

View File

@ -108,7 +108,7 @@ namespace Nz
return std::make_shared<BulletSphereCollider3D>(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<BulletCollider3D>();
}

View File

@ -76,7 +76,7 @@ namespace Nz
return std::make_unique<WhirlpoolHasher>();
}
NazaraInternalError("Hash type not handled ({0:#x})", UnderlyingCast(type));
NazaraInternalErrorFmt("Hash type not handled ({0:#x})", UnderlyingCast(type));
return nullptr;
}
}

View File

@ -119,6 +119,6 @@ namespace Nz
void ByteStream::OnEmptyStream()
{
NazaraError("No stream");
NazaraError("no stream");
}
}

View File

@ -76,7 +76,7 @@ namespace Nz
auto impl = std::make_unique<DynLibImpl>();
if (!impl->Load(libraryPath, &m_lastError))
{
NazaraError("failed to load library: {0}", m_lastError);
NazaraErrorFmt("failed to load library: {0}", m_lastError);
return false;
}

View File

@ -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<FileImpl> impl = std::make_unique<FileImpl>(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<std::size_t>(static_cast<std::size_t>(remainingSize), NAZARA_CORE_FILE_BUFFERSIZE);
if (file.Read(&buffer[0], size) != size)
{
NazaraError("Unable to read file");
NazaraError("unable to read file");
return false;
}

View File

@ -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;
}
}

View File

@ -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<int>::max();
}
}

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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));
}
}

View File

@ -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<ShaderModule> stage = Graphics::Instance()->GetRenderDevice()->InstantiateShaderModule(m_shaderStages, *m_shaderModule, std::move(states));

View File

@ -101,7 +101,7 @@ namespace Nz
return std::make_shared<JoltSphereCollider3D>(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<JoltCollider3D>();
}
@ -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)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -46,7 +46,7 @@ namespace Nz
std::size_t size = m_buffer->GetSize();
if (!EncodeHeader(m_buffer->GetBuffer(), static_cast<UInt32>(size), m_netCode))
{
NazaraError("Failed to encode packet header");
NazaraError("failed to encode packet header");
return nullptr;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -275,7 +275,7 @@ namespace Nz
if (!ptr)
{
m_lastError = SocketError::Packet;
NazaraError("Failed to prepare packet");
NazaraError("failed to prepare packet");
return false;
}

View File

@ -277,7 +277,7 @@ namespace Nz
}
}
NazaraError("Invalid ip address");
NazaraError("invalid ip address");
return 0;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -50,7 +50,7 @@ namespace Nz
std::unique_ptr<GL::Loader> loader = SelectLoader(config);
if (!loader)
{
NazaraError("Failed to initialize OpenGL loader");
NazaraError("failed to initialize OpenGL loader");
return false;
}

View File

@ -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<unsigned int>(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<unsigned int>(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<unsigned int>(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;

View File

@ -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;
}

View File

@ -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<HWND>(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;
}

View File

@ -132,7 +132,7 @@ namespace Nz::GL
if (m_handle <= 0)
{
NazaraError("failed to create Web context: {0}", WebLoader::TranslateError(static_cast<EMSCRIPTEN_RESULT>(m_handle)));
NazaraErrorFmt("failed to create Web context: {0}", WebLoader::TranslateError(static_cast<EMSCRIPTEN_RESULT>(m_handle)));
return false;
}

View File

@ -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;
}

View File

@ -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());
}
}

View File

@ -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()

View File

@ -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()

View File

@ -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;

View File

@ -60,7 +60,7 @@ namespace Nz
m_impl = std::make_unique<WindowImpl>(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<WindowImpl>(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

View File

@ -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<Nz::UInt8> source(length);
if (file.Read(&source[0], length) != length)
{
NazaraError("Failed to read program file");
NazaraError("failed to read program file");
return {};
}

View File

@ -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);
}
}
}

Some files were not shown because too many files have changed in this diff Show More