| 56 | } |
| 57 | |
| 58 | PixelFormat GLES2TextureManager::getNativeFormat(TextureType ttype, PixelFormat format, int usage) |
| 59 | { |
| 60 | // Adjust requested parameters to capabilities |
| 61 | const RenderSystemCapabilities *caps = Root::getSingleton().getRenderSystem()->getCapabilities(); |
| 62 | |
| 63 | // Check compressed texture support |
| 64 | // if a compressed format not supported, revert to PF_A8R8G8B8 |
| 65 | if (PixelUtil::isCompressed(format) && |
| 66 | !caps->hasCapability(RSC_TEXTURE_COMPRESSION)) |
| 67 | { |
| 68 | return PF_BYTE_RGBA; |
| 69 | } |
| 70 | // if floating point textures not supported, revert to PF_A8R8G8B8 |
| 71 | if (PixelUtil::isFloatingPoint(format) && |
| 72 | !caps->hasCapability(RSC_TEXTURE_FLOAT)) |
| 73 | { |
| 74 | return PF_BYTE_RGBA; |
| 75 | } |
| 76 | |
| 77 | // Check if this is a valid rendertarget format |
| 78 | if (usage & TU_RENDERTARGET) |
| 79 | { |
| 80 | /// Get closest supported alternative |
| 81 | /// If mFormat is supported it's returned |
| 82 | return GLRTTManager::getSingleton().getSupportedAlternative(format); |
| 83 | } |
| 84 | |
| 85 | // format not supported by GLES2: e.g. BGR |
| 86 | if(GLES2PixelUtil::getGLInternalFormat(format) == GL_NONE) |
| 87 | { |
| 88 | return PF_BYTE_RGBA; |
| 89 | } |
| 90 | |
| 91 | // Supported |
| 92 | return format; |
| 93 | } |
| 94 | |
| 95 | bool GLES2TextureManager::isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage, |
| 96 | bool preciseFormatOnly) |
no test coverage detected