From 5f88bf8a792a0463f5c362ec00ea11bccefae8ce Mon Sep 17 00:00:00 2001 From: historic_bruno Date: Thu, 30 Aug 2012 19:24:24 +0000 Subject: [PATCH] Displays error when converting a grayscale texture instead of possibly crashing, refs #1640 This was SVN commit r12560. --- source/graphics/TextureConverter.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/graphics/TextureConverter.cpp b/source/graphics/TextureConverter.cpp index c7517e10e3..df030f6292 100644 --- a/source/graphics/TextureConverter.cpp +++ b/source/graphics/TextureConverter.cpp @@ -337,6 +337,14 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath // Check whether there's any alpha channel bool hasAlpha = ((tex.flags & TEX_ALPHA) != 0); + // TODO: grayscale images will fail on some systems + // see http://trac.wildfiregames.com/ticket/1640 + if (tex.flags & TEX_GREY) + { + LOGERROR(L"Failed to convert grayscale texture \"%ls\" - only RGB textures are currently supported", src.string().c_str()); + return false; + } + // Convert to uncompressed BGRA with no mipmaps if (tex_transform_to(&tex, (tex.flags | TEX_BGR | TEX_ALPHA) & ~(TEX_DXT | TEX_MIPMAPS)) < 0) {