Utility/PixelFormat: use std::string_view to store name

This commit is contained in:
SirLynix
2023-05-30 12:33:40 +02:00
parent dfe6b2ddcf
commit 68b3e31eec
6 changed files with 17 additions and 17 deletions

View File

@@ -133,7 +133,7 @@ namespace Nz
case PixelFormatContent::Undefined:
default:
throw std::runtime_error("unhandled pixel format " + PixelFormatInfo::GetName(textureFormat));
throw std::runtime_error("unhandled pixel format " + std::string(PixelFormatInfo::GetName(textureFormat)));
}
if (glTexture.RequiresTextureViewEmulation())

View File

@@ -94,7 +94,7 @@ namespace Nz
if (!PixelFormatInfo::IsConversionSupported(m_sharedImage->format, newFormat))
{
NazaraError("Conversion from " + PixelFormatInfo::GetName(m_sharedImage->format) + " to " + PixelFormatInfo::GetName(newFormat) + " is not supported");
NazaraError("Conversion from " + std::string(PixelFormatInfo::GetName(m_sharedImage->format)) + " to " + std::string(PixelFormatInfo::GetName(newFormat)) + " is not supported");
return false;
}
#endif
@@ -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 " + PixelFormatInfo::GetName(m_sharedImage->format));
NazaraError("Failed to convert RGBA8 to " + 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 " + PixelFormatInfo::GetName(m_sharedImage->format));
NazaraError("Failed to convert RGBA8 to " + std::string(PixelFormatInfo::GetName(m_sharedImage->format)));
return false;
}
@@ -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 " + PixelFormatInfo::GetName(m_sharedImage->format));
NazaraError("Failed to convert RGBA8 to " + std::string(PixelFormatInfo::GetName(m_sharedImage->format)));
return false;
}

View File

@@ -134,7 +134,7 @@ namespace Nz
{
PixelFormatContent formatContent = PixelFormatInfo::GetContent(format);
if (formatContent != PixelFormatContent::DepthStencil && formatContent != PixelFormatContent::Stencil)
NazaraWarning("Invalid format " + PixelFormatInfo::GetName(format) + " for depth-stencil attachment");
NazaraWarning("Invalid format " + std::string(PixelFormatInfo::GetName(format)) + " for depth-stencil attachment");
m_depthStencilFormat = ToVulkan(format);
if (m_depthStencilFormat == VK_FORMAT_UNDEFINED)

View File

@@ -553,7 +553,7 @@ namespace Nz
}
default:
throw std::runtime_error("Unsupported pixel format " + PixelFormatInfo::GetName(pixelFormat));
throw std::runtime_error("Unsupported pixel format " + std::string(PixelFormatInfo::GetName(pixelFormat)));
}
}
}