Allow error message to be formatted
This commit is contained in:
committed by
Jérôme Leclercq
parent
25957c4b7f
commit
a741672a51
@@ -72,7 +72,7 @@ namespace Nz
|
||||
if (!config.allowDummyDevice)
|
||||
throw;
|
||||
|
||||
NazaraError(std::string("failed to open default OpenAL device: ") + e.what());
|
||||
NazaraError("failed to open default OpenAL device: {0}", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Nz
|
||||
std::optional<AudioFormat> formatOpt = GuessAudioFormat(wav.channels);
|
||||
if (!formatOpt)
|
||||
{
|
||||
NazaraError("unexpected channel count: " + std::to_string(wav.channels));
|
||||
NazaraError("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: " + Error::GetLastError());
|
||||
NazaraError("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: " + std::to_string(m_decoder.channels));
|
||||
NazaraError("unexpected channel count: {0}", m_decoder.channels);
|
||||
return Err(ResourceLoadingError::Unsupported);
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace Nz
|
||||
std::optional<AudioFormat> formatOpt = GuessAudioFormat(channelCount);
|
||||
if (!formatOpt)
|
||||
{
|
||||
NazaraError("unexpected channel count: " + std::to_string(channelCount));
|
||||
NazaraError("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: " + Error::GetLastError());
|
||||
NazaraError("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: " + std::to_string(m_channelCount));
|
||||
NazaraError("unexpected channel count: {0}", m_channelCount);
|
||||
return Err(ResourceLoadingError::Unrecognized);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Nz
|
||||
|
||||
if (readBytes < 0)
|
||||
{
|
||||
NazaraError("an error occurred while reading file: " + VorbisErrToString(readBytes));
|
||||
NazaraError("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: " + std::to_string(info->channels));
|
||||
NazaraError("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: " + Error::GetLastError());
|
||||
NazaraError("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: " + std::to_string(info->channels));
|
||||
NazaraError("unexpected channel count: {0}", info->channels);
|
||||
return Err(ResourceLoadingError::Unsupported);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Nz
|
||||
std::optional<AudioFormat> formatOpt = GuessAudioFormat(info.channels);
|
||||
if (!formatOpt)
|
||||
{
|
||||
NazaraError("unexpected channel count: " + std::to_string(info.channels));
|
||||
NazaraError("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: " + Error::GetLastError());
|
||||
NazaraError("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: " + std::to_string(m_decoder.info.channels));
|
||||
NazaraError("unexpected channel count: {0}", m_decoder.info.channels);
|
||||
return Err(ResourceLoadingError::Unsupported);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Nz
|
||||
|
||||
if (ALenum lastError = m_library.alGetError(); lastError != AL_NO_ERROR)
|
||||
{
|
||||
NazaraError("failed to reset OpenAL buffer: " + std::to_string(lastError));
|
||||
NazaraError("failed to reset OpenAL buffer: {0}", std::to_string(lastError));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ namespace Nz
|
||||
|
||||
for (const char* libname : libs)
|
||||
{
|
||||
ErrorFlags disableError(ErrorMode::Silent, ~ErrorMode::ThrowException);
|
||||
|
||||
if (!m_library.Load(libname))
|
||||
continue;
|
||||
|
||||
@@ -84,6 +86,8 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
ErrorFlags disableSilent({}, ~ErrorMode::Silent);
|
||||
|
||||
NazaraWarning(std::string("failed to load ") + libname + ": " + e.what());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Nz
|
||||
std::shared_ptr<SoundBuffer> buffer = SoundBuffer::LoadFromFile(filePath, params);
|
||||
if (!buffer)
|
||||
{
|
||||
NazaraError("Failed to load buffer from file (" + filePath.generic_u8string() + ')');
|
||||
NazaraError("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 (" + PointerToString(data) + ')');
|
||||
NazaraError("failed to load buffer from memory ({0})", PointerToString(data));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Nz
|
||||
return std::make_shared<BulletSphereCollider3D>(primitive.sphere.size);
|
||||
}
|
||||
|
||||
NazaraError("Primitive type not handled (0x" + NumberToString(UnderlyingCast(primitive.type), 16) + ')');
|
||||
NazaraError("Primitive type not handled ({0:#x})", UnderlyingCast(primitive.type));
|
||||
return std::shared_ptr<BulletCollider3D>();
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Nz
|
||||
return std::make_unique<WhirlpoolHasher>();
|
||||
}
|
||||
|
||||
NazaraInternalError("Hash type not handled (0x" + NumberToString(UnderlyingCast(type), 16) + ')');
|
||||
NazaraInternalError("Hash type not handled ({0:#x})", UnderlyingCast(type));
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Nz
|
||||
auto impl = std::make_unique<DynLibImpl>();
|
||||
if (!impl->Load(libraryPath, &m_lastError))
|
||||
{
|
||||
NazaraError("Failed to load library: " + m_lastError);
|
||||
NazaraError("failed to load library: {0}", m_lastError);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <NazaraUtils/CallOnExit.hpp>
|
||||
#include <NazaraUtils/EnumArray.hpp>
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -20,6 +21,22 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
namespace NAZARA_ANONYMOUS_NAMESPACE
|
||||
{
|
||||
constexpr EnumArray<ErrorType, std::string_view> s_errorTypes = {
|
||||
"Assert failed: ", // ErrorType::AssertFailed
|
||||
"Internal error: ", // ErrorType::Internal
|
||||
"Error: ", // ErrorType::Normal
|
||||
"Warning: " // ErrorType::Warning
|
||||
};
|
||||
|
||||
thread_local ErrorModeFlags s_flags;
|
||||
thread_local std::string s_lastError = "no error";
|
||||
thread_local std::string_view s_lastErrorFunction;
|
||||
thread_local std::string_view s_lastErrorFile;
|
||||
thread_local unsigned int s_lastErrorLine = 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \class Nz::Error
|
||||
@@ -33,6 +50,8 @@ namespace Nz
|
||||
|
||||
ErrorModeFlags Error::GetFlags()
|
||||
{
|
||||
NAZARA_USE_ANONYMOUS_NAMESPACE
|
||||
|
||||
return s_flags;
|
||||
}
|
||||
|
||||
@@ -45,8 +64,10 @@ namespace Nz
|
||||
* \param function Optional argument to set last error function
|
||||
*/
|
||||
|
||||
std::string Error::GetLastError(const char** file, unsigned int* line, const char** function)
|
||||
std::string Error::GetLastError(std::string_view* file, unsigned int* line, std::string_view* function)
|
||||
{
|
||||
NAZARA_USE_ANONYMOUS_NAMESPACE
|
||||
|
||||
if (file)
|
||||
*file = s_lastErrorFile;
|
||||
|
||||
@@ -118,90 +139,39 @@ namespace Nz
|
||||
|
||||
void Error::SetFlags(ErrorModeFlags flags)
|
||||
{
|
||||
NAZARA_USE_ANONYMOUS_NAMESPACE
|
||||
|
||||
s_flags = flags;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks if the error should trigger
|
||||
*
|
||||
* \param type ErrorType of the error
|
||||
* \param error Message of the error
|
||||
*
|
||||
* \remark Produces a std::abort on AssertFailed with NAZARA_CORE_EXIT_ON_ASSERT_FAILURE defined
|
||||
* \remark Produces a std::runtime_error on AssertFailed or throwing exception
|
||||
*/
|
||||
|
||||
void Error::Trigger(ErrorType type, std::string error)
|
||||
void Error::TriggerInternal(ErrorType type, std::string error, unsigned int line, std::string_view file, std::string_view function)
|
||||
{
|
||||
if (type == ErrorType::AssertFailed || (s_flags & ErrorMode::Silent) == 0 || (s_flags & ErrorMode::SilentDisabled) != 0)
|
||||
Log::WriteError(type, error);
|
||||
NAZARA_USE_ANONYMOUS_NAMESPACE
|
||||
|
||||
s_lastError = std::move(error);
|
||||
s_lastErrorFile = "";
|
||||
s_lastErrorFunction = "";
|
||||
s_lastErrorLine = 0;
|
||||
if (type == ErrorType::AssertFailed || (s_flags & ErrorMode::Silent) == 0)
|
||||
{
|
||||
if (line == 0 && file.empty())
|
||||
Log::Write("{}{}", s_errorTypes[type], error);
|
||||
else
|
||||
Log::Write("{}{} ({}:{}: {})", s_errorTypes[type], error, file, line, function);
|
||||
}
|
||||
|
||||
if (type != ErrorType::Warning)
|
||||
{
|
||||
s_lastError = std::move(error);
|
||||
s_lastErrorFile = file;
|
||||
s_lastErrorFunction = function;
|
||||
s_lastErrorLine = line;
|
||||
}
|
||||
|
||||
#if NAZARA_CORE_EXIT_ON_ASSERT_FAILURE
|
||||
if (type == ErrorType::AssertFailed)
|
||||
std::abort();
|
||||
#endif
|
||||
|
||||
if (type == ErrorType::AssertFailed || (type != ErrorType::Warning &&
|
||||
(s_flags & ErrorMode::ThrowException) != 0 && (s_flags & ErrorMode::ThrowExceptionDisabled) == 0))
|
||||
if (type == ErrorType::AssertFailed || (type != ErrorType::Warning && s_flags.Test(ErrorMode::ThrowException)))
|
||||
throw std::runtime_error(s_lastError);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks if the error should trigger
|
||||
*
|
||||
* \param type ErrorType of the error
|
||||
* \param error Message of the error
|
||||
* \param line Line of the error
|
||||
* \param file File of the error
|
||||
* \param function Function of the error
|
||||
*
|
||||
* \remark Produces a std::abort on AssertFailed with NAZARA_CORE_EXIT_ON_ASSERT_FAILURE defined
|
||||
* \remark Produces a std::runtime_error on AssertFailed or throwing exception
|
||||
*/
|
||||
|
||||
void Error::Trigger(ErrorType type, std::string error, unsigned int line, const char* file, const char* function)
|
||||
{
|
||||
file = GetCurrentFileRelativeToEngine(file);
|
||||
|
||||
if (type == ErrorType::AssertFailed || (s_flags & ErrorMode::Silent) == 0 || (s_flags & ErrorMode::SilentDisabled) != 0)
|
||||
Log::WriteError(type, error, line, file, function);
|
||||
|
||||
s_lastError = std::move(error);
|
||||
s_lastErrorFile = file;
|
||||
s_lastErrorFunction = function;
|
||||
s_lastErrorLine = line;
|
||||
|
||||
#if NAZARA_CORE_EXIT_ON_ASSERT_FAILURE
|
||||
if (type == ErrorType::AssertFailed)
|
||||
std::abort();
|
||||
#endif
|
||||
|
||||
if (type == ErrorType::AssertFailed || (type != ErrorType::Warning &&
|
||||
(s_flags & ErrorMode::ThrowException) != 0 && (s_flags & ErrorMode::ThrowExceptionDisabled) == 0))
|
||||
throw std::runtime_error(s_lastError);
|
||||
}
|
||||
|
||||
const char* Error::GetCurrentFileRelativeToEngine(const char* file)
|
||||
{
|
||||
if (const char* ptr = std::strstr(file, "NazaraEngine/"))
|
||||
return ptr;
|
||||
|
||||
if (const char* ptr = std::strstr(file, "NazaraEngine\\"))
|
||||
return ptr;
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
ErrorModeFlags Error::s_flags = ErrorMode::None;
|
||||
std::string Error::s_lastError;
|
||||
const char* Error::s_lastErrorFunction = "";
|
||||
const char* Error::s_lastErrorFile = "";
|
||||
unsigned int Error::s_lastErrorLine = 0;
|
||||
}
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace Nz
|
||||
* \param replace Replace the entirely the old flag if true, else do a "OR"
|
||||
*/
|
||||
|
||||
ErrorFlags::ErrorFlags(ErrorModeFlags flags, bool replace) :
|
||||
ErrorFlags::ErrorFlags(ErrorModeFlags orFlags, ErrorModeFlags andFlags) :
|
||||
m_previousFlags(Error::GetFlags())
|
||||
{
|
||||
SetFlags(flags, replace);
|
||||
SetFlags(orFlags, andFlags);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -51,11 +51,12 @@ namespace Nz
|
||||
* \param flags Flags for the error
|
||||
* \param replace Replace the entirely the old flag if true, else do a "OR"
|
||||
*/
|
||||
void ErrorFlags::SetFlags(ErrorModeFlags flags, bool replace)
|
||||
void ErrorFlags::SetFlags(ErrorModeFlags orFlags, ErrorModeFlags andFlags)
|
||||
{
|
||||
if (!replace)
|
||||
flags |= m_previousFlags;
|
||||
ErrorModeFlags newFlags = m_previousFlags;
|
||||
newFlags |= orFlags;
|
||||
newFlags &= andFlags;
|
||||
|
||||
Error::SetFlags(flags);
|
||||
Error::SetFlags(newFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace Nz
|
||||
if (!impl->Open(m_filePath, openMode))
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::Silent); // Silent by default
|
||||
NazaraError("failed to open \"" + m_filePath.generic_u8string() + "\": " + Error::GetLastSystemError());
|
||||
NazaraError("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; " + Error::GetLastSystemError());
|
||||
NazaraError("failed to open new file; {0}", Error::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -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 \"" + path.generic_u8string() + '"');
|
||||
NazaraError("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 \"" + path.generic_u8string() + '"');
|
||||
NazaraError("failed to open \"{0}\"", path);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -613,7 +613,7 @@ namespace Nz
|
||||
break;
|
||||
|
||||
default:
|
||||
NazaraError("Split heuristic out of enum (0x" + NumberToString(method, 16) + ')');
|
||||
NazaraError("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 (0x" + NumberToString(rectChoice, 16) + ')');
|
||||
NazaraError("Rect choice heuristic out of enum ({0:#x})", UnderlyingCast(rectChoice));
|
||||
return std::numeric_limits<int>::max();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Nz
|
||||
void FileImpl::Flush()
|
||||
{
|
||||
if (fsync(m_fileDescriptor) == -1)
|
||||
NazaraError("Unable to flush file: " + Error::GetLastSystemError());
|
||||
NazaraError("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 \"" + filePath.generic_u8string() + "\" : " + Error::GetLastSystemError());
|
||||
NazaraError("Failed to open \"{0}\": {1}", filePath, Error::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace Nz
|
||||
break;
|
||||
|
||||
default:
|
||||
NazaraInternalError("Cursor position not handled (0x" + NumberToString(UnderlyingCast(pos), 16) + ')');
|
||||
NazaraInternalError("Cursor position not handled ({0:#x})", UnderlyingCast(pos));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Nz
|
||||
}
|
||||
catch (utf8::exception& e)
|
||||
{
|
||||
NazaraError("UTF-8 error: " + std::string(e.what()));
|
||||
NazaraError("UTF-8 error: {0}", e.what());
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
||||
61
src/Nazara/Core/ToString.cpp
Normal file
61
src/Nazara/Core/ToString.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/ToString.hpp>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/std.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
namespace Detail
|
||||
{
|
||||
std::string FormatFallback(std::string_view str)
|
||||
{
|
||||
return fmt::format(str);
|
||||
}
|
||||
|
||||
std::string FormatFallback(std::string_view str, std::string_view param1)
|
||||
{
|
||||
return fmt::format(str, param1);
|
||||
}
|
||||
|
||||
std::string FormatFallback(std::string_view str, std::string_view param1, std::string_view param2)
|
||||
{
|
||||
return fmt::format(str, param1, param2);
|
||||
}
|
||||
|
||||
std::string FormatFallback(std::string_view str, std::string_view param1, std::string_view param2, std::string_view param3)
|
||||
{
|
||||
return fmt::format(str, param1, param2, param3);
|
||||
}
|
||||
|
||||
std::string FormatFallback(std::string_view str, std::string_view param1, std::string_view param2, std::string_view param3, std::string_view param4)
|
||||
{
|
||||
return fmt::format(str, param1, param2, param3, param4);
|
||||
}
|
||||
|
||||
std::string FormatFallback(std::string_view str, std::string_view param1, std::string_view param2, std::string_view param3, std::string_view param4, std::string_view param5)
|
||||
{
|
||||
return fmt::format(str, param1, param2, param3, param4, param5);
|
||||
}
|
||||
}
|
||||
|
||||
std::string ToStringFormatter<std::filesystem::path>::Format(const std::filesystem::path& path)
|
||||
{
|
||||
return path.generic_u8string();
|
||||
}
|
||||
|
||||
#define NAZARA_TO_STRING_FMT_SPEC(Type) \
|
||||
std::string ToStringFormatter<Type>::Format(Type value) \
|
||||
{ \
|
||||
return fmt::format("{}", value); \
|
||||
}
|
||||
|
||||
NAZARA_TO_STRING_FMT_SPEC(float);
|
||||
NAZARA_TO_STRING_FMT_SPEC(double);
|
||||
NAZARA_TO_STRING_FMT_SPEC(long double);
|
||||
|
||||
#undef NAZARA_TO_STRING_CPP_SPEC
|
||||
}
|
||||
@@ -43,7 +43,7 @@ namespace Nz
|
||||
void FileImpl::Flush()
|
||||
{
|
||||
if (!FlushFileBuffers(m_handle))
|
||||
NazaraError("Unable to flush file: " + Error::GetLastSystemError());
|
||||
NazaraError("Unable to flush file: {0}", Error::GetLastSystemError());
|
||||
}
|
||||
|
||||
UInt64 FileImpl::GetCursorPos() const
|
||||
@@ -153,7 +153,7 @@ namespace Nz
|
||||
break;
|
||||
|
||||
default:
|
||||
NazaraInternalError("Cursor position not handled (0x" + NumberToString(UnderlyingCast(pos), 16) + ')');
|
||||
NazaraInternalError("Cursor position not handled ({0:#x})", UnderlyingCast(pos));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -177,13 +177,13 @@ namespace Nz
|
||||
|
||||
if (!SetCursorPos(CursorPosition::AtBegin, size))
|
||||
{
|
||||
NazaraError("Failed to set file size: failed to move cursor position: " + Error::GetLastSystemError());
|
||||
NazaraError("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: " + Error::GetLastSystemError());
|
||||
NazaraError("failed to set file size: {0}", Error::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError(std::string("Failed to instantiate texture: ") + e.what());
|
||||
NazaraError("failed to instantiate texture: {0}", e.what());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Nz
|
||||
|
||||
if (!newTexture->Copy(oldTexture, Boxui(0, 0, 0, oldSize.x, oldSize.y, oldSize.z)))
|
||||
{
|
||||
NazaraError("Failed to update texture");
|
||||
NazaraError("failed to update texture");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,11 +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 " +
|
||||
std::to_string(UnderlyingCast(textureProperty.type)) +
|
||||
" but shader sampler is of type " +
|
||||
std::to_string(UnderlyingCast(textureData.imageType)));
|
||||
|
||||
NazaraError("unmatching texture type: material property is of type {0} but shader sampler is of type {1}", UnderlyingCast(textureProperty.type), UnderlyingCast(textureData.imageType));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +50,7 @@ namespace Nz
|
||||
m_optionHash = optionData->hash;
|
||||
}
|
||||
else
|
||||
NazaraError("option " + m_optionName + " is not a boolean option (got " + ToString(optionData->type) + ")");
|
||||
NazaraError("option {0} is not a boolean option (got {1})", m_optionName, nzsl::Ast::ToString(optionData->type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,14 +66,14 @@ namespace Nz
|
||||
const auto& arrayType = std::get<nzsl::Ast::ArrayType>(*varType);
|
||||
const auto& innerType = arrayType.containedType->type;
|
||||
if (!IsSamplerType(innerType))
|
||||
throw std::runtime_error("unexpected type " + ToString(innerType) + " in array " + ToString(arrayType));
|
||||
throw std::runtime_error("unexpected type " + nzsl::Ast::ToString(innerType) + " in array " + nzsl::Ast::ToString(arrayType));
|
||||
|
||||
arraySize = arrayType.length;
|
||||
bindingType = ShaderBindingType::Sampler;
|
||||
varType = &innerType;
|
||||
}
|
||||
else
|
||||
throw std::runtime_error("unexpected type " + ToString(varType));
|
||||
throw std::runtime_error("unexpected type " + nzsl::Ast::ToString(varType));
|
||||
|
||||
// TODO: Get more precise shader stage type
|
||||
m_pipelineLayoutInfo.bindings.push_back({
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Nz
|
||||
nzsl::Ast::ModulePtr newShaderModule = resolver->Resolve(name);
|
||||
if (!newShaderModule)
|
||||
{
|
||||
NazaraError("failed to retrieve updated shader module " + name);
|
||||
NazaraError("failed to retrieve updated shader module {0}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError("failed to retrieve updated shader module " + name + ": " + e.what());
|
||||
NazaraError("failed to retrieve updated shader module {0}: {1}", name, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Nz
|
||||
return std::make_shared<JoltSphereCollider3D>(primitive.sphere.size);
|
||||
}
|
||||
|
||||
NazaraError("Primitive type not handled (0x" + NumberToString(UnderlyingCast(primitive.type), 16) + ')');
|
||||
NazaraError("Primitive type not handled ({0:#x})", UnderlyingCast(primitive.type));
|
||||
return std::shared_ptr<JoltCollider3D>();
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Nz
|
||||
{
|
||||
SocketError errorCode;
|
||||
if (!SocketImpl::SetBlocking(m_handle, m_isBlockingEnabled, &errorCode))
|
||||
NazaraWarning("Failed to set socket blocking mode (0x" + NumberToString(UnderlyingCast(errorCode), 16) + ')');
|
||||
NazaraWarning("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: " + std::string(ErrorToString(m_lastError)));
|
||||
NazaraError("failed to open a dual-stack socket: {0}", std::string(ErrorToString(m_lastError)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Nz
|
||||
|
||||
if (!m_library.IsLoaded())
|
||||
{
|
||||
NazaraError("failed to load libcurl: " + m_library.GetLastError());
|
||||
NazaraError("failed to load libcurl: {0}", m_library.GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Nz
|
||||
|
||||
if (peerId >= m_peers.size())
|
||||
{
|
||||
NazaraError("Insufficient peers");
|
||||
NazaraError("insufficient peers");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Nz
|
||||
|
||||
if (peerCount > ENetConstants::ENetProtocol_MaximumPeerId)
|
||||
{
|
||||
NazaraError("Peer count exceeds maximum peer count supported by protocol (" + NumberToString(ENetConstants::ENetProtocol_MaximumPeerId) + ")");
|
||||
NazaraError("peer count exceeds maximum peer count supported by protocol ({0})", UnderlyingCast(ENetConstants::ENetProtocol_MaximumPeerId));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ namespace Nz
|
||||
{
|
||||
if (m_socket.Bind(address) != SocketState::Bound)
|
||||
{
|
||||
NazaraError("Failed to bind address " + address.ToString());
|
||||
NazaraError("failed to bind address {0}", address.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Nz
|
||||
return m_ipv6 == LoopbackIpV6.m_ipv6; // Only compare the ip value
|
||||
}
|
||||
|
||||
NazaraInternalError("Invalid protocol for IpAddress (0x" + NumberToString(UnderlyingCast(m_protocol), 16) + ')');
|
||||
NazaraInternalError("Invalid protocol for IpAddress ({0:#x})", UnderlyingCast(m_protocol));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 " + NumberToString(errno) + ": " + Error::GetLastSystemError() + ')');
|
||||
NazaraError("failed to add socket to epoll structure (errno {0}: {1})", errno, Error::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
default:
|
||||
NazaraInternalError("Unhandled ip protocol (0x" + NumberToString(UnderlyingCast(ipAddress.GetProtocol()), 16) + ')');
|
||||
NazaraInternalError("Unhandled ip protocol ({0:#x})", UnderlyingCast(ipAddress.GetProtocol()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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: 0x" + NumberToString(UnderlyingCast(waitError), 16) + "): " + ErrorToString(waitError));
|
||||
NazaraError("SocketPoller encountered an error (code: {0:#x}): {1}", UnderlyingCast(waitError), ErrorToString(waitError));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Nz
|
||||
break;
|
||||
}
|
||||
|
||||
NazaraInternalError("Unexpected socket state (0x" + NumberToString(UnderlyingCast(m_state), 16) + ')');
|
||||
NazaraInternalError("Unexpected socket state ({0:#x})", UnderlyingCast(m_state));
|
||||
return m_state;
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ namespace Nz
|
||||
break;
|
||||
}
|
||||
|
||||
NazaraInternalError("Unhandled socket state (0x" + NumberToString(UnderlyingCast(m_state), 16) + ')');
|
||||
NazaraInternalError("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 (0x" + NumberToString(UnderlyingCast(errorCode), 16) + ')');
|
||||
NazaraWarning("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 (0x" + NumberToString(UnderlyingCast(errorCode), 16) + ')');
|
||||
NazaraWarning("failed to set socket keep alive mode ({0:#x})", UnderlyingCast(errorCode));
|
||||
|
||||
m_peerAddress = IpAddress::Invalid;
|
||||
m_openMode = OpenMode_ReadWrite;
|
||||
|
||||
@@ -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: " + Error::GetLastSystemError(errorCode));
|
||||
NazaraError("failed to initialize Windows Socket 2.2: {0}", Error::GetLastSystemError(errorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 (" + NumberToString(FD_SETSIZE) + ")");
|
||||
NazaraError("Socket count exceeding hard-coded FD_SETSIZE ({0})", FD_SETSIZE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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: " + TranslateOpenGLError(checkResult));
|
||||
NazaraError("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: " + TranslateOpenGLError(checkResult));
|
||||
NazaraError("Blit read FBO is incomplete: {0}", TranslateOpenGLError(checkResult));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ namespace Nz::GL
|
||||
{
|
||||
hasAnyError = true;
|
||||
|
||||
NazaraError("OpenGL error: " + TranslateOpenGLError(lastError));
|
||||
NazaraError("OpenGL error: {0}", TranslateOpenGLError(lastError));
|
||||
}
|
||||
|
||||
m_didCollectErrors = true;
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Nz::GL
|
||||
EGLint numConfig = 0;
|
||||
if (m_loader.eglChooseConfig(m_display, configAttributes, configs, EGLint(maxConfigCount), &numConfig) != GL_TRUE)
|
||||
{
|
||||
NazaraError(std::string("failed to retrieve compatible EGL configurations: ") + EGLLoader::TranslateError(m_loader.eglGetError()));
|
||||
NazaraError("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(std::string("failed to create EGL context: ") + EGLLoader::TranslateError(m_loader.eglGetError()));
|
||||
NazaraError("failed to create EGL context: {0}", EGLLoader::TranslateError(m_loader.eglGetError()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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: " + Error::GetLastSystemError());
|
||||
NazaraError("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: " + Error::GetLastSystemError());
|
||||
NazaraError("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: " + Error::GetLastSystemError());
|
||||
NazaraError("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: " + Error::GetLastSystemError());
|
||||
NazaraError("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: " + Error::GetLastSystemError());
|
||||
NazaraError("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: " + Error::GetLastSystemError());
|
||||
NazaraError("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: " + Error::GetLastSystemError());
|
||||
NazaraError("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: " + Error::GetLastSystemError());
|
||||
NazaraError("failed to choose pixel format: {0}", Error::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_loader.SetPixelFormat(m_deviceContext, pixelFormat, &descriptor))
|
||||
{
|
||||
NazaraError("Failed to choose pixel format: " + Error::GetLastSystemError());
|
||||
NazaraError("failed to choose pixel format: {0}", Error::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,13 +126,13 @@ namespace Nz::GL
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraError(std::string("failed to create WebGL context: OpenGL is not supported"));
|
||||
NazaraError("failed to create WebGL context: OpenGL is not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_handle <= 0)
|
||||
{
|
||||
NazaraError(std::string("failed to create Web context: ") + WebLoader::TranslateError(static_cast<EMSCRIPTEN_RESULT>(m_handle)));
|
||||
NazaraError("failed to create Web context: {0}", WebLoader::TranslateError(static_cast<EMSCRIPTEN_RESULT>(m_handle)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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: " + Error::GetLastSystemError());
|
||||
NazaraError("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: " + Error::GetLastSystemError());
|
||||
NazaraError("failed to retrieve window device context: {0}", Error::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ namespace Nz
|
||||
|
||||
Cursor::Cursor(const Image& cursor, const Vector2i& hotSpot, SystemCursor placeholder)
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
Create(cursor, hotSpot, placeholder);
|
||||
}
|
||||
|
||||
Cursor::Cursor(SystemCursor systemCursor)
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
Create(systemCursor);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Nz
|
||||
|
||||
Icon::Icon(const Image& icon)
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
Create(icon);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Nz
|
||||
);
|
||||
|
||||
if (!m_surface)
|
||||
NazaraError("failed to create SDL Surface for cursor: " + std::string(SDL_GetError()));
|
||||
NazaraError("failed to create SDL Surface for cursor: {0}", std::string(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: " + std::string(SDL_GetError()));
|
||||
NazaraError("failed to create SDL cursor: {0}", std::string(SDL_GetError()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Nz
|
||||
{
|
||||
m_cursor = SDL_CreateSystemCursor(s_systemCursorIds[cursor]);
|
||||
if (!m_cursor)
|
||||
NazaraError("failed to create SDL cursor: " + std::string(SDL_GetError()));
|
||||
NazaraError("failed to create SDL cursor: {0}", std::string(SDL_GetError()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Nz
|
||||
);
|
||||
|
||||
if (!m_icon)
|
||||
NazaraError("failed to create SDL Surface for icon: " + std::string(SDL_GetError()));
|
||||
NazaraError("failed to create SDL Surface for icon: {0}", std::string(SDL_GetError()));
|
||||
}
|
||||
|
||||
IconImpl::~IconImpl()
|
||||
|
||||
@@ -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: " + Error::GetLastSystemError());
|
||||
NazaraError("failed to create window: {0}", Error::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -212,8 +212,8 @@ namespace Nz
|
||||
if (SDL_GetWindowWMInfo(m_handle, &wmInfo) != SDL_TRUE)
|
||||
{
|
||||
#ifndef NAZARA_PLATFORM_WEB
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
NazaraError(std::string("failed to retrieve window manager info: ") + SDL_GetError());
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
NazaraError("failed to retrieve window manager info: {0}", SDL_GetError());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace Nz
|
||||
#if defined(NAZARA_PLATFORM_WEB)
|
||||
handle.type = WindowBackend::Web;
|
||||
#else
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
NazaraError("unhandled window subsystem");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Nz
|
||||
File file(sourcePath);
|
||||
if (!file.Open(OpenMode::ReadOnly | OpenMode::Text))
|
||||
{
|
||||
NazaraError("Failed to open \"" + sourcePath.generic_u8string() + '"');
|
||||
NazaraError("Failed to open \"{0}\"", sourcePath);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Nz
|
||||
if (auto it = renderAPIStr.find(value); it != renderAPIStr.end())
|
||||
preferredAPI = it->second;
|
||||
else
|
||||
NazaraError("unknown render API \"" + std::string(value) + "\"");
|
||||
NazaraError("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 \"" + std::string(value) + "\"");
|
||||
NazaraError("unknown validation level \"{0}\"", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Nz
|
||||
auto it = m_impl->sequenceMap.find(sequence.name);
|
||||
if (it != m_impl->sequenceMap.end())
|
||||
{
|
||||
NazaraError("Sequence name \"" + sequence.name + "\" is already in use");
|
||||
NazaraError("sequence name \"{0}\" is already in use", sequence.name);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Nz
|
||||
std::size_t jointIndex = skeletonComponent->FindJointByName(jointName);
|
||||
if (jointIndex == Skeleton::InvalidJointIndex)
|
||||
{
|
||||
NazaraError("skeleton has no joint \"" + jointName + "\"");
|
||||
NazaraError("skeleton has no joint \"{0}\"", jointName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Nz
|
||||
|
||||
if (byteStream.Read(ptr, byteCount) != byteCount)
|
||||
{
|
||||
NazaraError("Failed to read level #" + NumberToString(i));
|
||||
NazaraError("failed to read level #{0}", NumberToString(i));
|
||||
return Nz::Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -234,14 +234,14 @@ namespace Nz
|
||||
buf[3] = (header.format.fourCC >> 24) & 255;
|
||||
buf[4] = '\0';
|
||||
|
||||
NazaraError("Unhandled format \"" + std::string(buf) + "\"");
|
||||
NazaraError("unhandled format \"{0}\"", buf);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraError("Invalid DDS file");
|
||||
NazaraError("invalid DDS file");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +320,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: " + Error::GetLastError());
|
||||
NazaraError("failed to open stream from file: {0}", Error::GetLastError());
|
||||
return false;
|
||||
}
|
||||
m_ownedStream = std::move(file);
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace Nz
|
||||
}
|
||||
else if (!hasGlobalColorTable)
|
||||
{
|
||||
NazaraError("corrupt gif (no color table for image #" + std::to_string(m_frames.size() - 1) + ")");
|
||||
NazaraError("corrupt gif (no color table for image #{0}", m_frames.size() - 1);
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ namespace Nz
|
||||
m_byteStream >> minimumCodeSize;
|
||||
if (minimumCodeSize > 12)
|
||||
{
|
||||
NazaraError("unexpected LZW Minimum Code Size (" + std::to_string(minimumCodeSize) + ")");
|
||||
NazaraError("unexpected LZW Minimum Code Size ({0})", minimumCodeSize);
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ namespace Nz
|
||||
break;
|
||||
|
||||
default:
|
||||
NazaraWarning("unrecognized extension label (unknown tag 0x" + NumberToString(label, 16) + ")");
|
||||
NazaraWarning("unrecognized extension label (unknown tag {0:#x})", label);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
default:
|
||||
NazaraError("corrupt gif (unknown tag 0x" + NumberToString(tag, 16) + ")");
|
||||
NazaraError("corrupt gif (unknown tag {0:#x})", tag);
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
}
|
||||
@@ -450,7 +450,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: " + Error::GetLastError());
|
||||
NazaraError("failed to open stream from file: {0}", Error::GetLastError());
|
||||
return false;
|
||||
}
|
||||
m_ownedStream = std::move(file);
|
||||
|
||||
@@ -208,26 +208,26 @@ namespace Nz
|
||||
std::size_t frameCount = m_frames.size();
|
||||
if (frameCount == 0)
|
||||
{
|
||||
NazaraError("Frame count is invalid or missing");
|
||||
NazaraError("frame count is invalid or missing");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::size_t jointCount = m_joints.size();
|
||||
if (jointCount == 0)
|
||||
{
|
||||
NazaraError("Joint count is invalid or missing");
|
||||
NazaraError("joint count is invalid or missing");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_frameIndex != frameCount)
|
||||
{
|
||||
NazaraError("Missing frame infos: [" + NumberToString(m_frameIndex) + ',' + NumberToString(frameCount) + ']');
|
||||
NazaraError("missing frame infos: [{0},{1}]", m_frameIndex, frameCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_frameRate == 0)
|
||||
{
|
||||
NazaraWarning("Framerate is either invalid or missing, assuming a default value of 24");
|
||||
NazaraWarning("framerate is either invalid or missing, assuming a default value of 24");
|
||||
m_frameRate = 24;
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace Nz
|
||||
|
||||
void MD5AnimParser::Error(const std::string& message)
|
||||
{
|
||||
NazaraError(message + " at line #" + NumberToString(m_lineCount));
|
||||
NazaraError("{0} at line #{1}", message, m_lineCount);
|
||||
}
|
||||
|
||||
bool MD5AnimParser::ParseBaseframe()
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace Nz
|
||||
|
||||
void MD5MeshParser::Error(const std::string& message)
|
||||
{
|
||||
NazaraError(message + " at line #" + std::to_string(m_lineCount));
|
||||
NazaraError("{0} at line #1", message, m_lineCount);
|
||||
}
|
||||
|
||||
bool MD5MeshParser::ParseJoints()
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Nz
|
||||
File file(filePath);
|
||||
if (!file.Open(OpenMode::ReadOnly | OpenMode::Text))
|
||||
{
|
||||
NazaraError("Failed to open MTL file (" + file.GetPath().generic_u8string() + ')');
|
||||
NazaraError("failed to open MTL file ({0})", file.GetPath());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Nz
|
||||
const MTLParser::Material* mtlMat = materialParser.GetMaterial(matName);
|
||||
if (!mtlMat)
|
||||
{
|
||||
NazaraWarning("MTL has no material \"" + matName + '"');
|
||||
NazaraWarning("MTL has no material \"{0}\"", matName);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ namespace Nz
|
||||
std::filesystem::path mtlLib = parser.GetMtlLib();
|
||||
if (!mtlLib.empty())
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::ThrowExceptionDisabled);
|
||||
ErrorFlags errFlags({}, ~ErrorMode::ThrowException);
|
||||
ParseMTL(*mesh, stream.GetDirectory() / mtlLib, materials, meshes, meshCount);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,13 +65,13 @@ namespace Nz
|
||||
|
||||
if (!mesh.IsValid())
|
||||
{
|
||||
NazaraError("Invalid mesh");
|
||||
NazaraError("invalid mesh");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mesh.IsAnimable())
|
||||
{
|
||||
NazaraError("An animated mesh cannot be saved to " + format + " format");
|
||||
NazaraError("an animated mesh cannot be saved to {0} format", format);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Nz
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Nz
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
}
|
||||
@@ -207,14 +207,14 @@ namespace Nz
|
||||
UInt8 magic;
|
||||
if (!stream.Read(&magic, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
/* first byte must be equal to 0x0c (12) */
|
||||
if (magic != 0x0c)
|
||||
{
|
||||
NazaraError("Colormap's first byte must be 0x0c (0x" + NumberToString(magic, 16) + ')');
|
||||
NazaraError("Colormap's first byte must be 0x0c ({0:#x})", magic);
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace Nz
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
}
|
||||
@@ -284,7 +284,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace Nz
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
default:
|
||||
NazaraError("Unsupported " + NumberToString(bitCount) + " bitcount for pcx files");
|
||||
NazaraError("unsupported {0} bitcount for pcx files", bitCount);
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Nz
|
||||
UInt8* ptr = stbi_load_from_callbacks(&s_stbiCallbacks, &stream, &width, &height, &bpp, STBI_rgb_alpha);
|
||||
if (!ptr)
|
||||
{
|
||||
NazaraError("Failed to load image: " + std::string(stbi_failure_reason()));
|
||||
NazaraError("failed to load image: {0}", std::string(stbi_failure_reason()));
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,13 +113,13 @@ namespace Nz
|
||||
int componentCount = ConvertToIntegerFormat(tempImage);
|
||||
if (componentCount == 0)
|
||||
{
|
||||
NazaraError("Failed to convert image to suitable format");
|
||||
NazaraError("failed to convert image to suitable format");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!stbi_write_bmp_to_func(&WriteToStream, &stream, tempImage.GetWidth(), tempImage.GetHeight(), componentCount, tempImage.GetConstPixels()))
|
||||
{
|
||||
NazaraError("Failed to write BMP to stream");
|
||||
NazaraError("failed to write BMP to stream");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -133,20 +133,20 @@ namespace Nz
|
||||
int componentCount = ConvertToIntegerFormat(tempImage);
|
||||
if (componentCount == 0)
|
||||
{
|
||||
NazaraError("Failed to convert image to suitable format");
|
||||
NazaraError("failed to convert image to suitable format");
|
||||
return false;
|
||||
}
|
||||
|
||||
long long imageQuality = parameters.custom.GetIntegerParameter("JPEGQuality").GetValueOr(100);
|
||||
if (imageQuality <= 0 || imageQuality > 100)
|
||||
{
|
||||
NazaraError("NativeJPEGSaver_Quality value (" + Nz::NumberToString(imageQuality) + ") does not fit in bounds ]0, 100], clamping...");
|
||||
NazaraError("NativeJPEGSaver_Quality value ({0}) does not fit in bounds ]0, 100], clamping...", imageQuality);
|
||||
imageQuality = Nz::Clamp(imageQuality, 1LL, 100LL);
|
||||
}
|
||||
|
||||
if (!stbi_write_jpg_to_func(&WriteToStream, &stream, tempImage.GetWidth(), tempImage.GetHeight(), componentCount, tempImage.GetConstPixels(), int(imageQuality)))
|
||||
{
|
||||
NazaraError("Failed to write JPEG to stream");
|
||||
NazaraError("failed to write JPEG to stream");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace Nz
|
||||
ImageType type = image.GetType();
|
||||
if (type != ImageType::E1D && type != ImageType::E2D)
|
||||
{
|
||||
NazaraError("Image type 0x" + NumberToString(UnderlyingCast(type), 16) + " is not in a supported format");
|
||||
NazaraError("Image type {0:#x}) is not in a supported format", UnderlyingCast(type));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (layerIndex >= m_layers.size())
|
||||
{
|
||||
NazaraError("Layer index out of range (" + NumberToString(layerIndex) + " >= " + NumberToString(m_layers.size()) + ')');
|
||||
NazaraError("layer index out of range ({0} >= {1})", layerIndex, m_layers.size());
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Nz
|
||||
|
||||
if (!PixelFormatInfo::IsConversionSupported(m_sharedImage->format, newFormat))
|
||||
{
|
||||
NazaraError("Conversion from " + std::string(PixelFormatInfo::GetName(m_sharedImage->format)) + " to " + std::string(PixelFormatInfo::GetName(newFormat)) + " is not supported");
|
||||
NazaraError("Conversion from {0} to {1} is not supported", PixelFormatInfo::GetName(m_sharedImage->format), PixelFormatInfo::GetName(newFormat));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -275,7 +275,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError("Failed to allocate image's level " + NumberToString(i) + " (" + std::string(e.what()) + ')');
|
||||
NazaraError("Failed to allocate image's level {0} ({1})", i, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -313,7 +313,7 @@ namespace Nz
|
||||
std::unique_ptr<UInt8[]> colorBuffer(new UInt8[bpp]);
|
||||
if (!PixelFormatInfo::Convert(PixelFormat::RGBA8, m_sharedImage->format, &color.r, colorBuffer.get()))
|
||||
{
|
||||
NazaraError("Failed to convert RGBA8 to " + std::string(PixelFormatInfo::GetName(m_sharedImage->format)));
|
||||
NazaraError("failed to convert RGBA8 to {0}", std::string(PixelFormatInfo::GetName(m_sharedImage->format)));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ namespace Nz
|
||||
std::unique_ptr<UInt8[]> colorBuffer(new UInt8[bpp]);
|
||||
if (!PixelFormatInfo::Convert(PixelFormat::RGBA8, m_sharedImage->format, &color.r, colorBuffer.get()))
|
||||
{
|
||||
NazaraError("Failed to convert RGBA8 to " + std::string(PixelFormatInfo::GetName(m_sharedImage->format)));
|
||||
NazaraError("failed to convert RGBA8 to {0}", std::string(PixelFormatInfo::GetName(m_sharedImage->format)));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ namespace Nz
|
||||
unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : m_sharedImage->depth;
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -463,7 +463,7 @@ namespace Nz
|
||||
std::unique_ptr<UInt8[]> colorBuffer(new UInt8[bpp]);
|
||||
if (!PixelFormatInfo::Convert(PixelFormat::RGBA8, m_sharedImage->format, &color.r, colorBuffer.get()))
|
||||
{
|
||||
NazaraError("Failed to convert RGBA8 to " + std::string(PixelFormatInfo::GetName(m_sharedImage->format)));
|
||||
NazaraError("failed to convert RGBA8 to {0}", std::string(PixelFormatInfo::GetName(m_sharedImage->format)));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ namespace Nz
|
||||
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size()));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -587,7 +587,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (x >= width)
|
||||
{
|
||||
NazaraError("X value exceeds width (" + NumberToString(x) + " >= " + NumberToString(width) + ')');
|
||||
NazaraError("X value exceeds width ({0} >= {1})", NumberToString(x), NumberToString(width));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -596,14 +596,14 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (y >= height)
|
||||
{
|
||||
NazaraError("Y value exceeds height (" + NumberToString(y) + " >= " + NumberToString(height) + ')');
|
||||
NazaraError("Y value exceeds height ({0} >= {1})", NumberToString(y), NumberToString(height));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : GetImageLevelSize(m_sharedImage->depth, level);
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -616,7 +616,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size()));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -634,7 +634,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size()));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -701,20 +701,20 @@ namespace Nz
|
||||
|
||||
if (x >= m_sharedImage->width)
|
||||
{
|
||||
NazaraError("X value exceeds width (" + NumberToString(x) + " >= " + NumberToString(m_sharedImage->width) + ')');
|
||||
NazaraError("X value exceeds width ({0} >= {1})", NumberToString(x), NumberToString(m_sharedImage->width));
|
||||
return Color();
|
||||
}
|
||||
|
||||
if (y >= m_sharedImage->height)
|
||||
{
|
||||
NazaraError("Y value exceeds height (" + NumberToString(y) + " >= " + NumberToString(m_sharedImage->height) + ')');
|
||||
NazaraError("Y value exceeds height ({0} >= {1})", NumberToString(y), NumberToString(m_sharedImage->height));
|
||||
return Color();
|
||||
}
|
||||
|
||||
unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : m_sharedImage->depth;
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth));
|
||||
return Color();
|
||||
}
|
||||
#endif
|
||||
@@ -739,7 +739,7 @@ namespace Nz
|
||||
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size()));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -748,7 +748,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (x >= width)
|
||||
{
|
||||
NazaraError("X value exceeds width (" + NumberToString(x) + " >= " + NumberToString(width) + ')');
|
||||
NazaraError("X value exceeds width ({0} >= {1})", NumberToString(x), NumberToString(width));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -757,20 +757,20 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (y >= height)
|
||||
{
|
||||
NazaraError("Y value exceeds height (" + NumberToString(y) + " >= " + NumberToString(height) + ')');
|
||||
NazaraError("Y value exceeds height ({0} >= {1})", NumberToString(y), NumberToString(height));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : GetImageLevelSize(m_sharedImage->depth, level);
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size()));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -785,7 +785,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size()));
|
||||
return Vector3ui::Zero();
|
||||
}
|
||||
#endif
|
||||
@@ -803,7 +803,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size()));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -889,7 +889,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (type != ImageType::E1D && type != ImageType::E2D)
|
||||
{
|
||||
NazaraError("Image type not handled (0x" + NumberToString(UnderlyingCast(type), 16) + ')');
|
||||
NazaraError("Image type not handled ({0:#x})", UnderlyingCast(type));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -975,7 +975,7 @@ namespace Nz
|
||||
ImageType type = image.GetType();
|
||||
if (type != ImageType::E2D)
|
||||
{
|
||||
NazaraError("Image type not handled (0x" + NumberToString(UnderlyingCast(type), 16) + ')');
|
||||
NazaraError("Image type not handled ({0:#x})", UnderlyingCast(type));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -1202,20 +1202,20 @@ namespace Nz
|
||||
|
||||
if (x >= m_sharedImage->width)
|
||||
{
|
||||
NazaraError("X value exceeds width (" + NumberToString(x) + " >= " + NumberToString(m_sharedImage->width) + ')');
|
||||
NazaraError("X value exceeds width ({0} >= {1})", NumberToString(x), NumberToString(m_sharedImage->width));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (y >= m_sharedImage->height)
|
||||
{
|
||||
NazaraError("Y value exceeds height (" + NumberToString(y) + " >= " + NumberToString(m_sharedImage->height) + ')');
|
||||
NazaraError("Y value exceeds height ({0} >= {1})", NumberToString(y), NumberToString(m_sharedImage->height));
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int depth = (m_sharedImage->type == ImageType::Cubemap) ? 6 : m_sharedImage->depth;
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
NazaraError("Z value exceeds depth ({0} >= {1})", NumberToString(z), NumberToString(depth));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -1248,7 +1248,7 @@ namespace Nz
|
||||
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds ({0} >= {1})", NumberToString(level), NumberToString(m_sharedImage->levels.size()));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -1372,7 +1372,7 @@ namespace Nz
|
||||
return GetMaxLevel(width, height, depth);
|
||||
}
|
||||
|
||||
NazaraError("Image type not handled (0x" + NumberToString(UnderlyingCast(type), 16) + ')');
|
||||
NazaraError("Image type not handled ({0:#x})", UnderlyingCast(type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1588,7 +1588,7 @@ namespace Nz
|
||||
for (auto&& [pixelFormat, pixelFormatInfo] : s_pixelFormatInfos.iter_kv())
|
||||
{
|
||||
if (!pixelFormatInfo.Validate())
|
||||
NazaraWarning("Pixel format 0x" + NumberToString(UnderlyingCast(pixelFormat), 16) + " (" + std::string(GetName(pixelFormat)) + ") failed validation tests");
|
||||
NazaraWarning("Pixel format {0:#x} {1} failed validation tests", UnderlyingCast(pixelFormat), GetName(pixelFormat));
|
||||
}
|
||||
|
||||
/***********************************A8************************************/
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Nz
|
||||
return indexCount - 2;
|
||||
}
|
||||
|
||||
NazaraError("Primitive mode not handled (0x" + NumberToString(UnderlyingCast(m_primitiveMode), 16) + ')');
|
||||
NazaraError("Primitive mode not handled ({0:#x})", UnderlyingCast(m_primitiveMode));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
NazaraError("Component type not handled (0x" + NumberToString(UnderlyingCast(type), 16) + ')');
|
||||
NazaraError("Component type not handled ({0:#x})", UnderlyingCast(type));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError("Failed to initialize vertex declaration: " + std::string(e.what()));
|
||||
NazaraError("failed to initialize vertex declaration: {0}", std::string(e.what()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Nz
|
||||
{
|
||||
VertexMapper::VertexMapper(SubMesh& subMesh)
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
|
||||
std::shared_ptr<VertexBuffer> buffer = nullptr;
|
||||
switch (subMesh.GetAnimationType())
|
||||
@@ -36,7 +36,7 @@ namespace Nz
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
NazaraInternalError("Animation type not handled (0x" + NumberToString(UnderlyingCast(subMesh.GetAnimationType()), 16) + ')');
|
||||
NazaraInternalError("Animation type not handled ({0:#x})", UnderlyingCast(subMesh.GetAnimationType()));
|
||||
}
|
||||
|
||||
m_mapper.Map(*buffer, 0, buffer->GetVertexCount());
|
||||
@@ -44,7 +44,7 @@ namespace Nz
|
||||
|
||||
VertexMapper::VertexMapper(VertexBuffer& vertexBuffer)
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
m_mapper.Map(vertexBuffer, 0, vertexBuffer.GetVertexCount());
|
||||
}
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace Nz
|
||||
|
||||
if (!s_instance.Create(validationLevel, instanceInfo))
|
||||
{
|
||||
NazaraError("Failed to create instance: " + TranslateVulkanError(s_instance.GetLastErrorCode()));
|
||||
NazaraError("failed to create instance: {0}", TranslateVulkanError(s_instance.GetLastErrorCode()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -606,7 +606,7 @@ namespace Nz
|
||||
std::shared_ptr<VulkanDevice> device = std::make_shared<VulkanDevice>(s_instance, enabledFeatures, BuildRenderDeviceInfo(deviceInfo));
|
||||
if (!device->Create(deviceInfo, createInfo))
|
||||
{
|
||||
NazaraError("Failed to create Vulkan Device: " + TranslateVulkanError(device->GetLastErrorCode()));
|
||||
NazaraError("failed to create Vulkan Device: {0}", TranslateVulkanError(device->GetLastErrorCode()));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Nz
|
||||
VkResult result = vmaMapMemory(m_device.GetMemoryAllocator(), m_allocation, &mappedPtr);
|
||||
if (result != VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to map buffer: " + TranslateVulkanError(result));
|
||||
NazaraError("failed to map buffer: {0}", TranslateVulkanError(result));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Nz
|
||||
VkResult result = vmaCreateBuffer(m_device.GetMemoryAllocator(), &createInfo, &allocInfo, &m_stagingBuffer, &m_stagingAllocation, &allocationInfo);
|
||||
if (result != VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to allocate staging buffer: " + TranslateVulkanError(result));
|
||||
NazaraError("failed to allocate staging buffer: {0}", TranslateVulkanError(result));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@ namespace Nz
|
||||
|
||||
if (!framebuffer.Create(*m_swapchain.GetDevice(), frameBufferCreate))
|
||||
{
|
||||
NazaraError("Failed to create framebuffer for image #" + NumberToString(i) + ": " + TranslateVulkanError(framebuffer.GetLastErrorCode()));
|
||||
NazaraError("failed to create framebuffer for image #{0}: {1}", i, TranslateVulkanError(framebuffer.GetLastErrorCode()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -495,10 +495,11 @@ namespace Nz
|
||||
|
||||
bool VulkanSwapchain::SetupRenderPass()
|
||||
{
|
||||
NazaraError("Test");
|
||||
std::optional<PixelFormat> colorFormat = FromVulkan(m_surfaceFormat.format);
|
||||
if (!colorFormat)
|
||||
{
|
||||
NazaraError("unhandled vulkan pixel format (0x" + NumberToString(m_surfaceFormat.format, 16) + ")");
|
||||
NazaraError("unhandled vulkan pixel format ({0:#x})", UnderlyingCast(m_surfaceFormat.format));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -508,7 +509,7 @@ namespace Nz
|
||||
depthStencilFormat = FromVulkan(m_depthStencilFormat);
|
||||
if (!depthStencilFormat)
|
||||
{
|
||||
NazaraError("unhandled vulkan pixel format (0x" + NumberToString(m_depthStencilFormat, 16) + ")");
|
||||
NazaraError("unhandled vulkan pixel format ({0:#x})", UnderlyingCast(m_depthStencilFormat));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -579,7 +580,7 @@ namespace Nz
|
||||
|
||||
if (!success)
|
||||
{
|
||||
NazaraError("Failed to create Vulkan surface: " + TranslateVulkanError(m_surface.GetLastErrorCode()));
|
||||
NazaraError("failed to create Vulkan surface: {0}", TranslateVulkanError(m_surface.GetLastErrorCode()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -640,7 +641,7 @@ namespace Nz
|
||||
Vk::Swapchain newSwapchain;
|
||||
if (!newSwapchain.Create(m_device, swapchainInfo))
|
||||
{
|
||||
NazaraError("failed to create swapchain: " + TranslateVulkanError(newSwapchain.GetLastErrorCode()));
|
||||
NazaraError("failed to create swapchain: {0}", TranslateVulkanError(newSwapchain.GetLastErrorCode()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Nz
|
||||
m_lastErrorCode = m_instance.vkCreateDevice(deviceInfo.physDevice, &createInfo, allocator, &m_device);
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to create Vulkan device: " + TranslateVulkanError(m_lastErrorCode));
|
||||
NazaraError("failed to create Vulkan device: {0}", TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Nz
|
||||
// Load all device-related functions
|
||||
try
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
|
||||
UInt32 deviceVersion = deviceInfo.properties.apiVersion;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError(std::string("Failed to query device function: ") + e.what());
|
||||
NazaraError("Failed to query device function: {0}", e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace Nz
|
||||
Vk::CommandPool& commandPool = m_internalData->commandPools[queueType];
|
||||
if (!commandPool.Create(*this, m_defaultQueues[queueType], VK_COMMAND_POOL_CREATE_TRANSIENT_BIT))
|
||||
{
|
||||
NazaraError("Failed to create command pool: " + TranslateVulkanError(commandPool.GetLastErrorCode()));
|
||||
NazaraError("failed to create command pool: {0}", TranslateVulkanError(commandPool.GetLastErrorCode()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -237,7 +237,7 @@ namespace Nz
|
||||
m_lastErrorCode = vmaCreateAllocator(&allocatorInfo, &m_memAllocator);
|
||||
if (m_lastErrorCode != VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to initialize Vulkan Memory Allocator (VMA): " + TranslateVulkanError(m_lastErrorCode));
|
||||
NazaraError("failed to initialize Vulkan Memory Allocator (VMA): {0}", TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Nz::Vk
|
||||
m_lastErrorCode = Loader::vkCreateInstance(&createInfo, allocator, &m_instance);
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to create Vulkan instance: " + TranslateVulkanError(m_lastErrorCode));
|
||||
NazaraError("failed to create Vulkan instance: {0}", TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Nz::Vk
|
||||
// And now load everything
|
||||
try
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
|
||||
#define NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(ext) if (IsExtensionLoaded(#ext)) { \
|
||||
NazaraDebug(#ext " extension is supported");
|
||||
@@ -186,7 +186,7 @@ namespace Nz::Vk
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError(std::string("Failed to query instance function: ") + e.what());
|
||||
NazaraError("Failed to query instance function: {0}", e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Nz::Vk
|
||||
m_lastErrorCode = vkEnumeratePhysicalDevices(m_instance, &deviceCount, nullptr);
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS || deviceCount == 0)
|
||||
{
|
||||
NazaraError("Failed to query physical device count: " + TranslateVulkanError(m_lastErrorCode));
|
||||
NazaraError("failed to query physical device count: {0}", TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace Nz::Vk
|
||||
m_lastErrorCode = vkEnumeratePhysicalDevices(m_instance, &deviceCount, devices->data());
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to query physical devices: " + TranslateVulkanError(m_lastErrorCode));
|
||||
NazaraError("failed to query physical devices: {0}", TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace Nz::Vk
|
||||
m_lastErrorCode = vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionPropertyCount, nullptr);
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to query extension properties count: " + TranslateVulkanError(m_lastErrorCode));
|
||||
NazaraError("failed to query extension properties count: {0}", TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace Nz::Vk
|
||||
m_lastErrorCode = vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionPropertyCount, extensionProperties->data());
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to query extension properties count: " + TranslateVulkanError(m_lastErrorCode));
|
||||
NazaraError("failed to query extension properties count: {0}", TranslateVulkanError(m_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Nz
|
||||
s_lastErrorCode = vkEnumerateInstanceExtensionProperties(layerName, &propertyCount, nullptr);
|
||||
if (s_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to get instance extension properties count: " + TranslateVulkanError(s_lastErrorCode));
|
||||
NazaraError("failed to get instance extension properties count: {0}", TranslateVulkanError(s_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Nz
|
||||
s_lastErrorCode = vkEnumerateInstanceExtensionProperties(layerName, &propertyCount, properties->data());
|
||||
if (s_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to enumerate instance extension properties: " + TranslateVulkanError(s_lastErrorCode));
|
||||
NazaraError("failed to enumerate instance extension properties: {0}", TranslateVulkanError(s_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Nz
|
||||
s_lastErrorCode = vkEnumerateInstanceLayerProperties(&propertyCount, nullptr);
|
||||
if (s_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to get instance layer properties count: " + TranslateVulkanError(s_lastErrorCode));
|
||||
NazaraError("failed to get instance layer properties count: {0}", TranslateVulkanError(s_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Nz
|
||||
s_lastErrorCode = vkEnumerateInstanceLayerProperties(&propertyCount, properties->data());
|
||||
if (s_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to enumerate instance layer properties: " + TranslateVulkanError(s_lastErrorCode));
|
||||
NazaraError("failed to enumerate instance layer properties: {0}", TranslateVulkanError(s_lastErrorCode));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Nz
|
||||
|
||||
if (!s_vulkanLib.IsLoaded())
|
||||
{
|
||||
NazaraError("Failed to open vulkan library: " + s_vulkanLib.GetLastError());
|
||||
NazaraError("failed to open vulkan library: {0}", s_vulkanLib.GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Nz
|
||||
vkGetInstanceProcAddr = reinterpret_cast<PFN_vkGetInstanceProcAddr>(s_vulkanLib.GetSymbol("vkGetInstanceProcAddr"));
|
||||
if (!vkGetInstanceProcAddr)
|
||||
{
|
||||
NazaraError("Failed to get symbol \"vkGetInstanceProcAddr\": " + s_vulkanLib.GetLastError());
|
||||
NazaraError("Failed to get symbol \"vkGetInstanceProcAddr\": {0}", s_vulkanLib.GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Nz
|
||||
{
|
||||
PFN_vkVoidFunction func = vkGetInstanceProcAddr(nullptr, name);
|
||||
if (!func && !opt)
|
||||
NazaraError("Failed to get " + std::string(name) + " address");
|
||||
NazaraError("Failed to get {0} address", name);
|
||||
|
||||
return func;
|
||||
};
|
||||
@@ -101,7 +101,7 @@ namespace Nz
|
||||
#define NAZARA_VULKANRENDERER_LOAD_GLOBAL(func) func = reinterpret_cast<PFN_##func>(GetProcAddr(#func))
|
||||
try
|
||||
{
|
||||
ErrorFlags flags(ErrorMode::ThrowException, true);
|
||||
ErrorFlags flags(ErrorMode::ThrowException);
|
||||
|
||||
#define NAZARA_VULKANRENDERER_GLOBAL_FUNCTION(func) func = reinterpret_cast<PFN_##func>(GetProcAddr(#func, false));
|
||||
#define NAZARA_VULKANRENDERER_GLOBAL_FUNCTION_OPT(func) func = reinterpret_cast<PFN_##func>(GetProcAddr(#func, true));
|
||||
@@ -111,7 +111,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError(std::string("Failed to query device function: ") + e.what());
|
||||
NazaraError("Failed to query device function: {0}", e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user