//----------------------------------------------------------------------- bool TextureManager::isEquivalentFormatSupported(TextureType ttype, PixelFormat format, int usage) { PixelFormat supportedFormat = getNativeFormat(ttype, format, usage); // Assume that same or greater number of bits means quality not degraded return PixelUtil::getNumElemBits(supportedFormat) >= PixelUtil::getNumElemBits(format); }
//--------------------------------------------------------------------- bool D3D11TextureManager::isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage, bool preciseFormatOnly) { if (!preciseFormatOnly) format = getNativeFormat(ttype, format, usage); D3D11RenderSystem* rs = static_cast<D3D11RenderSystem*>( Root::getSingleton().getRenderSystem()); return rs->_checkTextureFilteringSupported(ttype, format, usage); }
bool GLES2TextureManager::isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage, bool preciseFormatOnly) { if (format == PF_UNKNOWN) { return false; } // Check native format PixelFormat nativeFormat = getNativeFormat(ttype, format, usage); if (preciseFormatOnly && format != nativeFormat) { return false; } // Assume non-floating point is supported always if (!PixelUtil::isFloatingPoint(nativeFormat)) { return true; } return false; }
//----------------------------------------------------------------------- bool TextureManager::isFormatSupported(TextureType ttype, PixelFormat format, int usage) { return getNativeFormat(ttype, format, usage) == format; }
//----------------------------------------------------------------------------- bool GLTextureManager::isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage, bool preciseFormatOnly) { if (format == PF_UNKNOWN) return false; // Check natively format PixelFormat nativeFormat = getNativeFormat(ttype, format, usage); if (preciseFormatOnly && format != nativeFormat) return false; // Assume non-floating point is supported always if (!PixelUtil::isFloatingPoint(nativeFormat)) return true; // Hack: there are no elegant GL API to detects texture filtering supported, // just hard code for cards based on vendor specifications. // TODO: Add cards that 16 bits floating point flitering supported by // hardware below static const String sFloat16SupportedCards[] = { // GeForce 8 Series "*GeForce*8800*", // GeForce 7 Series "*GeForce*7950*", "*GeForce*7900*", "*GeForce*7800*", "*GeForce*7600*", "*GeForce*7500*", "*GeForce*7300*", // GeForce 6 Series "*GeForce*6800*", "*GeForce*6700*", "*GeForce*6600*", "*GeForce*6500*", "" // Empty string means end of list }; // TODO: Add cards that 32 bits floating point flitering supported by // hardware below static const String sFloat32SupportedCards[] = { // GeForce 8 Series "*GeForce*8800*", "" // Empty string means end of list }; PixelComponentType pct = PixelUtil::getComponentType(nativeFormat); const String* supportedCards; switch (pct) { case PCT_FLOAT16: supportedCards = sFloat16SupportedCards; break; case PCT_FLOAT32: supportedCards = sFloat32SupportedCards; break; default: return false; } const GLubyte* pcRenderer = glGetString(GL_RENDERER); String str = (const char*)pcRenderer; for (; !supportedCards->empty(); ++supportedCards) { if (StringUtil::match(str, *supportedCards)) { return true; } } return false; }