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

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