Minor fixes

This commit is contained in:
Jérôme Leclercq
2021-06-04 18:02:28 +02:00
parent 8fe11711a3
commit 4b3b595a99
15 changed files with 47 additions and 36 deletions

View File

@@ -145,7 +145,11 @@ namespace Nz
bool IsSupported(const std::string_view& extension)
{
return extension == "ogg";
static std::set<std::string_view> supportedExtensions = {
"oga", "ogg", "ogm", "ogv", "ogx", "opus", "spx"
};
return supportedExtensions.find(extension) != supportedExtensions.end();
}
Ternary CheckOgg(Stream& stream)

View File

@@ -29,6 +29,7 @@ namespace Nz
Core::~Core()
{
LogUninit();
HardwareInfo::Uninitialize();
Log::Uninitialize();
PluginManager::Uninitialize();

View File

@@ -361,8 +361,9 @@ namespace Nz
NazaraAssert(m_handle != SocketImpl::InvalidHandle, "Invalid handle");
NazaraAssert(buffer && size > 0, "Invalid buffer");
CallOnExit updateSent;
std::size_t totalByteSent = 0;
CallOnExit updateSent;
if (sent)
{
updateSent.Reset([sent, &totalByteSent] ()

View File

@@ -110,7 +110,7 @@ namespace Nz
{
NazaraAssert(handle != InvalidHandle, "Invalid handle");
if (GetLastError(handle, nullptr) != SocketError::Internal)
if (GetLastError(handle, nullptr) == SocketError::Internal)
NazaraWarning("Failed to clear socket error code: " + Error::GetLastSystemError(WSAGetLastError()));
}

View File

@@ -1307,19 +1307,11 @@ namespace Nz
bool PixelFormatInfo::Flip(PixelFlipping flipping, PixelFormat format, unsigned int width, unsigned int height, unsigned int depth, const void* src, void* dst)
{
#if NAZARA_UTILITY_SAFE
if (!IsValid(format))
{
NazaraError("Invalid pixel format");
return false;
}
#endif
NazaraAssert(IsValid(format), "invalid pixel format");
std::size_t flippingIndex = UnderlyingCast(flipping);
auto it = s_flipFunctions[flippingIndex].find(format);
if (it != s_flipFunctions[flippingIndex].end())
it->second(width, height, depth, reinterpret_cast<const UInt8*>(src), reinterpret_cast<UInt8*>(dst));
auto& flipFunction = s_flipFunctions[UnderlyingCast(format)][UnderlyingCast(flipping)];
if (flipFunction)
flipFunction(width, height, depth, reinterpret_cast<const UInt8*>(src), reinterpret_cast<UInt8*>(dst));
else
{
// Flipping générique
@@ -1496,9 +1488,6 @@ namespace Nz
NazaraWarning("Pixel format 0x" + NumberToString(i, 16) + " (" + GetName(static_cast<Nz::PixelFormat>(i)) + ") failed validation tests");
}
// Reset functions
std::memset(s_convertFunctions, 0, (PixelFormatCount)*(PixelFormatCount)*sizeof(PixelFormatInfo::ConvertFunction));
/***********************************A8************************************/
RegisterConverter<PixelFormat::A8, PixelFormat::BGRA8>();
RegisterConverter<PixelFormat::A8, PixelFormat::LA8>();
@@ -1725,16 +1714,18 @@ namespace Nz
void PixelFormatInfo::Uninitialize()
{
for (unsigned int i = 0; i < PixelFormatCount; ++i)
for (std::size_t i = 0; i < PixelFormatCount; ++i)
{
s_pixelFormatInfos[i].Clear();
for (std::size_t j = 0; j < PixelFormatCount; ++j)
s_convertFunctions[i][j] = nullptr;
std::memset(s_convertFunctions, 0, (PixelFormatCount)*(PixelFormatCount)*sizeof(PixelFormatInfo::ConvertFunction));
for (unsigned int i = 0; i < PixelFlippingCount; ++i)
s_flipFunctions[i].clear();
for (std::size_t j = 0; j < PixelFlippingCount; ++j)
s_flipFunctions[i][j] = nullptr;
}
}
PixelFormatDescription PixelFormatInfo::s_pixelFormatInfos[PixelFormatCount];
PixelFormatInfo::ConvertFunction PixelFormatInfo::s_convertFunctions[PixelFormatCount][PixelFormatCount];
std::map<PixelFormat, PixelFormatInfo::FlipFunction> PixelFormatInfo::s_flipFunctions[PixelFlippingCount];
std::array<std::array<PixelFormatInfo::ConvertFunction, PixelFormatCount>, PixelFormatCount> PixelFormatInfo::s_convertFunctions;
std::array<std::array<PixelFormatInfo::FlipFunction, PixelFlippingCount>, PixelFormatCount> PixelFormatInfo::s_flipFunctions;
std::array<PixelFormatDescription, PixelFormatCount> PixelFormatInfo::s_pixelFormatInfos;
}

View File

@@ -219,7 +219,7 @@ namespace Nz
}
VkDebugUtilsMessengerCreateInfoEXT callbackCreateInfo = { VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT };
callbackCreateInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;
callbackCreateInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT;
callbackCreateInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
callbackCreateInfo.pfnUserCallback = &DebugCallback;