From 59da504cde3ee77eb3d71c9192624ec036a7124e Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Fri, 31 Jul 2020 01:18:33 +0200 Subject: [PATCH] Exclude images with less than 16 bits per pixel from the DDS Texture Cache --- simgear/scene/model/ModelRegistry.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/simgear/scene/model/ModelRegistry.cxx b/simgear/scene/model/ModelRegistry.cxx index 92a09bca..0b9789d7 100644 --- a/simgear/scene/model/ModelRegistry.cxx +++ b/simgear/scene/model/ModelRegistry.cxx @@ -359,6 +359,8 @@ ModelRegistry::readImage(const string& fileName, if (res.validImage()) { osg::ref_ptr srcImage = res.getImage(); int width = srcImage->s(); + //int packing = srcImage->getPacking(); + //printf("packing %d format %x pixel size %d InternalTextureFormat %x\n", packing, srcImage->getPixelFormat(), srcImage->getPixelSizeInBits(), srcImage->getInternalTextureFormat() ); bool transparent = srcImage->isImageTranslucent(); bool isNormalMap = false; bool isEffect = false; @@ -367,6 +369,11 @@ ModelRegistry::readImage(const string& fileName, */ bool can_compress = (transparent && compress_transparent) || (!transparent && compress_solid); + if (srcImage->getPixelSizeInBits() <= 16) { + SG_LOG(SG_IO, SG_INFO, "Ignoring " + absFileName + " for inclusion into the texture cache because pixel density too low at " << srcImage->getPixelSizeInBits() << " bits per pixek"); + can_compress = false; + } + int height = srcImage->t(); // use the new file origin to determine any special processing